sentences:
How do I dynamically use the rect tool in Unity2D? The rect tool in Unity2D (I honestly do not remember if it is present in Unity3D) allows you to scale down/scale up an object in just one direction (what it does is it simultaneously increases/decreases the height of an object in transform.scale and transform.position. I was trying to scale down an object while keeping its position the same using this code (P.S. I took the first four lines of code from here: The Best Way To Generate a Random Float in C#):
       float range = (double)float.MaxValue - (double)float.MinValue;
       float sample = scaleRand.NextDouble();
       float scaled = (sample * range) + float.MinValue;
       float f = (float)scaled;
        if (f > 0.6f)
        {
            f = 0.6f;
        }
            gameObject.localScale = new Vector2(gameObject.lossyScale.x, (gameObject.lossyScale.y - f));

However, this code does not work. So, how can I recreate the effect of using the rect tool in Unity Editor using C#?

sentences:
How can I create online leaderboards for iOS and Android? I'm developing a racing game for iOS and Android phones/tablets and I want to implement online leaderboards. My game has a singleplayer mode(no multiplayer features) but I want to implement online leaderboards to encourage people to beat other player's score and time.

I want to save the score and time(the time that you need to finish the race) in an online leaderboard. In addition, the name of the player and if possible his country are also saved in the leaderboard. The leaderboards don't need to be cross platform, I can create two leaderboards, one for iOS and one for Android.

Is it possible to create online leaderboards without MySQL and PHP knowledge? In addition, I don't have a server to save the data.

I use MonoGame to develop my game. Do you know a step by step tutorial for implementing online leaderboards because I don't know where to start.

sentences:
Isometric projection start point I have a question about isometric projection: Why did in all tutorials and examples start point for isometric is in left top corner ?
For example in cocos2d 3.1 my start screen point in left bottom, so left top isometric position will nearly 1500,1500. So is it normal to make start isometric point in left bottom corner ? i mean :

x,y
0,3 1,3 2,3
0,2 1,2 2,2
0,1 1,1 2,1
0,0 1,0 2,0

or better

0,0 1,0 2,0
0,1 1,1 2,1
0,2 1,2 2,2
0,3 1,3 2,3

sorry for stupid question

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:
Architecture for Versioned Save Data We're working on an iOS game that we plan on having several content updates for.

It's a story type game with lots of little flags when things have been accomplished and such.  There is also an inventory system.

I'm looking for ideas on how to best design a game state save data system that will be resilient to a lot of updates and changes to the game.

sentences:
Calculating the resulting velocity after a reflection I am trying to do a simple reflection of a point entity off of an arbitrary surface that contains it. It doesn't have to be physically correct but essentially the goal is to do the following:

if (isOutsideOfContainer()) {
   placeOnNearestEdgeOfContainer()
}
float2 container = getContainerNormal();
float2 newVelocity = f(velocity, container);

So essentially I am placing the out of bounds point on an edge of the container, getting the normal of the edge at that point on the container, and using that to calculate the new velocity vector.

How exactly do I do this?

I am doing this so that particles can "bounce" off of the edge of the screen as computationally cheaply as possible. Sometimes the screen will be a boring rectangle but other times it might be an iPhone X, or have half of its corners rounded. No-matter what the screen I want to properly simulate its bounce.

sentences:
Why Minecraft has such a terrible backward compatibility? For every release of Minecraft, even a minor release, is almost guaranteed to break some plugins or mod.

Why is this so? I am asking this so that we could avoid the same architecture problem as Minecraft.

I mean, why can't the upgrades also support previous version of minecraft? Minecraft requires an EXACT version number match in order to connect. I am pretty sure the protocol can be designed so that clients should ignore unsupported commands.

For example, if there is new block introduced and the client doesn't understand it, they can just fall back to default/dummy block so that players can still play but start seeing dummy wireframe block or so.

Once they start seeing too much of wireframe blocks they know they should upgrade.

sentences:
Object rotating error in Bullet Physics with OpenGL I have got some problem in my OpenGL game. I am using bullet physics and I want to achive quite simple effect - I want one object (a sphere) to roll and hit another (box) which will fall down.

I have got almost everything but still I have got some errors. When the box is hit it is rotating almost how I would like to. Well, almost means that when ball hits it it falls and rotates however there are about 20 degrees left to the ground.

It isn't stoping on a ball because the speed is so high that it is throw away and after a while it "meets" ball

This is my code for objects (including floor) initialization:

dynamicsWorld->setGravity(btVector3(0,-10,0));

    ballShape = new btSphereShape(1);

    fallMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(2,1,0)));
    btScalar mass = 5;
btVector3 fallInertia(0,0,0);
ballShape->calculateLocalInertia(mass,fallInertia);

    groundShape = new btBoxShape(btVector3(btScalar(50.),btScalar(1.),btScalar(70.)));

    btDefaultMotionState* groundMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,-1,0)));
    btRigidBody::btRigidBodyConstructionInfo groundRigidBodyCI(0,groundMotionState,groundShape,btVector3(0,0,0));
btRigidBody* groundRigidBody = new btRigidBody(groundRigidBodyCI);
    dynamicsWorld->addRigidBody(groundRigidBody);

    btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(mass,fallMotionState,ballShape,fallInertia);
fallRigidBody = new btRigidBody(fallRigidBodyCI);
dynamicsWorld->addRigidBody(fallRigidBody);

    fallRigidBody->setLinearVelocity(btVector3(-5,0,0));

    pinShape = new btBoxShape(btVector3(0.5,2,0.5));

    btDefaultMotionState* fallMotionState2 = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,3,0)));
    btScalar mass2 = 1;
btVector3 fallInertia2(0,0,0);
pinShape->calculateLocalInertia(mass2,fallInertia2);
    btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI2(mass2,fallMotionState2,pinShape,fallInertia2);
pinRigidBody = new btRigidBody(fallRigidBodyCI2);
dynamicsWorld->addRigidBody(pinRigidBody);

and this is how I am setting the box position and rotation:

btTransform trans2;
pinRigidBody->getMotionState()->getWorldTransform(trans2);
    cubeX = trans2.getOrigin().getX();
    cubeY = trans2.getOrigin().getY();
    cubeZ = trans2.getOrigin().getZ();

    rot = trans2.getRotation();
//...
glTranslatef(cubeX,cubeY,cubeZ);
    glRotatef(rot.getX()*(360/3.14),1,0,0);
    glRotatef(rot.getY()*(360/3.14),0,1,0);
    glRotatef(rot.getZ()*(360/3.14),0,0,1);

    glScalef(0.5,5.0,0.5);
    glutSolidCube(1.0f);

Can someone tell me what is wrong in it? I have got no idea what else I can do.

sentences:
Why won't character stay at the x-axis rotation I set In the inspector? Here is a snippet of my Update function, which contains everything regarding my rotations for the character:

// Higher the Z float, the LESS of a rotation when moving
Vector3 v3 = new Vector3 (Input.GetAxis ("Horizontal"), 0.0f, 1.5f);

// A Quaternion variable named "quaternion" that's equal to LookRotation class that takes
// the "v3" variable
Quaternion quaternion = Quaternion.LookRotation (v3);

// The actual rotation is done using the Slerp class
transform.rotation = Quaternion.Slerp (
  transform.rotation,
  quaternion,
  Rotspeed * Time.deltaTime);

// When Countdown timer is done, then the animator is enabled
adventureAnimator.enabled = true;

When I put "357" on the X-Axis tab of Rotation, why does it go back to 0 whenever the game starts? After some debugging I know it is because of my logic contained in my "transform.rotation = Quaternion.Slerp" line of code. What do I need to change?

If you need more information or need me to elaborate, please let me know.

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:
Tips on combining the right Art Assets with a 2D Skeleton and making it flexible I am on my first attempt to build a skeletal animation system for 2D side-scrollers, so I don't really have experience of what may appear in later stages. So i ask advice from anyone that been there and done that!

My approach:

I built a Tree structure, the root node is like the center-of-mass of the skeleton, allowing to apply global transformations to the skeleton. Then, i make the hierarchy of the bones, so when moving a leg, the foot also moves. (I also make a Joint, which connects two bones, for utility).

I load animations to it from a simple key frame lerp, so it does smooth movement.

I map the animation hierarchy to the skeleton, or a part of it, to see if the structure is alike, otherwise the animation doesnt start.

I think this is pretty much a standard implementation for such a thing, even if i want to convert it to a Rag Doll on the fly..

Now to my question:

Imagine a game like prototype, there is a skeleton animation of the main character, which can animate all meshes in the game that are rigged the same way.. That way the character can transform into anything without any extra code.

That is pretty much what i want to do for a side-scroller, in theory it sounds easy, but I want to know if that will work well. If the different people will be decently animated when using the same skeleton-animation pair. I can see this working well with a Stickman, but what about actual humans? Will the perspective look right, or i will need to dynamically change the sprites attached to bones?

What do you recommend for such a system?

sentences:
PhaserJS: Detecting intersection I'm making a card game to get my legs with phaser. I have an row of overlapping, face down cards. I want to detect when any card is covered by another card.

The deck is shuffled before being placed on the board, so the order is known card[1] thru card[54]. It goes card.events.onInputDown.add(tap, this) on each card during setup to detect interaction, and then calls tap(this):

function tap(pointer){
    console.log(pointer.z);
    let zpos = pointer.z
    if (Phaser.Rectangle.intersects(pointer, *abovecard*)) {
        console.log("covered");
    } else {
        pointer.play("front"); // anim to show the card back
    }
}

(abovecard is asterisked as a placeholder because I'm not sure what to put there)

A simple boundary overlap check seems to be the model to use. But when I go abovecard = card[zpos + 1], it doesn't see a card above it. Even when I do in the console Phaser.Rectangle.intersects(card[37], card[38]), which are visibly overlapping, it says false.

Primary question: What am I missing here?

2ndary question: Is there a better way, than what I've described, to detect if one sprite is overlapping another sprite (whether the other sprite is known or not)?

sentences:
Loading and rendering one large image or many smaller ones I am working on an android game with a top down style view similar to the original GTA's or a scrolling version of Legend of Zelda.

I have recently begun designing some prototype levels for the game which vary between a corridor style dungeon similar to diablo or an open area with obstacles similar to Zelda.  My question is would it be better to have one large background image and draw it once or a relatively small one (size of or less than the view) and draw it multiple times.

My concerns are the memory required to load/store a large background image vs the performance boost of only drawing one image.

Any input would be appreciated.

sentences:
Generate Geodesic Sphere from Hex and Pentagons I have two polygonal meshes, a hexagon and a pentagon (They are tiles in a strategy game). I want to use them to construct a geodesic sphere (https://upload.wikimedia.org/wikipedia/commons/e/e7/G%C3%A9ode_V_3_1_duale.gif).

I can modify the sizes of each mesh to fit what I need, but I can't figure out how to get the radial coordinates of each face in the geodesic sphere. Is there a way to do this?

I'd like to only need two meshes for the tiles, but I can make different versions if absolutely necessary.

sentences:
How to prevent "underwater sight" in games In many games where the player can go underwater, it seems like when you look where the top half of the screen is in the air, and the bottom half the screen is in the water, it's almost like the water doesn't exist and the player is... flying slowly with water sounds?

Is  there a logical way to solve this? An algorithm? Doesn't seem like any solution has come up yet since many games still have this. I don't want to make the same mistake.

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:
How to display a lot of small objects using WebGL? Introduction

The game scene contains a lot of 10x10 pixel elements: for 1980x1200 px. screen the number of elements on the scene can vary from 0 to 23760 (elements cannot intersect).

The live example: http://fintank.ru/game/

The entire game space comprised of tiles: each tile is responsible for some area and keeps elements for that area (similar to google maps).

Each tile exist as 2 entities: S and G. S is a set of elements in the tile, G is rendered image of a tile. When the server put/remove elements to the tile, we change S and then re-render the G.

To draw a frame (at 20 fps) I just put the G of each visible tile using the putImageData(). That is done without WebGL.

The question

What is the most CPU effective approach to implement such many-elements management using WebGL? Should I render each tile to a texture or each element may be implemented as a separate textured rectangle? The main concern is that each tile may be updated 30-60 times a second (elements adding/removal).

How to avoid memory leaks (how to reuse buffers?) if we make many new textures every second?

What is the most effective way to manipulate pixels during rendering a 100x100 tile?

How to avoid re-uploading the unchanged textures to graphic card?

sentences:
How to prevent one account from unlocking products on other devices using Apple StoreKit? We are currently wrapping up a free-to-play game on iOS in which you can purchase non-consumable products. We have been discussing this case internally and are not quite sure what the best practices are as this is our first title.

For example, if a user downloads our app, and makes some purchases. These can be restored should the app ever be deleted and reinstalled as long as the user uses the same Apple ID. What is to stop him from making a fake Apple account, purchasing items and then posting this account on the web allowing everyone to get the items for free?

That is obviously a worst case situation. But a smaller case would be a user unlocking items for his friends. We do not want this to be an always online game but have considered doing a check on startup if there is internet available. If the currently logged in account doesn't own the products do we lock them again? Probably not because people may simply sign into the device with different Game Center logins at which point we don't want to constantly lock and unlock items.

At some point we will be adding multiplayer at which point we can definately do a check with the currently logged in account. This is because A, they will be online when attempting multiplayer, and B, they will want to use their own account for multiplayer. Unfortunately we aren't quite ready for this yet.

Has anyone tackled this issue. Are we overthinking here?

sentences:
Pure OpenGL software rendering For training a machine learning algorithm, we need to render some geometry in OpenGL without any hardware rendering support (no graphics card).
So we were thinking of rendering in pure software, and we have looked at Mesa already.
It seems like it is capable of rendering in pure software, but so far, we only get OpenGL 2.x, whereas we need OpenGL 3.3 .

Does anyone know if that is possible? and if so, how?
We seem to run into stumbling blocks all the time.

(Background, why we want to do that: for training the learning algorithm, we need to perform a lot of runs of our software on a PC cluster, which do not allow rendering in hardware.)

Any hints, ideas, and pointer will be appreciated.

sentences:
Implementing a wheeled character controller I'm trying to implement Boxycraft's character controller in XNA (with Farseer), as Bryan Dysmas did (minus the jumping part, yet).

My current implementation seems to sometimes glitch in between two parallel planes, and fails to climb 45 degree slopes. (YouTube videos in links, plane glitch is subtle).

How can I fix it? From the textual description, I seem to be doing it right.

(Note: my coordinates system is top for positive Y).

Here is my implementation (it seems like a huge wall of text, but it's easy to read. I wish I could simplify and isolate the problem more, but I can't):

public Body TorsoBody { get; private set; }
public PolygonShape TorsoShape { get; private set; }
public Body LegsBody { get; private set; }
public Shape LegsShape { get; private set; }
public RevoluteJoint Hips { get; private set; }
public FixedAngleJoint FixedAngleJoint { get; private set; }
public AngleJoint AngleJoint { get; private set; }

...

this.TorsoBody = BodyFactory.CreateRectangle(this.World, 1, 1.5f, 1);
this.TorsoShape = new PolygonShape(1);
this.TorsoShape.SetAsBox(0.5f, 0.75f);
this.TorsoBody.CreateFixture(this.TorsoShape);
this.TorsoBody.IsStatic = false;

this.LegsBody = BodyFactory.CreateCircle(this.World, 0.5f, 1);
this.LegsShape = new CircleShape(0.5f, 1);
this.LegsBody.CreateFixture(this.LegsShape);
this.LegsBody.Position -= 0.75f * Vector2.UnitY;
this.LegsBody.IsStatic = false;

this.Hips = JointFactory.CreateRevoluteJoint(this.TorsoBody, this.LegsBody, Vector2.Zero);
this.Hips.MotorEnabled = true;
this.AngleJoint = new AngleJoint(this.TorsoBody, this.LegsBody);
this.FixedAngleJoint = new FixedAngleJoint(this.TorsoBody);

this.Hips.MaxMotorTorque = float.PositiveInfinity;
this.World.AddJoint(this.Hips);
this.World.AddJoint(this.AngleJoint);
this.World.AddJoint(this.FixedAngleJoint);

...

public void Move(float m) // -1, 0, +1
{
    this.Hips.MotorSpeed = 0.5f * m;
}

sentences:
Android opengles how to use glunproject How to use glunproject in my android app?

I have the following parts in my engine:

A projection matrix
A view matrix for the camera
A model matrix for each of the objects in my world. This matrix is calculated from the parent objects model matrix and the objects own model matrix. These matrices are calculated from a translation, rotation and scale matrix. (this all works fine)

These matrices are then multiplied and passed to my vertex shader.

Now I understand glunproject needs the model matrix and the projection matrix and can caluclate a near and far 3d coordinate depending on the camera viewport settings ( for the near and far plane)

Do I need to use glunproject for each of the objects in my world and then check if the ray produced by these near and far coords intersects my object?
This seems quite expensive on the cpu?

What is the proper use for glunproject

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:
Workflow for non human ragdolls So I want to make automatic ragdoll generation system for all my enemies in my game, the assets are already made and have been paid for a while ago so I can't really ask the artist to change anything or generate some extra info, they are a variety of models (humans, robots, beasts) with a hard limit of 32 bones. Each bone is labelled and there is only a single mesh provided, which is skinned and ready to go.

I am trying to understand how an automated system can generate ragdolls from this. So far my idea involves convex decomposition (v-hacd?) to split up the mesh into small convex hulls and attach them using hinge and cone twist constrains (in bullet physics).

The idea sounds simple in my head but actually there are so many questions such as, how to do it automatically? how to make each convex hull be attached to a bone correctly? how to join the convex hulls with constraints in the correct place? the ragdoll would be generated from the bind pose, but how to transform the ragdoll so that it is perfectly aligned with the skeleton after its death animation?

I would very much appreciate some guidance on this, thanks.

sentences:
"Occlusion culling data is out of date. Please rebake" - No scene specified, Unity 5.6.2 I've inherited a Unity project with hundreds of scenes. When I try to build it for consoles/mobile I get 11 errors saying "Occlusion culling data is out of date. Please rebake" and the build fails. Double clicking on these errors takes me nowhere, and no scenes are specified. It is my understanding that I can only bake occlusion culling by opening the scene manually and hitting the bake button. Due to the size of this project, that would take many hours. The game runs fine from within the editor, but simply won't export to consoles.

How can I do any of the following:

Automatically rebuild all occlusion culling information.
Find which scenes are out of date.
Disable occlusion culling project wide, letting me at least get a build onto dev-kits out for further evaluation.

Thanks for any help at all.

sentences:
Gravity wells that go with finger I have a simple particle game, where all the particles are arranged in a grid.  This game is for touch devices so to take advantage of it I am trying to have a multitouch gravity field thing going on.

Basically I am trying to get it so that each finger is basically a well in an otherwise non existent gravity field. That way the particles are pulled towards a finger.

My problem is I don't even know where to begin with these calculations, I have tried averaging a particles distance to each finger, its direction to each finger and nothing seems to work nicely!

I have seen other games do this.  What does the math for it look like?

sentences:
How to make the player slide smoothly against terrain I'm making an isometric game. When the player tries to walk diagonally into a wall I want them to slide smoothly across it, so whatever portion of the movement would be legal is used, and anything in the direction of the normal is thrown away. Walls can be any angle, not just vertical or horizontal, and the player has 360 motion.

I feel like I'm almost there but I can't put the last piece into place.

Update: great news everyone! I have it working. But... I'm a bit confused what I should be normalising and what not. The normal just needs to be a unit vector, right? but then I'm mixing that with my input so I'm normalising that - am I wrong?

By the way, I have also found that I need to push the player 1 pixel in the direction of the normal, so that they don't get stuck on things - works well.

sentences:
Unity Editor stops updating ScriptableObjects if I click away from them in editor I'm trying to be better about structuring my code, and I think I'm doing it right. The issue I've got right now is I need to get joystick inputs, scale those values appropriately, and then use that scaled data on any number of MonoBehaviour scripts.

I'm trying to split the input conditioning from the end user, and I'd like to do that by using a ScriptableObject to hold the conditioned data.

I was thinking that a MonoBehaviour script would run, get the joystick data, scale it, and then push that data to variables in the ScaledJoystickData ScriptableObject. Later, a second MonoBehaviour script would access the variables in the ScaledJoystickData and use those to move the things in the game.

I'm understanding the benefits of structuring the code this way, especially in that I can access the ScriptableObject from the editor and manipulate those values; I don't actually need to have a joystick connected, and I'm free to test either end of the input handling independently.

The problem is that, if I am looking at the ScriptableObject instance in the editor, it stops updating as soon as I click away from it (to the consuming GameObject). If I click back to the ScriptableObejct instance, none of the values update. Nothing on the GameObject's script updates unless I start the game with that GO selected in-editor, and again THAT fails to update if I click off and click back.

The GameObject script is currently using the values from the ScriptableObject instance and piping them to public variables, and the public variables aren't updating.

Is there some bug with ScriptableObjects, or am I doing this wrong?

:EDIT:

Here's an example. Make a script called "ExampleSO" and replace the contents with:

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

[CreateAssetMenu]
public class ExampleSO : ScriptableObject
{
    public float stashedVar = 0f;
}

Make a script called "ExampleWriter" and replace the contents with:

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

public class ExampleWriter : MonoBehaviour
{
    public float scaling = 2f;
    public float scaledInput = 0f;
    public ExampleSO exampleSO = null;

    // Update is called once per frame
    void Update()
    {
        if(exampleSO!=null)
        {
            scaledInput = scaling * (Input.GetKey(KeyCode.LeftArrow) ? 1f : 0f);
            exampleSO.stashedVar = scaledInput;
        }
    }
}

Make a script called "ExampleReader" and replace the contents with:

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

public class ExampleReader : MonoBehaviour
{
    public float display = 0f;
    public ExampleSO exampleSO = null;

    void Update()
    {
        if(exampleSO!=null)
        {
            display = exampleSO.stashedVar;
        }
    }
}

Create an instance of the ExampleSO, add the ExampleWriter to a game object, and put the ExampleSO instance into the ExampleWriter slot.

Highlight the game object holding ExampleWriter and run it. Push the left arrow key and see the value toggle 0/2.

Click the ExampleSO instance. Nothing is happening there now. Click back on the game object, and now it doesn't update either.

If you have the ExampleReader on the same game object then it won't work at all. ExampleReader will read fine, if you have it on a separate GameObject, but again if you click off and click back then it stops responding.

sentences:
How to use Transvoxel tables Could someone explain how to use the lookup tables provided on http://transvoxel.org/ with the regular Marching Cubes algorithm?

I'm not even talking about the whole LOD System etc. I actually understand how that is supposed to work and why Transvoxel uses different tables, I just can't seem to figure out what modifications to make to the regular Marching Cubes algorithm to use them.

sentences:
How to generate a city street network? I would like to create a city generator for a game, but I am facing a problem at the very start of the generation: the road system.

As it is a medieval world, I don't want a grid plan like many modern cities. I would ideally prefer a pseudo-random generation of large avenues and smaller streets, where it could be possible to get lost, but with still some logic - not a complete labyrinth.
Something that would look like a naturally grown town.

In order to keep it simple, let's say my cities would be on flat and stable terrains, without any river-crossing or relief problems. I could try to integrate it to a solution after.

I didn't decide of a precise size or disposition for my cities, so if you have a solution that would work only with cities of a precise form (square, circle, rectangle etc), I would take it.

sentences:
textures in tilemap games: use 2d planes or 3d objects? (example with Dragons of Atlantis) How to create the textures in games such as Dragons of Atlantis?

I was thinking about 2 ways:

using 2d planes to save space and memory, using the color from the 3d
software
adding a very simple mesh and stick a detailed texture onto it in Unity

Is there a preferable way to choose between the two?
The first solution could save some memory, but maybe a bit difficult to change the camera view for example at the end of the game.
As for the second solution, it would be creating a very detailed mesh in the 3d software, paint the texture, cut the texture and add it to a very simple mesh, such as cubes. Could be better, but maybe it would take more work.

What do you think?

Thanks

sentences:
Where should I put units and items in a squad-combat ECS-based game? So I'm working on a game where squads of varied units would explore, fight, trade and build on an overworld map. Combat would be automated more or less, and happen on the overworld. Basically, something like Mount&Blade but without the real-time hack and slash combat.

I'm using an ECS architecture, and even in MVP stages I'm running into confusion: Should each unit be an entity in the grand entity pool, with an ID pointing to the squad it belongs to? Or should they be in an array of units in the squad entity?
When they start having items, should every dagger and boot be part of a gigantic entity pool, or only exist inside units and inventories?
When it'll come to skills and enchantments, buffs... will a "+10% damage" buff float among houses and squads and knives and forests in the entity pool, or will it be part of a buff array?
If it helps
I'm using Javascript with a homemade ECS, for fast and shareable iterations, and for learning purposes too.

sentences:
How to fit rectangles in a page? Here's my problem: I need to fit rectangles in a polygon but in "certain way".
I have few rectangular shapes (of different sizes) and I need to put them on a polygon.

My first idea was to always try to put them on the top right of the previously placed shape, and if it is not possible, on the bottom left angle of the previously placed shape. It works but it does not looks great, since it does not take into account the placement of the previously placed shape (sometimes the last placed shape is not the most logical).

From this, I imagine we could have a kind of "navmesh": when a shape is placed, it says that nothing more can be placed here and that it needs to find a better place.

Here is how it should look:

Imagine I have the above case, and I want to add one rectangular shape... it shoud go like this:

... with enough space to welcome a new rectangular shape that could possible fit on the blank space.

So... what I want is to place my shapes on the far top and then on the far left.

Do you guys have any ideas how to do this? Maybe this kind of algorithm already exists and I don't know the name?

Thanks !

sentences:
Can I use someone else's music/midi? The music in question is not exactly owned by the other individual either, as it's simply an arrangement of a game's soundtrack as a midi or music sheet.

Am I allowed to use these in my videogame? Should those persons be given credit or should it go to the original composers of the track in the original video game?

Should I ask for permission for the authors of the rearrange? What if the file and site list no author? What if it lists an author but I have no means to reach and ask?

sentences: Is it possible to make desktop visible behind drawn object using SDL2? I would like to draw an avatar over the desktop, something similar to those word 97 assistants, my idea so far is to make only the background transparent but I haven't had any luck, any suggestion? is it possible to make with SDL2?

sentences:
How can i check when rotation is ended? At the top of script:

public Quaternion _lookRotation;

In Update:

void Update()
{
 transform.rotation = Quaternion.Slerp(transform.rotation, _lookRotation,
 Time.deltaTime * RotationSpeed);
}

I want to know when the transform rotation ended and is at _lookRotation
Maybe using some flag ?

This is my code:

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;
    public float rotationSpeed = 0.6f;

    private Material material;
    private float targetAlpha = 0;
    private float lerpParam;
    private float startAlpha = 1;
    private bool rotated = false;
    private Quaternion clampedTargetRotation;

    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);
            }

            if (fpc.transform.localRotation == Quaternion.Euler(0,0,0))
            {
                fpc.GetComponent<FirstPersonController>().enabled = true;
                rotationSpeed = Mathf.Clamp(rotationSpeed - endAcceleration * Time.deltaTime, 0, maxSpeed);
                blur.enabled = false;
                blurOptimized.enabled = false;

                rotated = true;
            }

            clampedTargetRotation = Quaternion.RotateTowards(fpc.transform.localRotation, Quaternion.Euler(0, 0, 0), rotationSpeed * Time.deltaTime);
            fpc.transform.localRotation = clampedTargetRotation;
        }
    }

    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;
    }
}

What i want in the rotation part is to start the rotation slowly and then accelerate a bit and then in the end when it's getting "close enough"  to 0,0,0 so start accelerate down until complete stop. Complete stop not must be at 0,0,0 but close to it. Th way i'm doing it now is wrong i'm not using the t 0/1 solution and not courtine.

The rotation now in my script is almost working as i want. It start slowly and accelerate but in the end it stop at once without smoothly accelerate down.

sentences:
How can I adapt "random walk" generation to very large maps? The random (or drunkard's) walk is a great, simple algorithm that can generate very organic-looking maps, such as this:

Unfortunately it seems to have poor scalability, making it unsuitable for generating large maps in a reasonable amount of time. For example, a test I performed looking at how many iterations are required to generate a desired range for a 1D random walk yielded what looked like quadratic complexity:

Range | Iterations
------+-----------
10    | 81
100   | 7309
1000  | 585352
10000 | 30656784

For higher-dimension walks I imagine this would be even worse.

How can improve the efficiency of random walk, whilst preserving the overall look of the result, for large maps? I'm hoping for a solution with sub-quadratic complexity.

sentences:
What algorithm can I use to detect simple shapes in a 4x4 matrix? I'm working on a simple multiplayer game that receives a random 4x4 matrix from a server and extracts a shape from it.

For example:

XXOO       OXOO
XXOX       XXOO
XOOX  and  XOOO
XXXX       OXXX

So in the first matrix the shape I want to parse is:

  oo
  o
 oo

and the 2nd:

  oo
  oo
 ooo

I know there must be an algorithm for this because I saw this kind of behavior on some puzzle games but I have no idea how to go about to detecting them or even where to start.

So my question is: How do I detect what shape is in the matrix and how do I differentiate
between multiple colors? (it doesn't come only in X and O, it comes in a maximum of 4). Additionally, the shape must be a minimum of 4 blocks.

sentences:
Points on lines where the two lines are the closest together I'm trying to find the points on two lines where the two lines are the closest. I've implemented the following method (Points and Vectors are as you'd expect, and a Line consists of a Point on the line and a non-normalized direction Vector from that point):

void CDClosestPointsOnTwoLines(Line line1, Line line2, Point* closestPoints)
{
    closestPoints[0] = line1.pointOnLine;
    closestPoints[1] = line2.pointOnLine;

    Vector d1 = line1.direction;
    Vector d2 = line2.direction;

    float a = d1.dot(d1);
    float b = d1.dot(d2);
    float e = d2.dot(d2);

    float d = a*e - b*b;
    if (d != 0) // If the two lines are not parallel.
    {
        Vector r = Vector(line1.pointOnLine) - Vector(line2.pointOnLine);
        float c = d1.dot(r);
        float f = d2.dot(r);

        float s = (b*f - c*e) / d;
        float t = (a*f - b*c) / d;
        closestPoints[0] = line1.positionOnLine(s);
        closestPoints[1] = line2.positionOnLine(t);
    }
    else
    {
        printf("Lines were parallel.\n");
    }
}

I'm using OpenGL to draw three lines that move around the world, the third of which should be the line that most closely connects the other two lines, the two end points of which are calculated using this function.

The problem is that the first point of closestPoints after this function is called will lie on line1, but the second point won't lie on line2, let alone at the closest point on line2! I've checked over the function many times but I can't see where the mistake in my implementation is. I've checked my dot product function, scalar multiplication, subtraction, positionOnLine() etc. etc. So my assumption is that the problem is within this method implementation.

If it helps to find the answer, this is function supposed to be an implementation of section 5.1.8 from 'Real-Time Collision Detection' by Christer Ericson.

Many thanks for any help!

sentences: Making a Collision Detection for ImageViews I'm trying to make a collision detection system for two ImageViews, but I can't seem to figure it out. I've tried doing several things from StackOverflow and other places, but they don't work. One ImageView stays still and the other moves toward it (it's animated, not a sprite). They don't do anything when the collide, though. Do I need to make them sprites or drawables on a canvas or something?

sentences: How do I play background music in Slick/LWJGL? I'm trying to play music in the background for my opening menu, but cant seem to find a tutorial specifically on how to play a music file. Does anyone know how this can be accomplished?

sentences:
How to integrate Javascript into C# and run scriptcode step by step We are currently working on a Pokemon MMO trying to figure out how to implement an asynchronous scripting language the best. We don't want to work with threads or tasks, but the goal was to wait for specific commands like the messageBox("Hello World")-Command and stuff like that.

Is there any general solution for our problem?

sentences:
What revenue models can I use for a non-commercial game I don't have any budget to buy commercial licenses but the libraries I use offer non-commercial free licenses.

How far can I go in regard to monetizing my game without it being considered commercial ? Donations? Do ads count? Optional items purchase?

For example, fmod states in their free license:

  This license cannot be used for commercial services, where the executable containing fmod is not sold, but the data is.

What if only some data (optional) is sold?

Thank you.

sentences:
What's the best way to compare blocks in a matching game that can be multiple colors? I have a match 3-4 game and the blocks can be one of 7 colors. There are an addition 7 blocks that are a mix of the original 7 colors so for example there is a red and blue block and there is also a red/blue block which can be matched with either the red or the blue. My original thought is just to use binary operations so.

int red     = 0x000000001;
int blue    = 0x000000010;
int redblue = 0x000000011;

Then just do an & operation so see if they match. Does this sound like a decent plan or am I over complicating it?

edit:

Better yet so it's more readable.

int red = 1;
int blue = 2;
int red_blue = 3;
int yellow = 4;
int red_yellow = 5;

maybe as defines or static vars?

sentences:
How to integrate android camera for LibGDX project? (deprecated material..) I'm trying to use the Android camera in LibGDX. I tried using this implementation of the API, which is basically the only you will find on Google.

https://github.com/libgdx/libgdx/wiki/Integrating-libgdx-and-the-device-camera

However, most of it is deprecated. It uses GL10, and the methods it calls to connect to the camera are stubs. It is not usable, and the API has probably got easier to use since (but I'd rather not look at google documentation when this has probably been made before... or has it? nothing on Google anyway).

So, do I have to make my own implementation, or is there anything available that would make it any easier? Or is the 2013 implementation actually still usable somehow?

Thanks in advance.

sentences:
Is restitution the wrong value, to make bouncing objects? I have been experimenting with Bullet. Specifically I was modifying the Hello World tutorial, to make the ball bouncing.

The first thing I noticed is, that I need to set  both the restitution of the ball and the ground above 0 to make the ball bouncing.

For a simple setup, with two objects, this seems fine. However, for larger simulations I fell like, restitution is the wrong way, to make bouncy objects. Here are my reasons:

Reason 1

Consider three objects: ball, box and ground. ground is just some plane. box is a box, which is not supposed to be very bouncy, thus its restitution is near or equals zero. ball is supposed to be bouncy, so I give it a restitution of 0.5.

If now the ball collides with the ground, it only actually bounces, if the ground also has a restitution higher than 0, so let's give it a restitution of 1. So our ball is bouncy as expected, when colliding with the ground.

When it collides with box it won't bounce, because the box has a restitution of 0. If we give box a higher restitution, the ball will bounce from it. But now we have a different problem. If the box collides with the ground, it will bounce off, but it isn't supposed to.

I see no way, with restitution only, to make this scenario work.

 Reason 2

Restitution describes the amount of energy, that remains as impulse after a collision. The rest of the energy goes into deforming the colliding bodies and other side effects.

If we now look at a typical bouncy object, like a rubber ball, we see that they are easily deformable (compared to less bouncy objects). When the rubber ball collides with something, it takes up energy from the collision, by being deformed and then goes back into its original form, thus releasing the energy taken up during the collision and bouncing back off.

 The solution (?)

Reason 2 suggests, that a bouncy ball (like a rubber ball) shouldn't have a restitution close to 1, but rather be elastic (thus being deformed and then going back to its original form), to model bouncy objects as expected.

The way to model this in Bullet, would be a soft-body and I think it would be the way to go, in such a scenario.

 The actual question

The text above looks more like an answer than a question, so here's the question I'm trying to ask:

I'm really unsure, whether this is right. Are soft-bodies really the better way for bouncy stuff or am I just mistaking the principle of restitution?

sentences:
PacMan character AI suggestions for optimal next direction Firstly, this is AI for PacMan and not the ghosts.

I am writing an Android live wallpaper which plays PacMan around your icons. While it supports user suggestions via screen touches, the majority of the game will be played by an AI. I am 99% done with all of the programming for the game but the AI for PacMan himself is still extremely weak. I'm looking for help in developing a good AI for determining PacMan's next direction of travel.

My initial plan was this:

Initialize a score counter for each direction with a value of zero.
Start at the current position and use a BFS to traverse outward in the four possible initial directions by adding them to the queue.
Pop an element off of the queue, ensure it hasn't been already "seen", ensure it is a valid board position, and add to the corresponding initial directions score a value for the current cell based on:

Has a dot: plus 10
Has a power up: plus 50
Has a fruit: plus fruit value (varies by level)
Has a ghost that is frightened: plus 200
Has a ghost travelling toward PacMan: subtract 200
Has a ghost travelling away from PacMan: do nothing
Has a ghost travelling perpendicular: subtract 50
Multiply the cell's value times a pecentage based on the number of steps to the cell, the more steps from the initial direction, the closer the value of the cell gets to zero.

and enqueue the three possible directions from the current cell.
Once the queue is empty, find the highest score for each of the four possible initial directions and choose that.

It sounded good to me on paper but the ghosts surround PacMan extremely rapidly and he twitches back and forth in the same two or three cells until one reaches him. Adjusting the values for the ghost presence doesn't help either. My nearest dot BFS can at least get to level 2 or 3 before the game ends.

I'm looking for code, thoughts, and/or links to resources for developing a proper AI--preferably the former two. I'd like to release this on the Market sometime this weekend so I'm in a bit of a hurry. Any help is greatly appreciated.

FYI, this was originally posted on StackOverflow

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:
How do I trigger OnSelect() via the ISelectHandler in my class? I'm trying to figure out how I can make a custom UI element identify when it has been selected or deselected. Classes such as Selectable inherit from the ISelectHandler and IDeselectHandler  and their methods OnSelect() and OnDeselect() are called whenever I click inside the Selectable element and click outside of it.

From my understanding, inheriting from the appropriate handler interface and implementing it's required method will allow your class to handle events from the EventSystem. As an example if I have:

public class TestSelectable
    : MaskableGraphic,
    ISelectHandler,
    IDeselectHandler,
    IPointerEnterHandler,
    IPointerExitHandler
{

    public void OnSelect(BaseEventData eventData)
    {
        Debug.Log("Selected");
    }

    public void OnDeselect(BaseEventData eventData)
    {
        Debug.Log("De-Selected");
    }

    public void OnPointerEnter(PointerEventData eventData)
    {
        Debug.Log("Pointer Enter");

    }

    public void OnPointerExit(PointerEventData eventData)
    {
        Debug.Log("Pointer Exit");

    }

When the mouse enters and exits the element the OnPointerEnter() and OnPointerExit() methods are sucessfully called. However selecting/De-selecting the element does not cause the OnSelect() or OnDeselect() methods to be called. Though if you look in InputField.cs (which inherits from Selectable), the OnSelect() method does successfully get called when the input field is selected. I'm trying to replicate this within my own element without having to inherit from Selectable, and since Unity's event system is publicly accessible this should be possible.

Are there other requirements that will enable those events to fire and call my methods?

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:
Box collider don't catch mouse button press event I have a cupboard with 2 colliders - one for cupboard and one for it's box. When I press on the box, I want to open/close it. It worked fine, but now by some reason it only work when I press on the edge on the box. When click on the center, it don't work.

Video: https://youtu.be/OozsAi7KNzs

Here is the code, which play animation (open/close cupboard), when I press on the box:

public Animation[] animations;
public string[] animationName;
public bool playOneDirection;   // should revert animation speed after second playing?
public AudioSource myAudioOpen;
public AudioSource myAudioClose;

private bool isDoorClosed;
private bool isAimationReadyToPlay = true;
private Collider thisCollider;

public void Start()
{
    thisCollider = GetComponent<Collider>();
}

void Update ()
{
    if (Input.GetButton("Fire1"))
        if(DoPlayerLookAtButton() && isAimationReadyToPlay)
            OpenCloseDoor();
}

bool DoPlayerLookAtButton()
{
    RaycastHit _hit;
    Ray _ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));
    bool isHit = Physics.Raycast(_ray, out _hit, 1.5f);

    if (isHit && _hit.collider == thisCollider) return true;
    else return false;
}

public void OpenCloseDoor()
{
    if (!isDoorClosed) // Play animation with normal speed
    {
        myAudioOpen.Play();
        for (int i = 0; i < animations.Length; i++)
        {
            animations[i][animationName[i]].speed = 1.0f;
            animations[i].Play();
        }
    }

    if(playOneDirection)
        return;

    if (isDoorClosed) // Play animation with revert speed
    {
        myAudioClose.Play();
        for (int i = 0; i < animations.Length; i++)
        {
            animations[i][animationName[i]].speed = -1.0f;
            animations[i][animationName[i]].time = animations[i][animationName[i]].length;
            animations[i].Play();
        }
    }

    StartCoroutine("DelayBetweenAnimations");
    isDoorClosed = !isDoorClosed;
}

IEnumerator DelayBetweenAnimations()
{
    isAimationReadyToPlay = false;
    yield return new WaitForSeconds(0.5f);
    isAimationReadyToPlay = true;
}

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:
Simple Android loading screen when using OpenGL My game uses openGL ES 2.0 on Android and it's got to the point where the pause (while loading resources) has become noticeable.

All I'm after is to show a static screen (probably via an XML layout if it's the simplest way, but through openGL is OK too).  And then dismiss the view and switch to the game.

I'm loading my resources in the onSurfaceCreated method of my GLSurfaceView class and creating my sprite objects in my onSurfaceChanged method (I need the width and height to scale them, so do it here, plus Google's docs recommend it).  I don't load my resources in onCreate.

I've tried creating a simple XML layout called 'loading' and putting something like this into my glSurfaceView class's constructor (glSurfaceView being an inner class of my Activity class)....

public MyGLSurfaceView(Context context) {
        super(context);
        {
loading_dialog = new Dialog(context,android.R.style.Theme_Black_NoTitleBar_Fullscreen);
loading_dialog.setContentView(R.layout.loading);
loading_dialog.show();
}

This displays my 'loading' screen OK, but I need to call:

loading_dialog.dismiss();

at the end of my onSurfaceChanged method in my GLSurfaceView.Renderer class.  I obviously can't do this as the GLSurfaceView.Renderer class has no knowledge of the loading_dialog object.

I tried to create the object directly in the GLSurfaceView.Renderer class, but I don't have access to the context from here, so I tried to pass it in from the Activity class but then I got different errors at which point, I searched the net and couldn't find a clear answer on how to do this so thought I would post here in the hope that someone could point me in the right direction.

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:
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:
Unity Colliders - How do I detect nearby objects without my detection ranges detecting each other How can I get both colliders' types in a trigger overlap message like OnTriggerExit2D(Collider2D other)?

Example:

objects A and B both have a BoxCollider2D and CircleCollider2D components.
Then, object A enters one of the trigger colliders of object B.
I can get object B's collider type with the is operator.

How can I get A's collider type?

The reason I want this is that I want only collisions where object A's CircleCollider2D touches object B's BoxCollider2D.

void OnTriggerExit2D(Collider2D other)
{
    if (other is BoxCollider2D)
        //Do Code
}

Here is a table of what I want: I want only to register trigger overlaps from CircleCollider2D to BoxCollider2D. With the is operator, I can safely remove all collisions to CircleCollider2D but collisions between two BoxCollider2D stay, which I do not want.

+------------------+---------------+------------------+
|  Row to Column   | BoxCollider2D | CircleCollider2D |
+------------------+---------------+------------------+
| BoxCollider2D    | No            | No               |
| CircleCollider2D | Yes           | No               |
+------------------+---------------+------------------+

Edit
The real questions was to detect nearby objects without the detection range dectecting each other.

sentences:
How To Make My First Person Controller turn left and right in unity 5 I want my first person controller to turn left and right instead of just moving straight on that axis.

i have a 3d environment setup in "unity 5" and i am working with the "first person controller" script in unity 5 by default it moves my camera forward,back,left and right what i want is to change the left and right so that it turns the camera instead of moving straight over.

sentences:
Which open source licenses can address these concerns for an open source game engine? I am on a team that is looking to open source an engine we are building.  It's intended as an engine for Online RPG style games.  We're writing it to work on both desktops and android platforms.

I've been over to the OSI http://opensource.org/licenses/category to check out the most common licenses. However, this will be my first time going into an open source project and I wanted to know if the community had some insight into which licenses might be best suited.

Key licensing concerns:

Removing or limiting our liability (most already seem to cover this, but stating for completeness).
We want other developers to be able to take part or all of our project and use it in their own projects with proper accreditation to our project.
Licensing should not hinder someone's ability to quickly use the engine. They should be able to download a release and start using it without needing to wait on licensing issues.
Game content (gfx, sound, etc.) that is not part of the engine should be allowed to be licensed separately. If someone is using our engine, they can retain full copy right of their content, including engine generated data.
Our primary goal is exposure, which is why we're going open source to
start with.  Both for the project and for the individuals developing it.  Are there any licenses that can require accreditation visible to players? Update: As per comments, I mean this to be a requirement for either a splash screen or placement in the credits. Not a constantly visible logo.

While I'd put our primary goal as exposure, for licensing the accreditation is less of a concern.

From what I've read through (and have been able to understand) it doesn't seem like any of the licenses cover anything that is produced by the licensed software.  Are there any that state this specifically, or does simply not mentioning it leave it open for other licensing?

Are there any other concerns that we should consider?

Has anyone had any issues using any of these licenses?

sentences:
Design constraints for games that the elderly (65+) get engaged with I'm a newbie in game design and gaming in general (Tetris, board games, this sort of things). But have observed that the elderly got very much engaged with bubble shooter and solitaires (quite different approaches). I've tried to look for something similar, and have tried to initiate some in these games, but nope, the shooter is always preferred.

Does anybody know of general criteria, design constraints, or (even better) concrete examples of games that the elderly like to play, apart from these two?

Note: agreed, not correctly tagged, but can't find something that fit, nor can I propose new ones.

sentences:
Bullet: Apply any Transformation to RigidBody? I'm using Bullet for CollisionDetection.
I load a scene from a Collada-File using Assimp.
Let's say I want to give every object in the scene a RigidBody with a box as CollisionShape.
Right now I first load the vertices of the object from the file into my Model-Object and then store the transformation matrix. After that I create the CollisionShape with the following code:

btVector3 rigidBodyPos;
btCollisionShape* collisionShape;

glm::vec3* minMax = getMinMaxVertexCoords();
glm::vec3 minCoords = minMax[0]; //The minmum/maximum x/y/z values in the Mesh
glm::vec3 maxCoords = minMax[1];
glm::vec3 middleSize = glm::vec3((maxCoords.x - minCoords.x) / 2, (maxCoords.y - minCoords.y) / 2, (maxCoords.z - minCoords.z) / 2);
glm::vec3 middlePos = glm::vec3((maxCoords.x + minCoords.x) / 2, (maxCoords.y + minCoords.y) / 2, (maxCoords.z + minCoords.z) / 2);

collisionShape = new btBoxShape(btVector3(middleSize.x, middleSize.y, middleSize.z));
rigidBodyPos = btVector3(middlePos.x, middlePos.y, middlePos.z);

Here's a look at my getMinMaxVertexCoords():

glm::vec3* Model::getMinMaxVertexCoords() {
    float maxValue = std::numeric_limits<float>::max();
    float minValue = std::numeric_limits<float>::lowest();
    glm::vec3 lowestVec = glm::vec3(maxValue, maxValue, maxValue);
    glm::vec3 highestVec = glm::vec3(minValue, minValue, minValue);
    for (Vertex v : getVertices()){
        //Apply Transform
        glm::vec4 pos = getModelMatrix() * glm::vec4(v.position, 1);
        glm::vec3 homogenizedPos = glm::vec3(pos.x / pos.w, pos.y /     pos.w, pos.z / pos.w);
        lowestVec.x = min(pos.x, lowestVec.x);
        lowestVec.y = min(pos.y, lowestVec.y);
        lowestVec.z = min(pos.z, lowestVec.z);
        highestVec.x = max(pos.x, highestVec.x);
        highestVec.y = max(pos.y, highestVec.y);
        highestVec.z = max(pos.z, highestVec.z);
    }
    glm::vec3 res[2] = { lowestVec, highestVec };
    return res;
}

The problem doing it this way is, if my scene contains a rotated cube, the collisionbox is obviously not rotated, but parallel to the axes.

I tried solving this by applying the transformation matrix only after creating the RigidBody (so when creating the CollisionShape the ModelMatrix is the identity matrix) and then transforming the RigidBody afterwards:

btTransform transform;
transform.setFromOpenGLMatrix(glm::value_ptr(getModelMatrix()));
_rigidBody->setWorldTransform(transform);

The problem with this however is that the box might be rotated now, but if the transformation contains a Scaling - which is very likely - Bullet does not accept it, and my RigidBody basically disappears (no collision is detected anymore).

Does anybody know a solution to this problem?

sentences: Where should my 3D character's pivot/anchor be? I created a 3d character with some animations a month ago and when testing the character in my game, I notice there are some weird interactions with the scenery that have me worried, particularly when climbing slopes and jumping over ledges. My character is a humanoid biped and his pivot point is his pelvis (it was the first bone I made for the armature in Blender). Should I have moved the pivot to the bottom of his feet? Does it matter? My character does NOT use "use root transform" in Unity; He was animated "in-place" in Blender and forces move him around (including jump trajectories) in Unity

sentences:
Difference between "staggered" isometric and "normal" isometric tilemaps? The Tiled Map Editor v0.9 recently added support for staggered tilemaps in addition to its usual isometric tilemap support.

What are the exact technical differences between these two types of isometric tilemaps? What are their advantages/disadvantages?

sentences:
How to prevent Unity from triangulating faces of imported models? I have an object that will be rendered with a wireframe shader. This means that line between vertices in a model would be drawn.

The problem is that Unity automatically triangulates all n-gons in my models. I want these n-gons to render as is.

Is there a way to prevent this?

sentences:
Slicing irregular spritesheet (automatically?) If found a cool sprite sheet on the internet but its irregular.

Is there any way besides manually cutting sprites to extract the separate pngs?
I need to pack them then again into the Texture Atlas under proper names.

Maybe theres some smart online tool that uses deep learning or something like that?

sentences:
Java 2d game cross-platform compatability I need to make a few small, simple 2d educational games primarily to help kids improve their reading. Drag & drop/matching words with pictures, spelling out words as well as maybe a scrolling shooter and some other things too. I also need these to run on multiple platforms (namely windows, osx, ipads and android).

If I do this with java (which I don’t currently know), is it possible to use the same code to create versions compatible with the above-mentioned platforms?

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:
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:
What is the best way to check for intersection of two bounding boxes, given a minimum and maximum Vector3 for each one I have a BoundingBox object which holds two Vector3's (x, y, z), one for the minimum point and one for the maximum point. (-1.5 0 9 | 1.5 3 10)

What is the best way to check for any intersection or overlap of two BoundingBoxes?

The test for intersection will happen more often than not when there are no points actually intersecting, just faces.

The code that I currently am using is:
bb1.max_.x_ > bb2.min_.x_ && bb1.min_.x_ < bb2.max_.x_ && bb1.max_.y_ > bb2.min_.y_ && bb1.min_.y_ < bb2.max_.y_ && bb1.max_.z_ > bb2.min_.z_ && bb1.min_.z_ < bb2.max_.z_;

However this leads to problems when points are, for example -1.5 0 9 | 1.5 3 10 intersecting with -0.5 0 8.5 | 0.5 1.8 10.5... The Z minimum and maximum points for the second object laying entirely outside of the Z min and max for the first object.

sentences:
Entity System with C++ I'm working on a game engine using the Entity System and I have some questions.

How I see Entity System :

Components : A class with attributs, set and get.

Sprite
Physicbody
SpaceShip
...

System : A class with a list of components. (Component logic)

EntityManager
Renderer
Input
Camera
...

Entity : Just a empty class with a list of components.

What I've done :

Currently, I've got a program who allow me to do that :

// Create a new entity/
Entity* entity = game.createEntity();

// Add some components.
entity->addComponent( new TransformableComponent() )
            ->setPosition( 15, 50 )
            ->setRotation( 90 )
        ->addComponent( new PhysicComponent() )
            ->setMass( 70 )
        ->addComponent( new SpriteComponent() )
            ->setTexture( "name.png" )
            ->addToSystem( new RendererSystem() );

My questions

Did the system stock a list of components or a list of entities ?
In the case where I stock a list of entities, I need to get the component of this entities on each frame, that's probably heavy isn't it ?
Did the system stock a list of components or a list of entities ?
In the case where I stock a list of entities, I need to get the component of this entities on each frame, that's probably heavy isn't it ?

sentences:
Unity and arduino processing This question relates to this link:
https://www.freetronics.com.au/blogs/news/6537043-experimenting-with-unity-processing-and-arduino#.W2-SFs4zbIU
Does anyone have any idea how I would begin doing this? I cannot find the tutorial or code that relates to this. I have a cube on unity that changes colour and texture according to the input from a force sensing resistor. How would I get the cube to react in this way (as in the video)? Any assistance will be appreciated

In this video, a flexiforce sensor is housed in a cube. When the user presses the sensor, a cube on Unity reacts in the same manner that the real cube is squeezed; its basically a virtual version of what is happening to the cube in real life

sentences:
OpenGL ES, object intersection artifacts I was developing a C++ implementation of OpenGL for Android and I noticed those weird artifacts that formed between 2 intersecting objects (or triangles) :

[Here are the artifacts on Android]

The weird thing is that exactly the same library, running on my windows machine, with exactly the same shaders is not giving the same results (sorry for the bad image resolution) :

[No artifacts on windows]

I know about the existence of Z-fighting, but wouldn't that issue persist on Windows as well? I am using a 16 bit depth buffer resolution on Android (which seems to be the maximum here).

Is there something I could be missing or doing wrong?

Thank you!

sentences:
Cocosdenshion and Android not working I'm trying to play sounds and music with cocos2d. When I run on iPhone and .caf files the audio is perfect, but on Android it is not playing the background music and is only playing 2 sounds of 10 files. I don't know what I'm doing wrong.

#include <SimpleAudioEngine.h>
bool HelloWorld::init()
{
  const char *sound;

#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
  sound = "Fun.caf";
#else
 sound = "Fun.wav";
#endif

  auto audio = CocosDenshion::SimpleAudioEngine::getInstance();

  audio->preloadBackgroundMusic(sound);

  audio->playBackgroundMusic(sound, true);

  audio->setBackgroundMusicVolume(1.0f);
}

void HelloWorld::playSound()
{
  const char *effect;

   #if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
  effect = "Bomb.caf";
#else
  effect = "Bomb.wav";
#endif

    audio->preloadEffect(effect);
    audio->playEffect(effect);
}

sentences:
Sprite wrong position on screen I want to render one sprite on top of another one. I create both sprites using same coordinates and while debuging I can see that they have same position but still one is being rendered beneath another and slightly to the left. Could somebody tell me what am I doing wrong? here is my code where I create sprites:

Sprite sprite1 = new Sprite(new Texture("1.png"));
sprite1.setScale(1/PPM);
Sprite sprite2 = new Sprite(new TextureRegion(...));
sprite2.setScale(1/PPM);
sprite1.setPosition(x,y);
sprite2.setPosition(x,y);

Could it have something to do with scaling? Or maybe the fact that second sprite is created from TextureRegion?

sentences:
Farseer: How can I break a body into multiple pieces? I created a breakable body but the pieces are not flying around if the ball touches it. What is wrong? Why is the breakable body not breaking into pieces?

I made a video and I enabled debugview, so you can see the bodies:

http://www.vidup.de/v/ihW2L/

//create the breakable body
BreakableBody Polygon;
List<Vertices> list = new List<Vertices>();
Vector2 _origin;
float _scale;
PolygonSprite = Content.Load<Texture2D>("polyplatform");
uint[] data = new uint[PolygonSprite.Width * PolygonSprite.Height];

PolygonSprite.GetData(data);
Vertices textureVertices = PolygonTools.CreatePolygon(data, PolygonSprite.Width, false);
Vector2 centroid = -textureVertices.GetCentroid();
textureVertices.Translate(ref centroid);

_origin = -centroid;
textureVertices = SimplifyTools.ReduceByDistance(textureVertices, 4f);

list = BayazitDecomposer.ConvexPartition(textureVertices);
_scale = 1f;
Vector2 vertScale = new Vector2(ConvertUnits.ToSimUnits(1)) * _scale;
foreach (Vertices vertices in list)
{
  vertices.Scale(ref vertScale);
}

Polygon = new BreakableBody(list, world, 1);
Polygon.MainBody.BodyType = BodyType.Static;
Polygon.MainBody.Position = new Vector2(graphics.GraphicsDevice.Viewport.Width / 200f, graphics.GraphicsDevice.Viewport.Height / 200f + 1.15f);
Polygon.Strength = 2;
Polygon.MainBody.CollisionCategories = Category.Cat11;
world.AddBreakableBody(Polygon);

//Draw the breakable body
spriteBatch.Draw(PolygonSprite, ConvertUnits.ToDisplayUnits(this.Polygon.MainBody.Position), null, Color.White, this.Polygon.MainBody.Rotation, _origin, _scale, SpriteEffects.None, 0f);

sentences:
How many threads should I have, and for what? Should I have separate threads for rendering and logic, or even more?

I'm aware of the immense performance drop caused by data synchronization (let alone any mutex locks).

I've been thinking of taking this to the extreme and doing threads for conceivable every conceivable subsystem. But I'm worried that may slow things too. (For example, is it sane to separate the input thread from rendering or game logic threads?) Would the data synchronization required make it pointless or even slower?

sentences:
How do I render a PNG with transparency in LibGDX? I'm building a simple tic-tac-toe example with LibGDX. I have simple images: cross, circle and board, all pngs created with GIMP with a transparent background.

How can I render them as a Texture with transparency?

I've tried with GL10 enable feature, but it seems not to work.

sentences:
Synchronizing "token" between players(multiplayer) I am implementing the multiplayer(client-server architecture) of a game, and I came to doubt about entities common to players.

I understand how to share information such as the position of the players among themselves. However I am caught up in the logic of how to do for the common entities between them.

Imagine: Two players and a chicken, how would you share the position of the chicken between them? because it needs to move, and can not move in different places in the two clients, the two clients should see the chicken in the local place, but if I send the position of the chicken of one client, and also the other, there may be conflicts.

What should I do. Choose one of the clients to be the "master" who will send the chicken position to the other players? How do they handle this in online games?

I am thinking of doing the following:

I can not imagine the calculations being done on the server working properly, I will use the example of the hens, my hens would have an AI maybe too complex to stay on the server. I thought the following, one of the clients of the update area, as it is a big map, the clients are receiving updates being in chunks of the map, then one of the clients would be the master (the first one that entered the channel) , the others would just listen to it, the "master" client would then send to the server the chicken positions/states and the server would send to all the clients enrolled in the channel the chicken position/status.

It works similar to a "token" who is at the top of the channel users list is going to deal with the chicken's calculations.

advantages:
- Less work for the server to handle.

Disadvantages:
- Poorly trained players could change the position of the hen and make the game experience unpleasant.

What could you do to avoid this disadvantage?

sentences:
Stamina Bar refuses to go back up I am creating a very simple script for my stamina bar to go down when I press M, but when I am not pressing M, for the bar to go back up slowly back to 100.The bar goes down fine when I press M, however, while the bar does go down, it refuses to go back up.

Attached is the code:

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

public class StaminaBar : MonoBehaviour {
    public Scrollbar StaminaGUIBar;
    public float Stamina;

    void Start()
    {
        Stamina = 100;
    }

    void Update()
    {
        Debug.Log(Stamina);
        if (Input.GetKey(KeyCode.M))
        {
            Stamina -= 5;
            StaminaGUIBar.size = Stamina /100f;
            Refuel();
        }
    }

    public void Refuel()
    {
        while (Stamina < 100)
        {
            Stamina += 5f;
            StaminaGUIBar.size = Stamina * 100f;

            if (Stamina >= 100)
            {
                break;
            }
        }
    }
}

Any Ideas

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:
Unity and C# - Cube with random directions I want to create a similar line RigidObject in Unity c# just like in the iOS game Circle:

So far I placed a cube object that is extended by length.

So, how would you approach to create such an object?

I tried with a for loop where I was trying to add a cube at the end of the other, but the rotation messed everything up.

I don't want to create a prefab, since I want the lines to be random and different every time the player starts the game.

sentences:
parametric 3D sphere unwrapping math for perfect 3D-textures After some time looking or it on the internet I can't find the proper answer to my concern.

I'm currently generating 3D textures on a shader for my planets to avoid sphere mapping issues (pole, distortion, ...).

It works great however I'm limited due to algorithm complexity so I'd like to generate my 3D textures on the CPU side. However a fully furnished 3D texture is heavy like crazy (3 dimension remember) so I'd want to store a 3D result in a 2D texture.

I need to find the correct transformation from 3D coordinates to 2D storage. Anyone have a clever thought ?

Edit : not looking for Sphere cube Map, Octohedron or similar, several texture (like in EveOnline).

I'm looking for something that you have in 3D modelers where you can unwrap a sphere on a flat surface (not regularly).

Typically the picture on the bottom:

With a function vec2 map(vec3) which can map a 3D texture and retrieve the correct value on the sphere surface.

sentences:
D3DCompileFromFile() failed, gives an error HRESULT i'm reading the "3D game programming with directx 11 " book (Frank Luna) and i'm struggling becouse he uses the old D3DX11CompileFromFile() method, which can't be used anymore. So i searched on internet how to solve this problem and i found out i have to use D3DCompileFromFile instead, which is a little bit different, but not totally. Now this is my script

DWORD flags = D3DCOMPILE_ENABLE_STRICTNESS | D3DCOMPILE_DEBUG;
    ID3DBlob*compiledShader = nullptr;
    ID3DBlob*compilationMsgs = nullptr;

    HRESULT hr = D3DCompileFromFile(L"FX/effects.fx", 0, 0, 0, "fx_5_0", flags, 0,  &compiledShader, &compilationMsgs);

    if (FAILED(hr))
        MessageBox(0, L"Failed D3DCompileFromFile", 0, 0);  //THIS POPS OUT

I did this by myself and than i started copying things from internet to make it work. Could the problem be in entryPoint=0? What do i have to put there?
This is the effect.fx file

cbuffer cbPerObject
{
    float4x4 gWorldViewProj;
};
struct VertexIn
{   float3 Pos : POSITION;
    float4 Color : COLOR;
};

struct VertexOut {
    float4 PosH : SV_POSITION;
    float4 Color : COLOR;
};
VertexOut VS(VertexIn vin) {
    VertexOut vout; // Transform to homogeneous clip space.
    vout.PosH = mul(float4(vin.Pos, 1.0f), gWorldViewProj); // Just pass vertex color into the pixel shader.
    vout.Color = vin.Color; return vout; }

float4 PS(VertexOut pin) : SV_Target {
    return pin.Color;
}
technique11 ColorTech {
    pass P0 {
        SetVertexShader( CompileShader( vs_5_0, VS() ) );
SetPixelShader( CompileShader( ps_5_0, PS() ) );
    }
}

float3 iPosL; // local space
float3 gEyePosW; // world space
float3 normalV; // view space
float4 posH; // homogeneous clip spac

Thanks

sentences: LibGDX: Max number of textures? I've been developing a game targeted at android. I know not to think about program optimization until the project is finished, but I have to wonder how many textures most phones can handle safely without melting or murdering battery. I've seen that the max SIZE of a texture should be 1024 or 2048 pixels squared (I've been combining sprite-sheets into 1024x1024 atlas's) but I can't help but wonder if there is a limit to how many of these I can use at runtime. I understand it should depend on the GPU but what spec determines it?

sentences:
Where to put common System functionality in Entity-System Design? I am working on an Entity System design based largely off of Adam Martin's design and Ray Wenderlich's Objective-C Implementation.

I am working on the AI system using a state machine with a System for each state. However, many of these systems share a lot of functionality, for example:

-(NSArray*)findEnemiesOfEntity:(Entity*)entity withinRange:(float)range {
    // Get all entities with a Team component
    // Narrow down entities to those on opposing team
    // For those that have a Position component:
    //     Get their position
    //     If their position is within range:
    //         Add to array of return values
    // Return array of return values
}

Obviously this functionality could be used in many ways; for example, the AIDefendSystem could use it to know if it is safe to move to the Attack State and the AIAttackSystem could use it to know when to return to a Defensive State.

So my question is this: where does a function like the one above go in the design?

Things I have thought of so far:

A copy in each system: this seems quite redundant and hard to maintain.  Perhaps because other design approaches view this as a code smell, I can't quite bring myself to do it.
Inheritance hierarchy for systems: the common OOP solution to the problem of keeping a copy in each system.  This also seems like bad design as it will encounter the same sorts of inheritance problems ES was supposed to solve (e.g. what happens when a non-AI system needs to know how many enemies are within a given range).
A separate helper class with all these functions: to continue the database metaphor that Adam uses, I would interpret this as the "view" functionality in mysql. The downside to this would be a giant class full of seemingly unrelated helper functions
The above approach with a single class per functionality: solves the giant class problem but creates either a singleton nightmare or dependency injection nightmare.
Create another system with the functionality: this is the answer that "sounds" right, but I have no idea how it would work.

Let me know if I can provide any further detail or clarification. Thanks in advance!

sentences:
How do I create a horizon? I added a sky to my raytracer that gets sampled when a ray completely misses any object.

What I'm doing here is if a ray completely misses anything in the scene, it returns the Perlin noise function at (ray.direction.x, ray.direction.y, ray.direction.z) - in other words it "samples a sphere around the origin".

But it "looks wrong" (because the sky looks like it's facing you).

How can I improve the sky and make it look more like the earth's horizon?

Or is this more or less what it should look like, and I should simply add more geometry on the floor?

sentences:
How do I fix a delay between the first and second KeyEvent I recently got really interested in making my own little game. As I have no real game development background I'm still figuring stuff out, but I encountered a little problem.

While working on the user input, I noticed a delay between the first and the second time the key event gets called.

Can somebody give me a tip on how I can fix it? I already had a method to make the changing a bit slower. But the input delay kinda broke the method.

Here you can see the problem https://gfycat.com/EvenCreepyAsianconstablebutterfly

As you can see from the console output I have a delay before the second activation.

    run_anim = new Image[4];
    try {
        sprite_idle = ImageIO.read(new File("img/sprite/base_.png"));
        run_anim[0] = ImageIO.read(new File("img/sprite/run_0.png"));
        run_anim[1] = ImageIO.read(new File("img/sprite/run_1.png"));
        run_anim[2] = ImageIO.read(new File("img/sprite/run_2.png"));
        run_anim[3] = ImageIO.read(new File("img/sprite/run_3.png"));
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    spriteInx = run_anim.length;

    currentImage = sprite_idle;

Here is my key event:

public void keyPressed(KeyEvent e){
    int key = e.getKeyCode();

    for(int i = 0; i < handler.object.size(); i++){
        Entity temp  = handler.object.get(i);

        if(temp.getID() == ID.Player){
            //Player Control
            if(key == KeyEvent.VK_LEFT){
                System.out.println(System.currentTimeMillis());
                Player tempP = (Player) temp;
                tempP.startRun("left");
            }
            if(key == KeyEvent.VK_RIGHT) temp.setVelX(2);
        }
    }
}

I add my images in the constructor of the player

And here you get the code for my startRun method.

public void startRun(String string) {
    running = true;
    if(string.equals("left")){
        nextSprite(string);
    }

}

public void nextSprite(String dir) {
    if(running){
        if(dir.equals("left")){
                if(spriteCount < spriteInx-1){
                    currentImage = run_anim[spriteCount];
                    spriteCount++;
                }else{
                    spriteCount = 0;
                }

                currentImage = run_anim[spriteCount];
                setVelX(-2);
            }
        }
    else{
        currentImage = sprite_idle;
    }
}

If you need anything further, just tell me.

I use AWT and Swing and nothing like lwjgl or jmonkeyengine.

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:
Rotating sprite 180 deg I should say first, that I have the rotation down. Its just that I want my square to rotate exactly 180 degrees. Currently, it will rotate but it will rotate but by less each jump. So after several jumps it will be moving on one of its side.
There's not much code to show but I'll show you how I'm rotating:

if (jumped)
        {
            roation += 0.1f;
            playerVel.Y += gravity;
        }

I haven't initialized rotation to anything.
I've also tried using some Math functions but I just get the same result.

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:
Changing the RotateAround center point dynamically Black circles are static
Red - player
Blue line - path

I'm trying to achieve a constant movement of the red dot like on the image below. For now, I have something like:

void Update(){

    target = firstCircle; // here I need to perform some calculations
    this.transform.RotateAround(target.transform.position, Vector3.forward, speed * Time.deltaTime);

}

As you can see in the code, it rotates around the upper circle now. I need to switch the target variable to the secondCircle when the player comes back to it's initial position (or is near it).

I came up with something like:

if(Mathf.Abs(Mathf.DeltaAngle(360f,this.transform.rotation.eulerAngles.z)) < 5f)
    //change target

and it works but has two issues. First - the epsilon value. If I set it to 5f the above if is true like 7 times (depending on the player's speed). Of course I could make a lock to run it only once per cycle, but there's a second problem. If the object is moving too fast, the if will be false each time, cause the speed-step is always higher than the epsilon.

How is this done in 'gravity' games like AngryBirds when the bullet changes it's attraction point?

sentences:
What audio method works across all web browsers and mobile for HTML5/JavaScript? I have looked at a number of ways to trigger audio in HTML5/JavaScript, but each time I find something that might be workable, I find web browsers and mobile devices it doesn't work on at all.

What is considered the best method that works across all web browsers and mobile for creating a game with sound using HTML5/JavaScript?

What do experienced interactive game programmers do? Do you check the user's web browser or mobile device and serve up different code to make it work? Or do you have a single solution for this? Or do you warn the user by supplying a list of web browsers and mobile devices the software is known to work with?

Additional Information: I found out that audio in some web browsers, like Safari on the Mac, it will load the audio file each time it is triggered, which causes a problem. I saw once solution using what is called Audio Sprites:
https://phaser.io/examples/v2/audio/audio-sprite
This way, you load one audio containing all your sounds needed, and then you pass a pointer to where in the audio file to start playing the sound and where to stop. That sounded like a solution, but this doesn't work on the Safari web browser, it produces no sound at all.

Then I looked into Web Audio API, and this is impressive:
https://forestmist.org/share/web-audio-api-demo

While this worked on the Mac for Safari, Firefox and Google Chrome, and the iPhone, it doesn't work on Windows with Internet Explorer (or Safari on Windows either).

I've not tested Web Audio API on the android phone yet, because I don't have access to one at the moment. So I was wondering what experienced interactive programmers do to provide audio to work across most or all platforms? It seems a huge step-backwards to have to alert visitors to a website that they can only use the functions on it by using a short list of web browsers.

The issues as I see it seem to have to do with being able to load the audio file and not have it re-loaded over the internet each time it is referred as play(). I realize Web Audio API might provide much more capability than most of us needs, but is that the current gold-standard for audio in a HTML5/JavaScript game?

Here is a simple example, using audio that works on Google Chrome/Mac, but it doesn't work on Safari/Mac:
https://rawgit.com/mehaase/js-typewriter/master/example3-typewriter/index.html

sentences: What has the most efficient intersection test against an AABB tree - OBB, Cylinder or Capsule? I'm currently trying to find collisions in 3D between a tighter volume than an AABB and a tree of AABB volumes. I just need to know whether they are intersecting, no closest distance or collision response. An OBB, Cylinder or Capsule would all roughly fit these purposes but Cylinder and Capsule were the first thing I thought of, which I have found little information about detecting intersections online. Am I right in thinking that they would always be more complex to perform Separating Axis Tests on even though they might seem like simpler shapes? I figure by the time I get my head around SAT for curved shapes I could have done the thing with OBBs but I wanted to find out for sure.

sentences:
Changing player color without multiple player bitmaps Possible Duplicate:
  How to colorize certain parts of a model - like RTS games have those team colors?

Ok, so here is my current situation. I have a player model, fully UV mapped, and textured. At first I made multiple bitmaps for the character representing multiple colors for each team in the game. (red, blue, green, yellow, etc) Well, as my player count build up, space lowers. So I needed to make a new method of keeping the game effecient, clean, and fast. So I thought of the idea of having a color mask (alpha map covering the areas to be colored). I am using OpenGL, and I just have NO idea on where to begin!

So I ask you, are there any libraries? methods? anything that could help me do this?

sentences:
JME3 Fragment/Shader not compiling Here is the fragment shader code (MyShaders/Shader1.frag):

void main(){
   gl_FragColor = vec4(1.0,1.0,1.0,1.0);
}

And the vertex shader code (MyShaders/Shader1.vert):

void main(void)
{

    gl_Position=vec4(1.0,1.0,1.0,0.0);

}

And the .j3md material code:

MaterialDef Shader1 {
    MaterialParameters {
    }

    Technique {
        VertexShader GLSL100 GLSL150:   MyShaders/Shader1.frag
        FragmentShader GLSL100 GLSL150: MyShaders/Shader1.vert
    }
}

The error stack trace is:

WARNING: Bad compile of:
1   #version 110
2   #define FRAGMENT_SHADER 1
3   void main(void)
4   {
5
6       gl_Position=vec4(1.0,1.0,1.0,0.0);
7
8   }

May 01, 2018 3:35:57 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
com.jme3.renderer.RendererException: compile error in: ShaderSource[name=MyShaders/Shader1.vert, defines, type=Fragment, language=GLSL100]
ERROR: 0:6: Use of undeclared identifier 'gl_Position'

And here is the code for instantiating the material:

Material mat=new Material(assetManager,"MyShaders/Shader1.j3md");

I think that the bug is somewhere in me not passing any gl_Position parameters into the shader, but how do I do that?

I am using JME3 and Java.

sentences:
How to make effective permament rubble in a voxel game made in Unity3D? I'm working on a semi-voxel game, and I already optimized the voxel structures' meshes by combining and chunking them.

When I destroy a voxel, I spawn a low poly voxel fragment, with a rigidbody and a collider. And then I add an explosion force.

Even if I turn off rigidbodies when they stop moving, or disable overall physics, the amount of separate meshes to render causes a huge fps loss after a few destroyed voxels.

How could I achieve permanent rubbles?

sentences: How to refresh andoid photo gallery in unity After saving a screenshot into the folder i cannot view the screenshot in the android gallery but can see the screenshot in the folder created.Is there anyway i can see it through gallery?

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:
Point Light Soft Shadows How to implement soft shadows for omni directional (point) light. We use typical shadow mapping technique. Depth is rendered to texture cube and addresing is pretty simple then. Just using vector from light to fragments world position. It works perfectly. Until you want soft shadows. In our engine we use PCSS technique for spot lights. But for point light there begins troubles.

How to sample in 3D?

I developed technique when orthonormal basis is created from  a direction and upvector (0,1,0). And then multiply sampling vector (something like this (1.0,i/depthMapSize,j/depthMapSize) with this basis. But this (of course :)) looks pretty bad for vectors near (0,1,0) and (0,-1,0).

I will appreciate any help on this.

sentences:
Calculate diameter of sphere large enough to encompasss a frustum I'm attempting to speed up box-to-box collision checks by first testing if two spheres large enough to encompass each (respectively) would collide (because I'm using separating axis theorem and it's slower than I'd like it to be).

This is fine for equilateral boxes (ie, cubes) since I can just take two opposing corners and the line between them is the exact diameter of a sphere big enough to encompass the whole thing properly; and also the point in it's middle is the origin of the sphere. I add an epsilon just to avoid any glitches with colliding with the corners of the cube, but theoretically it shouldn't be necessary.

But for non-equilateral boxes, such as frusta, this method does not work. I've pondered it over and nothing I can come up with is a quick enough calculation for my taste. The best I've come up with is to take two opposing edges (diagonally through the box) from the near face to the far face, get their individual lengths and sum them; then do the same thing for the left-to-right faces and top-to-bottom faces. with these three sums, take the largest and just use that.

Anyway, that method works but it's too much calculation, involving 6 square roots. I need something faster and preferably more accurate. I've googled and haven't found much on this subject at all. I'd like the solution to work for boxes of any shape (as long as faces are valid) and frustums of unknown orientation (meaning the large face could be any side, not a known one).

It's also important to know the origin of the sphere (which is the dead center of the frustum). Which if there is no faster calculation, this is just the sum of all 8 verts divided by 8.

Any ideas?

sentences:
Nested Coroutine Movement is slugish So I have a few AIs walking between waypoints. What I want to accomplish here is to have my AI move to the waypoint, when he reaches it, he must stop, wait for a few seconds (Not walk just stand still), then move to the new waypoint. Lets pretend he was observing while at this point.

Issue right now - He moves to the waypoint with a twitchy behavior where he would usually avoid objects, sometimes gets stuck while moving to objects or its like the AI cant decide what to do, move or stand still. Without the Waitforseconds method the AI avoids objects perfectly.

Please note I want to use Coroutines for this even if you wouldn't use / recommend it for this. If you have a suggestion for using Unity's Random to decide when he stands still after reaching a point or not, that would be a bonus for me.

We define all fields and call the FSM() Coroutine with a default patrol state in the Start Method, from Here, This is my Code:

Update - Implemented A Boolean IsMoving variable - This works to some extent. The AI now moves perfectly to the waypoint. The Twitching however continues once the AI reaches the waypoint vicinity until he leaves the waypoint radius - The movement then continues to a normal state.

IEnumerator FSM()
{
        while (alive)
        {
            switch (state)
            {
            case State.PATROL:
                StartCoroutine(Patrol());
                break;
            case State.CHASE:
                Chase ();
                break;
            default:
                break;
            }
            yield return null;
        }
    }

    /// <summary>
    /// Patrol will move to a waypoint if too far, otherwise move to a next waypoint if one is reached.
    /// </summary>
    IEnumerator Patrol()
    {

            //Sets a common speed for the agent to move in.
            agent.speed = patrolSpeed;

            //Now we want to check the position the character is at vs the waypoint location - If i am too far, move closer
            //                        My Position           Waypoint Indexes - We Set Multiple
            if (Vector3.Distance (this.transform.position, waypoints [wayPointIndex].transform.position) >= 2)
            {
                //Telling the navmesh agent where to go.
                agent.SetDestination (waypoints [wayPointIndex].transform.position);

                //                                  false, false - Specifies if we are jumping or crouching
                character.Move (agent.desiredVelocity, false, false);

            }
            //Now we want to check the position the character is at vs the waypoint location - If i am at a waypoint, move to a new index
            else if (Vector3.Distance (this.transform.position, waypoints [wayPointIndex].transform.position) <= 2)
            {
                character.Move (Vector3.zero, false, false);
                yield return new WaitForSecondsRealtime (6.0f);

                wayPointIndex += 1; //Move towards a new waypoint in the waypoint indexes flags

                //Move to a random waypoint
                wayPointIndex = UnityEngine.Random.Range (0, waypoints.Length);

            }
            else
            {
                //Doesn't move, plays the idle movement - We know this point wont be reached but if so...
                character.Move (Vector3.zero, false, false);
                yield return null;
            }
        }

sentences:
Design problem with specific requirements (logical dependencies needed) I started to write some code for a small 3D environment. This week I wanted to start with my entities and when I thought about it again, I stumbled across some unmet requirements. My design works fine concerning the game loop, but I missed the logical relationships between distinct entities.
To show what I mean: my entities could interact through a common interface (my base class) but they lack the ability to react to a specific environment, e.g. imagine you have a simulation with some different animals. Some are carnivores (pretator) and some herbivores (prey). When I thought about my design, I somehow missed to include the ability to catch an entity's surroundings. My prey cannot find out about the predators near them ('am I in danger of being eaten? should I flee or am I safe? ..'), nor can the predators actually hunt their prey.

So I am looking for a design that is able to manage all entities through a single interface (game side) and allows information about the environment (entity side).
Besides these, there are some more conditions:

thread-safety
expandable via dll (I'm using C++)
effectivity

Side notes: my entities don't need to change properties during runtime (like in ECS) and I want injected entities (through dlls) to work properly with the original ones (e.g. if someone adds a lion through a dll, any prey should properly react to nearby lions as they are a kind of predator).

sentences: Linux Game Development Resources Do you have any Linux-specific game development resources?

sentences:
No intellisense on my classes I've been using Monodevelop's current version and Unity 4.
I don't get intellisense on the classes I've created but I do have intellisense on classes that are in Unity's framework. Bug or its just as it is?

I use UnityScript:

class SomeClass extends ScriptableObject{
    public function Test(){return "";}
}

In another class, when I use a variable typed as this class I get no intellisense.

sentences: Unity 2d - rigidbody rotating Z axis if hit something I have problem with my player. I use rigidbody2D on my player and I had fixed rotation on Z, but now i need use rotation with some of my root animation. Ok, i enabled it, but when my player hit something (for example NPC, wall, ...), rotates on the Z axis and falls off. Can you help me? Thanks and sorry for my mistakes.

sentences:
Why the main menu is not working on the second time when pressing on escape key to back to the main menu? I have two scenes. Main Menu and the main scene.
The game start when only the main menu is loading.

When I click on the New Game button it's loading the main scene and removing the main menu scene.

If I click now on the Escape key it will remove the main scene and load back the main menu scene but this time I can't click on any of the buttons in the main menu.

I'm not sure if this is the right way to switch between the scenes but it's not working good.

On the Newgame button I created and attached a new script. And then in the OnClick event of the button I'm calling the method LoadByIndex:

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

public class LoadSceneOnClick : MonoBehaviour
{
    public void LoadByIndex(int sceneIndex)
    {
        SceneManager.LoadScene(sceneIndex);
    }
}

On the main scene I added a empty gameobject and attached to it another script:

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

public class BackToMainMenu : MonoBehaviour
{
    public int sceneIndex;

    // Update is called once per frame
    void Update ()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            UnityEngine.SceneManagement.SceneManager.LoadScene(sceneIndex);
        }
    }
}

When the game start in the main menu when clicking on New Game button it's loading index 1 the main scene and removing the main menu.

When clicking on escape key it's loading index 0 and removing the main scene.
But then the main menu is not working.

sentences:
Why do console versions of multiplayer games support fewer players than PC versions? source
http://answers.yahoo.com/question/index?qid=20111205162848AAb1sl9

  64 Players on P.C ( 32vs32)

  & bigger maps with more vehicles & buildings.

  24 on Consoles ( 12vs12)   ( It was planned to have a 32 player
  limit, but was later reduced to 24).

Why does the console version have a maximum of 24 players? Is it hardware related?

One of the reason was that players can host games themselves. If thats true its very sad that you cannot play 32x32, because one or two guys want to host games.

sentences:
Tracking playing position into an array I'm trying to track playing position every 500ms which i can do but i need it to populate an array which i save to a txt file as a comma delimted list or something.

I have this code so far (which incorporates the player movement code too), which displays the positions in the console:

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

public class CharacterControllerT : MonoBehaviour {

    public float speed = 10.0f;
    public Read_moveT ReadMove;
    [SerializeField] private float _duration = 0.5f;
    private float _timer = 0f;
    public Vector3 PlayerPosT;
    GameObject Mover;
    public Vector3[] PlayerTxyz;

    // Use this for initialization
    void Start () {
        Cursor.lockState = CursorLockMode.Locked;
        Mover = GameObject.Find ("PlayerT");
        ReadMove = Mover.GetComponent<Read_moveT> ();
    }

    // Update is called once per frame
    void Update () {

        if (!Input.GetButton ("DoorTrigger")) {
            ReadMove.mUP = Input.GetAxis ("Vertical");
            ReadMove.mLEFT = Input.GetAxis ("Horizontal");
            float translation = ReadMove.mUP * speed;
            float straffe = ReadMove.mLEFT * speed;

            translation *= Time.deltaTime;
            straffe *= Time.deltaTime;

            transform.Translate (straffe, 0, translation);
        }

        if (Input.GetKeyDown ("escape")) {
            Cursor.lockState = CursorLockMode.None;
        }

        _timer += Time.deltaTime;
        if (_timer >= _duration) {
            _timer = 0f;
            PlayerPosT = Mover.transform.position;
            print ("Player:: X: " + PlayerPosT.x + ", Z: " + PlayerPosT.z);
        }
    }
}

I just need these coords to be saved into an array that i can process when the game is over. The problem being that the array will always be (until game over) of undetermined length.

Any ideas?

Thanks,

Paul..

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:
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:
How do I access a variable from my code in Godot's editor? In Godot, I have a node with a variable that I often need to tweak for balancing purposes. It would be a lot easier to manage if I could modify it inside the editor instead of the code.

How would I go about doing this?

sentences:
What are the reasons to reset MMR and introduce seasons? I have a game with a ranked mode that keeps track of MMR.

Players have been asking me to have "seasons" so we can reset it and help people who are "stuck in ELO hell" climb better.

My thought is that people who are stuck in elo hell are just bad and that resetting per-seasons are pointless, why not just climb? I'm going to add rewards for the highest rank achieved every 4 months but not reset MMR.

Is there any real reason to reset MMR?

sentences:
Multithreading vs Asynchronous game loop for multiplayer online game? I'm trying to create a turn based multiplayer online game where players can be grouped in a room/lobby and play (similar to Ludo but number of players can be more than 4). There can be multiple such rooms at a time.
Here is brief overview of the game: The game is not resource heavy. Each player gets his turn to perform some actions for some time (~90 seconds) and meanwhile other players just communicates with server to get the actions performed by the player. There can be multiple game rounds and a winner is declared at the end.
The game state of each room would be different at a given time. Therefore, to manage the game states for all the rooms, I could think of two approaches:

Multithreading approach: Spawn a new thread for each room and run/manage the game loop and corresponding game states in room specific threads. But if there are too many rooms, the number of threads would be very large and this approach is not feasible as per this answer's comment. However this approach is preferable for mass multiplayer games online games (MMO) as per this answer. I also think this should work for considerable number of rooms because most of the time, threads are waiting for player's actions.
Asynchronous approach: Here, the game states of all the rooms would be stored in server's memory and whenever any requests is received from any player, the game state object will be retrieved using player's room ID and based on the state, the server will command players in that room. The state will then be updated. There will be only one main thread here.

So my question is what would be the better approach for this type of games, considering the future scaling requirements? Also suggest any better alternatives which I couldn't think of.

sentences:
Most efficient way to modify character mesh at run time What is the most efficient way in unity to alter the mesh of a character in this scenario:

When the player pick up an item:

-A part of the mesh should be replaced, for example, the left arm is swapped by a robotic, rock, wood etc... arm.

-The animations are the same.

-Other parts may change in a different way, for example, left arm stone right wood.(This happens in a different pick up later)

-There is no problem if the game slows for a sec as this not happen "in action".

One more thing:

In general terms, what are the thing to consider when doing these modifications in terms of performance?(Such as polygons of the mesh, resolution of textures...)

Will many changes end up in consuming memory or other resources?

sentences:
sdl: unlock mouse in fullscreen mode and make it useable on another monitor Is it possible to unlock the mouse in fullscreen mode so that you can use it on a another monitor?
I read trough the SDL documentation, but I couldn't find anything related to my problem.

sentences:
Stop Animated Tile from looping Unity2D C# I am using the animated Tile script and starting the animation when I need it, by replacing a static tile with an animated one. Currently on collision with the player, however, I need the animation to run to its end and then stop when it finishes.

My current code is  trying to find if the current sprite on the position is the same as the last one of the animation and if that is true it should just replace it with a static tile. However, that happens instantly after the animation has been triggered.

Check if the animation is finished:

if (playingAnimation)
    {
        if (tilemap.GetSprite(lastPPosition) == destructableLast.sprite) // if animation ended
        {
            Debug.LogWarning("Destructable Animation finished; Returning to end sprite");
            tilemap.SetTile(lastPPosition, destructableLast);
            playingAnimation = false;
        }
    }

Code for setting the animated tile:

private void AnimatedTile_Destroyable(TileBase type, Collision2D collision, Vector3Int pPos)
{
    if (type == destructable0)
    {
        tilemap.SetTile(pPos, destructable1Animation);
        lastPPosition = pPos;
        playingAnimation = true;
    }
}

I did find this in the Animated Tile script:

public override void GetTileData(Vector3Int location, ITilemap tileMap, ref TileData tileData)
    {
        tileData.transform = Matrix4x4.identity;
        tileData.color = Color.white;
        if (m_AnimatedSprites != null && m_AnimatedSprites.Length > 0)
        {
            tileData.sprite = m_AnimatedSprites[m_AnimatedSprites.Length - 1];
            tileData.colliderType = m_TileColliderType;
        }
    }

Which confuses me, because from what I see, the sprite that is used as the animated tile sprite is the last one from the animation. Shouldn't the sprite change constantly when the animation plays, and is there a way to stop the animation once it has finished?

sentences: How to make a simple score system for my game? I'm making a simple game and I can't seem to impliment a simple score system. As the object moves 10 units forward the score should increase by 10. My issue is that when I turn the object around and move backwards the score decreases.

sentences:
Is there a way to display navmesh agent path in Unity? I'm currently making a prototype for a game I plan to develop. As far as I did, I managed to set up the navigation mesh and my navmeshagents.

I would like to display the path they are following when setDestination() is fired.

I did some researches but didn't find anything about it.

EDIT 1 : So I instantiate an empty object with a LineRenderer and I have a line bewteen my agent and the destination. Still I've not all the points when the path has to avoid an obstacle. Furthermore, I wonder if the agent.path does reflect the real path that the agent take as I noticed that it actually follow a "smoothier" path.

Here is the code so far :

GameObject container = new GameObject();
container.transform.parent = agent.gameObject.transform;
LineRenderer ligne = container.AddComponent<LineRenderer>();
ligne.SetColors(Color.white,Color.white);
ligne.SetWidth(0.1f,0.1f);
//Get def material

ligne.gameObject.renderer.material.color = Color.white;
ligne.gameObject.renderer.material.shader = Shader.Find("Sprites/Default");
ligne.gameObject.AddComponent<LineScript>();
ligne.SetVertexCount(agent.path.corners.Length+1);
int i = 0;
foreach(Vector3 v in p.corners)
{
    ligne.SetPosition(i,v);
    //Debug.Log("position agent"+g.transform.position);
    //Debug.Log("position corner = "+v);
    i++;
}
ligne.SetPosition(p.corners.Length,agent.destination);
ligne.gameObject.tag = "ligne";

So How can I get the real coordinates my agent is going to walk throught ?

sentences: LIBGDX Image tearing I'm making an game in libGDX and I have been noticing some image tearing when camera is moving. Note that it happens only when the game is maximized and the camera x position is less than screen width and camera y position is less than screen height. Here's a GIF showing what is the problem The color errors are not the problem here, it is the GIF fault

sentences:
Camera closes in on the fixed point I've been trying to create a camera that is controlled by the mouse and rotates around a fixed point (read (0, 0, 0)), both vertical and horizontal. This is what I've come up with:

camera.Eye = Vector3.Transform(camera.Eye, Matrix.CreateRotationY(camRotYFloat));

Vector3 customAxis = new Vector3(-camera.Eye.Z, 0, camera.Eye.X);
camera.Eye = Vector3.Transform(camera.Eye, Matrix.CreateFromAxisAngle(customAxis, camRotXFloat * 0.0001f));

This works quite well, except for the fact that when I 'use' the second transformation (go up and down with the mouse) the camera not only goes up and down, it also closes in on the point. It zooms in.

How do I prevent this?

Thanks in advance.

sentences:
Javascript Isometric draw optimization I'm having trouble with isometric tiles drawing.

At the moment I got an array with the tiles i want to draw.
And it all works fine until i increase the size of the array.

Since I draw ALL tiles on the map it really affects the game performance (obviously) :D.

My problem is I'm no genius when it comes to javascript and I haven't managed to just draw what is in viewport.

Should be fairly simple for an expert though because its fixed sizes etc.
Canvas is 960x480 pixels, each tile 64x32.
This gives 16 tiles on first row, 15 on the next etc. for a total of 16 rows.

Tile 0,0 is in the top-right corner. And draws X up to down and Y right to left.
Going through the tiles on the first row from left to right as +X -Y.

Here is the relevant part of my drawMap()

function drawMap(){
    var tileW = 64; // Tile Width
    var tileH = 32; // Tile Height
    var mapX = 960-32;
    var mapY = -16;
    for(i=0;i<map.length;i++){
        for(j=0;j<map[i].length;j++){
            var drawTile = map[i][j];
            var drawObj = objectMap[i][j];
            var xpos = (i-j)*tileH + mapX;
            var ypos = (i+j)*tileH/2 + mapY; // Place the tiles isometric.
            ctx.drawImage(tileImg[drawTile],xpos,ypos);
            if(drawObj){
                ctx.drawImage(objectImg[drawObj-1],xpos,ypos-(objectImg[drawObj-    1]));
            }

        }
    }
}

Could anyone please help me how to translate this to just draw the relevant tiles?
It would be deeply appreciated.

sentences:
How can I make different levels in a game? Let's say I was working on a platform game. Each level has an exit. When the player reaches the exit, the game switches to the next level.

What would be the best way represent and switch to the next level?

One idea I had is to make a Level class. This class handles most of the game logic and has most of the program's code, but doesn't paint anything on the screen.

For each level, I create a class that extends (inherits) Level class. All of these classes would inherit everything from Level, but paint different things on the screen.
When the player finishes a level, finishedLevel() method is activated inside class Main, and this class creates an instance of the next level.

Is this approach reasonable, or is there a better one?

sentences:
How to Convert DirectX Texture2D to a DXGI Surface for WPF Rendering? I have an image in my WPF application that uses a D3DImage to render DirectX content. On the DirectX side I render everything to a Texture2D using SharpDX (a C# DirectX wrapper), but I'm not sure how to convert the rendered texture to a D3DImage.

I found the D3DImage.SetBackBuffer(D3DResourceType backBufferType, IntPtr backBuffer) method, but that requires the texture to be a DXGI Surface. Here's the code I'm working with:

// renderTexture is a Texture2D that serves as the renderTarget for the DirectX content
// d3dimg is the D3DImage that WPF uses

d3dimg.Lock()
d3dimg.SetBackBuffer(D3DResourceType.IDirect3DSurface9,
                     renderTexture.QueryInterface<Surface>().NativePointer);
d3dimg.Unlock();

But for some reason, the SetBackBuffer function call throws an exception saying that the "specified cast is not valid," even though I'm not doing any casts here (as far as I can see). What am I doing wrong?

sentences:
Stopping Actor tap/click event from propagating I've been struggling with this for hours now and have read posts, docs and libgdx sources to better understand what's happening, but I still can't make any sense of this.

I want to accomplish something very simple: stopping a tap on an Actor from propagating through the stage.

The setup is as follows:

GameStage defines a gesture listener (for map panning and propagating taps in the map to the Player actor so it can move around)
Player has a child actor which can receive clicks

It is on that last child actor that I want to detect clicks, but then not have them propagate to any other actors or be handled by the stage. I define the click handler as follows:

// in child actor:
addListener(new ClickListener() {
   void clicked(...)
});

Nothing surprising here.

The problem is: since the actor is physically located outside the Player parent actor, any clicks on it get picked up by the stage's map gesture handler which then propagates these taps back to the player which makes it move around. I don't want that; this click listener is supposed to handle and swallow the event.

However, none of the following calls I make inside clicked actually cancel the event:

event.handle()
event.stop()
event.cancel()

The only way I could make the event stop from propagating is to use Stage#cancelTouchFocus. However, this has the side effect of dispatching a touchUp event on the stage (why?), which ends up in my gesture listener and gets interpreted as a longPress! Probably because it is paired up with the wrong touchDown...

What am I missing? It can't be that complicated to stop an event from propagating given all the supposed options?

UPDATE:
I believe the problem lies in Stage:
https://github.com/libgdx/libgdx/blob/2bd1557bc293cb8c2348374771aad832befbe26f/gdx/src/com/badlogic/gdx/scenes/scene2d/Stage.java#L348

It walks over all the listeners that have touch focus, and let's them handle the event. However, it does not break out of the loop as soon as a listener has handled it, thus propagating it further. Is that just a bug?

sentences:
How are physics or graphics components typically built in a component-oriented system? I have spent the last 48 hours reading up on Object Component systems, and feel I am ready enough to start implementing it. I got the base Object and Component classes created, but now that I need to start creating the actual components I am a bit confused. When I think of them in terms of HealthComponent or something that would basically just be a property, it makes perfect sense. When it is something more general as a Physics/Graphics component, I get a bit confused.

My Object class looks like this so far (If you notice any changes I should make please let me know, still new to this)...

typedef unsigned int ID;

class GameObject
{
public:

    GameObject(ID id, Ogre::String name = "");
    ~GameObject();

    ID &getID();
    Ogre::String &getName();

    virtual void update() = 0;

    // Component Functions
    void addComponent(Component *component);
    void removeComponent(Ogre::String familyName);

    template<typename T>
    T* getComponent(Ogre::String familyName)
    {
        return dynamic_cast<T*>(m_components[familyName]);
    }

protected:

    // Properties
    ID m_ID;
    Ogre::String m_Name;
    float m_flVelocity;
    Ogre::Vector3 m_vecPosition;

    // Components
    std::map<std::string,Component*> m_components;
    std::map<std::string,Component*>::iterator m_componentItr;
};

Now the problem I am running into is what would the general population put into Components such as Physics/Graphics? For Ogre (my rendering engine) the visible Objects will consist of multiple Ogre::SceneNode (possibly multiple) to attach it to the scene, Ogre::Entity (possibly multiple) to show the visible meshes, and so on. Would it be best to just add multiple GraphicComponent's to the Object and let each GraphicComponent handle one SceneNode/Entity or is the idea to have one of each Component needed?

For Physics I am even more confused. I suppose maybe creating a RigidBody and keeping track of mass/interia/etc. would make sense. But I am having trouble thinking of how to actually putting specifics into a Component.

Once I get a couple of these "Required" components done, I think it will make a lot more sense. As of right now though I am still a bit stumped.

sentences:
Client Server UDP Jumping I don't really think this is an issue with the fact that UDP can drop packets (I'm using Lidgren and using ReliableInOrder), but basically, in my game, the client send the input keys (if forward is prsesed, backward is pressed, etc)

Now, when lag occurs, it's not noticeable at all if the packet that says "I'm pressing forward" right now is behind schedule, because I have interpolation.  However, it's really annoying when you press the space bar (jump button), and nothing happens because the packet was dropped and Lidgren needs to resend it.

How can I fix this?  Please keep in mind that the server controls all position data to prevent hacking, so I can't just make jumping client-sided and send the position.

Thanks!

sentences:
Convert Minimap render texture to 3d space position I am using Render Texture to make a Mini Map it is working fine. Now I want world space position from render texture click point.
Is there any way available that I get the world space position from the render texture's specific click point?
If I click somewhere in render texture then, how can I get that point in 3D world space?
For example, I click a car object on render texture How can I highlight or get it in 3D world space.?
Update: Actual Scenario is:

One Main Camera Rendering the Scene.
NGUI Camera Rendering the GUI.
That GUI contains the Render Texture(minimap) which rendering the
scene on texture using GUI Camera.

Now how can I get 3D position from 2D render texture!

sentences: The reasons behind Unity3D engine design (game object/transform component) I'm trying to understand the reasoning behind Unity3D engine design and this is something I can't get my head around yet: why is transform data stored in a separate component, instead of being a part of GameObject, like name, layer masks and tags? It cannot be removed like all of the other components anyway, there are no alternatives and thus no need for it to be removed.

sentences:
Defensive statistic mechanics There are many systems where attack statistics are opposed by defense statistics:

Strict: HP -= (damage - defense)
Threshold: HP -= (damage>defense? damage : 0)
Reciprocal: HP -= (damage / defense)

Just to name a few, and there are variations on those as well:

Reciprocal threshold: HP -= damage>defense ? (damage/defense) : 0

Note that this is by no means an exhaustive list, since many games use multiple stats to arrive at a final "defensive" result (agility, current speed, movement relative to attacker, flanking) that's applied to any potential damage.

What drives the selection of one relationship over another?

sentences:
How to render a pseudo-3D view like in the game Biosys (1999)? Biosys is a PC game released in 1999, where navigation through its environments is done by clicking an "exit" on a scene, taking the player to a new scene. The player can't move in a scene, and interaction is done by clicking a location in it. In some scenes the player can freely look around in 360 degrees by moving the mouse.

My question is, what technique could be used to render such a scene? I'm asking because that doesn't look like it's true 3D; it looks drawn as if a picture is wrapped around the player, but how would you produce and render a picture in such a way?

Here is a rare YouTube video of that game, beginning at 3:40 where the technique I'm curious about is shown.

And here's a picture of one of those environments:

sentences:
Player Flying after colliding - Unity I have a Player with a capsule collider on him and i have various objects in the scene. Most of the objects have either mesh collider or box collider enabled.
When i move my player and the player collides with any object, my player just starts flying into space, literally.
Any way to fix this?

Thanks in Advance.

The code i have on my player is this:

using UnityEngine;
using System.Collections;

public class Controller : MonoBehaviour {
Animator anim;
Rigidbody rbody;
float inputH;
float inputV;
int Life=20;
bool Dead=false;
public float sensitivity=10f;
void Start () {
    anim = GetComponent<Animator> ();
    rbody = GetComponent<Rigidbody> ();
}
void Update () {
    if (Dead == false) {
        inputH = Input.GetAxis ("Horizontal") * 50f;
        inputV = Input.GetAxis ("Vertical") * 20f;
        anim.SetFloat ("inputH", inputH);
        anim.SetFloat ("inputV", inputV);
        float moveX = inputV  * Time.deltaTime;
        float moveZ = inputH * 0.5f * Time.deltaTime;
        this.transform.position += this.transform.forward * moveX;
        this.transform.position += this.transform.right * moveZ;
        transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivity, 0);
    }
    if (Input.GetKey (KeyCode.Z))
        Life--;
    if (Life == 0)
        Dead = true;
    anim.SetBool("Dead",Dead);
}
}

sentences:
how to use unity3d webgl content in a asp.net mvc view? I asked this question in stackoverflow but no answers so I think it would fit here better.

I have a unity webgl project and an asp.net mvc project.

I need to show the webgl content in a view.

The first thing that came to my mind was to simply copy the content of the index.html that unity gave me and paste it in a .cshtml file and change the addresses. But when I do this the incorrect header error pops up.

Am I doing some thing wrong or everything wrong. should I change my method entirely?

I also added these file extensions to the web.config

<staticContent>
  <!-- Unity 5.x -->
  <remove fileExtension=".mem" />
  <mimeMap fileExtension=".mem" mimeType="application/octet-stream" />
  <remove fileExtension=".data" />
  <mimeMap fileExtension=".data" mimeType="application/octet-stream" />
  <remove fileExtension=".memgz" />
  <mimeMap fileExtension=".memgz" mimeType="application/octet-stream" />
  <remove fileExtension=".datagz" />
  <mimeMap fileExtension=".datagz" mimeType="application/octet-stream" />
  <remove fileExtension=".unity3dgz" />
  <mimeMap fileExtension=".unity3dgz" mimeType="application/octet-stream" />
  <remove fileExtension=".jsgz" />
  <mimeMap fileExtension=".jsgz" mimeType="application/x-javascript; charset=UTF-8" />
</staticContent>

sentences:
How to decide which Area2D is behind? How to make an Area2D drawn after another one only in certain situations?

The boat
+ Area2D
|_ AnimatedSprite

The stone
+ Area2D
|_ AnimatedSprite

Correct

Not correct

Do I have to use 3D?

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:
Colliders stop working when they move I'm trying to make a game where you play basketball as a catapult. Obviously an idea like this leans heavily on the unity physics engine. The cup of the catapult has a bucket on it to keep the ball from falling out. When you hit space, the arm of the catapult spins, which should throw the ball out of the bucket of the catapult. Instead, the ball passes through the cup of the catapult(when it isn't spinning, it acts normally and rolls around the bucket) and then it doesn't fall whatsoever, eve though has gravity is enabled. Here are my physics settings:
The ball

The cup(and also a cup with flipped normals)

The Rim of the bucket

Here's my ball throwing code:
public class BallThrower : MonoBehaviour
{
    private Vector3 axis;
    // Start is called before the first frame update
    void Start()
    {
        axis = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.Space))
        {
            if (transform.rotation.z > -95.4)
            {
                transform.Rotate(0f, 0f, -5f, Space.Self);

            }
        }
    }
}

What's missing here? Should I make the cup a rigidbody? Let me know if you need more info, Thanks!

sentences:
What does "kTriangles/s" mean in hardware graphics benchmark reports? I've looked around and found several sites offering benchmarking statistics for mobile platforms and I've been seeing the unit of measure as "kTriangles/s". Originally I misread this, missing the 'k'; does this translate to "thousand(s) of triangles/s", e.g.:

8902 kTriangles/s = 8,902,000 triangles/s

(I'm pretty sure that my interpretation is correct, but I hope someone can confirm this for me)

sentences:
Big maps with deep zoom and pan I have a world map of 14048x7134, the game starts with the zoom completely out and during the operation it zoom in and zoom out and pan in all directions, it can get really near the surface, at almost a 1:1 ratio between the screen and the map information. It is going to be draw in a 1024x768 screen.

Scale a 14048x7134 to fit 1024x768 in each frame it's way far from efficient, so I am wondering...
What strategies there are to solve this problem?
Is there any tool or library to help in this process?

sentences:
Applying angular velocity to quaternion I am reading Game Physics Engine Development by Ian Millington currently. In his book, he represent an orientation of rigid body by quaternion. I don't understand the formula where he apply angular velocity to the quaternion. The formula is

$$ q_{new} = q_{0} + \frac{t}{2} * w * q_{0} $$

where w is the angular velocity in quaternion representation.

$$ w = \begin{bmatrix} 0\\ w_{x}\\ w_{y}\\ w_{z} \end{bmatrix} $$

He doesn't explain where the formula come from. Currently I apply this method in my physics engine where I compute the angular rotation then convert it to quaternion and multiply it. It is slower than the above operation because of the sine, cosine and square root operation when converting the rotation to quaternion. Can someone explain to me where did the formula above come from? I understand basic quaternion operation like representing axis angle by quaternion and rotating a vector by quaternion.

sentences:
D3D12 ConstantBuffer - Shader receives wrong values im having trouble with one constantbuffer:

struct CameraConstData
{
    urd::Matrix projection; // 64 ( 16 floats)
    urd::Matrix view;       // 64 ( 16 floats)
    urd::Vec3 viewPosition; // 12 ( 3 floats)
    urd::Vec3 viewDir;      // 12 ( 3 floats)

    // 104 bytes (26 * 4)
    float offset[26];
};

inside the shader its defined like:

// desc heap cbv
cbuffer CameraConstBuffer : register(b0)
{
    float4x4 projectionMatrix;
    float4x4 viewMatrix;
    float3 viewPos;
    float3 viewDir;

}

now viewdir is always filled with wrong buffer indices.

viewDir.x is the passed y value
viewDir.y is the passed z value
viewDir.z is 0.0

checked it in the shader like:

float3 vpos = normalize(float4(viewDir, 0.0)).xyz;
//float value = vpos.x; // uses the passed y value
//float value = vpos.y; // uses the passed z value
color = float4(vpos, 1.0);

GPU Debugging shows that the constant buffer looks fine:

i checked the vectors against the cpu side and they match.

So why is the shader reading index 36-38 instead of 35-37?

Its always affecting the 4th member of the struct. If i switch viewPosition with viewDir, viewPosition is false.

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:
Algorithm for spending x points on y things divided by n people I'm trying to devise an algorithm to spend a given amount of points on a randomly generated list of items each with their own cost in a way that results in having a number of items that is divisible by a given value (the number of points given is always divisible by this). Each item must be represented as equally as possible.

Points: 12
Divisor: 6
Items: Foo (1) & Bar (3)

The optimal result would be 3 Foo and 3 Bar (12 total points and 6 items).

That could be achieved by filling the space alternately starting with the smallest item but that algorithm won't work for other permutations of the starting values or if there are more items to spend points on, some of which may have the same value as other items but must be represented equally in the final result.

The algorithm can result in spending less points than are available but never more. There may not always be a 1 cost item to fill in any remainders.

Another example I can't solve...

Points: 24
Divisor: 8
Items: Foo (1), Nacho (1) , Pizza(2), Bar (3), Cake (4)

Just spending all of the points is easy but spending it in such a way that you end with a specific number of items that can be divided between the divisor has had me scratching my head all day.

sentences:
Aim prediction along a parabola - How to make a Tower Defence Mortar aim accurately I am building a very basic tower defence game in Unity3D where one tower is your standard long range mortar/artillery.

I want the projectile it fires to follow a parabola curve to make its movement seem like a mortar. This movement is not dependant on any physics (as I can make a projectile follow a curve  but I could implement the Unity3D physics if the method used would benefit from it.

My question is: What technique should I use to ensure the projectile hits the locked unit whilst taking into account that the unit is moving along a possibly non linear path (defined with my A* implementation.) I have not implemented any code as of yet as I wanted to consult the masses for any wisdom you can provide!

My initial idea was to fix the time the projectile would take along its parabola curve (regardless of distance) and try and track the position the unit would be at after this time delay. Is this along the right lines or are there alternative methods to consider when aiming a projectile that follows a curved path instead of a linear one?

Thank you for your time.

sentences:
How to get Entitas components from gameObject.getEntityLink() I'm new to Entitas. I have a DamageSystem that should Physics.Raycast() toward the target and if tag is enemy it should reduce enemy health.

I have HealthComponent:

public class HealthComponent: IComponent{

public float value;

}

In DamageSystem I wanna do something like:

if(Physics.Raycast(target, direction, out hit)){

     tag.gameObject.entity.health.value = currentHealth - damage ;

}

But after Physics.Raycast(), I have  only  the gameObject and getEntityLink() method that return EntityLink without actual components... I guess that getEntityLink() returns only abstract components, and there is no way to get HealthComponent from EntityLink?

Does someone know how to get components from EntityLink, in a clean manner?
 Thanks!

sentences:
Programming the combat sequence in a role playing game I'm trying to write a short "game" where a player goes around and fights monsters but I have no idea how to handle the combat.

For example, say I have a "Warrior" and a "Troll". How do the two fight each other? I know I can do something like

Conan = Warrior.new();
CaveTroll = Troll.new();
Conan.attack(CaveTroll);
CaveTroll.attack(Conan);

But what part of the game controls the monster? Do I just stick the above sequence in a loop until one of them dies? Or does the game "engine" need to have a part that deals specifically with combat? Or is this an aspect of the Troll's artificial intelligence that needs to take care of it's actions?

Also, who/what determines the actions that the monster takes? Maybe a Troll can bash, kick, bite, cast spells, drink potions, use a magical item. Does the game engine determine what action the Troll takes or is that something the Troll class manages?

Sorry I can't be more specific but I need some guidance on which direction to go with this.

sentences:
How to associate a number to a button and get that number when the user clicks on the button? I am creating buttons for each level through script as shown below

private void CreateLevelButtons()
{
    for (int i = 1; i <= no_of_levels; i++)
    {
        Button button = Instantiate(button_prefab);
        button.GetComponentInChildren<Text>().fontSize = 12;
        button.GetComponentInChildren<Text>().text = "Level " + i.ToString();
        button.transform.SetParent(content.transform, false);
        button.onClick.AddListener(() => OnClickLevelButton());
    }
}

In OnClickLevelButton() function I want to determine the level number of the button that was clicked. Is there a way to associate a number to a button so that i can access that number later when the user clicks on the button?

sentences: Rotate Object Towards Direction in 2D For my RTS game's physics engine, I'm trying to find out a clever way to make a unit face the direction it's moving in. Given a Vector2d direction of movement (its normalized velocity), how can I calculate the unit's rotation? If possible, I'd rather not use inverse trig functions because I only have a lookup table for Sine.

sentences:
How to convert RotateAround speed to directional speed in Unity? I am currently using

transform.RotateAround(transform.position, Vector3.forward, degreesPerSecond * Time.deltaTime)

to make an object rotate around another object. This works well, but I want to make the object stop rotating around and instead move in a certain direction at the same speed that it was rotating. However, I can not figure out how to convert the degreesPerSecond into a directional speed.

My goal is to have something like this:

if(rotating) {
    transform.RotateAround(transform.position, Vector3.forward, degreesPerSecond * Time.deltaTime)
} else {
    transform.position += transform.right * DegreesToDirectionalSpeed(degreesPerSecond ) * Time.deltaTime;
}

float DegreesToDirectionalSpeed(int degrees) {
    // Code that I don't know goes here
}

Any tips on how to achieve this?

sentences:
How to I access "Deny" message from a Lidgren client? I'm using the Lidgren v3 network for a UDP client/server networking model. On the server end, I'm initializing a NetServer object with the NetIncomingMessage.ConnectionApproval message type enabled.

So the client is able to successfully connect and the first packet it sends is a login packet, containing a username and password supplied by the user. The server is receiving that and doing some black magic to authenticate, and everything works up to that point.

If the login fails, the server calling NetIncomingMessage.SenderConnection.Deny("Invalid Login Credentials"). I want to know how to properly receive this deny message on the client.

I'm getting the message, it shows up with a message type of NetIncomingMessage.StatusChanged. If I call ReadString on that message, I get a corrupted version of the string I passed to the Deny method on the server. The type of corruption varies, I've seen odd characters in there but in every case it's truncated and is way shorter than the string I entered.

Any ideas? The official documentation is sparse on this topic. I could use pointers from anyone who has successfully used the Lidgren library and uses the Accept or Deny methods.

Also, if I don't do any authentication and just Approve() the connection every time, stuff actually works just fine and I'm getting reliable two-way UDP traffic. (And lastly, Stack Exchange said I don't have enough reputation to use the "Lidgren" tag....???)

sentences:
Enum or Inheritance for event-based interaction? I am currently considering two possibilities to a centralised interaction system within my game.

Consider that you want to produce different results for different types of objects within the game world - you interact with a signpost and dialogue appears, or interact with an item on the ground and it gets added to your inventory with a notification.

Essentially, I cannot decide whether it would be more efficient to implement such functionality all within one centralised place or to spread each function out over separate events.

Option 1: Centralised

This is what I have started coding. One Interact class which contains several "Types" of possible events in my game.

When the player "interacts" with an object implementing this script, it will implement the functionality that it is set to in the Editor. This means I drag and drop this Event Script onto a prefab and can automatically tweak its functionality within a couple of seconds and have it ready to go in the game world.

I have simplified the general consensus of my code into this block for readability:

public string eventName;

public enum EventType
{
    Movement = 0,
    Dialogue = 1,
    NPC = 2,
    ItemCollect = 3,
    Teleport = 4,
    Cutscene = 5,
    Switch = 6,
    Custom = 7
}

public EventType eventType;

/*
* #############################
* ##@@## INITIALIZATION ##@@##
* #############################
*
*/

private void Awake()
{
    SetupEvent(eventType);
}

public void Activate(bool calledFromTrigger = false)
{
    if (autoTrigger && !calledFromTrigger)
        return;

    Debug.Log("Activated " + name + "!");
    StartEvent(eventType);

}

private void StartEvent(EventType type)
{
    switch (type)
    {
        case EventType.Movement:
            MovePlatform();
            break;
        case EventType.Dialogue:
            break;
        case EventType.NPC:
            break;
        case EventType.ItemCollect:
            break;
        case EventType.Cutscene:
            break;
        case EventType.Switch:
            break;
        case EventType.Custom:
            break;
    }
}

Resulting in:

Option 2: Inheritance

It is as if I have a little devil and angel on my shoulder, one tugging me towards the easy and half-finished code of the former example, and another urging me to redesign what I am doing into a much cleaner and abstracted approach.

In the previous example, all "event types" (Movement, Dialogue, Item Collection etc.) were handled by enums that were passed through a Switch statement to check which method should be executed based on the parameters inputted into the Unity Editor for that specific Game Object.

In this system, there would be a base "Interactible" class, which various classes would inherit from to implement functionality. The Activate() method would be overridden in the children for each specific class.

public class NPC : Interactible
{
    public override void Activate()
    {
        //NPC Code...
    }
}

The unfortunate downside to this is that I can't just use one prefab for all my events and change them based on the custom editor that I define.

I would have to create a custom editor for each possible child of the Interactible class, and instead of selecting which type of event I want it to be from a simple drop down, I will have to swap out different scripts for different functionality.

sentences:
Unity access Label in GUI? There is a quick and dirty appreoch to creating text boxes:

void OnGUI(){
    GUILayout.Label("Text 1");
}

It works well. But, since the Label method returns void, how do I access this later on?

Let's say I want to access the text later to change the score?

someField = GUILayout.Label("Text 1");

Is not going to work.

sentences:
AI not pathing correctly with pathfinding I have implemented A* pathfinding to use in a game that im making for a project. The issue is that the AI that's using the pathfinding does not seem to wanna follow the path correctly. as displayed in the picture

blue dots = AI's path

yellow dots = path to take according to the pathfinding

red dots = impassable wall

As you can see the AI completly ignores the path to follow according to the pathfinding. I have been twisting my head multiple times around and have been unable to figure out the issue.

Below is the code where the pathfinding is used by the AI and shows all the states it cant be in. Position and rotation is applied later down in the code which is not shown here.

if (_pathState == SEARCHING)
        {
            if (glm::length(enemy->getPosition() - player->getPosition()) < 10.0f)
            {
                _isAtGoal = true;
                _pathState = ATTACKING;
            }

            _pathFinding->findPath(enemy->getPosition(), player->getPosition(), map);
            _isAtGoal = false;
            if (_pathFinding->foundGoal)
            {
                _targetPos = player->getPosition();
                _pathState = FOUND_GOAL;
            }
        }
        if (_pathState == FOUND_GOAL)
        {
            if (!_isAtGoal)
            {
                glm::vec3 targetDistance = _pathFinding->nextPathPos(enemy->getPosition(), getRadius()) - enemy->getPosition();
                angle = glm::degrees(atan2(targetDistance.x, targetDistance.z));
                rotation = glm::angleAxis(glm::radians(angle), glm::vec3(0, 1, 0));
                _velocityX += 0.1f * cosf(angle);
                _velocityZ -= 0.1f * sinf(angle);

                /*if (glm::length(_targetPos - enemy->getPosition()) < 10.0f)
                {
                    _pathFinding->intializedStartGoal = false;
                    _pathFinding->foundGoal = false;
                    _pathFinding->clearPathToGoal();
                    _pathState = SEARCHING;
                }

                if (glm::length(_targetPos - player->getPosition()) > 10.0f)
                {
                    _pathFinding->intializedStartGoal = false;
                    _pathFinding->foundGoal = false;
                    _pathFinding->clearPathToGoal();
                    _pathState = SEARCHING;
                }*/

                if (glm::length(enemy->getPosition() - player->getPosition()) < 1.0f)
                {
                    _isAtGoal = true;
                    _pathState = ATTACKING;
                }
            }
        }
        if (_pathState == ATTACKING)
        {
            if (glm::length(enemy->getPosition() - player->getPosition()) > 10.0f)
            {
                _pathFinding->intializedStartGoal = false;
                _pathFinding->foundGoal = false;
                _pathFinding->clearPathToGoal();
                _pathState = SEARCHING;
            }
            else
            {
                glm::vec3 playerDir = enemy->getPosition() - player->getPosition();
                angle = glm::degrees(atan2(playerDir.x, playerDir.z));
                rotation = glm::angleAxis(glm::radians(angle), glm::vec3(0, 1, 0));
            }
        }

The tutorial that I followed when implementing the pathfinding is from here:

https://www.youtube.com/watch?annotation_id=annotation_654919&feature=iv&src_vid=-A2HYXj186c&v=NJOf_MYGrYs

And my pathfinding is pretty much as follows. My own suspicion is that the radius is whats causing the problem, since the radius is just a set number that I didn't put any thought into when I set it.

sentences:
How do I customise automatically-generated script? When you create a script via the Unity editor, it generates a script with some pre-formatted code.

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

public class GenericClass : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }
}

When I create a script, I am generally guaranteed to use additional code, such as a namespace or a custom editor. Furthermore, I almost always delete content from the automatically-generated script. Is there a way to change the automatic code generated by Unity?

sentences:
How do I make 3d Sprites like Myth did 20 years ago? The game that Bungie cut it's AAA chops on: Myth: The Fallen Lords. about 20 years old now.

https://en.wikipedia.org/wiki/Myth:_The_Fallen_Lords

For the time, it had a pretty revolutionary way of doing lots of "3d" characters, hundreds, on screen and interactive at a time.
to accomplish this, basically they use sprites for each character: choosing and skewing each sprite based on the camera perspective to make it appear 3d.

I would really love to read and learn more about how this technique worked, as I think it can still be applicable to modern indie games, but I've never seen this technique used since.
Does anyone know where I could read more on this?

here is a youtube of the game being played, showing the characters: https://youtu.be/PySrgfe6pr4?t=6m2s

sentences: Use of the xyY color space? What's the use of the xyY colorspace in games? I'm not sure what's the advantage of using it in shader programming or elsewhere.

sentences:
How do I serialise a mesh to a text file? I'm building a game engine in OpenTK (OpenGL for C#). Is it ossible to take a terrain mesh (in any format) and convert it into a text file (or a really small character-filled file, no more than a few bytes). Then, afterwards, I'd take that file and generate the terrain from it.

The only reason I'm doing this is to save some memory on the computer. I think it would be more efficient if we had to quickly generate a crude terrain, and then smooth it instead of loading in a large mesh file.

Is this possible, and if so, how could I do it?

sentences:
Editing sprite shading to change perspective? I'm currently developing an RPG in Java with some of my friends, and one of my tasks is to do the pixel art. I'm a beginner at it, but I know that I'll get better in time.
I recently finished the concept of our main character (after many, many revisions), however, because the game is going to be in a 3/4 top down perspective; how would I edit the shading of the sprite to show this? Obviously a frontal view will not look right. My shading skills are not the best though, even with this sprite (some parts appear to be flat).

Below I have the sprite attached.

I did read something that said it would be harder to make higher resolution sprites for beginners (tile size is 32 x 32, MC is almost 2 tiles tall); however, it is a difficulty I am willing to deal with.

Thanks,
Nelson

sentences:
Nifty popup fails to register I'm new to Nifty GUI, so I'm following a tutorial here for making popups. For now, I'm just trying to get a very basic "test" popup to show, but I get multiple errors and none of them make much sense. To show a popup, I believe it is necessary to first have a Nifty Screen already showing, which I do. So here is the ScreenController for the working Nifty Screen:

public class WorkingScreen extends AbstractAppState implements ScreenController {

//Main is my jme SimpleApplication
private Main app;
private Nifty nifty;
private Screen screen;

public WorkingScreen() {}

public void equip(String slotstr) {
    int slot = Integer.valueOf(slotstr);
    System.out.println("Equipping item in slot "+slot);
    //Here's where it STOPS working.
    app.getPlayer().registerPopupScreen(nifty);
    System.out.println("Registered new popup");
    Element ele = nifty.createPopup(app.getPlayer().POPUP);
    System.out.println("popup is " +ele);
    nifty.showPopup(nifty.getCurrentScreen(), ele.getId(), null);
}

@Override
public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);
    this.app = (Main)app;
}

@Override
public void update(float tpf) {
    /** jME update loop! */
}

public void bind(Nifty nifty, Screen screen) {
    this.nifty = nifty;
    this.screen = screen;
}

When I call equip(0) the system prints Equipping item in slot 0, then a lot of errors and none of the subsequent println()'s. Clearly it botches somewhere in Player.registerPopupScreen(Nifty nifty). Here's the method:

public final String POPUP = "Test Popup";
public void registerPopupScreen(Nifty nifty) {
    System.out.println("Attempting new popup");
    PopupBuilder b = new PopupBuilder(POPUP) {{
            childLayoutCenter();
            backgroundColor("#000a");

            panel(new PanelBuilder() {{
                id("List");
                childLayoutCenter();
                height(percentage(75));
                width(percentage(50));
                control(new ButtonBuilder("TestButton") {{
                    label("TestButton");
                    width("120px");
                    height("40px");
                    align(Align.Center);
                }});
            }});
    }};
    System.out.println("PopupBuilder success.");
    b.registerPopup(nifty);
    System.out.println("Registerpopup success.");
 }

Because that first println() doesn't show, it looks like this method isn't even called at all!

Edit

After removing all calls on the Player object, the popup works. It seems I'm not "allowed" to access the player from the ScreenController. Unfortunate, since I need information on the player for the popup. Is there a workaround?

sentences:
What is the best way to increase slowly object movement speed and slow down the object near the end? There a Lerp but also SmoothDamp.
In this script I'm using SmoothDamp but why not using Lerp ? And how should I use this script with the SmoothDamp tp make slowly increasing speed at the start ? Now it's only slow down at the end but I want it also to increase slowly at the start and then slowly down near the end.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MovementSpeedController : MonoBehaviour
{
    public Transform target;
    private Vector3 velocity = Vector3.zero;
    public float smoothTime = 0.3F;

    void Update()
    {
        transform.position = Vector3.SmoothDamp(transform.position, target.position, ref velocity, smoothTime);
    }
}

sentences:
Tiled PolygonObjects rendering wrong in libgdx this is how I render the polygons in Tiled
this is how they get rendered in libgdx. Notice the top part of the triangles is straight instead of being hollow.
here is the code I use to convert the polygon object to a polygonshape

    PolygonShape polygon = new PolygonShape();
    float[] vertices = polygonObject.getPolygon().getTransformedVertices();
    float[] worldVertices = new float[vertices.length];

    for (int i = 0; i < vertices.length; ++i) {
        worldVertices[i] = vertices[i] / ppt;
    }

    polygon.set(worldVertices);

    BodyDef bd = new BodyDef();
    bd.type = BodyDef.BodyType.StaticBody;
    Body body = world.createBody(bd);
    body.createFixture(polygon, 1);
    polygon.dispose();

it this normal behavour for libgdx? to flatten the top of the polygons?

sentences:
What is a proper way to handle player inputs based on different states? So, I have two ideas how to do that:

Use enum to define current state and check current state value before running certain method group in Update. Code:

void Update()
{switch(currentState){
    case 1:
        InputGroup1();
        break;
    case 2:
        InputGroup2();
        break;
    <...>
}

And so on. I don't think that this is a good idea because of possible performance drops.
Same concept about current state, but instead of checking it and running method groups, "head" script will check current state and activate corresponding script, disabling others. For me it looks like best way in terms of performance and usability.

And also, is it better to keep all input checks in one giant script/component and call functions you need from it? Essentially creating centralized Input Manager.

sentences:
How can I change Box2D bodyDef type of an object after adding it to the world in Libgdx? I have a basic 2d square class that has it's body type set to a Static Body. After the player presses a button on the UI I want to change the body type to a Dynamic Body.

When I change the object to a Dynamic Body within the render method nothing happens.

How can I change the Body Type so that it updates on the screen?

public void show() {
    ...
    s0 = new Square(-10, -20, 5, 5, 3);
    ground = world.createBody(s0.bodyDef);
    ground.createFixture(s0.fixtureDef);
    ground.setUserData(s0.sprite);
    s0.shape.dispose();
    ...
}

public void render(float delta) {
    ...
    if (ready) {
        s0.bodyDef.type = BodyType.DynamicBody;
    }
    ...
}

sentences:
Rasterization Rules and States This thread directly concerns lightmap generation; however, indirectly, the rasterization of polygons by the GPU.

I am currently generating lightmaps using a pixel shader. To the shader I send 3 lightmap UV coordinates per mesh face. Those UV coordinates are directly rendered onto a lightmap texture( by setting the lightmap as the render target ). The vertex shader looks like this:

// ---------------------------------------------------------------
// Vertex Declaration
// ---------------------------------------------------------------
struct VS_INPUT_Std
{
    float4 Position : POSITION0;
    float3 Normal : NORMAL0;
    float2 tUV : TEXCOORD0; // diffuse UV coordinates
    float2 lUV : TEXCOORD1; // lightmap UV coordinates
};
//--------------------------------------------------------------//
// LightMap Pass
//--------------------------------------------------------------//
PS_INPUT_Std LightMapPass_Vertex_Shader( VS_INPUT_Std Input )
{
    PS_INPUT_Std Output = ( PS_INPUT_Std )0;

    Output.Position = float4( ( Input.lUV.x * 2 ) - 1, ( Input.lUV.y * -2 ) + 1, 0, 1 );
    Output.Normal = mul( Input.Normal, mW );
    Output.Pos3 = mul( Input.Position, mW );
    Output.tUV = Input.tUV;
    Output.lUV = Input.lUV;
    return Output;
}

The pixel shader returns a color based on light contribution. The result of the lightmap generation for this test mesh looks like this:

The light for this scene is floating in the center of the room...

The problem is that the lightmap has 'cracks' due to the rasterization of polygons by the GPU. It appears as though that for a given face lightmap pixels are not included during rasterization because their pixel centers do not fall within the bounds of the face's UV coordinates despite the fact that the face overlaps those pixels. As a result a black( unset ) pixel is rendered and effectively blackens the diffuse color of the mesh during texture modulation. Here is a screenshot:

Here is a screenshot of an auxiliary window which shows both the lightmap and a selected mesh face. This is generated by rendering the UV coordinates of the mesh face over a screen quad of the lightmap:

As you can see, the mesh face( green ) extends beyond the pixels rendered during generation of the lightmap. It seems as though those pixels were excluded during rasterization. Most of the problem faces are narrow in dimension. I thought that I could fix this by increasing the size of the lightmap, however, this doesn't always work...

Here is the entire lightmap:

Can I change a rasterization state to allow pixels under certain conditions?

EDIT: Lightmap and Deferred Shading Cube Pics

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 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:
How can I render 3d pictures synched frame by frame to a keyed video? I'm developing a software that aims to combine a keyed video with a 3D rendered one, synchronously frame by frame.

Each frame of video should be combined with a timely corresponding frame of 3D picture using a matching camera position parameter.

How can I perform this rendering and ensure it stays in synch?

sentences:
Greiner-Hormann clipping problem I have a set of planar polygons in 3D space defined by their vertices in counterclockwise order. Let's define the 'positive face' as being the face of the 3D polygon such as when observed, the vertices appear in counterclockwise order, and the 'negative face', the face which when observed, the vertices appear in clockwise order.

I'm doing perspective projection of the set of polygons onto a projection polygon defined by the points in this order: (0, h, 0), (0, 0, 0), (w, 0, 0), and (w, h, 0), where w and h are strictly positive integers. The positive face of this projection polygon is oriented towards positive Z, and the camera point is somewhere at (0, 0, d), where d is a strictly negative number.

In order to 'clip' the projected polygons into the projection polygon, I'm applying the Greiner-Hormann (PDF) clipping algorithm, which requires that the clipper and the to-be-clipped polygons be in the same order (i.e. clockwise or counterclockwise).

My question is the following:

How can I determine whether the projected face of the 3D polygon is the negative or the positive one? Meaning, how do I find out if I have to work with the vertices in normal or inverted order for the algorithm to work?

I noticed that only if the 3D polygon is facing the projection polygon with its negative face, both of them are in the same order (counterclockwise), otherwise, a modification needs to be done.

Here is a picture that illustrates this:

Note that the planes described by the polygon from the set and the projection polygon may not always be parallel.

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:
Object pooling of different tpyes of agents (Mobile Game) in Unity The mobile game I am developing consists of one to four players and different agents that are being spawned and act in their own way. All those Agents (Car, Animal and Powerup) derive from the same base class 'Agent' which in turn has a field called 'rank' which represents something like 'low', 'medium' and 'high'.
So an agent with rank 'high' will look and behave different than one being tagged 'low'.

The thing is - the 'rank' of the agent is determined at random. The max count of agents active simultaneously is known but this number is not in regard to their 'rank'. When objectpooling, this would lead to the follwing case:

There's a max agent count of, say, 6. This would require 6 instances of each agent with rank 'low' to 'high' to be created, altough some of those instances would never even be used.

So my idea was to create only 6 gameobjects holding the components that each agent requires and use reflection to set the components fields according to the type. The problem is that some compoents which are unique to rank and type would need to be added and removed at runtime.

What solution would be better in terms of runtime and memory performance?

sentences:
Facebook data exchange for mobile games (multiplayer) A multiplayer mobile game that we are working on connects players through Google Play and Game Center but we would also like to add an option to play with your Facebook friends and here's the question:

Is there a way to exchange the data between Facebook users through the FB API so we could exchange Google Play ID / Game Center ID?

Is there a way to do this without having a server which holds Facebook UIDs and stuff?

sentences:
Is it possible/recommended to make a universal game library interface in C Lets say I want a game to be able to run with SDL, Allegro, on Game parks or Tiny Arcade and I don't want to recode everything everytime I port my game.

The C and C++ language separate definition in .h files and source in .c files. My teacher said it could be possible use the same .h declaration file but have different .c implementation files.

So in theory I could write something like this in the .h (the syntax is not perfect)

typedef myBitmapStruct;
void myBlittingFunction ( myBitmapStruct bmp, int x, int y );

Then I could have different .c for each game library. myBitmapStruct will refer to a BITMAP in the allegro implementation, or an sdl_surface in the SDL implementation, etc.

So in theory I think it could work, in practice it might lead to optimization issues. Since first it needs an additional method call because library functions are encapsulated. Second it might been additional code to make conversion or adjustments. For example allegro 5 use an on grid coordinate system, so 0.5 must be added to any x, y coordinates passed in parameter.

Do you think it could be recommended to do a such universal interface?

Did other people already attempted to do this before?

sentences:
OpenGL GL_LINE_STRIP produces arcs with visible line edges Another member mentioned an issue while drawing arcs with GL_LINE_STRIP.
He has GL_LINE_SMOOTH enabled.

The question is, how could he avoid the tiny gaps between vertices without increasing their number?

Edit: The original discussion was on SO. Click here for more info.

sentences:
Android Virtual Pet Gameloop Hello I'm looking for a bit of advice in which way is the best to proceed creating my applications 'gameloop' - It doesn't want to be a game loop in the truest sense since I'm not really rendering any graphics just displaying some animated gifs.

My goal is to have a task that runs every 30 minutes that decrements pet variables

Example Method
passTime { <pets health> = <pets health> - 1; <pets hunger> = <pets hunger> -1; <pets exp> = <pets exp> + 5; } et

c.  I was wondering the best way to go about this? AsyncTask will be of no use since this ideally wants to be running even when the app isn't.

I would rather use an IntentService subclass rather than a Service subclass but I can't seem to get the IntentService to run through a pendingIntent via the AlarmManager.

So I'm asking advice on the best way to proceed from the ground up with this. Thank you!

sentences:
Can I run my own loading script during the Unity splash screen? Can I load data in the background while the Unity splash screen is up?  If so, how?

I am trying to run code during the splash screen, not just load assets.

I have not been able to find any information on this in Google or the Unity Documentation.

sentences:
Ray tracing - soft shadow I'm implementing my own ray tracer as an iPad app for a school project. At the moment this is the result:

I need to add the last requirement, soft shadows, but I can't find a complete reference anywhere. If I understood well, to implement this feature I have to shoot many rays from an intersection point to mt light source. This one must be an area light. Suppose i use a sphere, my questions are:

which point on the sphere i must use to calculate the shadow ray?
how do I average the result?

Thanks for helping me.

sentences: Use eyeray trigger to speak with NPC in Unity3D for Vive I'm developing a first-person-player game in Unity for HTC Vive. Basically, I want my NPC to speak when my player looks at him for more than a second. I didn't find any eyeray tutorials to achieve this for Vive. Please help.

sentences:
Player moving back and forth when moving with camera LIBGDX I have a problem. When in libGDX my player moves across the screen and the camera is moving after him the player jumps back and forth a bit. Player still moves forward but it looks goofy

I'm moving left-up

package com.qookie.miner;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx.*;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.audio.*;
import com.badlogic.gdx.Input.Keys;

public class MinerMain extends ApplicationAdapter {
SpriteBatch batch;
SpriteBatch b;
private OrthographicCamera camera;
private float timer;
private int rand;
Texture img;
Texture map;
FreeTypeFontGenerator generator;
FreeTypeFontParameter parameter;
BitmapFont font;
private int speed = 250;
GameObject player;

@Override
public void create () {
    batch = new SpriteBatch();
    b = new SpriteBatch();
    img = new Texture("images/player.png ");
    map = new Texture("map1_fixed.png");
    generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/VCR_OSD_MONO_1.001.ttf"));
    parameter = new FreeTypeFontParameter();
    parameter.size = 10;
    parameter.color = Color.WHITE;
    font =  generator.generateFont(parameter);
    generator.dispose();
    player = new GameObject(img);
    camera = new OrthographicCamera(800,480);

}

@Override
public void render () {
    update();
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    //Normal rendering(map, player, objects, enemies)
    batch.begin();
        batch.draw(map,0,0);
        batch.draw(player.getTexture(),player.x,player.y);
    batch.end();

    // GUI rendering(always in the same spot on the screen)
    b.begin();
        font.draw(b,"0_01a",4,476);
    b.end();
}

public void update() {
    //batch.setProjectionMatrix(camera.combined);
    //camera.position.set(player.x+player.width/2,player.y+player.height/2,0);
    //camera.update();
    if(Gdx.input.isKeyPressed(Keys.W)){
        player.y += speed * Gdx.graphics.getDeltaTime();
    }

    if(Gdx.input.isKeyPressed(Keys.A)){
        player.x -= speed * Gdx.graphics.getDeltaTime();
    }

    if(Gdx.input.isKeyPressed(Keys.S)){
        player.y -= speed * Gdx.graphics.getDeltaTime();
    }

    if(Gdx.input.isKeyPressed(Keys.D)){
        player.x += speed * Gdx.graphics.getDeltaTime();
    }

    if(Gdx.input.isKeyPressed(Keys.ESCAPE)){
        Gdx.app.exit();
    }

    timer += Gdx.graphics.getDeltaTime();

    rand = MathUtils.random(10);
    batch.setProjectionMatrix(camera.combined);
    camera.position.set(player.x+player.width/2,player.y+player.height/2,0);
    camera.update();
}
@Override
public void dispose() {
    font.dispose();
    batch.dispose();
    img.dispose();
    b.dispose();
}
}

GameObject.java file:

package com.qookie.miner;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.math.*;

public class GameObject extends Rectangle {
private Texture txt;
public Texture getTexture() {
return txt;
}
public GameObject(Texture t) {
this.txt = t;
this.width = t.getWidth(); this.height = t.getWidth();
  }

}

sentences:
Geometry Struct and glDrawElements currently I re-write my codes and change them to make they are better.

I have vertex struct like this:

struct SVertex
{
    float X, Y, Z;
};

struct STexCoord
{
    float U, V;
};

And I re-wrote it like this

struct SVertex
{
    int Flag, BoneID;
    float Pos[3];
    float UV[2];
};

When it comes to the render function, I just need to change it from:

glVertexPointer(3, GL_FLOAT, 0, &(Mesh[i].Vertex[0]));
glTexCoordPointer(2, GL_FLOAT, 0, &(Mesh[i].TexCoord[0]));

to:

glVertexPointer(3, GL_FLOAT, sizeof (SVertex), &(Mesh[i].Vertex[0].Pos));
glTexCoordPointer(2, GL_FLOAT, sizeof (SVertex), &(Mesh[i].Vertex[0].UV));

The problem comes from the triangle struct. I re-wrote the Triangle from

struct STriangle
{
    int X, Y, Z;
};

to

struct STriangle
{
    int Flag, Group;
    int V[3], N[3];
};

and I changed the glDrawElements from:

glDrawElements(GL_TRIANGLES, Mesh[i].TriangleTotal*3, GL_UNSIGNED_INT, &(Mesh[i].Triangle[0]));

to

glDrawElements(GL_TRIANGLES, Mesh[i].TriangleTotal*3, GL_UNSIGNED_INT, &(Mesh[i].Triangle[0].V));

And I got messed vertex with the new triangle struct. If I use the old ones, it is correct. How to pass the new triangle struct to the glDrawElements?

sentences:
My array loads in the wrong order I have a load all chapters script which loads up all the Chapter items in an array and instantiates the buttons in the Viewport so you can select which chapter you would like to play. The problem is the chapters load up in the wrong order, they load up as Chapter 4, Chapter 0, Chapter 1, Chapter 2, Chapter 3. Below is the code I am using.

void Start()
{
    menuManager = GetComponentInParent<MainMenuManager>();
    levelManager = GetComponentInParent<LevelManager>();

    chapterArray = Resources.LoadAll<GameObject>("Chapters").OrderBy(go => go.name).ToArray();

    txtStatus.text = "";
    if (chapterArray == null)
    {
        txtStatus.text = "Could not find Chapters";
        return;
    }
    else
    {
        txtStatus.text = "Loading...";
        FillChapterList();
    }
    txtStatus.enabled = false;
}
void FillChapterList()
{
    foreach (GameObject chapter in chapterArray)
    {
        GameObject listChapter = Instantiate(chapterListItemPrefab);
        listChapter.transform.SetParent(chapterListParent, false);

        ChapterListItem _chapterListItem = chapterListItemPrefab.GetComponent<ChapterListItem>();
        chapDetails = chapter.GetComponentInChildren<ChapterDetails>();

        _chapterListItem.Setup(chapDetails.chapterNumber,chapDetails.chapterName);
    }
}

This is not only happening with the Chapter Select, it has been happening with all the arrays I load up in this fashion. Below is the visual side of the problem where you can see it loads the last object First.

I have been struggling with this for a while and I think its stopping me from progressing forward. Thank you for reading this and taking the time out of your day to help.

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 make a gameobject snap to something when it gets close to it? Any idea if there is a way I can make a gameobject snap to something when it gets close to it? Like drag a cube around and when it gets close to something then snap to it.

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:
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:
Octree LOD without traversing the entire tree I am working on a voxel engine that uses a huge Hashed Linear Octree that reconfigures when you move. Each octree leaf is a voxel. The world is procedurally generated using 2D Perlin noise.
The octree utilizes face culling and instancing to accomplish pretty good performance in OpenGL. I have implemented LODs in order to allow for much bigger scenes and my bottleneck has quickly shifted from rendering faces to generating the Octree.
Each time the camera moves I need to reconfigure the Octree's LOD in order to ensure the viewer sees high detail near him and low detail in the distance. The system works great for small Octrees (256^3) but as soon as I go to a 1024^3 Octree, the generation of the Octree LOD takes 1-2 minutes. Even done on a separate thread it isn't enough.
I am sure there is a way to generate the Octree world without traversing the whole Octree but I could not find it.
The basic outline of how I do the Octree LOD generation when the camera moves:

Start traversing the Octree at the root node

For each node, check the distance of the node's center from the camera
2.a. If the node is a leaf and the distance is smaller than the node size * CONSTANT, divide it. If it is not a leaf, traverse its children and go back to (2).
2.b. If the node is not a leaf, and the distance is larger than the node size * CONSTANT, collapse the node if needed.

That's basically it. Because the world is procedurally generated, dividing each node means iterating its entire volume (x+1,z,x+2,z...x,z+1,x,z+2...x+1,z+1....) to determine if the 2D Perlin noise passes through the node volume, above it, or below it (This has to be part of the problem as for 256^3 nodes it takes 65536 iterations).
I know that I can improve this by parallelizing the entire algorithm, but I still feel like there has to be 1) a way to calculate LODs without entire tree traversal, and 2) figuring out if to divide the node without iterating through its whole volume 1 by 1.
Would love to get some pointers, I could not find many resources about this online.

sentences:
Resolution independent game world in 3D I'm developing a game similar to Don't Starve - 2D billboards in a 3D world. Now I have encountered a problem with resolutions. I want the player to be able to change resolution, but I don't want to change how much of the world that can be seen on screen. This is how it works in Don't Starve.

So will the resolution just decide the size of the textures? Do I use a set internal resolution and then scale the textures according to the resolution? Do I then need to scale the world coordinates?

I want the field of view to be the same and also so the camera angle(it's looking down with an angle as in most strategy games). I might also mention I'm coding with Monogame.

sentences: How can I hand out free copies of my otherwise-paid Play Store game? With Google Play Services, is it possible to give people redeemable codes for an Android game I made, or give them special access or something like that? How do I do it?

sentences: What size window should i use for making an Xbox 360 game in XNA I have a basic understanding of XNA 4.0 and i want to create an xbox game. What size window should i use? should i use the 16:9 aspect ratio then put it in full screen?

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:
Networking and physics Context

I have been implementing my own networking for a third person multiplayer game, but controls and physics will be ala old school FPSs. I'm using Unity's transport layer, which allows me to send and recieve raw data between server and client.

I used this model as reference, in order to implement better client response:
http://www.gabrielgambetta.com/client-server-game-architecture.html

Implementing prediction, and interpolation was no problem, but I'm having a problem implementing reconciliation, even though I successfully implemented for normal ground movement.

I do the following each tick:

Client: The client sends the server the delta updates on the player position, and the server validates this movement and updates the player accordingly on the server.
Server: I send a snapshot to all clients with all players' positions. Each client interpolates the rest of the players, and reconciliates it's own position.

Reconciliation

Ground movement seems easy, because each frame the player input determines how the player moves: Each FixedUpdate, the player moves a certain distance.
This makes reconciliation really easy, since knowing which was the last input the server has received, your client just needs to consider the rest of the inputs yet to be processed.

Reconciliating jumping

But I don't know how to deal with jumping. Jumping is an input that has an impact on the player's position over several frames: while it's airborne (and for a few frames, as the placer decelerates in case his air speed was high).

This means I can't just rely on the input "jump" to recalculate my client's position, since depending on the moment I'm present, I could be ascending, or descending. Even more, if I jump and collide with the roof, killing all my vertical speed, the movement would be completelly different.

This lead me to think I should be sending to the server each update on the player's position:
Instead of sending "hey, im jumping here", I could send "I'm moving up 1 unit"..."I'm moving up 0.9 units".... describing the players parabole. But I feel this method is not enterily secure, since the client could be sending "I'm moving up 1" ever single time, allowing the player to just fly away. So the server has to be the one handling the physics on the jump.

Other scenerios

This problem is also present in anything physics related: When the player is pushed away by an external force set up by the server or the client itself. If the client recieves a message saying has been affected by an explosion, I could set the client's speed accordingly, but:
 - If I have any kind of air control (which I want to have), I need to tell the server the change on air speed
 - If the server makes a correction on the physics made, I need to be able to predict and reconciliate the position AND speed. For example: If I collide against a wall in the server, which for some reason, is not present in the client, I also need to kill the player speed or it will keep slamming into an invisible wall.

Posible solutions

There are several solutions I was thinking about, but I'm not really satisfied with any of them:

As said earlier, I could could let the client handle the air movement by sending the position update back to the server, but this feels insecure since th client could technically make himself fly around, and make himself immune to being pushed away.
Besides sending the player positions, I could also send the players' speed, storing this information could make reconciliation easier and more reliable, but it will also increase the size of snapshots and network usage.

Maybe I'm missing a clever alternative, but I don't really see any other option. Any ideas?

sentences:
3D title Rendering in Maya For babylon Js Game Engine I created a 3D title in Maya and applied color through Lambertian shading and rendering with mental ray.

The problem is when the title is rendered in the game engine, it is looking very sad. The colors are faded also the lighting is not the same as Maya's rendered output.

Please tell me how can I make the in-game version look more like the result in Maya. I saw lots of 3D games whose titles and objects are very beautiful, bright and colorful with lighting.

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:
Speedup Dev process for bug fixing and debugging in Unity? We're using Unity 2017 for a big Indie game. at the moment We have some issues with our development speed:

In order to fix issues and bugs, We used the visual studio and attach the process to Unity and go through the code step by step. every time we change something (even just a line of code) we back to unity and wait for all scripts to recompile which takes up to 1 minutes sometimes. after that, we run the game and go to the place that bug happened which takes us about two minutes.

  I was wondering if there was a Best practice for fixing issues and
  debugging in Unity which brings us speedup on script compiles and also
  helps us to get to bug location faster.

sentences:
Game resources storing I'm working on a browser-based RTS, and we are targeting 10k+ users with multiple towns per user.

I have the following table townresources in which I store every resource value for every town ID:

CREATE TABLE IF NOT EXISTS `townresources` (
  `townResourcesId` int(10) NOT NULL AUTO_INCREMENT,
  `userId` int(10) NOT NULL,
  `resourceId` int(10) NOT NULL,
  `townId` int(10) NOT NULL,
  `balance` decimal(8,2) NOT NULL,
  `resourceRate` decimal(6,2) NOT NULL,
  `lastUpdate` datetime NOT NULL,
  PRIMARY KEY (`resourceId`,`townId`,`townResourcesId`,`userId`),
  KEY `townResources_userId_users_userId` (`userId`),
  KEY `townResources_townId_towns_townId` (`townId`),
  KEY `townResourcesId` (`townResourcesId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Stores Town Resources' AUTO_INCREMENT=9;

I'm a bit reserved about performance impact for a large amount of users. I'm thinking about moving the balance for resources to the towns table, and the general value of a resource to a PHP file. Is this a better option?

sentences:
How to generate Normal Maps from Lighting Profiles? How might I go about generating a normal map from a lighting profile(light map)? I saw "Sprite Lamp" however, if possible, if there is some sort of math I can do myself to convert a lighting profile to a normal map, how might I go about doing that? Or convert multiple lighting profiles to one normal map, how would I do that?

I don't have $35 to shell out currently, so I'd like to generate the normal maps myself. If you don't know what Sprite Lamp is, check out this link: http://steamcommunity.com/sharedfiles/filedetails/?id=193335844

sentences: TRS Matrix between 2 points I have got 2 Points in 3D Space whose TRS Matrix' from 0.0 to there current place is known. Now I want to change the Matrix of the left point so that the matrix of the right point combined with the new Matrix results in the point being at the same position as before. Here a short illustration that I hope helps a little. Sorry for the bad explanation

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:
Number Guessing Game: How to ensure player cannot be dishonest about their guess I'm building a number guessing game in Unity. The computer has 10 chances to guess the number the player is thinking of. The player interacts by pressing Higher or Lower or Correct Guess.

The basic game works fine, as long as the player is honest. I'm now trying to make the game watertight and prevent any user error or dishonesty about their number. I created some test conditions to check if the random number generator has produced a number already used before, or to check if the player is pressing Higher or Lower beyond the max and min guess range.

The problem can be demonstrated well by constantly pressing Lower to the point where the final guess is the number 1. Pressing Lower again results in the game freezing. It also happens if the number you are thinking of is displayed and you press Higher or Lower towards a range of numbers which have already been eliminated as possibilities. I am thinking this is due to the game getting stuck in my while loop in MakeGuess().

I think the problem lies in the following test condition in MakeGuess() but any tweaks I make seem to have no effect:

// check if number has been guessed before
if (newGuess == guess && (newGuess > max || newGuess < min)) {

I've uploaded my current playable build to GameBucket.io here: https://gamebucket.io/game/07cc2b61-493b-46ae-a446-aeaa98ffac0e

All the game logic is handled in the NumberWizard script which is attached to the NumberWizard GameObject in the main Game scene:

using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class NumberWizard : MonoBehaviour
{
    int max;
    int min;
    int newGuess;
    public int guess;
    public int maxGuessesAllowed = 10;

    public Text text;
    public Text guessesRemaining;

    // Use this for initialization
    void Start()
    {
        StartGame();
    }

    void StartGame()
    {
        max = 1000;
        min = 1;

        MakeGuess();
        UpdateDisplay();
    }

    public void GuessHigher()
    {
        min = guess;
        NextGuess();
    }

    public void GuessLower()
    {
        max = guess;
        NextGuess();
    }

    public void GuessCorrect()
    {
        StartGame();
        SceneManager.LoadScene("Lose");
    }

    void NextGuess()
    {
        if (maxGuessesAllowed <= 0) SceneManager.LoadScene("Win");

        MakeGuess();
        maxGuessesAllowed -= 1;
        UpdateDisplay();
    }

    void UpdateDisplay()
    {
        text.text = guess.ToString() + " ?";
        guessesRemaining.text = maxGuessesAllowed.ToString();
    }

    void MakeGuess()
    {
        //guess = (max + min) / 2; // old guessing method

        bool validGuess = false;

        while (validGuess == false)
        {
            newGuess = GenerateNumber();

            // check if number has been guessed before
            if (newGuess == guess && (newGuess > max || newGuess < min))
            {
                Debug.Log("Number has been guessed before and is already at either range limit.");
                SceneManager.LoadScene("Lose2");
            }
            else if(newGuess == guess)
            {
                newGuess = GenerateNumber();
                Debug.Log("Number has been guessed before but is not at range limit.");
            }
            else
            {
                validGuess = true;
                guess = newGuess;
                Debug.Log("Number has not been guessed before.");
            }

            Debug.Log("Min: " + min);
            Debug.Log("Max: " + max);
            Debug.Log("====================");
        }
    }

    int GenerateNumber() {
        int result = Random.Range(min, max + 1); return result;
    }
}

Any help with the code

sentences:
Creating VR Headset Video So I have a video stream of known resolution and I have a VR headset via HDMI at a known resolution.

Is there an existing library to create the slight fisheye and side-by-side layout for these single screen headsets? (It's a custom build, so no hardware locked API please)

Target: Win 7/8/10

sentences:
How to get what button was clicked on? Other contexts in which this was done I'm sure have been answered for this kind of problem before. But this has thus far been a 2 week long impasse of wittling down all the other suggestions I've seen and not one has worked.

I've got a prefab GUI with a singleton instance based script, which automatically disables itself at the start (I've tried commenting that out to see if that was it). The gui has a title text, body text, and 8 buttons. The script is meant to allow other scripts for interactive objects to safely access it and "start a conversation", using a coroutine.

I created a script for the buttons that I attach to each, that when called should set a public bool to true, indicating it was clicked, this bool is polled among the buttons to see which button the user clicked. This is then return to the script which called the GUI, and the GUI closes or waits for the next piece of the conversation. I've set everything to be enabled, and removed anything that disabled the components. I've made sure that the buttons are higher in the hierarchy than everything else, to make sure nothing else was intercepting the clicks.

I'm unable to get OnClick, OnMouseOver, OnMouseDown to be called. Debug messages never show. I've tried setting OnClick as part of the GUI where you select a function from the list, and inside of the button's code by adding a listener manually to the button. I've tried IPointerExitHandler, IPointerDownHandler, etc, also never seen anything come back from the methods.

I've tried several other methods to date to get which button I clicked, such as ray casting when the mouse button is down and checking the name for the button's name, however it always passes through to the terrain. I've tried getting the button's rect and using Rect.contain with the mouse position to see if the mouse was over the button when clicked, but this never returns true.

I'm really interested in seeing a working example where something like this has been done, so that perhaps if that doesn't work, I could at least start hunting down what might be causing a functioning example to fail, as I've no idea what's wrong at this point. Not to vent but this is very frustrating, and I feel it could be made so much simpler.

Thank you all for any help you can give, you guys have been very wonderful with my short time here.

sentences:
TCG - how to program cards as separate entities So I'm planning to try making a card game (in Java) but I'm not sure what the best way to design it is. I understand the engine stuff but not how the cards should be coded an how they should interact with the engine. The scope is like so:

We have an engine that understands the flow of the game. It knows you draw at the start, play cards at some point, have a combat step, and end the turn (switching players). This much is fine, but the concern is the cards themselves.

I want to have cards be their own entities. I'm not sure if it would be better to:

a) Have each card be their own class
b) Have each card be programmed as an external script (say in Python)

I want the game engine to know as little as possible about a card. When you play a card, I want the game engine to go:

You're playing a card. Do you have resources? Ask the card how much it takes, then confirm you have it. When a card has an interaction, I want it to do as much as it can. For example, if the card says draw a card, I want it to forceably tell the engine to draw a card, or better yet, hook into the game, draw a card, and then force the engine to update itself.

Extreme cases would probably provide a better description, so if there was a card that said "players do not draw at the beginning of their turn", the engine would normally automatically draw, so we'd have to stop that. I could reasonably program something where the engine would check if anything special happens before each interaction and it would see "skip draw". Even still, how would I program that? Would I write a method in the engine to skip draw and then have the card add it as a special trigger? Would I actually have the card (perhaps programmed in Python) hook into the engine and end the draw method?

What would be the best way to go about this?

sentences:
Unity error after adding skybox material So I added the night material from the fantasy skybox asset I download from the asset store and the rest of my objects turned white for some reason I figured it was just a glitch like the light baking and it would be okay when I deployed my project

Well I saved and built my project as usual and the objects all turn pink as if their materials did not exist and every time I go to play the game I receive the following error

'Assets/Build/ParcoreBeast_Data/Managed/Assembly-CSharp.dll' shouldn't be queried by IsAssemblyCompatible, missing IsInternalOrCompiledAssembly check ?
UnityEditorInternal.InternalEditorUtility:GetMonoIslands()
UnityEditor.SyncVS:SyncVisualStudioProjectIfItAlreadyExists()

How do I fix this?

sentences:
Designing RPG player classes, and the trend to avoid a Priest or Cleric RPG class From my experience, RPG classes ("hero" or "villain" types) are often divided into four categories:
 1. Mage
 2. Priest
 3. Rogue
 4. Warrior

However, there are quite a few popular RPGs that ignore the Priest or Cleric "base" character class entirely.  Two game series of note: The Elder Scrolls (Skyrim), and Dragon Age.

Is there a specific reason why this is so?  Perhaps the background story makes allowing players to be a Cleric difficult; for example, if there is a large amount of NPCs in the game that have the adventure class of Cleric, and making that class available to players would be detrimental to the story of the game.

I've pondered this quandary myself when working on developing my own video RPG; should the character class options be sub-categorized with the aforementioned base classes?  Or perhaps even more difficult of a question to answer, should a video RPG include some kind of Deity system?

The RPG approach to "gods" is difficult for me, particularly because I've have somewhat of a spiritual perspective on real life, I'm not sure how to reconcile my choices with game design to my choices regarding spirituality.

Any helpful responses will be greatly appreciated!

sentences:
Stronger Hack-proof MMO Game Comparison: Game Client Based Vs. Via Web Browser I was wondering. I observed most of any MMO that are hack-prone area. Hacks used one-hit kills, stealing accounts, instant level up, aimbots (mostly MMOFPS), and questionable wallers (also in MMOFPS). These hackers might affect the fairness and excitement of the gamers which lead to doubts, abuse kickers (mostly in MMOFPS*, and misunderstandings. Even in MMORPG referred to hacks for instant money for purchase items. I saw these examples via Wikipedia.

This leads me to my question:

Which kind of MMO game platform or model would be best for making MMO games whilst reducing the possibility of hacking?

For example I could make an MMO game for the web browser (by website or via Facebook) or making an MMO game using installers/clients that fetches for patches and graphics that could run only through program via computer. What will help with preventing hacking and how?

In the case of making an installer/client based MMO games, are there anti-hack programs or techniques you can recommend in MMO context?

sentences:
When is the right time to save game data in a standalone game? For standalone game, what's the best time to save game data, such as player's coins, level, skill data and so on?

Should the data be saved before quitting? Or whenever it changes? Or something else?

sentences:
Any tips on figuring out programming in Unreal Engine (without focusing mainly on blueprints, or at least a fairly even mix of the two?) So for the past few months I've been attempting to learn Unreal Engine. Most tutorials feature blueprints which I guess makes sense as it's new and simple and their solution to artists trying to make games. However, when learning to code or program anything, I've always valued actually understanding what I'm typing in. It makes it easy to remember, especially when it's not a habit like say, typing in int main()
before starting your C++ code.
When I need to write code spontaneously, I find it valuable to understand what I'm typing in.

However, UE4's usage of C++ is almost as if you're learning a new derived language, which is what was once done by users of Unreal Engine. Outrageously though, I've found no source which explains the vast amount of macro's and jargon used when programming games in UE4. Thing's such as GENERATED_UCLASS_BODY() or void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
Perhaps the terms void, class, and override have been mentioned in typical C++, but the Unreal API is a mystery, and I've found no place where I can know what any of this actually means, or more importantly -in my view of course-, why I'm connecting them the way I'm told too. It's somewhat obvious that all these are related, but it's harder to uncover how they're to be formatted and linked together. Does anyone know a way I can get a better understanding of the library of macros and terms Epic has taken no time to explain?

sentences:
Multiple weapons for android game I am trying to make a 3D game for android using the Rajawali engine to render the 3D graphics and blender for designing my models(exporting as .md2), and I want my character to be able to change weapons, armor, helm, etc.

Rendering every possible animation would be too much: if I had 10 different weapons, 10 armor and 10 helm, I would have to create 1000 animations with every possible equipment and if I add boots to list it would be even worse.

I read somewhere you can use bones for this; but in Android, I only get the object itself to work with.

Does anyone has an idea how i can solve this? If I make the weapon a different object how do I parent it to my models in my game?

sentences:
Plugins for creating and styling custom Editor Windows like C#/C++ Form Designer or “Web Inspector”? Unity3d allows to construct window with custom UI. Just need to use EditorGUI/EditorGUILayout classes and their static methods.
Example of custom window:

The problem is that all the components have to be added manually via script. Then need to save, switch to Editor, wait for little compile things, and then we can see the result.

In web-development people use Web Inspector (for example, we can press F12 in chrome, Tab Elements -> Styles). We can add all needed properties to element and can see the result in real-time.

EDIT. another example (better than previous): we know C# winFormApp, C++ MFC e.t.c, which has form designer. We can choose any elements and set their properties:

It would be nice to have similar plugins for Unity

So. Does Unity3d have similar tools, utilities, plugins? Utilities to inspect code and editing styles (position, margin, padding, background, width, height, color  e.t.c.)?

sentences:
I have a frag shader, one with an empty s_lightMap, how and why is it effecting the output? I have an image of concrete rocks of different shades of colors, and I'm applying this shader, but without referencing s_lightMap's uniform in my program:

        precision mediump float;
        varying vec2 v_texCoord;
        uniform sampler2D s_baseMap;
        uniform sampler2D s_lightMap;
        void main()
        {
          vec4 baseColor;
          vec4 lightColor;

          baseColor = texture2D( s_baseMap, v_texCoord );
          lightColor = texture2D( s_lightMap, v_texCoord );
          gl_FragColor = baseColor * (lightColor + 0.25);
        }

it displays a picture with variable light color added to the final pixel color, but s_lightMap isn't even linked into the program, what is happening in this case, at first I thought it would just do the baseColor as the FragColor, but the addition of the 0.25 makes a non-negative result to (lightColor + 0.25). I'm confused, one minute I think lightColor would be set to a texture of 1's the next an array of 0's.

Or is it just random data? It doesn't appear at all random in the picture, it looks like it's obeying a rule of shading.

I'd like to mimic this effect in code that's not broken.

Here's the unshadded image:

Example "gimped" image of how it has variable shades (though this is an invert):

sentences:
How can I give a MonoBehaviour field a default value that depends on the object? In Unity3D, I have a MonoBehaviour which gets added to game objects. I'm adding a string "name" field to it. I'd like the default value for the name to be the name of the game object the component is added to. Is there an easy way to do this? Some more details:

The component is an existing one to which I'm adding the name field. In old versions, the name was always the name of the game object, and this is a new feature to allow them to be different.
The common case is (still) for the name to be the name of the game object, so having that as the default would simplify the process of adding the component to a new object.
Ideally, deserializing an old scene will fill in the default, so updating scenes takes zero effort. I'm less concerned about this than about newly created scenes/objects.
The component already uses a CustomEditor.
I don't care about updating the name in the component if the game object's name is changed, or if the component values are pasted into a different game object.

One way I can think of is to add a bool "override name" to the object. If the bool is unchecked, it uses the default name (the game object); if it's checked, it uses the new field. But I'd like to avoid adding complexity to the GUI to support it. The whole point of my request is to add the new functionality (overriding the name) without adding steps to the creation workflow.

sentences: AndroidManifest file was deleted by accident I deleted the AndroidManifest file of my project which was located in Assets\Plugins\Android , so I tried creating new project and copying the Assets and everything but it seems that something is missing ,it's perfectly working in the editor , but as apk there are few things aren't working, I can't figure out why, and there isn't even a Plugins folder in my new project !

sentences:
In Unity, how can I cause something to happen on a specific frame of an animation? I have a GameObject "enemy" with an Animator and several states, like "idle", "walk", and "attack".

I want to activate the "hitbox" when an animation "attack" starts. The problems is that the sword does not fall down immediately: it takes about 2 frames.

Is there a way to know what frame of the animation is currently being run?

sentences:
Can one develop an application with Bluetooth support on iOS using Flash Builder 4.5? I have heard about Flash Builder 4.5.1. As I have understood, one can make an application using Flex with Flash Builder 4.5.1 and also export the release build for iOS, Android and Blackberry.

Is it possible to include Bluetooth functionality in an application this way?

sentences:
2D wave-like sprite movement XNA I'm trying to create a particle that will 'circle' my character. When the particle is created, it's given a random position in relation to my character, and a box to provide boundaries for how far left or right this particle should circle. When I use the phrase 'circle', I'm referring to a simulated circling, i.e., when moving to the right, the particle will appear in front of my character, when passing back to the left, the particle will appear behind my character.

That may have been too much context, so let me cut to the chase:

In essence, the path I would like my particle to follow would be akin to a sine wave, with the left and right sides of the provided rectangle being the apexes of the wave. The trouble I'm having is that the position of the particle will be random, so it will never be produced at the same place within the wave twice, but I have no idea how to create this sort of behavior procedurally.

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:
How can I handle a bunch of achievements in a game? Take for example Team Fortress 2.  There are a huge load of achievements, and I'm wondering how the manages all of them. And since there's a lot of achievements, I'd also like to know how it "knows" you've achieved one.

Basically, how can the game handle a huge achievement system?  Is there some special process? Are there hundreds and hundreds of boolean variables all over the code, waiting for certain conditions to be met, then ,Bam, achievement?

If there are several approaches, what are they?

sentences:
Is this Code saving performance ? It is kind of a Occlusion Culling I wanted to do Occlusion Culling on my Scene but I just get a bunch of Errors like "Couldn't load geometry..." etc. I tried to do like another way but the same thing, the Occlusion Culling just disables the Objects the Camera dont see.
I tried it with OnTriggerEnter and Exit.

I have 2 Areas one is on the left and one on the right, when the Player is walking in the first Area the Box Collider checks it and disables the Objects in Area2 but when Player is walking into Area2, Objects in Area1 disables and Different. Got the Script on both Areas that it disables a list of arrays as GameObjects.

My Question is, does this save performance ?

public GameObject[] deactivatingModels;
bool playerEntered = false;

void OnTriggerEnter (Collider other)
{

    foreach(GameObject envis in deactivatingModels)
    {
        if(other.gameObject.tag == "OcclusionCuller")
        {
            envis.SetActive(false);
            Debug.Log ("Player has entered Occuling Zone");
        }
    }
}

void OnTriggerExit(Collider other)
{
    foreach(GameObject envis in deactivatingModels)
    {
        if(other.gameObject.tag == "OcclusionCuller")
        {
            envis.SetActive(true);
            Debug.Log ("Player has left Occuling Zone");
        }
    }
}

sentences:
2D simulating light sources (subtract a texture from an other) I want to simulate a night and day cycle with SFML (plain 2D, no shadows). What I want is to get a smooth transition from day to night, and during night having some lights "on".

So the approach I've thought is adding a black layer on top and change its transparency with time, that gives the effect I'm looking for. For adding lights I can crop out circles out of that layer

sf::CircleShape lightCircle(200);
lightCircle.setFillColor(sf::Color(255, 255, 255, 1));

sf::RenderTexture renderTexture;
renderTexture.create(/* view size */);

while (window.isOpen()) {
  // ...

  // update light
  renderTexture.clear(sf::Color::Black);
  renderTexture.draw(lightCircle, sf::BlendNone);
  renderTexture.display();

  // draw
  window.clear();
  window.draw(sf::Sprite(renderTexture.getTexture()));
  window.display();
}

Now, what I would like to do is use my own image instead of a CircleShape. Say a circle or a cone with fading borders, some more realistic than just a circle. Like

I have tried with sf::Image and createMaskFromColor but I'm not able to handle the fading edges.

How can I get that?

Am I in the right path or is there a simpler approach?

sentences:
how to set image resource path for D3DXCreateTextureFromFileEx method? I try to merge all the image resources to a folder called resource. So, set image path as "resource/" but my directX framework only works if I compile at VS 2010. If I run from the debug folder it cannot run.(I already copy all the image resources to debug folder)

http://i.stack.imgur.com/XRFLC.png

string folder = "resource/";

void setTexture(LPDIRECT3DTEXTURE9& texture, string imgName, int imgWidth, int imgHeight, D3DCOLOR TransparentColorKey)
{
    string path;

    path = folder + imgName;

    //  Create texture.
    hr = D3DXCreateTextureFromFileEx(d3dDevice, path.c_str(), imgWidth, imgHeight,
        D3DX_DEFAULT, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
        D3DX_DEFAULT, D3DX_DEFAULT, TransparentColorKey, NULL, NULL, &texture);
}

sentences:
Getting more particles in engine I followed rbwhitakers tutorial on making a particle engine and I'm wondering how to get more particles on the screen. I was thinking that the "total" variable would do it but it doesnt. Is this something I'm doing wrong in the method or a hardware problem?

private Particle GenerateNewParticle()
    {
        Texture2D texture = textures[random.Next(textures.Count)];
        Vector2 position = EmitterLocation;
        Vector2 velocity = new Vector2(0, 10);
        float angle = 0;
        float angularVelocity = 0;
        Color color = Color.LightSkyBlue;
        float size = (float)random.NextDouble();
        int ttl = 100;

        return new Particle(texture, position, velocity, angle, angularVelocity, color, size, ttl);
    }

    public void Update()
    {
        int total = 100;

        for (int i = 0; i < total; i++)
        {
            particles.Add(GenerateNewParticle());
        }

        for (int particle = 0; particle < particles.Count; particle++)
        {
            particles[particle].Update();
            if (particles[particle].TTL <= 0 || particles[particle].Position.Y > 550)
            {
                particles.RemoveAt(particle);
                particle--;
            }
        }
    }

Im creating rain but I want it to be really heavy rain. Right now it just looks like a heavy sprinkle...I guess I would call it.

            particleEngine.EmitterLocation = new Vector2((float)rand.NextDouble() * (graphics.GraphicsDevice.Viewport.Width), 0);

sentences:
how do I create a delay or cooldown timer? I want to know if I am in the right tracks in building a  function that gives you 2 secs of rest before you can attack again

int attackRate = 2000;
int timeElapse = 0
public void cooldown() {
      if (timeElapse < attackRate) {
          // do somthing here
          timeElapse++;
        } else {
           timeElapse = 0
      }

when creating this it doesnt seem to work. am i missing something?

sentences:
OnMouseUpAsButton not always called I'm working on a 2D implementation of Free Cell in Unity 4.6.1, and I'm having trouble getting my click-detection code working consistently. The code below should be called every time a card is clicked (they all have BoxCollider2D components) but it doesn't always happen.

// Handle Clicks on Card
void OnMouseUpAsButton()
{
    print ("test");

    int cardLayerMask = LayerMask.GetMask("Cards");

    RaycastHit2D[] hit = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, cardLayerMask);

    print ("Hit length: " + hit.Length.ToString());

    if (hit.Length > 0)
    {
        print ("Hit");

    }
}

Even the "Test" print statement doesn't get called consistently, so it's not a problem with the raycast. If it manages to print the test, the raycast always works.

Each time the game runs, the cards get dealt onto the playing field randomly into stacks. On each run, some subset of the cards don't call the above code. The number of cards that work correctly varies, as does their position on the field. It's not consistent with any particular card.

I'm wondering if maybe there's an issue with the BoxCollider2D instances overlapping. The other colliders in the scene, like the one on the "table", always trigger OnMouseUpAsButton() successfully.

I need to be able to register clicks on every card, so I need to find a way to make this work.

Have any of you run into a similar issue before? If not, is there a way for me to work around this? Maybe a different way to detect the clicks on the cards?

Here's a screenshot of an example card from the inspector. Aside from transform position & script property values, all of them are identical (from a prefab):

Update w/ Solution from Accepted Answer

Using @Byte56's solution, I was able to take care of this pretty easily. I've included sample code below.

Note that to get the sample to work, the "top" object has to have the highest transform.position.z out of all the objects the raycast hits. I also put all the possible hit objects into their own layers so I can trigger different behavior based on what type of object is clicked.

// Handle clicks
    if (Input.GetMouseButtonDown(0))
    {
        // Cast a ray, get everything it hits
        RaycastHit2D[] hit = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity);

        if (hit.Length > 0)
        {
            // Grab the top hit GameObject
            GameObject lastHitObject = hit[hit.Length - 1].collider.gameObject;

            // Determine layer of last hit object, take next steps as appropriate
            switch (LayerMask.LayerToName(lastHitObject.layer))
            {
            case "Cards":
                print ("Hit card!");
                break;
            case "Table":
                print ("Hit Table!");
                break;
            case "Cells":
                print ("Hit cell!");
                break;
            }
        }
    }

sentences:
Slick2D re-starting particle system/emitter I am trying to use a particle system/emitter in Slick2D to produce a thrust jet from a space ship.  I can get the emitter running continuously without any problem, however I can't get it to run for a fixed duration when I press the thrust key (which I need to do so that it only emits particles when the thrust is active).  Note I can get the emitter to run for a fixed duration once when the program starts, but can't get the emitter to restart afterwards.  I have variously tried (all attached to the thrust key press):

disabling/re-enabling the configurable emitter
resetting the particle system
resetting the configurable emitter
resetting the State of the configurable emitter
replaying the configurable emitter
running 2 separate emitters and re-adding these to the particle system when turning the jet on

... which either do nothing (no particles) or give a short burst of particles at the start of the program (for the initial emitter length if emitter length is enabled), but then do nothing whenever I press the thrust key.  The last option (running 2 emitters) causes the particle system to run out of particles after about 10 seconds.

Is there a way to stop and restart a particle emitter that will give the effect that I want?

Just to cover any initial questions, I have read and re-read the javadocs (which are, as ever, reductive and unhelpful) and have read what I can find on the internet (mainly FrumsNL videos on youtube, which mention but don't cover this case) as well as doing my own trials as per the list above.

Any help gratefully received.

sentences:
When importing a character to Unity, textures and meshes don't appear I'm relatively new to Unity, and I'm left with doing this as my last step towards my task - importing my animated character to a game engine and program the movements.

The problems that I have noticed are the missing textures and meshes, you can see in the first picture how it should look like in Blender, and what results I get in Unity:

The apple here doesn't have any holes, I think only one material got imported, and it doesn't look right. Textures are missing, the leaf near the stem is completely filled with gray texture. At least the animations work perfectly...

Download link to my .blend file - https://pasteall.org/blend/6c14ec0d9446404b81251585f83f3551

sentences:
Modern OpenGL Sprite Drawing - Not Rendering I'm trying to render sprites based of this tutorial, in LWJGL.

Here's what I have so far, with descriptions of what class I use:

Transformable2D is a class that holds transform matrices meant for 2D rendering, and Drawable is just an interface that has a draw() function.

Texture is a container for loading and creating Textures, and its bind function just sets the active  texture to it's ID and binds itself to the passed unit parameter.

SpriteTechnique is a container for a shader program, and I will paste the shaders here too, although they are the same as from the tutorial.

I make the shader and vao static, because every Sprite uses the same vao and shader.

Finally, I pass a View to the draw() function, which holds the necessary info to make an orthogonal matrix based off the transforms of the object. This matrix is correct, as I also use it for text rendering, where it works as expected.

All of  the classes described above work completely; I am 100% sure the problem is not within the backing classes. Here are the GL settings I set in my backend, too:

glFrontFace(GL_CW);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);

So, onto the actual class:

public class Sprite extends Transformable2D implements Drawable {

    private Texture texture;

    private Vector3f color;

    private static SpriteTechnique tech = new SpriteTechnique();

    private static boolean isRendererInitialized;

    private static int vao;

    public Sprite(Texture texture) {
        this.texture = texture;
        color = new Vector3f();
    }

    public static boolean initRenderer() {
        if (isRendererInitialized) {
            return true;
        }

        if (!tech.init()) {
            return false;
        }

        float[] vertices = {
            // Pos      // Tex
            0.0f, 1.0f, 0.0f, 1.0f,
            1.0f, 0.0f, 1.0f, 0.0f,
            0.0f, 0.0f, 0.0f, 0.0f,
            0.0f, 1.0f, 0.0f, 1.0f,
            1.0f, 1.0f, 1.0f, 1.0f,
            1.0f, 0.0f, 1.0f, 0.0f
        };
        FloatBuffer vertexBuf = BufferUtils.createFloatBuffer(vertices.length);
        vertexBuf.put(vertices);
        vertexBuf.flip();

        vao = glGenVertexArrays();

        glBindVertexArray(vao);

        int vbo = glGenBuffers();

        glBindBuffer(GL_ARRAY_BUFFER, vbo);
        glBufferData(GL_ARRAY_BUFFER, vertexBuf, GL_STATIC_DRAW);

        glEnableVertexAttribArray(0);
        glVertexAttribPointer(0, 4, GL_FLOAT, false, 16, 0);

        //glBindBuffer(GL_ARRAY_BUFFER, 0);
        //glBindVertexArray(0);

        isRendererInitialized = true;

        return true;
    }

    @Override
    public void draw(View v, RenderStates states) {
        if (!isRendererInitialized) {
            System.err.println("Sprite renderer must be initialized before drawing sprites!");
            return;
        }

        tech.enable();

        tech.setTextureUnit(COLOR_TEXTURE_UNIT_INDEX);
        tech.setColor(color);
        tech.setProjection(getOrthoTrans(v).getMatrix());

        texture.bind(COLOR_TEXTURE_UNIT);

        glBindVertexArray(vao);

        glDrawArrays(GL_TRIANGLES, 0, 6);
        //glBindVertexArray(0);
    }
}

Here are my shaders:

Sprite.vs:

#version 330 core
layout (location = 0) in vec4 vertex; // <vec2 position, vec2 texCoords>

out vec2 TexCoords;

uniform mat4 gProjection;

void main()
{
    TexCoords = vertex.zw;
    gl_Position = gProjection * vec4(vertex.xy, 0.0, 1.0);
}

Sprite.fs:

#version 330 core
in vec2 TexCoords;
out vec4 color;

uniform sampler2D gSpriteTexture;
uniform vec3 gSpriteColor;

void main()
{
    color = vec4(gSpriteColor, 1.0) * texture(gSpriteTexture, TexCoords);
}

When I try to render a Sprite, however, nothing appears on the screen. Not even a black quad. I've tried to scale the quad, but to no avail. What am I doing wrong here?

sentences:
How can I make a sprite-sheet-based animation system? I want to make animations based on a sprite sheet, but I'm stuck implementing it.

The key things I need my code to do are:

Play through a set of images once (e.g. a jump animation)
Loop through a set of images continuously (e.g. a walking animation)
Change an animation's speed

How can I implement such a system?

sentences:
Unity: camera moving up and down for no reason I have a standard camera in my scene. With standard I mean the camera you get when you click right mouse > Camera, with no modification except for the transform position and rotation. Then I attached to the camera this simple script:

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

public class CameraController : MonoBehaviour {

public GameObject target;
public Vector3 translationOffset;
public Vector3 rotationOffset;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    transform.position = target.transform.position + translationOffset;
    transform.LookAt(target.transform);
    transform.Rotate(-rotationOffset);
}

}

the result I have is this:

Why my camera is doing that? It may be worth noticing that everything was working fine, but at some point i clicked on "reimport all assets" and it started this weird behaviour. How can I fix? Thanks a lot.

sentences:
How to make an object towards the mouse on one Axis - Gamemaker Studio 2 I am trying to have my "obj_playership" move towards the Cursor on a single Axis.
Prefer it to be the Vertical Axis.
I tried doing this is an "Execute Code Box" in a step event

"direction = mouse_x"
"speed = 1          "
but the movement looks weird and does not do what I am trying to do.

To better refine my question I'm trying to have my "obj_playership" move just up and down in relation to the mouse, so if I'm moving my mouse up or down the obj_playership" will follow towards the mouse either up or down.

sentences:
Simultaneous events in a realtime system, where processing order causes different outcomes I am working on a realtime dungeon crawler, focusing on a relatively complex and flexible skill system. Somewhat similar to MMORPGs with many compound spells, area effects, buffs/debuffs, ect. I am working on the last few subsystems of the engine.

I found a problem with actions happening in the same logic frame which change an actor's attributes.

For example, let's say two actors use a skill on eachother in the same logic tick, which deals 100 damage and leaves a debuff which halves damage done.
If I simply iterate over each actor and process their abilities, the one which gets processed sooner will deal full damage, the other will do so with the debuffed state, dealing only 50.
Ideally, I'd like both of them to work similarly, dealing full damage and leaving the debuff.
What annoys me is the undetermined nature arising from the order of iteration.

One solution I thought about was to defer all the stat value changes and buff/debuff application until all the abilities are processed, since these are the only things which can affect the behaviour of abilties.
So essentially I loop over actors, process their ability methods, but queue up the stat and status effect changes in a list.
Once I processed every ability I iterate over once more, this time changing the actual stats from the queued values.

This fixes the determinism problem, but causes another.

To use another example (since I can't exactly phrase the general case):
Let's say the player has 100 mana, and gets hit by ten manaburn attacks in one frame, each burning at most 50 mana, and dealing damage equal to the mana burned.
If I don't use the former fix, it'll work correctly, two will burn out the 100 mana of the player dealing 100 damage, the rest eight will do nothing.

With the fix however, since the player's mana value doesn't change yet, all ten attacks will land and deal 500 damage, more than the amount of mana the player has, which is an even more silly situation than before.

I'm quite an amateur, I have less experience than wit for designing complex systems.
Is it possible to have determined behaviour for actions happening in the same frame while avoiding nastier consequences like the second example?

I know the player will unlikely notice the errors in the first case, and I don't think other developers bother with this issue either.

I'm still curious though, is such thing possible, a pipe dream, or just I have a warped idea about how the game logic should work?

Thank you!

sentences: Jagged shadows with default settings This is what it looks like no matter the settings I use when I try to use shadows in Unity. Changing the Bias or the Normal Bias does effect the shadows, but I cannot get the shadows to be smooth with any settings. Making the model bigger does fix this, but I would optimally not scale the model up, as it is already at 10.

sentences:
Unity3D and Photon Networking RPG Good time of the day.
My question might sound stupid, due to the knowledge you might have, but here it is.

I've purchased Diablo 3 a long time ago and been enjoying it since then. Since many of my friend are playing other Blizzard titles, i tried to convince them to purchase Diablo and to play all together. However, they don't want to invest money in the game they don't understand (yet).

So i've decided to write a game, which will be similar to the Diablo in the way of interaction and gameplay, but will (obviously) have some unique points in it (since i'm not only doing this for them, but also to educate myself in the game development area). Other this is, i've decided to take Masters in the Game Development (later this march, just got my bachelors in computer security) and wanted to have some basic knowledge about game development.

I used to make "RPG" games before, tho only browser style ones using LAMP stack, and have some basic knowledge on storing/retrieving data to/from server.

In order to implement multiplayer part of the game, i've decided to use free package PUN (Photon Unity Networking). Had no problem with creating my first room and spawning a player prefab for every new connection (tho they all move no matter on which client action is performed).

Now to the question(s):

By using PUN, i'm able to create new room for players (limited to 5), is it possible to set room names BEFORE they are actually initialized by the player? (set of rooms might be stored on MySQL server and retrieved by the API call)
Is it possible to save progression of the player on the server, and later pass it back to the spawned player (by PUN). This is my main concern, since i've no actual access to the data processed by the server. (Solution is to create another connection to the "storage" server, and keep both of them "online"?)
Does PUN allows you to select which scene should be loaded upon first player entering the room, if so, a bit of pseudo code might be helpful.
What will happen to the player, if there is no spots left to join the server (this is just theoretical question, since i'm not going to publish this game, and amount of friends playing games is less than 20)
How would one deal with the item equipped, which is received during the gameplay? (This one links to the second question) What i'm talking about is, is it possible to restore player object with the set of data received form the server (if possible, ofcourse)

I know, the first suggestion will be to go and to read documentation (i'm in the process of reading it, don't worry). But i've decided to write here, since there are many skilled people out there in this area, who can give me basic understanding on how this whole PUN system works.

I would like to thank you for all of the responses, which you are about to post (or maybe not), and again, have a great day.

sentences: What percentage of game content is normally free on a Free-to-Play game? If I wanted to launch a free-to-play game with different characters, weapons, items and clothes that can be either unlocked through gameplay or bought with real money, what percentage of items should only be available for real money? This isn't "subjective" - I'm interested in examples of real games and estimates of what percentage of their content is free.

sentences:
Client and server loops don't match up I'm trying to build a small networked game using WebGL and NodeJS. I have a basic client and server setup and I'm at the point where I'm trying to implement dead reckoning to simulate what happens on the client.

I have a odd problem which I'm not really sure how to fix, the game loops for my client and server don't seem to match up and the client one always seems to be faster. I'm hosting my server on the same system as my client right now and I'm logging every frame for the two. If I log it for longer than 5seconds the server starts to get behind by 10-20 frames and the gap just gets bigger and bigger over time. There isn't really anymore processing that is happening on the server than on the client at the moment because I'm working with a really basic example right now.

My loop for both right now look something like this:

var loopDelay = 16.666666666666666666666666666667;

function loop()
{
    setTimeout(function() {
        update();
        loop();
    }, loopDelay);
}

On the client I did have something like this:

function loop()
{
    setTimeout(function() {
        update();
        requestAnimationFrame(loop);
        draw();
    }, loopDelay);
}

But I removed it and copied the server one temporarily when I started running into this problem to make sure it wasn't that.

What can I do to make the two sync up perfectly?

Thanks

sentences:
XNA clip plane effect makes models black When using this effect file:

float4x4 World;
float4x4 View;
float4x4 Projection;

float4 ClipPlane0;

void vs(inout float4 position : POSITION0, out float4 clipDistances : TEXCOORD0)
{
    clipDistances.x = dot(position, ClipPlane0);
    clipDistances.y = 0;
    clipDistances.z = 0;
    clipDistances.w = 0;

    position = mul(mul(mul(position, World), View), Projection);
}

float4 ps(float4 clipDistances : TEXCOORD0) : COLOR0
{
    clip(clipDistances);

    return float4(0, 0, 0, 0);
}

technique
{
    pass
    {
        VertexShader = compile vs_2_0 vs();
        PixelShader = compile ps_2_0 ps();
    }
}

all models using this are rendered black. Is it possible to render them correctly?

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:
Get Text dimmensions on CCTextFieldTTF Hi I want to know the width of the text inside the CCTextFieldTTF but I can't find a way to do it, I want this width so I can move a CCLabelTTF in that position so it can be like a cursor for the CCTextFieldTTF

Thanks

sentences:
Pathfinder not acting correctly I've taken the A* Algorithm from this example XNA Pathfinder Example so that it will be able to plot a path for a moving goal.

The issue I'm having is that it will go in the right general direction but it will keep going back and forth in a line. I've changed the method so that it calculates a new path every half a second, clear out the previous points from the list and adds the new points to and from what I have debugged I can't find any issue with the points being added to the queue, to be honest I don't have the foggiest idea what is going wrong :/

This is the field where the waypoints are being held for the character

private Queue<Vector2> waypoints = new Queue<Vector2>();

This section is in the update loop and deals with the plotting a new path and laying out the new one onto the list mentioned above.

            timer += gameTime.ElapsedGameTime;

            if (timer.Seconds >= 0.5)
            {
                timer = TimeSpan.Zero;
                pathFinder.NewPath(position);
            }

            if (pathFinder.SearchStatus == SearchStatus.PathFound)
            {
                waypoints.Clear();
                foreach (Point point in pathFinder.FinalPath())
                {
                    Waypoints.Enqueue(level.MapToWorld(point, true));
                }
                moving = true;
            }

This section is where the waypoints are either taken off or used to set the new position of the character.

                if (moving)
                {
                    // If we have any waypoints, the first one on the list is where
                    // we want to go
                    if (waypoints.Count >= 1)
                    {
                        destination = waypoints.Peek();
                    }

                    // If we’re at the destination and there is at least one waypoint in
                    // the list, get rid of the first one since we’re there now
                    if (AtDestination && waypoints.Count >= 1)
                    {
                        waypoints.Dequeue();
                    }
                    if (!AtDestination)
                    {
                        direction = -(position - destination);
                        //This scales the vector to 1, we'll use move Speed and elapsed Time
                        //to find the how far the tank moves
                        direction.Normalize();
                        position = position + (direction * MoveSpeed * elapsedTime);
                    }
                 }

sentences:
Handling packet impersonating in client-server model online game I am designing a server-client model game library/engine.

How do I, and should I even bother to handle frequent update packet possible impersonating?

In my current design anyone could copy a packet from someone else and modify it to execute any non-critical action for another client.

I am currently compressing all datagrams so that adds just a tad of security.

Edit: One way I thought about was to send a unique "key" to the verified client every x_time and then the client has to add that to all of it's update packets until a new key is sent.

Edit2: I should have mentioned that I am not concerned about whether the actions described in the packet are available to the client at the time, this is all checked by the server which I thought was obvious. I am only concerned about someone sending packets for another client.

sentences:
Separate shader programs or branch in shader? I have a bunch of point lights and directional lights. Instead of checking the light type in the fragment shader and then branch for either point light calculation or directional light calculation, is it more efficient to use two separate programs, one for point lights and one for directional lights?

(Using deferred shading in OpenGL 3.3)

sentences:
The rule to scale pixel art non multiple of integer ratios I have pixel art, I want to draw. When player jumping I want to animate the art to squash stretch to have a feeling. But when I scale the art it get's distorted, as demonstrated in the image.

In one video I heard a rule to always scale to multiples of 100% ratio. So 150% is not allowed otherwise pixels collapse into each other. I haven't experienced that in this image but is it ok to scale arbitrarily in pixel art?
I see they scale the sprite arbitrarily in Celeste Game Player source. But It feels wrong to me.

sentences: Difference between Spherical Harmonics and Spherical Harmonics Lighting What is the difference between Spherical Harmonics and Spherical Harmonics Lighting in OpenGL?

sentences:
CanDraw in large hierarchical scene with rotation I've been assigned to write small simulation visualization, that contains thousands of cubes (I know you heard that before). Now I'm working on optimization of stuff that takes place there, but suddenly I came across a brain teaser (maybe my math foo is to weak).

Scene is arranged in hierarchy, each cube can contain another cubes and so on (cubes always must be contained in parent cube, position is relative to parent cube (including transformation except scale). Now we added ability to rotate cubes and all hell broke lose. We use simple culling of objects that shouldn't be drawn this look like this (Warning C#):

    public bool CanDraw(ICamera camera, Vector3d offset)
    {
        Vector3d pos = _translation + offset;

        _inFrustum = camera.SphereInFrustum(pos, _radius);

        if (_inFrustum == InFrustum.Partial && Children != null)
            foreach (IDrawable item in Children)
                item.CanDraw(camera, pos);

        return _inFrustum != InFrustum.No;
    }

InFrustum enum can be Yes, No, Partial.

Now the problem that we get is when parent cube is rotated for example by 45 deg around Z axis and is partially visible all children are tested, but rotation is not included this results in child cubes not being drawn... further more if child cube is drawn, but is rotated problem is starting to get worse.

Do any of you how to solve this without moving test draw code into rendering loop (after transformations are made to see if point 0,0,0 is in frustum?

I imagine that I would have to rotate pos using offset as axis origin and parent rotation (how?), but still that parent object (offset and rotation) might be already rotated by it's parent.

I must do those checks, cause scene contains around 300k+ boxes and drawing all of them ends up in <0.1 FPS on machines that it's used.

sentences:
Export into several files with custom XNA content pipeline? In order to implement a basic Ubershader (a shader which is compiled numerous times with different directives (defines)) I wrote a custom shader processor in XNA. My processor outputs a dictionarry full of compiled shaders, from which I pick the needed shader at runtime. Unfortunately the final dictionarry is so large, it takes a tone of time to load into memmory when the program starts. So I wonder if it is possible to export my results into several XNA output files, which I can load one at a time (and not all at once), calling Content.Load<Effect>("Name")?

I know how to specify an output type for a single output file:

public class PSProcessor : ContentProcessor<EffectContent, Dictionary<string, object>>

It's the second parameter in triangular brackets, but what if I want several files to be created?

sentences:
How do I render my own DirectX Stuff to a full screen WPF's DirectX surface? Basically Danny Varod seems to know as he posted it as an answer to this question:

Display a Message Box over a Full Screen DirectX application

I think, theoretically this might work, but I have no idea how to actually do it. Since I'm also not allowed to post a comment under his comment nor am I allwoed to ask on meta about how to contact another user, I ask this as a normal question here:

How do I render my own DirectX Stuff to a full screen WPF's DirectX surface?

For starters, I have no idea how to get the DirectX surface from a WPF window. If I had it, what do I have to take care of that the WPF rendering doesn't screw up my own rending or vice-versa?

sentences:
ETC1 Performance Problem Android I wanted to support etc1, because it shoul improve the performance and loading times, but somehow its worse than using normal png files.

I'm using Mali compression tool with seperate RBG pkm texture and Alpha pkm texture.
I'm using a GLSL shader to deal with the alpha problem ofc ETC1. With the shader the performance is really bad. but even without the shader, just working with the RGB pkm file (where transparency is black) the performance is equal to png. does anyone know what the problem might be?

sentences:
2D Grid based game - how should I draw grid lines? I'm playing around with a 2D grid based game idea, and I am using sprites for the grid cells. Let's say there is a 10 x 10 grid and each cell is 48x48, which will have sprites drawn there. That is fine.

But in design mode, I'd like to have a grid overlay the screen. I can do this either with sprites (2x600 pixel image etc) or with primitives, but which is best? Should I really be switching between sprites and 3d/2d rendering?

Like so:

Thanks!

sentences:
In OpenGL Shader, Why adding color change vertex position? I have the following vertex shader:

#version 120

attribute vec4 position;
attribute vec4 acolor;

varying vec4 theColor;

void main(){
    gl_Position = position;
    //theColor = acolor;  //[1]
    theColor = vec4(1.0,0.0,0.0,1.0); //[2]
}

When I use line [1], the color is transmitted rigth to the fragment shader, but when I change the color to the attribute acolor (using the line [2]) the positions of the triangles appear wrong. From the data of the main program, it seems to me like the positions get the color values.

I put two images, 1 with the rigth vertex positions and  2 with the wrong vertex positions.

UPDATE: render code on Github

sentences:
Is it possible to make a randomly rotating terrain texture painting brush in Unity? I wanted to make a terrain in unity with a dirt texture painted onto the original grass texture to make a path, but when I tried, the dirt (and grass) looked repetitive and full of patterns.

My question is, is there any way I can make a texture's tiles randomly rotate when being applied or painted onto an object?

sentences:
Pygame bullet firerate not working sometimes i have made this bullet class but i have a problem with the firerate. Sometimes  i'm not able to shoot even when the little delay (700ms) between the two shots has ended. I guess it's due to the pygame.time.set_timer(). Anyways i'm looking for a quick solution because i wanna move on to work on another part of this game.
...

class Singlebullet(object):

    def __init__(self):
        self.img = pygame.image.load(r'C:\Users\Salem\Documents\MyGame1\bullet.png')
        self.state = 'ready'
        self.speed = 0
        self.firerate = 700

    def shoot(self):
        if current_bullet_type == 'single':
            if self.state == 'ready':
                self.x = myplane.x + 71
                self.y = myplane.y
            if self.state == 'fire':
                self.speed = -13
            for event in events:
                if event.type == pygame.KEYDOWN or event.type == pygame.KEYUP:
                    if event.key == pygame.K_SPACE:
                        self.state = 'fire'
                        pygame.time.set_timer(pygame.USEREVENT+1, self.firerate)
                if event.type == pygame.USEREVENT+1:
                    self.state = 'ready'
            MyScrollingScreen.blit(self.img, (self.x, self.y))
            self.y += self.speed
s1 = Singlebullet()
...
while running:
    ...
    s1.shoot()
    ...

sentences:
How do I sort edge tiles for a hex grid in order to draw a border? I am trying to sort the edge tiles of a region in my hexagon map. Once it is properly sorted, I can then try to walk through them and attempt at creating a Civ style border map, but I can't seem to figure out the sorting.
Right now I just have a simple line renderer that represents my results. Red portion of the gradient represents the start of the line.

It comes quite close at times.

I tried playing around with checking the direction I was coming from to change the neighbor sort, but haven't had any luck. I added a Stack so that I can walk back if I hit a dead end. Sometimes it works, but depends on the direction it was coming from.
Don't necessarily pay too much attention to the coordinates themselves. I've gone through the entire https://www.redblobgames.com/ docs and can easily convert from a 2D grid, to Unity's Offset, and to Cube coordinates. This particular code is initially the coordinates from a int[,] that was used in the procedural generation of the map.
public void CalculateEdgeTiles(ref int[,] regionMap)
{
    EdgeTiles = new HashSet<MapCoord>();
    if (Tiles == null)
        throw new Exception();

    MapCoord startingEdgeTile = null;

    foreach (var tile in Tiles)
    {
        foreach(var neighbor in tile.Position.ToHexOffsetCoordinateRing(1, true))
        {
            if (regionMap[neighbor.x, neighbor.y] != tile.RegionId)
            {
                EdgeTiles.Add(tile);
            }
        }
    }

    var sortedTiles = new List<MapCoord>();
    var queue = new Queue<MapCoord>();
    var stack = new Stack<MapCoord>();

    queue.Enqueue(EdgeTiles.First());

    var walkingBack = false;
    MapCoord previousTile = null;
    while (queue.Count > 0)
    {
        var currentTile = queue.Dequeue();
        if (sortedTiles.Contains(currentTile))
            continue;

        if (!walkingBack)
        {
            sortedTiles.Add(currentTile);
            stack.Push(currentTile);
        }

        var foundNeighbors = new List<MapCoord>();

        foreach (var neighbor in currentTile.Position.ToHexOffsetCoordinateRing(1, true))
        {
            var tile = Tiles.FirstOrDefault(x => x.Position == neighbor);
            if (tile == null || !EdgeTiles.Contains(tile) || sortedTiles.Contains(tile))
                continue;

            foundNeighbors.Add(tile);
        }

        if (previousTile == null)
            previousTile = currentTile;

        bool addedNeighbor = false;
        var neighborQuery = previousTile.Position.y < currentTile.Position.y
                                ? foundNeighbors.OrderByDescending(x => x.Position.x + x.Position.y)
                                : foundNeighbors.OrderBy(x => x.Position.x + x.Position.y);
        foreach (var neighborTile in neighborQuery)
        {
            addedNeighbor = true;
            queue.Enqueue(neighborTile);
            break;
        }

        walkingBack = false;
        //If we added nothing, pop the stack and start walking back to check the next neighbor.
        if (!addedNeighbor && EdgeTiles.Count != sortedTiles.Count)
        {
            walkingBack = true;
            queue.Enqueue(stack.Pop());
        }

        previousTile = currentTile;
    }

    EdgeTiles = new HashSet<MapCoord>(sortedTiles);
}

I'm hoping I am just missing a simple trick or I was just dumb on one section of the code. Any info is appreciated.

sentences:
What is involved with writing a lobby server? So I'm writing a Chess matchmaking system based on a Lobby view with gaming rooms, general chat etc. So far I have a working prototype but I have big doubts regarding some things I did with the server. Writing a gaming lobby server is a new programming experience to me and so I don't have a clear nor precise programming model for it. I also couldn't find a paper that describes how it should work. I ordered "Java Network Programming 3rd edition" from Amazon and still waiting for shipment, hopefully I'll find some useful examples/information in this book.

Meanwhile, I'd like to gather your opinions and see how you would handle some things so I can learn how to write a server correctly. Here are a few questions off the top of my head: (may be more will come)

First, let's define what a server does. It's primary functionality is to hold TCP connections with clients, listen to the events they generate and dispatch them to the other players. But is there more to it than that?

Should I use one thread per client? If so, 300 clients = 300 threads. Isn't that too much? What hardware is needed to support that? And how much bandwidth does a lobby consume then approx?

What kind of data structure should be used to hold the clients' sockets? How do you protect it from concurrent modification (eg. a player enters or exists the lobby) when iterating through it to dispatch an event without hurting throughput? Is ConcurrentHashMap the correct answer here, or are there some techniques I should know?

When a user enters the lobby, what mechanism would you use to transfer the state of the lobby to him? And while this is happening, where do the other events bubble up?

sentences:
GPU Spatial Clustering I have a around 100k points on the screen (that might update). 2D points.

The goal is to cluster them into groups, by a constant distance. Meaning, finding groups of points that the distance between them is less than this distance. Instead of drawing those points, a big point will be drawn there with a number on it.

The problem is the calculation time.
Tried many algorithms on CPU, but didn't get the performances i wished for.

I'm trying to find an algorithm to solve this problem in the GPU using WebGL-GLSL, when texture contains all my locations.

Can be single draw phase or multiple.. as long as i achieve better calculation time than i get with the CPU.

sentences:
How to create a Spawn Area that can be visualized in the Unity Scene Editor? Consider a Spawn Area for GameObjects. We define a Spawn Area to be a boundary consisting of 3 or more points such that an object can spawn at any coordinate that is within the boundary of the Spawn Area. Contrast this with a Spawn Point, where objects can only be spawned at that specific coordinate.

In Unity, one method of creating such a Spawn Area is to place an Empty Game Object at a point, and then use Random.Range around that point.

Vector3 emptyGameObjectCoordinate = emptyGameObject.transform.position;
Vector3 randomSpawn = emptyGameObjectCoordinate + new Vector3(Random.Range(-1, 2), 0, 0);

My issue with this approach is that it is very difficult to visualize this area through the scene editor. It would look like a simple cube no matter what the area actually is.

I have considered possibly using a box collider as the area. This is can easily be visualized.

However, Unity Lacks a method to select points within a collider.

It would be ideal if we had a method such as Random.insideCollider.

BoxCollider collider = GetComponent<BoxCollider>();

// Ideally. But sadly, does not exist.
Vector3 randomSpawn = Random.insideCollider(collider);

So my question is, what is the Unity way of creating a Spawn Area such that it can be visualized through the scene editor?

As a bonus, how can we create areas that consists of arbitrary points, as opposed to just being rectangles or cubes? It would still need to be possible to visualize it, and it should be easy to select random points within it.

sentences:
How to use a .cube LUT file with Color Lookup? I have used "Image 2 LUT" to create a LUT for Unity from a certain movie.
However, currently "Image 2 LUT" only outputs ".cube" files.
For HDRP, this is great, but for some reason, URP doesn't accept .cube file.
URP expects specially laid out .png LUT file.
Is there any way to convert a .cube LUT file to a PNG that I can put into the slot of Color Lookup-> Lookup Texture with URP?
Unity expect this format:

The tutorial that Google finds and recommends is this.
However, I don't have Photoshop. Also, the tutorial deals with a square LUT that looks like this:

So even if I had Photoshop and I would follow the tutorial, I would still have a square LUT which is not laid out as Unity would expect it, so I did not use that tutorial.
How do I create a LUT png from a .cube file that I can use with URP?
Thank you.

sentences:
What file formats and conventions should I support to make my game engine artist-friendly? I'm writing a game engine, and I want to know what I should do to make it more artist-friendly. I don't want to be too limiting in terms of what file formats I support, etc.

Are there specific formats artists like to model in, or does it not matter, because the 3D modeler abstracts the data storage away?

Is it okay if I don't support per-vertex coloration in my game engine? If I have to store a diffuse, specular, ambient, and emissive color value for each vertex, it doubles the size of the vertices, in the buffer. Is it reasonable to ask artists to do all these things in the textures or maps?

sentences:
Seaming between procedurally generated terrain meshes in Unity I have been generating procedural terrain for an upcoming project however I am coming across a seaming effect between the tiles:

I have searched for solutions including this video.

Here is the code (sorry for the lack of comments):

chunkx and chunky are the x and y coordinates of the chunk that is being generated.

seed is a randomly generated integer.

float Gen_Height(int x, int y, int seed)
{
    float height = 0;
    float newx;
    float newy;
    for (float resolution = 128; resolution >= 8; resolution /= 8)
    {
        newx = (seed / 40f) / resolution + x / resolution;
        newy = (seed / 40f) / resolution + y / resolution;
        height += (Mathf.PerlinNoise(newx, newy) - 0.5f) * resolution;
    }
    if (height < 0) height = 0;
    return height;
}

public List<Vector3> Gen_Vertices(int chunkx, int chunky, int seed)
{
    float height;
    int x = 101;
    List<Vector3> vertices = new List<Vector3>();

    for (int i = 0; i < x; i++)
    {
        for (int j = 0; j < x; j++)
        {
            height = Gen_Height(i + chunkx * (int)x, j + chunky * (int)x, seed) * heightmod;
            vertices.Add(new Vector3(2*i, height,2* j));
            if (height > maxheight) maxheight = height;
            else if (height < minheight) minheight = height;
        }
    }
    return vertices;
}

sentences:
Command Interface design for RTS Commands may have different target type; like NONE, COORD, UNIT.
Some example commands may be: Attack (target UNIT), Move (target COORD), AttackMove (target COORD), Stop (target NONE), UseAbility (target ability.getTargetType).
Commands will be executed by UI or AI.
So in an OOP approach here, what methods should my Command interface have?
For the command execution has access to the target the command wants.

sentences:
Still award achievements/badges on failing level? I've got a simulation game where the player works through a series of missions/levels.

The player also earns in-level badges as he works through.

But, if the player fails a mission (and has to restart it), should the badges still be awarded?  Or should badges only be retained on successfully completing the parent mission?

Your thoughts are welcome.

sentences:
Unity3D 5.5b : C# WebGL open email client Win32 exception error I want to send an email in a WebGL build using C#. My code is as below

try
{
   Uri myUri = new Uri("mailto:anemailaddress@example.com? Subject=Hello%20again&body=TEST");
   System.Diagnostics.Process.Start(myUri.AbsoluteUri);
}
catch (Win32Exception e)
{
  Debug.LogError(e.Message);
}
catch (Exception e)
{
   Debug.LogError(e.Message);
}

to open an email client. But I get the following error as well as a Win32Exception : Success error

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/WebGL/runtime/DebugBindings.gen.cpp Line: 51)

a9b4b6fe-b629-4efc-bb29-821d1f0fcea2:9085:3
 Not implemented icall: Process::ShellExecuteEx_internalUnityLoader.js:3541:3
 Success

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/WebGL/runtime/DebugBindings.gen.cpp Line: 51)

sentences:
How to change a sprite via script at runtime when using an animator? I am making a simple 2D shooter.
I have my character's body and head as different objects, as I want him to look up/down regardless of the movement.
So, I basically use the following script:
public class PlayerHead : MonoBehaviour
{
    public static PlayerHead instance;
    public SpriteRenderer theSR;
    public Sprite netural, down, up;

    private void Start()
    {
        instance = this;

    }
    public void Up()
    {
        theSR.sprite = up;
    }

    public void Down()
    {
        theSR.sprite = down;
    }

    public void Netural()
    {
        theSR.sprite = netural;
    }

}

However, the head is also used in the player animations:

This is because head must move with the body during the idle animation (breathing and moving up&down slowly).
I suspect that because of this animation, the sprite of the head is somehow fixed. It does not change in runtime even though I change it manually inside Unity.
How can I make the Animator let me change the sprite?

sentences:
Cant center screen between black bars As I was trying to adapt my game to different device resolutions I ran into a problem when adjusting the game screen between the "black bars." In my case I am using the FitViewport class from the LibGdx library to add the black bars for me. Everything works fine and the black bars (one bar in my case) are being effectively created when necessary. My problem, however, is that my screen is not centered and I end up with one ugly black bar either to the top, bottom, right, or left of my game. For example:

How can I fix this so it looks like this:

Here is my code:

public class NordicMadness extends Game implements ApplicationListener{
    private Camera camera;
    public static FitViewport viewport;

    @Override
    public void create () {
        camera = new PerspectiveCamera();
        viewport = new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), camera);
        AssetLoader.loadAssets();
        setScreen(new SplashScreen(this));
        System.out.println(Gdx.graphics.getWidth() + ", " + Gdx.graphics.getHeight());
    }

    @Override
    public void dispose(){
        super.dispose();
        AssetLoader.dispose();
    }

    @Override
    public void resize(int width, int height) {
        // All resizing shall be done in main Game class
        viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getWidth(), true);
    }
}

The libgdx API states that adding true to the third argument of viewport.update(width, height, boolean center) should do the job but it's not working in my case.

After this I tried doing the following but with no success:

public void resize(int width, int height) {
        // All resizing shall be done in main Game class
        ScalingViewport scalingViewport = (ScalingViewport)viewport;
        float leftGutterWidth = scalingViewport.getTopGutterHeight();
        viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getWidth()); // Resize screen
        camera.position.set(0, Gdx.graphics.getHeight() - (leftGutterWidth / 2), 0);
    }

sentences:
Implementing smooth object rotation I declared two variables on class level. One is the angle the object is rotated by. The second is a stopwatch.

float yRot = 0.0f;
static CStopWatch rotTimer;

I rotate the cube using the SpecialKeys function.

void SpecialKeys(int key,int x,int y)
{

    if(key == GLUT_KEY_RIGHT)
    {
        yRot = rotTimer.GetElapsedSeconds() * 10.0f;
    }

    if(key == GLUT_KEY_LEFT)
    {
        yRot = rotTimer.GetElapsedSeconds() * -10.0f;
    }

    glutPostRedisplay();
}

Finally the rotation matrix is calculated using the rotation variable, in the RenderScene function.

// Create a rotation matrix based on the current value of yRot
m3dRotationMatrix44(mRotate, m3dDegToRad(yRot), 0.0f, 1.0f, 0.0f);

It actually works. My problem is that when I hold the key the animation looks fine. But if I press it the animation looks a little jumpy, like the angle is bigger then when I hold it. I suppose this hangs together with the stopwatch. How to solve this issue?

sentences:
LibGDX - GameWorld Dimensions vs ViewPort Dimensions vs Camera Dimensions Before someone mark it duplicate - I am aware that there are few questions already on this topic but the explanations are all theoretical and no graphical elaboration was provided which I think will help in understanding these concepts better.
Coming to the query in hand, I assume LibGDX follows OpenGl definitions of GameWorld, Camera and ViewPorts - please correct me if I am wrong. Now when I am trying to understand these basic concepts of LibGDX, confusions are arising all around me. I am sure these concepts are not that hard to understand and I must be looking at the things in a wrong way. As per my understanding:
GameWorld Dimensions: This is the dimension of the GameWorld that I have created, perhaps a Tiled map or some background which will be showing to the player. Lets assume the GameWorld dimension is 4096 x 4096 px.
Camera Dimensions: This is the dimension of the Camera that I would like to show to the user at a time. It could be 800x480 px or 320x240 px or whatever I want. When set, user will only be able to see that part of the GameWorld at a time.
ViewPort Dimensions: I have absolutely no clue how this works!
And my queries are: (Please explain with image/graphics for better clarity)
a. How is ViewPort related to Camera?
b. Is Camera a part of ViewPort or is it vice-versa?
c. Can Camera dimensions be different than that of ViewPort?  eg: Can camera be 800x480 px whereas Viewport 320x240 px or vice-versa?
d. When designing games for multiple screen densities/sizes, which is a better approach - Camera with standard dimensions (16/9 - 4/3 - 800x480) or   ViewPort? If ViewPort then which is the best in such cases -   Stretch/Fill/Fit/Expanded ?

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 do I copy the depth buffer to CPU memory in Direct3D 9? I have code in OpenGL that uses glReadPixels to copy the depth buffer to a CPU memory buffer:

glReadPixels(0, 0, w, h, GL_DEPTH_COMPONENT, GL_FLOAT, dbuf);

How do I achieve the same in Direct3D?

I have looked at a similar question which gives a solution for copying the color buffer. I've tried to write similar code to copy the depth buffer:

IDirect3DSurface9* d3dSurface;
d3dDevice->GetDepthStencilSurface(&d3dSurface);

D3DSURFACE_DESC d3dSurfaceDesc;
d3dSurface->GetDesc(&d3dSurfaceDesc);

IDirect3DSurface9* d3dOffSurface;
  d3dDevice->CreateOffscreenPlainSurface(
  d3dSurfaceDesc.Width,
  d3dSurfaceDesc.Height,
  D3DFMT_D32F_LOCKABLE,
  D3DPOOL_SCRATCH,
  &d3dOffSurface,
  NULL
);

// FAILS: D3DERR_INVALIDCALL
D3DXLoadSurfaceFromSurface(
  d3dOffSurface,
  NULL,
  NULL,
  d3dSurface,
  NULL,
  NULL,
  D3DX_FILTER_NONE,
  0
);

// Copy from offscreen surface to CPU memory ...

The code fails on the call to D3DXLoadSurfaceFromSurface. It returns the error value D3DERR_INVALIDCALL.

So, is something wrong with my code? How can I copy the depth buffer contents?

sentences:
Real Time vs Turn Based (XNA) What is a more difficult type of game to develop on XNA: A Real Time multiplayer game or a Turn Based multiplayer game? (not client server or peer to peer, just in general)

Any links to articles would be greatly appreciated!

sentences:
Where to generate data in an Entity-Component System? So I'm making a small game where I generate 2D landscape using perlin noise when the game first loads.

I've got it working in a OO way, but want to move over to an ES architecure, and I'm  just struggling to work out the right place for the code that does the generation to go?

In OO world, I have a World object which gets passes a coordinate value that is used as the seed for the perlin noise, and generates all the points for the land mass when the world is created.

I'm thinking I need a World component with a coordinate field on it - that's an easy part.

From there - is it right for a component to generate data when it's first initialised (or is that too OO?)?
Or should a System be doing that instead, when the game first starts?

Or... some other solution I'm not aware of?

Thanks in advance for any guidance.

sentences:
Exact collision detection for high-detail deformable triangular meshes What robust methods or approaches exist for exact collision detection involving high-detail, deformable geometry?

The kind of mesh I am describing is a surface that is specified as a triangulated polyhedron and looks very similar to this:

For the specific application I am working on, I need to find all the contact points for colliding meshes that undergo subsequent deformation. Possible deformations that may occur during a collisional event:

1) the mesh decomposes, or fragments into smaller (triangulated) meshes

2) the mesh retains integrity but the vertex values of it's surface change

3) both of the above deformations occur

There is no real-time constraint; accuracy rather than performance is the critical factor.

sentences:
Syncing Sprites themselves over a Network Ok, just found out I can't use [SyncVar] for a sprite gameobject. Furthermore that, [SyncVar] works only on simple values. My question is How would I go about syncing a Sprite over a network?

To explain the context for where I need it, I have a code for players to select an Avatar to play with. Player 'A' and 'B' are able to change their avatars in their own respective device. But the changes made by player 'A' are not reflected in 'B' and vice versa.

So the question is How do I sync a Sprite GameObject?

Note: I am using unity 5.4 and unity's default multiplayer system.

sentences:
Waitforseconds is skipping over I have a function for a timer using waitforseconds but instead of waiting for how long I want to, it just skips it.

A ui text should become "foo" then 5 seconds later become "bar" but it turns to bar as soon as it starts.

Code:

void Update () {
     text1.text = "foo";
     wait (5);
     text1.text = "bar";
 }

 IEnumerator wait(int time)
 {
     yield return new WaitForSeconds(time);
 }

sentences:
Issues with referencing experimental light class I am trying to reference a Light2D component on a GameObject but I get the following error:
'The type or namespace name 'Universal' does not exist in the namespace 'UnityEngine.Experimental.Rendering'.

I have confirmed that I have v10.2.2 of the Universal RP package in package manager. I have also attempted regenerating all csproj files as well as deleting the Library folder and reopening Unity. I also have the library reference to 'UnityEngine.Experimental.Rendering.Universal' in my script.

sentences:
Clipping speed when turning without using aggressive drag I have a Unity project in which I want to control a player in a similar way to Source games, and so far I am clipping each input to the speed in the player's coordinates, by using
transform.InverseTransformDirection( GetComponent<Rigidbody>().velocity )

after which I pass each of the player's input vector direction through this function:
private float FLSMF ( float aInputVelocity, float aMaximumVelocityOnAxis, float aSpeedOnAxis ) {
    if ( Mod( aSpeedOnAxis ) >= aMaximumVelocityOnAxis ) {
        if( Sign( aSpeedOnAxis ) != Sign ( aInputVelocity ) ) {
            if ( Mod( aSpeedOnAxis + aInputVelocity ) > aMaximumVelocityOnAxis ) {
                return Sign ( aInputVelocity ) * ( aMaximumVelocityOnAxis + Mod( aSpeedOnAxis ) );
            }
            return aInputVelocity;
        }
        return 0;
    }
    if( Mod( aSpeedOnAxis + aInputVelocity ) > aMaximumVelocityOnAxis ) {
        return Sign( aInputVelocity ) * ( aMaximumVelocityOnAxis - Mod( aSpeedOnAxis ) );
    }
    return aInputVelocity;
}

There is only one problem: whenever I turn and strafe and walk forwards or backwards, the speed increases dramatically. I tried solving it by comparing each processed velocity axis to the velocity rotated by the difference in the rotations between the last 2 FixedUpdate's. So far nothing worked, aside from driving the drag factor through the roof.
My best guess is that when turning, the unclipped X axis of the vector bleeds into the Z axis when turning, which can't add anything, but cant stop the X axis from interfering because the forward key is pressed.
There is no issue when only one of the input axis are used, the speed remaining consistent when turning.
I tried to implement this function especially so I don't have to use any drag, to allow the player to be flung by other things, like grapples and explosions (this issue is present irrespective of said external factors).
If you want to, I will share the entire code, but it's messy and I don't think it would help.
Any ideas how to solve it?
Edit: yes, I have normalized the input vector. The speed increases to more than triple of the maximum, in as few as 2 turns.

sentences:
Can you create input actions using more than one key in the editor with the new Input System? The new input system documentation says it's possible to add actions that require input combinations within the editor or code. I only see an option to add one binding path per action within in the Actions UI.

From the documentation:

  ... require the left trigger to be held and then the A button to be pressed and held for 0.4 seconds?

var action = new InputAction();
action.AddBinding("/<gamepad>/leftTrigger")
    .CombinedWith("/<gamepad>/buttonSouth", modifiers: "hold(duration=0.4)");

  Again, setting this up with the inspector in the editor is an alternative to dealing with the path strings directly.

sentences:
glm::perspective isn't working? So I'm learning how to make games and program, and while trying to setup a projection camera using GLM in GFLW, this line of code refuses to work and I can't figuire out why. The code is in the image below.
                                                 Thanks!

sentences:
Use spritesheet frames as particles? I want to use frames from a spritesheet as particles for my emitter.

I load my spritesheet with :

game.load.spritesheet('particles_sheet', 'http://stuff.lck.io/luckyslot/sprite_sheet.png', 50, 50, 6);

var emitter = game.add.emitter(game.world.centerX, canvas_height, 80);

And i need some code to load the right frame at random :

emitter.makeParticles('particles_sheet');

Any idea?

sentences:
In JavaScript, should I write a game loop for a turn-based game? I am using javascript and HTML5 canvas for turn-based games (e.g., checkers, mastermind, minesweeper).

Should I write a fixed-timestep game loop? What are the alternatives?

sentences:
How do I add an object to the node tree at a specific position I'm making a skiing game, and a part of that is programmatically adding snow to the scene in a specific place. It will all be the child of a single node.

I was looking through the Flappy Bird code but when it instances a scene, it only uses the function add_child(). There doesn't seem to be a way to set its position.

Here is the project on github.

sentences:
How to decide which GameObject should handle the collision? In any collision, there are two GameObjects involved right? What I want to know is, How do I decide which object should contain my OnCollision*?

As an example, let's suppose I have a Player object and a Spike object. My first thought is to put a script on the player that contains some code like this:

OnCollisionEnter(Collision coll) {
    if (coll.gameObject.compareTag("Spike")) {
        Destroy(gameObject);
    }
}

Of course, the exact same functionality can be achieved by instead having a script on the Spike object that contains code like this:

OnCollisionEnter(Collision coll) {
    if (coll.gameObject.compareTag("Player")) {
        Destroy(coll.gameObject);
    }
}

Whilst both are valid, it made more sense to me to have the script on the Player because, in this case, when the collision happens, an action is being performed on the Player.

However, what's making me doubt this is that in future you may want to add more objects that will kill the Player on collision, such as an Enemy, Lava, Laser Beam, etc. These objects will likely have different tags. So then the script on the Player would become:

OnCollisionEnter(Collision coll) {
    GameObject other = coll.gameObject;
    if (other.compareTag("Spike") || other.compareTag("Lava") || other.compareTag("Enemy")) {
        Destroy(gameObject);
    }
}

Whereas, in the case where the script was on the Spike, all you would have to do is add that same script to all the other objects that can kill the Player and name the script something like KillPlayerOnContact.

Also, if you have a a collision between the Player and an Enemy, then you likely want to perform an action on both. So in that case, which object should handle the collision? Or should both handle the collision and perform different actions?

I have never built a game of any reasonable size before and I'm wondering if the code can become messy and difficult to maintain as it grows if you get this sort of thing wrong in the beginning. Or maybe all ways are valid and it doesn't really matter?

Any insight is much appreciated! Thank you for your time :)

sentences:
How to share Unity High Scores on social media (Facebook , Google+ and Twitter)? This may be a common question but as a n00b I have some confusion on achieving this .

I am on a small game project and I want the user to share his / her scores on social media after completing the game .

When they post , it should be something like "Hurrayyyy ! I Scored 12345 on -My Game App Name- , Can you beat my score ? Try it ." where '-My Game App Name-' and 'Try it' should be a link directing to Google Play / Windows Store etc .

My Idea is like this :-

Here Share This on Facebook , Share This on Google+ and Share This on Twitter are 3 UI Images with Button component attached to them .

So when the player clicks on those buttons , they should post on social media .

So how to achieve this ? I got something here , but I don't know how to use that . I will prefer not to use Facebook Unity Plugin . So can I achieve this ?
I need code in c# , not in JavaScript :)

I hope you will help me to figure this out .

Regards , NB :)

sentences:
Why is my custom Texture2D blurry? Have some WWW object downloading a .PNG image.

((SpriteRenderer)renderer).sprite = Sprite.Create(request.texture,
         new Rect(0,0,100,100));

My sprite looks fine.

Now, let's be a bit redundant and create a Texture2D out of the bytes from the download:

Texture2D t = new Texture2D(100,100);
t.LoadImage(request.bytes);
((SpriteRenderer)renderer).sprite = Sprite.Create(t, new Rect(0,0,t.width,t.height));

Technically, this should produce something identical to the above snippet. However, the sprite is blurry (as in, low quality).

I suppose it is when calling LoadImage. What may be causing this?

sentences:
Time to render each frame is proportional to the amount of models in the scene This question is deliberately written in a "High-Level" manor to avoid screeds and screeds of code snippets, hopefully I can get my point across, I am using C++ and OpenGL.

I have a game engine, and in the engine I have my "game loop" that is called every frame, one of the things in this game loop is my call to Render(), before a call to SwapBuffers(), nothing new there.

Essentially my engine draws the scene using a scene graph, that is I have GameObject's and each object has a GameComponent. So when the Render() is called in the "game loop" I get the root GameObject and render its GameComponent and then move onto the next GameObject and render its GameComponent, etc. until all GameObject's and each of their GameComponent's are drawn using glDrawElements(...).

One of the GameComponent's a GameObject can have is a MeshRenderer, that is a Mesh paired with a Texture. In my scene I want to add loads of tree models, therefore I create for example 50 GameObject's that each have a MeshRenderer component (a tree) that will eventually in the game loop described above be drawn.

The issue with this is that the time it takes to render a frame is directly proportional to the number of tree models I have (O(N) I think is how you word it). For example with 100 trees the render time is 23ms, with 200 trees it is 46ms, with 400 trees it is 90ms so on and so forth.

This is terrible, I need at least 1000 trees in my "game world" and even at around 400 my game is "laggy". Because the time to draw a frame is proportional to the number of tees I know that each frame it is re-drawing each mesh essentially (every frame drawing 100 trees, and then 200 and so on, and the time to draw scales with it)

My question is this - How can I store the mesh data so that I don't need to draw them from scratch every frame, I can just draw them once, and then re-use that data for the next frame, but don't re-draw it all? is there a way to firstly use glDrawElements(...), then store that mesh data(all the vertices etc.) and then every frame after call something like for example glDrawExcistingElements() instead of  glDrawElements(...). Ultimately meaning that for consecutive frame draws the time is the exact same wether I have 1 tree or 1000 trees because the system is simply saying "here is the scene I already drew", instead of "lets draw it all again from scratch".

sentences:
How can I control ads frequency? This question was already asked a while ago, and I wanted to check the present situation:

Can I control ads frequency from the dashboard? (e.g. frequency
capping in Admob)
Can I control ads frequency through Unity IAP API?
If not, does that mean that I need to implement all that "frequency
control" functionality manually?

sentences:
Entity Component System: where do I put containers? I'm pretty new when it comes to the whole Entity Component System structure and I got some questions I just can't wrap my head around.

I know that for example collisions, you'd have a CollisionComponent and a CollisionSystem for handeling collisions. But what if I'd like to use a quadtree for collisions? Where do I put that quadtree? What do I store in that quadtree? Both the PositionComponent and CollisionComponent?

A quadtree is just an example, it could be any abstract container really. If somebody who has more experience with ECS could give me a primer on this, I'd be very grateful.

sentences:
How do you calculate if 2 lines are facing toward or away? Given the 4 points describing 2 line segments, how do you calculate if line A is towards or away from line B?

The 2 lines have a fixed length, and can be measured as distance from x1/y1 to x2/y2.

sentences:
For deferred rendering and SSAO, what coordinate system are the normals actually in? So, I'm following the very helpful LearnOpenGL online tutorials, and I'm working on implementing SSAO. I don't have a deferred rendering pipeline, but I need to collect normals during my depth pass so that I can sample them for the SSAO effect.  I'm following this tutorial: https://learnopengl.com/Advanced-Lighting/SSAO, and referencing this one when needed: https://learnopengl.com/Advanced-Lighting/Deferred-Shading.
However, neither of these tutorials really explain what's going on with the normals. What is the normalMatrix being used in the shader?
mat3 normalMatrix = transpose(inverse(mat3(view * model)));
Normal = normalMatrix * (invertedNormals ? -aNormal : aNormal);

I'm not worried about the invertexNormals conditional, that's probably just something weird the author added for handling different conventions, but what the heck is going on with that normalMatrix? Why would we invert the view * model matrix? If we're starting with aNormal in object space (whether it's coming directly from a vertex buffer or from a normal map TBN calculation), I can't for the life of me figure out what coordinate system that resulting normal is going to end up in!
So, long story short, what coordinate frame should my normals be in if I'm to use them for SSAO? World space? View Space? Clip space? None of the above? If it's some weird coordinate system, can somebody help me get there? I'm probably more confused than I should be.

sentences:
OnMouseDown() execute only once I have the following OnMouseDown() function:

private void OnMouseDown()
{
    Debug.Log("This turret is: " + thisTurret.ToString());
    if (EventSystem.current.IsPointerOverGameObject())
    {
        return;
    }

    if (thisTurret != null)
    {
        buildManager.SelectTurret(thisTurret);
    }

which send to the following functions:

public void SelectTurret(GameObject turret)
{
    if(selectedTurret == turret)
    {
        Debug.Log("Selected turret is: " + selectedTurret.ToString());
        DeselectTurret(selectedTurret);
        return;
    }

    selectedTurret = turret;
    Debug.Log("Selected turret here is: " + selectedTurret.ToString());
    Debug.Log("Pasted turret here is: " + turret.ToString());
    if (oldSelectedTurret == null)
    {
        oldSelectedTurret = selectedTurret;
    }

    //Debug.Log("Selected turret is: " + selectedTurret.ToString());

    if (oldSelectedTurret != selectedTurret)
    {
        turretUI.Hide(oldSelectedTurret);

        //Debug.Log("Old in if Selected turret is: " + oldSelectedTurret.ToString());

        oldSelectedTurret = selectedTurret;
    }
    //Debug.Log("Current Selected turret is: " + selectedTurret.ToString());

    turretToBuild = null;

    turretUI.SetTarget(selectedTurret);
}

public void DeselectTurret(GameObject turret)
{
    if(turret != null)
    {
        Debug.Log("Turret to deselect is: " + turret.ToString());
        turretUI.Hide(turret);
        selectedTurret = null;
    }
    else
    {
        Debug.Log("Turret to deselect is null!");
    }
}

it should deselect the turret if clicked twice but instead it select the turret on first click and don't execute on second click

sentences:
Unity3d Resources.LoadAll empty array In my resources folder structure I have myself a file, now in the unity editor this file is a Texture Type Sprite (2D and UI), now when I attempt to run this code in one of my scripts

var icons = Resources.LoadAll<Sprite>("Images/BuffIcons");

My icons variable is empty, now if I change the line above to

var icons = Resources.LoadAll("Images/BuffIcons");

It comes back with an array which has a Texture2D and then multiple Sprite objects. Now why can't I cast the objects to a Sprite?

Also just for your information the Sprite (2D and UI) is a Multiple sprite so this sprite in total has like 42 different sprites. It seems to me the sprite which holds all the other sprites is classed as a Texture2D and then all the sprites inside of the Texture2D are Sprites. How can I just tell the Resources.LoadAll to load the sprites?

Basically the same problem as this user http://answers.unity3d.com/questions/900990/assetdatabaseloadallassetsatpath-not-loading-asset.html however the answers provided don't work for me either :(

sentences:
How do I stop the player from rotating when they collide with a tile? I use Touch movement and if I jump and hit a corner with the feet of my player, my player rotates but I don't want this. Can anyone help me jumping without rotating if I hit anything ?

here is my Script:

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    public float speed = 10, jumpVelocity =  10;
    public LayerMask playerMask;
    public bool canMoveInAir = true;
    Transform myTrans, tagGround;
    Rigidbody2D myBody;
    bool isGrounded = false;

    private Animator anim;

    // Use this for initialization
    void Start ()
    {
        myBody = this.GetComponent<Rigidbody2D>();
        myTrans = this.transform;
        tagGround = GameObject.Find (this.name + "/tag_ground").transform;

        anim = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void FixedUpdate ()
    {
        isGrounded = Physics2D.Linecast (myTrans.position, tagGround.position, playerMask);

        #if UNITY_ANDROID && !UNITY_IPHONE && !UNITY_BLACKBERRY && !UNITY_WINRT
        Move(Input.GetAxisRaw("Horizontal"));
        if(Input.GetButtonDown("Jump"))
           Jump();
        #endif
    }

    public void Move(float horizontalInput)

    {
            //Er klebt nicht mehr an den Waenden
        if (!canMoveInAir && !isGrounded)
            return;

        Vector2 moveVel = myBody.velocity;
        moveVel.x = horizontalInput * speed;
        myBody.velocity = moveVel;

        anim.SetFloat ("speed", Mathf.Abs (GetComponent<Rigidbody2D> ().velocity.x));

        if (horizontalInput < 0)
        {
            transform.localScale = new Vector2 (25, 25);
        }
        if (horizontalInput > 0)
        {
            transform.localScale = new Vector2 (-25, 25);
        }
    }

    public void Jump()
    {
        if (isGrounded)
            myBody.velocity += jumpVelocity * Vector2.up;
    }
}

sentences:
Is a Single Texture Cube Map Possible? I'm currently developing a test project to explore OpenGL 3 texturing abilities. I have a simple cube, made of 8 vertices and 36 indices. I want each of the cubes faces to have a different texture, so I devised this texture:

I made it obvious which sections I want visible (I hope...). In Direct3D, I once made a skybox, and I used a cubemap. However, I had to split it into 6 different textures. This is annoying and hard to manage, it would be nice to have just one texture. Is this even possible? I read somewhere that I could do this by duplicating vertices, is that a good idea? Someone else said I could do it in the shader, but that also baffles me...

sentences:
common math algorithms that aren't physics/object based I'm starting to customize my game a lot more beyond just the engine and I'm curious what sorts of algorithms and concepts exist. There are a ton of solutions for physics and geometry-like questions, but I'm curious apart from that what is the most common. I know of things like LERP, etc. What else do you find most useful?
Thanks,

sentences:
Efficient Collision detection for polygons (fleet) in an RTS I'm trying to make an RTS for android using libgdx. I would like to have collision detection to be able to detect ships inside the range of weapons and collision between my bullets and the ships.

So far my strategy has been to use a PM QuadTree that I coded myself to store every segment of every polygons. A polygon being the hitbox of a ship.

Every frame I clear and add all the segments back in the quadtree. Every segment has a reference to the ship it belongs to. When I add a ship, I add it recursively to the nodes of the quadtree based on the intersection with the bounds of a node.

Detection collision is done by polling every polygon inside a rectangle that look into every node that fit entirely or partially inside the rectangle.

My problem is that adding every ship every frame gives bad result on Android. On Desktop it is fast enough but on Android it can takes up to 100 ms just to add around 200 segments.

Is there something wrong with my implementation (it shouldn't be this slow ?) or should I use another strategy for collision detection ? I thought about clearing the quadtree only every 5 frames but it would make the detection unprecise.

I have measured that some simple math operation to calculate intersection takes up to 50 more times on my android and I'm not sure why. Surely my phone cpu is not 50 times slower than my laptop, is it ?

It's a sufficiently fast moving RTS. Often the whole fleet is moving, thus every segment.

I heard about RDC in that article. Would that be a better algorithm ? My issue is that some ships are hard to be bounded by a sphere if they're very long but not wide.

sentences:
Does pixels per unit property affect performance of the game in Unity? The Sprite import inspector has a Pixels Per Unit setting that controls the size of the sprite objects when they're added to the scene:

Will Unity resize the sprite at run time or will it be resized after me changing the property and saved for the future?

sentences:
Destructible Terrain like worms I have to develop a game with a dynamic destruction of the map, I searched the internet and even looked at some questions regarding this topic on this Website, but they did not help me much out.

I made the map with tiled and used box2d to make collision between the game objects. As a game engine we have to use Libgdx, but I dont know how to start as I had never develeped a game before, can someone give me any tipps how I could start?

with regards,

sentences:
Improving an O(N^2) function (all entities iterating over all other entities) A little bit of background, I'm coding an evolution game with a friend in C++, using ENTT for the entity system. Creatures walk around in a 2D map, eat greens or other creatures, reproduce and their traits mutate.

Additionally, performance is fine (60fps no problem) when the game is run in real time, but I want to be able to speed it up significantly to not have to wait 4h to see any significant changes. So I want to get it as fast as possible.

I'm struggling to find an efficient method for creatures to find their food. Each creature is supposed to look for the best food that is close enough to them.

If it wants to eat, the creature pictured in the center is supposed to look around itself in a 149.64 radius (its view distance) and judge which food it should pursue, which is based on nutrition, distance, and type (meat or plant).

The function responsible for finding every creature their food is eating up around 70% of the run-time. Simplifying how its written currently, it goes something like this:

for (creature : all_creatures)
{
  for (food : all_entities_with_food_value)
  {
    // if the food is within the creatures view and it's
    // the best food found yet, it becomes the best food
  }
  // set the best food as the target for creature
  // make the creature chase it (change its state)
}

This function is run every tick for every creature looking for food, until the creature finds food and changes state. It's also run every time new food spawns for creatures already chasing a certain food, to make sure everyone goes after the best food available to them.

I'm open to ideas on how to make this process more efficient. I'd love to reduce the complexity from \$O(N^2)\$, but I don't know if that's even possible.

One way I already improve it is by sorting the all_entities_with_food_value group so that when a creature iterates over food too big for it to eat, it stops there. Any other improvements are more than welcome!

EDIT: Thank you all for the replies! I implemented various things from various answers:

I firstly and simply made it so the guilty function only runs once every five ticks, this made the game around 4x faster, while not visibly changing anything about game.

After that I stored in the food searching system an array with the food spawned in the same tick it runs as. This way I only need to compare the food the creature is chasing with the new foods that appeared.

Lastly, after research into space partitioning and considering BVH and quadtree, I went with the latter, as I feel like it's much simpler and better suited to my case. I implement it pretty quickly and it greatly improved performance, the food search barely takes any time at all!

Now rendering is what's slowing my down, but that's a problem for another day. Thank you all!

sentences:
How to see the surface arc in Unity? How to see the surface arc in Unity?
There is the tutorial and in this tutorial we can see the arc in editor:

While I can not see it. I checked that all my gizmos are enabled.

How can I enable the arc?

sentences:
Every Item is colliding but 1 In my game I have a BULLET, MOONS, STARS, and A SHIP. I shoot bullets from the ship and hit stars or moons and collisions occur. Yet when a moon runs into my ship there is no detection even though I set the a Collider for 2D on both of them.

    void OnCollisionEnter2D (Collision2D col) {
        Debug.Log (this.transform.tag);//moon hit ship not printing
        Debug.Log (col.transform.tag);//only bullet hit moons and stars
    }

Heres a quick snippet
https://i.gyazo.com/acc0bbf5d2aab994db3a6598bfd206aa.mp4

sentences:
Black and white textures load as turquoise? I have some black and white, and some grayscale textures, that are loading in unity as turquoise and white textures. What is causing this and how can I fix this?  Also, can somebody verify that I am supposed to load roughness textures into the "Metallic" slot of the Standard shader? That feels so weird. I was using Principled  Shader in Blender to make the original materials. **EDIT: "Autodesk Interactive" shader has a "Roughness" input but most of my roughness textures and some b&w textures are still turquoise, what is happening...

Here is one of the problem textures (the others are too big, > 6mb):

sentences:
Are there any issues with not drawing to all render targets when using MRT? Lets say I set 2 render targets:

device.SetRenderTargets(color, depth);

And then half my draw code only outputs color and not depth. This works fine on the PC and produces the expected results however I feel like this might be an issue on the Xbox.

Are there any issues I should be aware of when using MRT while only outputing to one render target?

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:
Count number of CCSprite added to a CCLayer Does cocos2d has a method that returns the amount of CCSprites added to a CCLayer?

A have SceneControlLayer object, and I added some CCSprites to it.

@interface SceneControlLayer : CCLayer {
}

@implementation SceneControlLayer

-(id)init {

CCSprite *spr1 = [CCSprite spriteWithFile:@"spr1.png];
[self addChild:spr1 z:1 tag:1];

CCSprite *spr2 = [CCSprite spriteWithFile:@"spr2.png];
[self addChild:spr2 z:2 tag:2];

...

}
@end

How do I retrieve an array of sprites added to the layer? Could I retrieve all the objects added through addChild and test its type?

Since I'm starting with cocos2d/objectivec, please, give some examples how to do it...

I also thought that I could create an array, and, besides adding it to the layer, add it to the array also. But I'm not so sure if it's a good option.

TIA,

Bob

sentences:
Distort a quad with a World Matrix Is it possible to distort a quad multiplying its vertices by a specific world matrix? See the picture to understand what kind of distortion I need:

Please note, that the quad is in 3d space and I particularly need it's VERTICES to be distorted and NOT to rotate a perspective camera. The quad is laying on a plane with Z=0, all of the quad's vertices have their Z components equal to 0 and they should have their Z component equal to 0 after the transformation.

I know that it can quite easily be done by moving the vertices in a vertex shader, but the reason why I need to distort the quad using a World matrix is because I am rendering hundreds of such quads with a single draw call. Some of them need to be distorted and some dont. So I need a uniform vertex shader for every case and before doing branching in the shader I would like to know if such distortion can be done with a World matrix.

sentences:
How would a turn based RPG game store move information in a reusable way? Suppose I create a turn based RPG in the veins of Pokémon, with a lot of moves and abilities, that would have elements of hand made code, in cases for special effects after a successful attack or status effect, for example, a status buff every turn, or an automatic attack every turn (think rollout or outrage from Pokémon).
def move_name():
    do_primary_effect()//damage, status effect
    do_secondary_effect()//on hit effects, side-effects,
    //delayed buffs/debuffs, setting next move, i.e. rollout, etc.
    set_flags()//flags like invulnerability from moves like dig, fly, etc.

Now suppose I wanted to make this game open source and allowed people to make their own builds/rebuilds or online versions, where they might use a different language. How can I program my moves/abilities in such a way that it can be interpreted by any compiler, regardless of language, so that there is no re-coding moves for different languages?
tldr; how would I go about a format for moves/abilities such that it is compiler independent(might be the wrong word, but means can be read and translated). Now I'm not asking for a direct answer, though those are greatly appreciated, I'm talking mostly about how such a format would look like, so real life examples for existing videogames are greatly appreciated. I've heard my friend say that Pokémon does this  with a data structure, so data structures are also appreciated.

sentences:
Teamviewer doesn't show my game screen I've been building a 3D engine from scratch using C# and I've tried to show the result to a friend of mine using Teamviewer. When my demo game starts he doesn't see it.
He can only see the last active program on my screen (for example visual studio from which I started the game)

The game engine launches a windows form at start, then directx binds to this form.
It's a fullscreen application with no windows forms borders etc.

Why doesn't teamviewer pick this up?

sentences:
Cocos2d: how to add anchor points to CCSpriteBatchNode I am doing some tests with animations in Cocos2D using sprite-sheets. The animation works ok except that the anchor-point is in the center. I need to put it in the bottom. With the code below i am not able to add an anchor-point to my sprites, after quite a few tests.

Would someone nice be able to help me with this?

-(id) init {

    if((self = [super init])) {

        [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"ratHammer.plist" textureFile:@"ratHammer.pvr.ccz"];
        CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"ratHammer.pvr.ccz"];
        [self addChild:spriteSheet];
        NSMutableArray *walkAnimFrames = [NSMutableArray array];
        for (int i = 0; i <= 5 ; ++i) {
            [walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"ratHammer_anim%d.png", i]]];
    }

    CCAnimation *walkAnim = [CCAnimation animationWithFrames:walkAnimFrames delay:0.1f];

    CGSize winSize = [CCDirector sharedDirector].winSize;
    self.bear = [CCSprite spriteWithSpriteFrameName:@"ratHammer_anim0.png"];
    _bear.position = ccp(winSize.width/2, winSize.height/2);
    self.walkAction = [CCRepeatForever actionWithAction:
                       [CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
    [_bear runAction:_walkAction];
    [spriteSheet addChild:_bear];

}
return self;

}

sentences:
What is an equivalent of Swift's UIScreen.mainScreen().bounds in Unity 2d? Basically, I am from a Swift SpriteKit background where UIScreen.mainScreen().bounds is a CGRect which represents the screen and can be manipulated in various ways like getting the middle of the screen by using

var screenCenter = CGPointMake(UIScreen.mainScreen().bounds.width/2, UIScreen.mainScreen().bounds.height/2)

What is an equivalent of UIScreen.mainScreen().bounds in Unity (C# Scripting) that can manipulated to get various positions in a similar manner?

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:
When should I clear an auxilliary render target? I'm using a few different render targets in my game in addition to the back buffer. These other render targets are only used in a few places, for specific tasks.

I'm wondering when I should be clearing them. Right now I clear all of my render targets at the beginning of the frame, and it seems like I'm waiting for all the textures to clear before the rest of the drawing gets underway.

Would it be more efficient to clear these textures later in the frame, when they aren't being used? Is there any hope of the GPU sort of clearing them "on the side" while unrelated rendering is happening? Or are these tasks always sequential and will I always need to wait for clearing?

sentences:
Matrix transforming with translation/rotation/scale at center of screen I'm trying to create a camera using matrix transforms, the gist is as follows:
Transform =
     Matrix.CreateRotationZ(Rotation) *
     Matrix.CreateTranslation(new Vector3(-Position.X, -Position.Y, 0)) *
     Matrix.CreateScale(Zoom) *
     Matrix.CreateTranslation(new Vector3(Bounds.Width * 0.5f, Bounds.Height * 0.5f, 0));

It works but with one issue. The rotation origin remains at the starting (-Position.X, -Position.Y) while the zoom works fine (at the center screen) which is obvious from the code. I'd like the rotation to occur at the center screen as well.

sentences:
How is raycasting implemented I know what it's used for, I know what it does.

What I am essentially asking is what is the math/code behind how it works?

I'm aware that any custom implementation would likely be slower than an engines official implementation, I just am interested in how it works.

sentences:
Does destroying body also destroys the sprite? Suppose a sprite is attached to a box2d body.
And
world.destroyBody(b); is getting called then the sprite also get destroyed or it stays there in memory.
In my situation lots of box2d bodies are getting created and destroyed and after a delay of few seconds the sprite disappears.
Here's the snippet of where body is getting destroyed:

    @Override
public void act(float delta) {
    super.act(delta);
    camera.update();
    world.step(1/60f, 6, 3);
    if (enemy_destroy) {
        Array<Body> bodies = new Array<Body>();
        world.getBodies(bodies);
        for(int i = 0; i < bodies.size; i++) {
            Body b = bodies.get(i);
            if (b.getUserData() instanceof Boolean) {
                world.destroyBody(b);
                b.setActive(false);
            }
        }
    }
}

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:
XNA 4.0: 2D Camera Y and X are going in wrong direction I asked this question on stackoverflow but assumed this might be a better area to ask it as well for a more informed answer.

My problem is that I am trying to create a camera class and have it so that my camera follows the proper RHS, however the Y axis seems to be inverted since on the screen the 0 starts at the top.

Here is my Camera2D Class:

    class Camera2D
    {
        private Vector2 _position;
        private float _zoom;
        private float _rotation;
        private float _cameraSpeed;
        private Viewport _viewport;
        private Matrix _viewMatrix;
        private Matrix _viewMatrixIverse;

        public static float MinZoom = float.Epsilon;
        public static float MaxZoom = float.MaxValue;

        public Camera2D(Viewport viewport)
        {
            _viewMatrix = Matrix.Identity;
            _viewport = viewport;
            _cameraSpeed = 4.0f;
            _zoom = 1.0f;
            _rotation = 0.0f;
            _position = Vector2.Zero;
        }

        public void Move(Vector2 amount)
        {
            _position += amount;
        }

        public void Zoom(float amount)
        {
            _zoom += amount;
            _zoom = MathHelper.Clamp(_zoom, MaxZoom, MinZoom);
            UpdateViewTransform();
        }

        public Vector2 Position
        {
            get { return _position; }
            set { _position = value; UpdateViewTransform(); }
        }

        public Matrix ViewMatrix
        {
            get { return _viewMatrix; }
        }

        private void UpdateViewTransform()
        {
             Matrix proj = Matrix.CreateTranslation(new Vector3(_viewport.Width * 0.5f, _viewport.Height * 0.5f, 0)) *
                           Matrix.CreateScale(new Vector3(1f, 1f, 1f));

             _viewMatrix = Matrix.CreateRotationZ(_rotation) *
                          Matrix.CreateScale(new Vector3(_zoom, _zoom, 1.0f)) *
                          Matrix.CreateTranslation(_position.X, _position.Y, 0.0f);

             _viewMatrix = proj * _viewMatrix;

        }

    }

I test it using SpriteBatch in the following way:

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.CornflowerBlue);
    Vector2 position = new Vector2(0, 0);
    // TODO: Add your drawing code here
    spriteBatch.Begin(SpriteSortMode.Immediate,
        BlendState.AlphaBlend,
        null,
        null,
        null,
        null,
        camera.ViewMatrix);

    Texture2D circle = CreateCircle(100);
    spriteBatch.Draw(circle, position, Color.Red);
    spriteBatch.End();

    base.Draw(gameTime);
}

sentences:
SceneManager.LoadScene doesn't seem to be working in Unity IDE I'm in the start screen scene of my game and I'm trying to load the actual game. I use the following code:

public void LoadGame(){
        SceneManager.LoadScene ("Main", LoadSceneMode.Single);
    }

I set this method to be called when a button in the UI is clicked. When testing in the game in the unity IDE, clicking the button doesn't do anything. Is my code wrong, is the IDE screwing up, or will clicking the button never do anything in the ide?

sentences: Do I need to ask Microsoft for permission to use their products logo? I am currently making a trailer of my game for my college project, I would like to note that my game is cross platform. Do I need to ask for permission to use those images in such situation? - When I want to say that their game will be on playable on Windows/Mac/Linux.

sentences:
Circle-Rectangle collision resolution I have a non axis aligned rectangle, like a car, in my game. I have to check and resolve the collision between the rectangle and circle, which is stationary.

I have found lots of ways to determine the collision, but couldn't find anything on resolving it. It is clear that i have to push back the rectangle away if there is a collision, but I can't find a proper way.

Is there a way of handling and resolving the collision between a rectangle and a circle? Like an algorithm?

I am developing in c++.

sentences:
how to reset etsa function GetJoystickNames in unity? the problem is that if I connect a command the array
GetJoystickNames increases an index but if you disconnect it does not reduce the index and continues counting as if it were connected

sentences:
Client-Server RTS networking with lockstep and lag The peer to peer lockstep networking model would seem to indicate that everyone's input is delayed the same amount. And so this would indicate that everyone would feel the same lag in response to their input.

But in Warcraft 3 from playing many custom games it is clear that the creator of a custom game has much faster response time to their input. How can this be given the lockstep model?

sentences:
SFML - How to implement a simple 2D lighting system Lately, I've been reading a lot about 2D lighting systems in a game, and have observed just how much lighting can add to a game's graphics appeal. However, as for implementing one of these in SFML, I am clueless. The lighting system I would like doesn't have to be too complex - I don't need things such as shadows. What I would like is something like this, which I made in Java using swing:

How this works:

I draw a black rectangle over the whole image with an alpha that changes based on the in-game time of day - 0 during the day, 128 during the night.
On top of that rectangle, I draw a gradient on top of the player's x and y coordinates - from (255, 255, 255, 100) to (0, 0, 0, 0)

What would be the ideal way to impement this in SFML?

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:
How to open auto detect LAN connections? After sucessfully creating my first online multiplayer with servers and clients in UDP, I am wondering how LAN connections works. As it is right now, I need to open a server and forward the ports for the server if public. In LAN, they connection is possible but requires the local IP address.

However, if we take Minecraft or Starcraft, the game is able to auto detects servers on your local network.

How are they achieving this ?

sentences:
How to Bind Multiple Shapes/Models to One Vertex Buffer? If I have two Vertex Arrays, one for Square, and one for Triangle; what is the best way to bind them to the VertexBuffer?

What are the patterns used to write multiple vertices to the VertexBuffer?  Streams?  Vectors?  Is there an Add, (+) overload that can be used like .pSysMem += anotherMesh.GetVertices()?

Is this possible with objects that have different numbers of Vertices?
Is this possible with objects that have different buffer element descriptions, (one with float4 position data, and another with float3 and texcoords, etc)?

Currently, I am binding one Shape, (a triangle), to the subresource like this:

ModelRenderer::StaticBufferDescription.ByteWidth = bufferSize;
ModelRenderer::StaticBufferDescription.BindFlags = D3D11_BIND_VERTEX_BUFFER;

ModelRenderer::StaticSubResourceData.SysMemPitch = 0;
ModelRenderer::StaticSubResourceData.SysMemSlicePitch = 0;
ModelRenderer::StaticSubResourceData.pSysMem = model->GetVertices();

DeviceManager::Device->CreateBuffer(
    & ModelRenderer::StaticBufferDescription,
    & ModelRenderer::StaticSubResourceData,
    & ModelRenderer::StaticBuffer);

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:
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:
Can I have keyboard controls in an MMO and still do movement calcuation in the server? I'm trying to decide between keyboard and mouse movement controls for a web-based multiplayer. It would be quite resource-intensive to use the WASD-keys and AJAX the server with controls every second.

Can I implement WASD-key movement and still have the server do all the movement calculations (to deter cheating)?

sentences:
What to do with input during movement? In a concept I'm working on, the player can move from one position in a grid to the next. Once movement starts it can't be changed and takes a predetermined amount of time to finish (about a quarter of a second).

Even though their movement can't be altered, the player can still press keys (perhaps in anticipation of their next move). What do I do with this input?

Possibilities i've thought of:

Ignore all input during movement.
Log all input and loop through them one by one once movement finishes.
Log the first or last input and move when possible.

I'm not really sure which is the most appropriate or most natural. Hence my question:

What do I do with player-input during movement?

sentences:
Simplyfing/dissolving octree to simple boxes by adjacent octants with similar traits I am looking forward to create a navigation volume to be utilized by AI actors.

The approach I am trying to tackle here is to first generate an octree and associate with respectable flags/data (type, what's contained for now). The octree is going to be fairly deep (up to 0.1 units).

This is the scene I am using for testing purposes:

results in 1947817 nodes in 9 levels. (22 x 9 x 22)

I am looking for an algorithm/concept/pseudo-code that would transform this octree into non-uniform, axis-aligned boxes derived from octants that match certain flags/data, that would, for instance, help me determine the navigation volume similar to what can be seen here (Havok):

With "I am looking for" - I have a feeling of such an algorithm/concept already existing, though, I am not sure. The feeling drives me towards this being a fairly mathematical problem that resides behind a common name.

The other approach would be to utilize a non-uniform grid (creates 4356000 cells) for the detailed shape to then be expanded (simplified) down to some boxes. Which my feeling tells, would utilize the same algorithm.

As for the "what have you tried part" - well... I have googled for some time with various combinations from keywords grid, merge, cell, flags, occupied, gamedev, octant, grow, largest space, adjacent and maybe some others to no avail.
Well, before pushing the Post button, I did try some more keywords and ended up with this answer: https://gis.stackexchange.com/questions/23365/how-to-combine-adjacent-polygons-sharing-similar-trait-into-single-polygon which appears to be close to what I am looking for, except that it's 2D (though, I gave the keyword "polygon" for this query). Having learned that the process is called "dissolve", I made some more attempts with various combos with added word "dissolve". And through my findings some more searches and so on... Well... nothing.

If the answer wont yield any results, I know that I could attempt this by raying the hell out of the graph by starting at either corner and flooding through it all, basically, brute forcing my way.

So...

Is the common algorithm/concept already out there, that I could be pointed towards?;
or - what guidelines should I follow to produce such a product?

sentences: Is there a Box2d b2World::ShiftOrigin function in Libgdx? Is there an equivalent Box2d b2World::ShiftOrigin function in Libgdx? I can't seem to find it.

sentences:
Flash animation or Sprite sheet animation good for Unity mobile games I would like to develop dress-up and cooking kind of games. So it needs lots of animations. Our designers done the animations in the lash. I found the plugins callued GAF and UniSWF to convert flash animation to Unity or We can convert animations into sprite-sheets and animate them in Unity, But i don't know which one is the best way to do animations for mobiles with better performance and lower game size.

Any kind of suggestion is good. Thank you!

sentences:
How do i calc what side the ball is of the rect? I have this nice drawing:

http://bildr.no/view/1085283

I know the ball's center and the rectangle's center, but how do I know (programming C#) what side of the rectangle the ball is?

By my drawing, the answer in this case should be the right side.

sentences:
Part of model in Unity is inside out but not in Blender? I've downloaded this asset and it looks perfectly fine in preview, and even in blender.

But when I import it in Unity, one of its shoulder is inside out, even after making all faces double sided.

I also tried switching the normal mode in the import settings to Calculate.

What causes this issue and how could I fix this?

sentences:
Monobehaviour script method does not appear as an option for UI button's On Click I have the following script, and when I try to use a UI button to call the CheckGuess method,  it does not appear as an option:

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

public class Guessthenumbergame: MonoBehaviour
{
    public InputField input;

    public Text infoText;

    private int guessNumber;

    private int userGuess;

    // Start is called before the first frame update
    void Start()
    {
        guessNumber = Random.Range(0, 100);

    }

    // Update is called once per frame
    public void CheckGuess()
    {
        userGuess = int.Parse(input.text);
        if (userGuess == guessNumber)
        {
            infoText.text = "You guessed the number right";
        }else if (userGuess > guessNumber)
        {
            infoText.text = "Your number is higher";
        }else if (userGuess < guessNumber)
        {
            infoText.text = "Your number is lower";
        }
        input.text = "";
    }
}

sentences:
How to deal with Character body parts from Design to Cocos2d I'm trying to figure out the pattern the game developers use together with game designers:

See the picture below with the independent parts:

Questions:

1) Should I create different image parts from different body parts or keep frame by frame animaton? (I know both can be used, but I'm trying to figure what is commonly used in the industry)

2) If I'm going to generate different image parts from different body parts (which is I thing is more logical) how would I export that to Cocos2d (Vector or Bitmap)?

sentences:
Tile based isometric depth sorting on different size objects. I am creating a tile based isometric game.

The problem we are having is with depth sorting, we tried a lot of methods but none work.

They all do a great job but its not perfect, they seem to bug sometimes.

We have tiled objects of different sizes, like 2x2, 2x6, 3x4. This makes it so hard.

We are trying to avoid slicing the bitmaps.

Anyone has a idea?

sentences:
Changing colour while keeping gradient I'm making a Flash game with ActionScript 3 and I have a square with a gradient applied to it. I am trying to programmatically changing the colour of the square depending on time, for example, some times it is orange, some times it is red, but it must always fade to black at the bottom.

The problem is, I'm using ColorTransform (as per here) but it seems to overwrite the gradient and simply fill the square with the solid colour. This isn't what I want. I want the colour that is chosen to fade to black at the bottom, like the original gradient.

How can I do this? Is there a way to only change the "hue" of the symbol (IE: not filling the entire thing with a solid colour), or will I have to reapply a gradient programmatically, with the desired colours?

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:
Character falls through the Platform Effector 2D in Unity. How can I fix it? Character falls through the Platform Effector 2D in Unity. How can I fix it?
Here is the demonstration: https://imgur.com/G5YkTxa.
I tried changing the Edit - Project Settings... - Physics 2D - Default Contact Offset from the current 0.01 value to the 0.1 value. The result is the same and here is the demonstration of it: https://imgur.com/3TAOsNY.
Here are my settings for the platform:

Here are my settings for the character's RigidBody 2D:

Here is what character colliders look like when my character runs: https://imgur.com/CTialU3.
I basically run the recorded inside Unity animation of running and move my character with the help of the:
        private void FixedUpdate()
        {
            ... some code which computes the velocity vector depending on the input (the pressed buttons)
            characterRigidBody2D.velocity = velocityVector;
        }

I googled for a while now similar issues, but was not able to find a solution. I want to avoid the character falling down randomly during running.

sentences: How to connect Google Domain to AWS ELB url I have recently uploaded a server with node js in my AWS environment and added a HTTPS listener in my load balancer. Also generated a certificate using ACM(AWS certificate manager) for my google domain and added it in HTTPS Listener. Added .ebextensions folder to upgrade Websocket in Proxy server. I have no Idea how can I connect my domain to my beanstalk app which url is something like "myapp.region.elasticbeanstalk.com" so that I can connect as "wss://MyGoogleDomain.com". Can you guys help me? I am new to this.

sentences:
Controlling loop frequency in a Coroutine I want this coroutine to execute continuously and change the colors. But right now it just waits 1 second at the start and then loops the Coroutine very fast.

So my question is how can I loop the Coroutine every 2 seconds.

public class control : MonoBehaviour
{
    public bool gravity = false;
    public bool m_isRunning = false;
    public SpriteRenderer m_spriteRenderer;
    private Rigidbody2D rb;

    private void Update()
    {
        if (gravity)
        {
            rb.gravityScale = 1;
        }

        StartCoroutine("Changecolor", 3f);
    }

    private void Start()
    {
        m_spriteRenderer = this.GetComponent<SpriteRenderer>();
        rb = GetComponent<Rigidbody2D>();
    }

    private IEnumerator Changecolor() <--- this coroutine
    {
        yield return new WaitForSeconds(1);

        int random = Random.Range(1, 4);
        if (random == 1)
        {
            m_spriteRenderer.color = Color.blue;
        }
        else if (random == 2)
        {
            m_spriteRenderer.color = Color.red;
        }
        else if (random == 3)
        {
            m_spriteRenderer.color = Color.green;
        }
        else
        {
            m_spriteRenderer.color = Color.yellow;
        }

        this.StartCoroutine("Changecolor", 3f);
    }

    private void OnMouseDown()
    {
        gravity = true;
    }
}

sentences: Android emulator with acceleration and gyroscope simulation Is there an Android emulator that is compatible with eclipse that can simulate acceleration and tilting of a mobile device?

sentences:
Importing code from unityscripts To encourage code reuse- i want to import methods and classes defined in my core unityscripts to be imported into other unityscripts. How do i go about this?

Note: An answer here seems too complicated for such a simple thing (i come from Python).

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:
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:
Tessellation Texture Coordinates Firstly some info - I'm using DirectX 11 , C++ and I'm a fairly good programmer but new to tessellation and not a master graphics programmer.

I'm currently implementing a tessellation system for a terrain model, but i have reached a snag. My current system produces a terrain model from a height map complete with multiple texture coordinates, normals, binormals and tangents for rendering. Now when i was using a simple vertex and pixel shader combination everything worked perfectly but since moving to include a hull and domain shader I'm slightly confused and getting strange results. My terrain is a high detail model but the textured results are very large patches of solid colour.

My current setup passes the model data into the vertex shader then through the hull into the domain and then finally into the pixel shader for use in rendering. My only thought is that in my hull shader i pass the information into the domain shader per patch and this is producing the large areas of solid colour because each patch has identical information. Lighting and normal data are also slightly off but not as visibly as texturing.

Below is a copy of my hull shader that does not work correctly because i think the way that i am passing the data through is incorrect. If anyone can help me out but suggesting an alternative way to get the required data into the pixel shader? or by showing me the correct way to handle the data in the hull shader id be very thankful!

cbuffer TessellationBuffer
{
    float tessellationAmount;
    float3 padding;
};

struct HullInputType
{
    float3 position : POSITION;
    float2 tex : TEXCOORD0;
    float3 normal : NORMAL;
    float3 tangent : TANGENT;
    float3 binormal : BINORMAL;
    float2 tex2 : TEXCOORD1;
};

struct ConstantOutputType
{
    float edges[3] : SV_TessFactor;
    float inside : SV_InsideTessFactor;
};

struct HullOutputType
{
    float3 position : POSITION;
    float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
    float2 tex2 : TEXCOORD1;
    float4 depthPosition : TEXCOORD2;
};

ConstantOutputType ColorPatchConstantFunction(InputPatch<HullInputType, 3>        inputPatch, uint patchId : SV_PrimitiveID)
{
    ConstantOutputType output;

output.edges[0] = tessellationAmount;
output.edges[1] = tessellationAmount;
output.edges[2] = tessellationAmount;
output.inside = tessellationAmount;

return output;
}

[domain("tri")]
[partitioning("integer")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(3)]
[patchconstantfunc("ColorPatchConstantFunction")]

HullOutputType ColorHullShader(InputPatch<HullInputType, 3> patch, uint pointId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID)
{
   HullOutputType output;

output.position = patch[pointId].position;
output.tex = patch[pointId].tex;
output.tex2 = patch[pointId].tex2;
output.normal = patch[pointId].normal;
output.tangent = patch[pointId].tangent;
    output.binormal = patch[pointId].binormal;

    return output;
}

Edited to include the domain shader:-

[domain("tri")]

PixelInputType ColorDomainShader(ConstantOutputType input, float3 uvwCoord :    SV_DomainLocation, const OutputPatch<HullOutputType, 3> patch)
{
    float3 vertexPosition;
    PixelInputType output;

// Determine the position of the new vertex.
    vertexPosition = uvwCoord.x * patch[0].position + uvwCoord.y * patch[1].position + uvwCoord.z * patch[2].position;

    output.position = mul(float4(vertexPosition, 1.0f), worldMatrix);
    output.position = mul(output.position, viewMatrix);
    output.position = mul(output.position, projectionMatrix);

    output.depthPosition = output.position;

     output.tex = patch[0].tex;
     output.tex2 = patch[0].tex2;
     output.normal = patch[0].normal;
     output.tangent = patch[0].tangent;
     output.binormal = patch[0].binormal;

    return output;
}

sentences:
World rotation independent mouselook Preface: I am terrible at using quaternions right.

I wanted to create a world rotation independent mouselook script. That is, no matter the 'down' for the camera, the mouselook should feel natural to the player in relation to what is displayed on screen.

I now have the following script running on update in my camera:

        Quaternion worldRot = Quaternion.LookRotation(Vector3.forward, Vector3.left);

    xRot += -rotSpeed * Input.GetAxis("Mouse Y");
    yRot += rotSpeed * Input.GetAxis("Mouse X");
    transform.rotation =
        Quaternion.AngleAxis(yRot, worldRot * Vector3.up) *
        Quaternion.AngleAxis(xRot, worldRot * Vector3.right) *
        worldRot;

Unsurprisingly, it tumbles all over the place. I think the issue is in basing the rotation angles on the worldRot (World rotation as seen by the camera), while then also rotating the whole by worldRot. I cannot get my head around how else to go about it, though...

My initial alternative was to use

        transform.rotation =
        Quaternion.AngleAxis(yRot, Vector3.up) *
        Quaternion.AngleAxis(xRot, Vector3.right) *
        worldRot;

But this anchors the mouse's movements to the world rather than the camera, which as described above isn't desired either.

Based on this (or, perhaps, in a completely different way), how do I make a mouselook system with an arbitrary down vector?

sentences:
FMB alteration based on derivative and noise value I'm still working on my procedural terrain generation and kind of sniffing ideas from Sean Murray (No Mans Sky programmer). So I watched this GDC17 presentation, but some things just don't make sense to me:

Altering amplitude based on currentGain AND noise value? This just makes all heights (large noise val like 1) do no alteration and the small ones to make the amplitude really tiny. How does that represent Altitude Erosion?

The audio also doesn't help much, has he isn't going into code detail.

Any ideas to makes sense out of this?

sentences:
How to change application surface size without changing view size? (GMS2) I am working on a pixel art project in GameMaker 2 with native resolution 428x240. In order to enable "subpixel" rending, I am trying to increase the resolution of my application_surface, but keep my view at its native resolution.

I am trying to increase the resolution of my application_surface by two, but keep my view at the native resolution. I have tried a few different things, but no matter what I do, I can't get it to work consistently.

Here is what I tried most recently:

surface_resize(application_surface, native_width * 2, native_height * 2);
camera_set_view_size(view_camera[0], native_width, native_height);

This works, but when I change rooms, the view resets to the size of the application surface, resulting in something like this:

It seems like every time you change rooms, the view size gets reset to the size of the application surface.

I tried iterating through all rooms and setting their view size to my native resolution on launch, but it doesn't seem to help.

How can I prevent the view from changing sizes on room change? I want to lock it at my native resolution.

sentences:
How do I enable a Box Collider when a timer reaches 0? I'm pretty new to Unity, and I am trying to enable a BoxCollider from another object when the timer reaches 0, using this code:

using UnityEngine;

public class Testv2 : MonoBehaviour
{
    public GameObject otherGameObject;

    private BoxCollider Target;
    public float timeLeft = 30.0f;

    void Awake()
    {
        Target = otherGameObject.GetComponent<BoxCollider>();
    }

    void OnMouseDown()
    {
      timeLeft -= Time.deltaTime;
    }

    void Update()
    {
        if (timeLeft < 0)
        {
            Target.enabled = true;
        }
    }
}

My issue is that the timer won't go down unless I keep clicking on the object. How do I enable the timer to start when someone clicks an object, and start counting down?

sentences:
How much of a game can be protected by law? I want to remake an old multiplayer game in commercial way and I wonder how different my game has to be not to violate some IP rights. I know so far that name and logo are registered trademarks of the company that still exists so I cannot use it. But ...
How about other things such as maps or mechanics of the game? Can this be somehow protected?
If I make a new map that will NOT use a single asset from that old map (like textures, sounds or models) but will mimic the old map as much as possible, can this be problem from legal point of view?
By mimic I mean for example putting tree in excactly same position as on the old map, but the tree would be completely different model; buildings would have same plans but all the models and walls textures would be different.
Also this game has some certain amount of features (players classes, mission scenarios, types of weapons) that are being used in other games commonly so this cannot be patented.
But how about given set of these features? For example having given types of classes connected with given missions scnarios and types of weapons can be protected even though seperately they cannot be???
Is that possible?

sentences:
Doing legacy DirectX Coding on Windows 10 I decided to study couple of old computer graphics books like Andre LaMothe's Tricks of 3D Game Programming Gurus. I feel like this book is full of great general computer graphics knowledge and I want this to be an exploration.

The problem is, since the book is old, it uses a very old DirectX API. It is DirectX 7 I guess. I want to be able to code the presented ideas myself and I have a Windows 10 machine. And I have couple of more old books which uses old APIs like DirectX 7 and 8. The question is;

What are my options if I want to code the examples in these books? Is there a way to write DirectX 7,8 and 9 code in Windows 10? I checked the articles "Where is the DirectX SDK?" from MSDN but they are mainly about how to move from D3D9 to new APIs. I want to code in those APIs for the sake of doing the exercises in the book, not move from those APIs. I think this should be possible because I am playing games from these eras in my computer today. If my computer is able to run them, there should be a way for me to write them as well.

If this is not possible or is very hard, how hard it would be for me to convert and try these ideas on modern OpenGL while I read the books?

In the case that I am completely lost, do you think I can still learn the computer graphics ideas presented in the books by reading the code and making sense of it, even if I don't code them myself?

NOTE: I have fundamental knowledge of computer graphics and modern OpenGL. It is not like I am choosing these books to begin my CG exploration. There are probably better, modern books for those and I read couple of them. The reason I want to read these books is because I like old books :) and I want to explore old wisdom lay in these.

sentences:
How do game engines like Unity and Game Maker exports to other platforms? From what I understand, if you want to export a Unity or GameMaker game from the editor, the game needs to be compiled to create an executable. I thought that to produce a Windows executable, you needed to be on Windows. How does Unity and GameMaker compile to Mac and Linux, if the engine is running on Windows? Likewise, How do they export to Android and iOS? Do they use the NDK for Android? What about WebGL?

How does the export actually work? Do they use a cross-platform framework written in some programming language, and when you do things with the editor it generates code using that programming language and framework, so that when you export, that code gets compiled? For WebGL, since the UnityScript code doesn't get compiled, can we see the .js files with the code?

sentences:
How to properly scale SCNNode so SCNPhysicsShape would be scaled for model too? It stays in old size I wrote a script that would match all models in one size, no matter the original size of source model. So now I have these models fit precisely in the scene, but unfortunately when I'm adding SCNPhysicsBody to them (with SCNPhysicsShape) - their colliders (shapes) are old-sized. They do not match the current scale of a node.
How to fix this?

sentences: Trouble programming JInput for game controller Due to lack of reasonable documentation, I have not been able to program inputs for using a game controller. The most I have ever found was how to detect if a controller is found and what it's name is. Does anyone know of a reliable tutorial on how to program controller buttons to perform any actions?

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:
Parallax Background Size If I have three scrolling/continuous parallax backgrounds, what should be the ideal size (width/height) of the background images assuming I am going to support all devices including the new iPad?

UPDATE:

Only landscape mode
Deployment Target: 4.2+
Same scene will be repeated.

sentences:
Virtual game dimensions - how to implement? I'm creating a fighting game in LibGDX with a static board, camera moves only right<>left.

There are 5 screen aspect ratios in Android and Apple so I have created 5 different background graphics:

2560x1440 16:9
2560x1920 4:3
2700x1800 3:2
3000x1800 5:3
3200x2800 8:5

Each background width is multiplied by 1.5, cause I need to zoom-out the game when players are too far away from each other, so for example 16:9 isn't 2560x1440 but 3840x1440. (I just realised that I should expand the height too LOL, gamedev is a fantastic place).

When I load the background I check the screen size and scale the background to fit.

The thing I need to implement is: Virtual Coordinates which are the same for each device.

Let's get the screen below:

I need to set virtual board dimensions to for example 2000x1000 units/meters whatever.

When the server sends a message:
Spawn a bomb on (1000,1000), left device spawns it at x=512, right device at x=960 (both on the half).

I think working on pixels is a bad idea, cause I would need to calculate things with each move, jump etc.

If someone could help me, how should I achieve this, I would be grateful for pointing me a way.

Thanks!

sentences:
Using xinput vibration with java I need to use vibration for my java game, which is only available through xinput since I use xbox controllers. How can I achieve this with jna? I've never worked with dlls before so any help is appreciated. I looked at some tutorials but I haven't found anything about using structures (specifically XINPUT_VIBRATION vibration;) and such.

This is what I want to do in the DLL:

XINPUT_VIBRATION vibration;
ZeroMemory( &vibration, sizeof(XINPUT_VIBRATION) );
vibration.wLeftMotorSpeed = 32000; // use any value between 0-65535 here
vibration.wRightMotorSpeed = 16000; // use any value between 0-65535 here
XInputSetState( i, &vibration );

The above is taken from http://msdn.microsoft.com/en-us/library/windows/desktop/ee417001(v=vs.85).aspx#setting_vibration_effects

Thanks!

sentences:
Adding Openai's GPT3 to a Unity project? I have a text-based project and it has a slot open for Openai's GPT3 model. My project has a terminal module where the user receives emails, I want to go a step further and allow the user to respond to such emails and get some unique response.
Here is a rundown of how I want it to work: User receives "email", they respond to it, GPT3 steps in and feeds a response into a new "email".
So how would I approach this? I think this could be pretty interesting as GPT3 hasn't been implemented in any games yet. I am aware that some beefy hardware may be required but my development computer is quite beefy enough.
P.S. Sorry if my title isn't specific enough, closest thing I could think of for this situation.

sentences:
Developing a game using opengl Hello Everyone,
               I want to create a game using OPEN GL to learn basics of the game development. I know C++ and OOPS and can manage the coding. I have tried using the free engines on the market like Unreal Engine, Unity and Game Maker. Unreal Engine in particular doesn't work well on my System due to it's higher requirements. Even all other engines have some kind of abstraction to themselves. I have time to spare. So, please suggest me a starting point to start developing using OPEN GL and also the math required to create them. All I want to do is learn it thoroughly at the lower level.
Thanks in advance

sentences:
How to implement collision detection of portals? For example, take this scenario (excuse my horrible drawing skills):

This is based on "Portal", where the stickman is going through the blue portal (which is linked to the red portal), but there is a wall stopping him on the red portal. Therefore he cannot go completely through the portal.

So my question is this: How do I do the physics/collision detection with them? Do I slice the player? Is there a way to link them? Are there any physics engines that support doing this? If not, how would I make one?

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:
Implementing a time scale in game with fixed physics update I'm currently putting together my game loop based on the "Fix Your Timestep" article at gafferongames.com. This is going fine, but I'm also trying to implement a 'time scale', i.e. a way to control the game speed.

Currently, the delta time is added to an accumulator, and then a loop iterates the physics as many times as there are multiples of the fixed time step in the accumulator.

Now, if I want to add a time scale, I should multiply the delta time by some factor, 0.5 for half speed or something, yes?

Here are my questions:

Should I still use the real fixed time step (prior to multiplication) to determine how often the physics is iterated, but perform the actual calculations with the increased or decreased time step? Or should I use the new time step for both, but surely this would just result in the same behaviour but with higher resolution calculations?

Wait, wait, wait. I have to affect the accumulator too, right? Then it would increase by a smaller frame time, but it would do the right amount of iterations with smaller dTs, over the right amount of time (the real delta time). That'd do it, right?

Given that the purpose of the fixed time step is to perform stable physics calculations, how can I combine these two concepts without jeopardising that stability?

Is it simply that LARGE time steps cause instability? Can I therefore slow down as much as I like? Or is it the variations in time step that causes instability?

Thanks

sentences:
Unity editor PropertyDrawer custom button I has a PropertyDrawer, everything goes fine, except one feature: I can't figure out how to add button and I use checkbox instead

using UnityEngine;
using UnityEditor;
using System.Collections;

[CustomPropertyDrawer (typeof (InteractiveObject))]
class InteractiveObjectPropertyDrawer : PropertyDrawer {

public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) {

    EditorGUI.BeginProperty (position, label, property);
    position = EditorGUI.PrefixLabel (position, GUIUtility.GetControlID (FocusType.Passive), label);
    var indent = EditorGUI.indentLevel;
    EditorGUI.indentLevel = 0;
    Rect colorRect = new Rect (position.x, position.y, 40, position.height);
    Rect unitRect = new Rect (position.x + 50, position.y, 90, position.height);
    Rect nameRect = new Rect (position.x + 150, position.y, position.width - 150, position.height);

    EditorGUI.BeginChangeCheck();
    EditorGUI.PropertyField (colorRect, property.FindPropertyRelative ("show"), GUIContent.none);
    if (EditorGUI.EndChangeCheck() ) {
        RenderSettings.skybox.SetColor("_highlight", property.FindPropertyRelative ("id").colorValue);
    }

    EditorGUI.PropertyField (unitRect, property.FindPropertyRelative ("name"), GUIContent.none);
    EditorGUI.PropertyField (nameRect, property.FindPropertyRelative ("name"), GUIContent.none);
    EditorGUI.indentLevel = indent;
    EditorGUI.EndProperty ();
}
}

How I can add button there?

sentences:
libgdx - collision detection with tiled map java currently, I am working on a 2d rpg game which is similar to final fantasy 1-4. I can load up a tiled map and the sprite can walk freely on the map. However, I will like to create a wall for it to stop walking through it.

I created three tiled layer Background, Collision, Overhead and one  Collision object layer with rectangles only.

"How do I handle collisions with the object layer in the tiled map?"

"Do I have to create every single rectangle that is in the object layer with Rectangle rectangle = new Rectangle() and rectangle.set(x, y, width, height)in the code?"

Thank you very much in advance. Any help is greatly appreciated!

sentences:
How to place an object at the mouse position? How can I place a object to position where I clicked in just x,y axis not in z,
I am trying to achieve it with

Vector3 mousepos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
object.transform.position = new Vector3(mousepos,mousepos);

but it does not seem to work, in fact the object doesn't even move.

sentences:
How to rotate object just like in the scene? Look at this image, I selected an object and pivot is set to local:

When I rotated selected object in the scene by X axis, it rotates exactly I wanted.

But if I rotate axis from inspector or script, it doesn't rotated to desired angle.

I'm not sure, but it seems it's related about Quaternion, but everything I tried doesn't worked well.

How do I rotate that object just like in rotated from scene?

sentences:
Tiling 2D textures in random order I am wondering what the best way to make a random set of 2D textures. Currently I have tried the follow code but I am aware that when this comes to collisions that would be an issue. Therefore I would really appreciate a different method of achieving this.

Random random = new Random();
        for (int i = 0; i < 10; i++)
        {
            GenPos = new Vector2((800 + (Length * Stone.Width)), (500 - (i * Stone.Height)));

            int number = random.Next(1, 3);

            if (i == 9)
            {
                if (Length < 31)
                {
                    i = 0;
                    Length++;
                }

            }
            else if (number == 1)
            {
                spriteBatch.Draw(Stone, GenPos, Color.White);
            }
            else if (number > 1)
            {
                spriteBatch.Draw(Grass, GenPos, Color.White);
            }

        }

This code works except for two critical things, the collision detection method dose not work as the GenPos changes throughout the code and that the Stone and Grass flashes. Also note that the grass is just a place holder for a future texture of Iron_Ore. I am wondering what the best method for achieving this would be because I need it to be able to detect collisions using a similar detection method to:

public Boolean StonePlayerCollision()
    {
        if (playerPosition.Y >= (StonePosition.Y + Stone.Height) && playerPosition.Y <= StonePosition.Y ))
        {
            return true;
        }
        else
        {
            return false;
        }

    }

If you are to suggest a new method, which would be much better than maintaining this messy system please note that the Tiled area will need to be in the view matrix method as seen below:

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend,
            SamplerState.LinearWrap, null, null, null, camera.ViewMatrix);

I hope that someone will be able to suggest the best / most efficient way of making a randomly tiled textures that can be detected by collisions.
Thank You.

sentences:
i want to move arrow by dragging and than want to toss/throw when i give swipe event In My Application I Have One Arrow Image With Fix Center and i Can rotate it by touch move method on same center but i also need to Toss/trow the arrow after doing some rotation with dragging or without doing that
   How Can I Put The Toss/Throw Action  in MyApplication

Thank You Very Much In/ advance

sentences:
Smoothly resize minimap camera rect width and height I have an orthographic camera that is working as a mini-map. Now I want to make it resizeable using mouse drag. I have applied some UI beside my minimap camera rect and those UI resizing perfectly with this code. But I have no clue that how to resize my camera rect with mouse drag:
 void Awake()
    {
        rectTransform = transform.GetComponent<RectTransform>();
    }

    public void OnPointerDown(PointerEventData data)
    {
        if (!resizePanelFeatureActive) return;
        rectTransform.SetAsLastSibling();
        RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, data.position, data.pressEventCamera, out previousPointerPosition);
    }

    public void OnDrag(PointerEventData data)
    {
        if (!resizePanelFeatureActive) return;

        if (rectTransform == null)
            return;

        Vector2 sizeDelta = rectTransform.sizeDelta;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, data.position, data.pressEventCamera, out currentPointerPosition);
        Vector2 resizeValue = currentPointerPosition - previousPointerPosition;

        sizeDelta += new Vector2(resizeValue.x, resizeValue.y);
        sizeDelta = new Vector2(
               Mathf.Clamp(sizeDelta.x, minSize.x, maxSize.x),
               Mathf.Clamp(sizeDelta.y, minSize.y, maxSize.y)
               );

        rectTransform.sizeDelta = sizeDelta;

        previousPointerPosition = currentPointerPosition;
    }

sentences:
Simulating an aging population Introduction:

The main idea is to "classify population as they age". Let me further explain it with an example:

Example:

There are 50k population (we are not going to care about if male or female for now). Inside these number there are kids [0 - 16], fertile[16 - 40], non-fertile [40 - 100].

Question

Which would be a nice implementation to represent an evolving population data that is better or at least not too resource intensive as my example below?

My Idea

(Pseudo code)

Population[] // Array
   Age [0 -> 5] //Array
       a pop obj that stores data
   Age [5 -> 10]
       pop obj
   .
   .
   .
   Age[95 - 100]
      pop obj

This would be the structure and each tick happens this calculation:

FertilePop.count * fertility rate * (some other stuff) = numberOfBirths

where numberOfBirths are added to the Age[0-5].obj.count

and the rest of Age[rang] are subtracted a number and added onto the next Age[rang] until Age[95 - 100] where they "die of old age".

Notes:

This is purely background data and i am asking for a better solution/implementation that could be less complex, more dynamic and learn from it.

I expect to be able to do a graph plot so the user sees the pop evolution.

I took my interest in the matter from this link here to a population simulator.

https://niko.roorda.nu/computer-programs/popsim-population-simulation/

Thanks for your interest in this question.

sentences:
How to avoid units with different destinations blocking each other in corridors? I'm making a roguelike in which enemies wander around the map until they're detected by the player. They each have random destinations, so sometimes their destinations conflict and they block each other in corridors.

Enemies can't go through each other

Is there any approach that can avoid this issue? Only idea I have right now would be to detect which ones are at the end of the "trafic block" and made them change destination until their path is free... But maybe there's a better design solution for this problem?

sentences:
How to reduce image size without pixelation? I see lots of games with smooth edges characters and high res images, however when I try to reduce images to say 64x64 for my character I just get a pixelated mess. even if I start with a 64x64 canvas I get pixelated edges.

Should I be scaling with OpenGL? or is there some technique perhaps with photoshop or pixen that I am unaware of?

sentences:
How to change the start position of my 2D game I am trying to create a game where you have to move a ball on a platform. At the start of the game, the ball is dropped on the platform and then you can move it around. This is al working, no problems here.

To keep the overview, the ball is centered in the middle of a div. When you move the ball you actually move the platform (giving the illusion the ball moves). This function should stay as it is. The platform is build in javascript as follows:

var levels = [
    [
        [1,1,1,1,1],
        [1,1,1,1,1],
        [1,2,1,1,1]
    ]
];

Where 1 = green tile, 0 = no tile and 2 is a yellow tile.

When loading the level it will generate the first tile (in this case the first 1) in the center of the div, then the next one and the next, etc. Al good so far, but if I change the first 1 tile to a 0 tile (= no tile), it will generate the platform, but since the platform is created in the middle of the div and since 0 is no tile, no tile will be generated and the ball will fall endlessly.

This is no good, I want to have different platforms and not always start with a 1 tile at this position. So I figured to make a "start tile". This is the yellow 2 tile. The idea is that this tile is the tile that always should be shown in the middle of the div at the start of a game, so that the ball always drops on the yellow tile. Therefore the whole platform should be moved at game start/load in order to center the yellow tile.

And this is my problem. How to do this?

I hope my problem is clear. I've also made a fiddle (click the 1 to start the game), so you can try things out

Many thanks

ps so in short:

Ball always drops in middle (must stay this way)
Yellow "start tile" should be moved/centered in the div, so the ball drops on it at game start

pps: The yellow tile can have a different position, it depends on the platform design

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:
Is it possible to tilt the canvas and have entities react to it I will try and explain this as simple as I can, let me know if you need more details and I'll edit the text.

Imagine a simple gravity-enabled 2D-game with a ball inside a room where the objective is to prevent the ball from hitting the walls of the room while the room itself is tilting from side to side. As a player you can control the ball left or right. The game is over when the ball hits one of the walls.

I have been trying to think of a way to have the ball (entity) react to the tilt of the room (canvas), specifically how to manage the acceleration, velocity and movement of the entity in respect to the tilt, but I haven't been able to find a suitable plugin or solution to this. Has anyone tried implementing this? How do you handle acceleration, velocity and movement, and would you implement the tilt in the canvas, a room entity or something else?

sentences:
Merging multiple image with DirectX D3DImage best approach? I'm currently rendering up to 6 images (7440 x 7440) together via a series of colorizing shaders (one each image) and then merging shaders (5 to merge colorizer result). I'm not getting the performance I would expect. I'm using D3DImage to render into a WPF application. The rendering is appearing to be very slow. However, the shaders are rendering in .005 secs each. This is currently rendered on one quad...

Is it better to flush between image and merge or send on flush at the end?

Are C# for loop slowing it do? The benchmarks are not showing that but...

Also I use the colorize shader to change color in near real time the UI locks up...

Windows 7 I know is limited to 1 device. Windows 10 I know support multiple instances of devices... is there a way to use that capability? is it worth it?

Here is the kicker I will need to eventually do this on 20 quads.

Thank you in advance!

sentences:
How to setup Steam VR Controller models and behavior in Unreal Engine? I want to preface this question by stating I am somewhat new to Unreal Engine. I googled for a solution to this, but no avail.

So I am setting up a bit of a sand box project in Unreal Engine to get a feel for VR development using the HTC Vive. The first thing I wanted to do was emulate the behavior of the motion controllers in the default Vive Screen. Basically, a 1:1 model of the controller appears inside the game space. It moves with the controller as you spin, point, twist and move the controller in real time. All the buttons respond in game when they are pressed in real life.

The solution I have hit on is to grab the raw model asset from /SteamApps/common/SteamVR/renderresource/ and manually line it up with the model ( by default the model is tiny, oriented wrong, and offset from the controller), and build individual events for each of the button that manipulates the models of the buttons in game. This seems kinda clunky and I was curious if there was a better way of doing this.

sentences: What are different rig types mean? I think I know what is rig - it's a set of bones for animation. But recently I watched a presentation where the guy mentioned animation rig, mesh rig, dynamic rig. What each mean?

sentences:
Smooth Sprite Movement - Don't Add Velocity to Position? I am trying to figure out if there is a way to move a sprite smoothly on the screen at different speeds without stuttering, but keeping the effect that it's moving smoothly; especially at faster velocities.

Below is a basic version of what I have with all of the object specific logic stripped out for readability.

void MoveableGameObject::update(double time)
{
    //maxVelocity is 10
    currentVelocity = min<float>(currentVelocity + acceleration * time, maxVelocity);
    location.x += currentVelocity;
}

void MoveableGameObject::draw()
{
    sprite->draw(location.x, location.y)
}

The part that I do not like is that the next time the frame renders and max velocity has been achieved, the sprite jumps 10 pixels and looks stuttery. If I tone down the numbers then it is of course smoother, but also slower.

I need to find a way to still have the speed, but give a smooth transition somehow. I am having a hard time wrapping my head around trying to implement movement speeds. Am I just using the wrong scale in terms of velocity to pixels?

My brain hurts, but I am still having a blast tinkering around with this and is a nice change of pace from doing nothing but business applications for the past 7 years.

I do have the ability to say run the game logic 20 times a second while rendering at 60 frames a second. Figured I would mention that in case that helps with an answer. Currently they are both just set to 60 since I am only running a single sprite and wanted to test the movement and check the sprite location on update() vs. draw().

Thanks in advance for any help.

EDIT: I forgot to mention and not sure if it matters or not, but I am currently using SDL to render.

sentences: What affects the size of APK files? The size of the .apk file built by Unity is larger than I expected. Is it image resolution, number of scenes, or something else?

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:
Do UV coordinates need correction for moving object? The image above is a static capture of a dynamic OpenGL project I created in which I wrapped a NASA albedo, i.e., sans clouds, image on an OpenGL generated sphere.  In so doing, I also generated the UV coordinates associated with each vertex position.

This was an incremental learning effort in which I had already applied model matrix corrections to the vertex positions for the rotating and translating (orbiting) "Earth".

I was surprised to find that I did not have to apply a model matrix correction to the UV coordinates.

I have tentatively concluded that once the jpg image coordinates are associated with the corresponding vertex positions with the UV coordinates in the range of [0, 1], they are fixed and need no further correction.

Does that sound correct, or is there more to the situation?

sentences:
Bilinear filter in repeating texture, HLSL I have a repeating texture that I'm using as a scroll surface.  The idea is that as I pan the surface I adjust the texture coordinates, filling in what gets wrapped on the right as it disappears from the left.  This is all working quite well.

When bilinear filtering is switched on (D3DTEXF_LINEAR) I think the repeat filters the edge of the texture with the corresponding pixels on the other side given the wrap.  This is wrong of course.

I've had a look around for bilinear filtering shaders that ignore edge texels but can't seem to find anything.  Does anyone have an ideas about how to do this?  Is there a way of configuring a sampler to ignore edge texels when filtering?  Is there a bilinear filtering shader knocking around I can use as a reference?

sentences: As an Android dev, what should I keep in mind for porting to iPhone? As an Android game developer, what should I keep in mind while developing my game if I ever wanted to cross-platform the game to the iPhone?  Any strategies, tips, etc. on porting to both of these mobile platforms?

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:
Approaches to timed puzzle elements I'm working on a side scrolling game that has a number of timed puzzle elements. As a simple example: I have a number of moving platforms that have been setup to transition in a pattern. Ideally I'd like to ensure that as the player first approaches them, they are in an ideal state -- whereby the player can witness the full transition and more experienced players (i.e: speedrunners) can complete the puzzle immediately without having to wait for the current transition to complete.

The issue here, in a nutshell, is that because these platforms begin transitioning at the start of the level, it's impossible to correctly calculate when the player is likely to stumble upon them.

I've done a fair bit of Googling but haven't managed to turn up any decent resources with regards to solving a problem like this. The obvious solution is to only begin updating the objects when the player (or more likely: the camera) first encounters them. But this becomes difficult when you consider more complicated situations.

It seems like potentially the easiest way of handling this is to have an invisible trigger volume that will tell any puzzle elements located inside of it that the player has 'arrived' upon first colliding with the player. But this would mean I'd have to logically group puzzle elements, which could become fairly messy in a hurry. Take, for instance, a puzzle that appears to the right of the screen. It may take the player a number of seconds to reach it. It would look strange if the elements involved were to remain stationary. But by the time the player arrives, it's likely things will be 'out of sync'.

I wanted to post here in the hopes that others know of, or have implemented, a decent solution to this problem?

sentences:
How to setup my texture cordinates correctly in GLSL 150 and OpenGL 3.3? I'm trying to do texture mapping in GLSL 150 and OpenGL 3.3

Here are my shaders I've tried my best to get this correct as possible hopefully this is :)

I'm guessing you want to know what the problem is well my texture shows but not in its fullest form just one section of it not the full texture on the quad.

All I can think of is its the texture cordinates in the main.cpp which is at the bottom of this post.

FRAGMENT SHADER

#version 150

in vec2 Texcoord_VSPS;

out vec4 color;

// Values that stay constant for the whole mesh.
uniform sampler2D myTextureSampler;

//Main Entry Point
void main()
{

    // Output color = color of the texture at the specified UV
    color = texture2D( myTextureSampler, Texcoord_VSPS );

}

VERTEX SHADER

#version 150

//Position Container
in vec3 position;

//Container for TexCoords
attribute vec2 Texcoord0;

out vec2 Texcoord_VSPS;

//out vec2 ex_texcoord;
//TO USE A DIFFERENT COORDINATE SYSTEM JUST MULTIPLY THE MATRIX YOU WANT

//Main Entry Point
void main()
{
    //Translations and w Cordinates stuff
    gl_Position = vec4(position.xyz, 1.0);
      Texcoord_VSPS = Texcoord0;
}

LINK TO MAIN.CPP
http://pastebin.com/t7Vg9L0k

sentences:
Recursive dungeon maps as represented by an elastic 2d array I came up with a method for recursively generating simple dungeon maps by starting with one room and recursively connecting new adjacent rooms randomly to it.

Maps are represented as two dimensional arrays where each cell contains a value of 0-15. 0 represents no room while each direction is represented by north=1, east=2, south=4, west=8.

I wanted to start with a single non room ([[0]]) and then expand the 2d array as necessary to fit the generated map. The difficulty I face with this tree like recursion is that if the arrays have to be unshifted to add rows and columns to the left and top of the map, I have to adjust the current position of the function, what row and column it is at. This makes it so that separate branches are not aware of array index adjustments from other branches, only their child functions will know because they have the adjusted position passed to them as their row and column arguments.

Is there a way to do this? I tried storing row and column offset values outside of the recursion, but it did not work for some reason.

sentences:
Platformer collision detection problem - player snapping onto sides I am having problems with collision detection. I am trying to make a simple platformer but when the player is falling or moving too fast it sometimes detects the wrong collision side. I am getting the side of the collision by checking the distance between the player and the sides of a block that are exposed to the player. I also tried detecting collision one axis at a time but this glitch still occurs.

blockCollision: function(block) {
        if(this.x + this.width > block.x && this.x < block.x + block.width && this.y + this.height > block.y && this.y < block.y + block.height) {
            let distanceLeft = Math.abs(this.x + this.width - block.x)
            let distanceRight = Math.abs(this.x - (block.x + block.width))
            let distanceTop = Math.abs(this.y + this.height - block.y)
            let distanceBottom = Math.abs(this.y - (block.y + block.height))

            if(distanceLeft < distanceTop && distanceLeft < distanceBottom && !block.collisionSides.includes('L')){
                this.velX = 0
                this.x = block.x - this.width
            }
            if(distanceRight < distanceTop && distanceRight < distanceBottom && !block.collisionSides.includes('R')){
                this.velX = 0
                this.x = block.x + block.width
            }
            if(distanceTop < distanceLeft && distanceTop < distanceRight && !block.collisionSides.includes('T')){
                this.jumping = false
                this.velY = 0
                this.y = block.y - this.height
            }
            if(distanceBottom < distanceLeft && distanceBottom < distanceRight && !block.collisionSides.includes('B')){
                this.velY = 0
                this.y = block.y + block.height
            }

            if(distanceLeft == distanceTop && !block.collisionSides.includes('LT')){
                this.x = block.x - this.width
                this.y = block.y - this.height
            }
            if(distanceLeft == distanceBottom && !block.collisionSides.includes('LB')){
                this.x = block.x - this.width
                this.y = block.y + block.height
            }
            if(distanceRight == distanceTop && !block.collisionSides.includes('RT')){
                this.x = block.x + block.width
                this.y = block.y - this.height
            }
            if(distanceRight == distanceBottom && !block.collisionSides.includes('RB')){
                this.x = block.x + block.width
                this.y = block.y + block.height
            }
        }
    }

JsFiddle

sentences:
Sending a shot left/right/up/down based on directional key press I am trying to make a top-down shooter game with similar combat to the Binding of Isaac:

when I press the up key the shot goes up
when I press the right key the shot goes to the right

I have all the rest of the code such as the point where the projectile is instantiating and the if statement to check for the button press I just want to know where I should put the vector 2 to allow me to set the direction and what to write into the vector 2

private void Update()
{

    if (Input.GetKeyDown("up"))
    {
        if (Time.time >= shotTime)

        {
            Instantiate(projectile, shotPoint);
            shotTime = Time.time + timeBetweenShots;

        }
    }

}

This is my Projectile script (at least the parts that I think would be useful)

void Update()
{
    transform.Translate(Vector2.up * speed * Time.deltaTime);
}

I realized that if I change the Vector2.up to make it say Vector2.down it would now shoot down But I need that to be able to change depending on which direction I am shooting.

sentences:
Generating a UV map for a procedural mesh I have created a procedural low poly rock mesh and now I would like to apply textures on it.

I have the 3D-coordinates of every vertex of the mesh but that's about it. How would I automatically generate a UV map for this mesh, since this list of vertices will change every time I generate a rock? How do I get all these faces correctly mapped in a (1,1) square?

I am working in Unity3D if that helps.

Thanks,

Alex

EDIT: Preserving the face shapes/sizes is priority! I don't want distortion at all. The texture will be generally just the same color with some darker/lighter spots so every edge could be used as a seam. Faces can overlap! I just want all the faces in one 2D box (1,1), with the correct dimensions.

EDIT 2:

I have this code:

    Vector3[] verts = mesh.vertices;

Vector2[] uvs = new Vector2[verts.Length];

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

    uvs[i] = new Vector2(Mathf.Abs(verts[i].x), Mathf.Abs(verts[i].z));

}

Which gives me the following UV map:
[![enter image description here][2]][2]

EDIT 3:

  float scaleFactor = 0.5f;

int[] tris = mesh.triangles;

Vector3[] verts = mesh.vertices;
Vector2[] uvs = new Vector2[verts.Length];

// Iterate over each face (here assuming triangles)
for(int index = 0; index < tris.Length; index += 3)
{
    // Get the three vertices bounding this triangle.
    Vector3 v1 = verts[tris[index]];
    Vector3 v2 = verts[tris[index + 1]];
    Vector3 v3 = verts[tris[index + 2]];

    // Compute a vector perpendicular to the face.
    Vector3 normal = Vector3.Cross(v3 - v1, v2 - v1);

        Debug.Log("surface " + index/3 + " : " + (normal*0.5f).magnitude);

    // Form a rotation that points the z+ axis in this perpendicular direction.
    // Multiplying by the inverse will flatten the triangle into an xy plane.
    Quaternion rotation = Quaternion.Inverse(Quaternion.LookRotation(normal));

    // Assign the uvs, applying a scale factor to control the texture tiling.
    uvs[tris[index]]     = (Vector2)(rotation * v1) * scaleFactor;
    uvs[tris[index + 1]] = (Vector2)(rotation * v2) * scaleFactor;
    uvs[tris[index + 2]] = (Vector2)(rotation * v3) * scaleFactor;
}

The red triangle on the left and the dark blue one on the right should be the same shape/size:

EDIT 4:

Mesh mesh = new Mesh();
mesh.name = "RockMesh";
List<int> Triangles = new List<int>();

var vertices = Vertices.Select(x => new Vertex(x)).ToList();

var result = MIConvexHull.ConvexHull.Create(vertices);
mesh.vertices = result.Points.Select(x => x.ToVec()).ToArray();
var xxx = result.Points.ToList();

foreach(var face in result.Faces)
{
    Triangles.Add(xxx.IndexOf(face.Vertices[0]));
    Triangles.Add(xxx.IndexOf(face.Vertices[1]));
    Triangles.Add(xxx.IndexOf(face.Vertices[2]));
}

mesh.triangles = Triangles.ToArray();

EDIT 5:

I had to move the code a bit but it finally works now! Like you guys predicted, the seems are not optimal, but I'm happy how it is now. Thanks!

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:
Pygame top down shooter firing bullets I'm working on a top down shooter in pygame and am having trouble getting bullets to fire. I'm using a class for the bullets, I'll show what I think is the relevant code.

This is what I do after the mouse button is clicked:

if event.type == pygame.MOUSEBUTTONDOWN:
        bullet_vel=[0,0]
        fired_pos=pygame.mouse.get_pos()
        player.fired=True
        bullet_pos_from_player=[0,0]

        bullet_pos_from_player[0]=fired_pos[0]-player.rect[0]
        bullet_pos_from_player[1]=fired_pos[1]-player.rect[1]
        bulletdistance=math.sqrt(abs((bullet_pos_from_player[0])^2) + abs((bullet_pos_from_player[1])^2))
        bullet_vel[0]=bullet_pos_from_player[0]/bulletdistance
        bullet_vel[1]=bullet_pos_from_player[1]/bulletdistance

        print bullet_vel[0], bullet_vel[1]

        bulletgroup.add(bullet((bullet_vel)))

and here is my class for the bullet:

class bullet(pygame.sprite.Sprite):
def __init__(self, bullet_vel):
    super(bullet,self).__init__()
    self.pos=player.draw_pos
    self.image=pygame.transform.rotate(bullet_image, player.angle)
    self.vel=bullet_vel

def update(self):
    self.pos[0]=self.pos[0]+self.vel[0]
    self.pos[1]=self.pos[1]+self.vel[1]
    screen.blit(self.image, self.pos)

Hope someone can help out,

thanks guys.

sentences:
How can I traverse a scene graph and hit only nodes in the view frustum? Scene Graph seems to be the most effective way of representing the game world.

The game world usually tends to be as large as the memory and device can handle. In contrast, the screen of the device captures only a fraction of the Game World/Scene Graph.

Ideally, I wish to process(update and render) only the visible game objects/nodes on per-frame basis. My question therefore is, how to traverse the scene graph so, that I will focus only on the game notes that are in the camera frustum?

How to organize data so that I can easily focus only on the scene graph nodes visible to me?
What are techniques to minimize scenegraph traversal time?
Is there such way as more effective traversal, or do I have to traverse whole scene graph on per-frame basis?

sentences:
correcting particleSystem speed? When I kill my enemy some kind of gold get out of him. This gold moves forward to the player if he gets close. In my cast it moves very slow. I need it becomes more faster when get close to the player.
Example

using System.Collections;
public class souls : MonoBehaviour {

public Transform _attractorTransform;

private float paticlesFarFrom;

private ParticleSystem _particleSystem;

private ParticleSystem.Particle[] _particles = new ParticleSystem.Particle[1000];
void Start ()

{

_particleSystem = GetComponent<ParticleSystem> ();

}
public void Update()

{

if (GetComponent<ParticleSystem>().isPlaying) {

int length = _particleSystem.GetParticles (_particles);

Vector3 attractorPosition = _attractorTransform.position;

for (int i=0; i < length; i++) {

paticlesFarFrom = Vector3.Distance(_particles[i].position,_attractorTransform.transform.position);

if (paticlesFarFrom <=200) {
 // this line need to fix
_particles [i].position = _particles [i].position + (attractorPosition - _particles [i].position) / (_particles [i].remainingLifetime) * Time.deltaTime;
}

}

_particleSystem.SetParticles (_particles, length);

}
}

}

sentences:
Quake style snapshot system for an MMO? I'm making an MMO style game in my spare time for kicks, I've been researching more and more into networking for video games and I've mostly been learning about Quake and Sources networking implementation where they have an authoritative server with a snapshot system where the client receives snapshots that reflect the current state, and the clients will send their input to the server and the server will simulate the game, etc.

Is this what most MMO games use in terms of their networking? I ask this because as I'm implementing it, it seems very expensive if you want a lot of players*, whereas the networking architecture seems more like it was designed for Quake or Source games where it's mostly shooter type stuff where you only have maybe 10 players at a time, sometimes you have 30 or so.

* To elaborate here, I mean that having even 10 players it costs a lot to send snapshots back and forth in terms of bandwidth, it can pretty quickly add up to megabytes. Is this normal? Is this expensive? I don't do a lot of network programming so I'm not particularly sure what is cheap or expensive in terms of bandwidth.

I've currently implemented most of this system, though I've added regions so that the world is split up into multiple areas so that entities in region A don't care about the events, particles, and other entities, etc. in region B or C, D, and so on.

sentences:
Pretty Sure I have Support for OpenGL 4, but it's not running. What can I do? Many Game Engines require OpenGL to run.  I have one of those.  I've confirmed that the program and any benchmarks for OpenGL above OpenGL 2 fail to run.

Is there, like, a way to confirm I have dependencies or something to that effect?  Is it installed or is it just a library included in other programs?

Specifically using Ubuntu Linux 17.10, computer specs are fairly low but I've run the Engine on Windows on the same machine before.  Linux should have more up to date graphics drivers, so I'm not sure what the root of the problem might be.

sentences:
Is Frustum Culling by itself enough for Consoles and Mobiles? Software occlusion culling is often expensive, especially for smaller and older devices.

Is frustum culling alone adequate on systems that can optimally display 10k triangles at most?

If not, are there any relatively fast techniques for determining which objects (both moving and static) occlude others?

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:
Use Python scripts in my C++ game? So I have this game project which is going very well for now. I implemented OpenGL stuff, animations, interfaces, and a lot of very nice things that I'm glad I've finally gotten around.

So now that the skeleton of my game engine is made and is solid, I'd like to add AIs to make my entities more lively. Because I like the idea of a game being simple to mod, I would really like to write the AIs in Python files, that would then be read and executed from my C++ code.

So my questions are the following :

It's a game, so performance is a concern. Is it a good idea to write the AIs in scripting files ?
I've heard that there were some JIT compilers such as PyPy, are they easy to use from a C++ program ?
Finally, how easy is it to send C++ objects to be treated in the Python code ?

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:
Making a Point Light follow a cube (Unity) I'm trying to have a point light positioned directly above a cube follow wherever the cube goes. However, it doesn't move at all. This is my code for the light:

using UnityEngine;
using System.Collections;

public class SpotlightController : MonoBehaviour {

// Use this for initialization
void Start() {

}

void OnGUI(){
    GUI.Label(new Rect(20,50,500,20), "(" + transform.position.x.ToString() + ", " + transform.position.y.ToString() + ", " + transform.position.z + ")");
}

// Update is called once per frame
void Update() {
    GameObject cube = GameObject.Find("Cube");
    float xlocation = cube.transform.position.x;
    float zlocation = cube.transform.position.z;

    transform.TransformPoint(new Vector3(xlocation,transform.position.y, zlocation) * Time.smoothDeltaTime);
    //transform.Translate(new Vector3(xlocation, 0, zlocation));
}
}

sentences:
How to efficiently render a large terrain mesh? Recently I've been stuck on a problem thinking about the best way to generate a terrain into my game. In another projects I normally used heightmaps, so all the core-work was based on the engine used, but now this cannot be done because the terrain has millions of specific polygons that must be drawn accurately. Also, many of them cannot be parsed from the Y vector (because of polygons hidden beneath), that is, a heightmap is not useful here. In this case I had to use a COLLADA object.

Someone told me to manually divide the model inside a software like Blender, but unfortunately this is also not possible because these terrains are created in chunks in another software and loaded after into the game (that's the idea). Therefore this would be a big work to be obliged to manually slice them everytime.

Thus, since a week I've been studying about how could I solve this problem and procedurally load this mesh, the terrain, accordingly to the camera frustrum, saving as much performance as possible. I came accross many documents about procedural mesh generation and I think that my problem could be solved by mapping the mesh into octrees. This is BIG work, at least for me, and that's why I'm here, because I don't want to risk taking the wrong path without before hearing from experienced people.

In short, I have millions of vertices and indices that together form the terrain, but for obvious reasons I cannot draw them at the same time. It's needed some kind of procedure. What's the best way to do that, to treat a big mesh as a terrain? Is there any specific book about that? Is there a best way to implement it?

Sorry for any kind of mistake, I'm very novice on this area.

sentences:
How to develop custom Unity graphics? Processing is a Java library for working with computer graphics, providing methods by which to draw primitive objects, custom meshes, etc., as well as mathematical methods (such as Simple Harmonic Motion) by which to animate and control them.

p5.js is an equivalent library for JavaScript and working with graphics on the web. You also have openFramworks which is similar but for C++.

How can you achieve similar graphics capabilities in the Unity Game Engine?

Suppose, for example, I wanted to build a game like Duet. I can imagine how I might go about creating those graphics in Processing or p5.js, but not in Unity and C#. How can you have that kind of creative freedom to build and draw in Unity?

Thanks.

sentences:
Can a developer change their product name on Steamworks? I recently got access to Steamworks and paid the product submission fee. Now I am able to create an app on Steam.

The app I'm working on is still untitled, but I want to start playing around with the Steamworks functionality.

Unfortunately, when I try to create a new app, Steamworks asks me for my product name. I am not sure if I will be able to change this later, so I am hesitant to proceed.

So my question is: If I use a tentative name for my product on Steamworks, will I be able to change it later?

I tried googling around, but couldn't find anything. There is too much noise from questions about changing one's username, etc.

sentences:
How to apply saturn's ring texture in Unreal Engine 4? I'm working on a "solar system" model project. And while trying to apply saturn's ring texture which is this one :

it ended up looking like this:

I'm new to UE4 and this branch in general. So I have no idea how to fix this .
your help would be appreciated

sentences:
How to simulate projectile path in 3D with Physijs andThree.js? I'm new in 3D rendering with WebGL. I would like to simulate a 3D projectile path using Three.js and Physijs.

How could I achieve this?

sentences:
How can I efficiently change the color of a BufferedImage? I am trying to change the color of a white BufferedImage image.

I do know that you can use .setRGB(x,y,rgb) and simply run some nested for loops and make changes to one pixel at a time. However, the problem arises when it comes to gradually changing the color instead of instantly doing so. This means I would have to run thousands of loops every runtime, completely ruining the frame rate.

My question is, is there a way to just change the color of an image right away?

sentences:
C++11 & Efficient Networking ClientServer"Zone(s)" I am building both an engine and a networked game at once because I'm completely insane. The original design/plan was to use internal Unix sockets for each "zone" for server<->zone communication, with UDP for server<->client(s) communication.

My conundrum is this: It seems like there are a variety of ways to handle getting packets from a client to the intended "zone", not none of them seem particularly efficient.

Simply move data from a singular queue to the intended zone server, via data objects within code.
(Pro: Simple  // Con: Potentially slow as molasses in a Canadian winter.)
(Somehow) Allow Server and Zones to communicate via Unix sockets, with a networking class/wrapper to pass packets into a "pool" for redistribution to Zones.
(Pro: Unix sockets, from my reading, tend to be fairly quick.  // Con: Need to re-evaluate how I am currently handling packets and the redistribution of packets makes it too similar to #1 for my liking.)
Use the underlying messages system on Linux. Ref
(Pro: Crazy fast for large objects. // Con: No idea how to implement at the moment.)

Additionally, if there is a specific text, document, or book(s) that I should be hitting instead of harassing everyone here, PLEASE let me know! Not at all afraid to spend a week tearing through a 200+ page tome.

Thank You!

sentences: 2D graphics with Direct3D I'm trying to work with 2D graphics using Direct3D 9, but am not sure where to start. Right now I'm using a texture as the "draw buffer", and drawing that texture to screen. For the simplest things, it works. But I can't see a way to e.g. draw lines, arcs, and the like onto the texture. How should I go about doing this?

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 to optimize collision detection I am developing a 2D Java Game with LibGDX. This is what it kinda looks like (simplified):

The big black circle is the player, which you can move by tilting the smartphone. The red circles and blue rectangles are enemies, which will move from the right of the screen to the left. The player has to avoid crashing into them.
Right now I am checking in the Game Loop every enemy against the player, whether they collide or not. This seems kinda inefficient to me, but I don't know how to improve it.
I have tried the Quadtree approach, but it did not really work. The player could easily glitch through enemies and the collision was not detected. Unfortunately, I have destroyed the Quadtree implementation. I used this tutorial/blog as my Quadtree implementation.

sentences:
C# Design for Ability System I'm a novice programmer but I have completed a pre-university in web prog so I am not a total noob. I'm using Unity, but this is just C# for now.

This is my first big project and I need some professional insight to make sure the design is not flawed. Currently working on abilities in an turn based rpg game.

What you might need to know: Abilities need to be learned/chosen, they may have requirements(levels, weapontype, more/etc.) New abilities will be added to the game with updates.

This is still the primitive stage, but very important to me because this project is more about learning to do it right rather than just getting it done.

Here are the following classes where we create abilities:

public abstract class Ability {
  public readonly int id, multi, manaCost;

 public Ability(int id, int multi, int manaCost) {
   this.id = id;
   this.multi = multi;
   this.manaCost = manaCost;
 }
 public virtual void resolve(Actor user, Actor target){}
 //Would create more methods with different parameters based on different abilities
 //Example for multi target ability
 public virtual void resolve(Actor user, Actor[] targets){}
}

Pretty simple stuff, Actor is just a in-game character. resolve is where the ability effects will be coded

using UnityEngine;
public class Freeze : Ability {
  public Freeze() : base(0, 0, 3) { }

  public override void resolve(Actor user, Actor target) {
    int damage = 2 * user.attribute[2];
    Debug.Log (damage);
    target.damage(damage);

    /*System.Random rnd = new System.Random();
    if(rnd.Next(100) <= 35)
    target.state = new Frozen();*/
  }
}

the way I was planning to use abilities is, in the main script of the battle system
there would be an array that has all the abilities such as this:

Ability[] all_ability;
public void createAbilities(){
    all_ability = new Ability[2]; //size increased as we create more abilities
    all_ability[0] = new Freeze();
    all_ability[1] = new FirstStrike(); //and so on as we create more
}

The index of the array is also the id of the ability which allows us to easily access abilities.

So if an Actor wanted to use freeze, the id of freeze would be stored in Actor i.e. p1.actors[0].ability_ids array

so let's say i've got what ability the player chose, it would be something like this

int aId = p1.actors[i].ability_ids[j]; //would return 0 assuming he chose freeze
all_ability[aId].resolve(p1.actors[i], p2.actors[k]);

Everything works so far, no errors, and damage gets calculated correctly but this is a very simple ability and still much more to add like damage counters, animations, status effects etc.

What should I look out for? is there a much easier way to do this I dont know about? I guess my main concern is, as we learn in web programming, it is said to be very bad to hard code values and everything should come from databases, but, is that also true for a game since each ability can be quite different? As you can see, everything is hard coded here. I guess I just want tips on things I may have done wrong/if there is a clear better way to do this. Thanks for any and all replies!

sentences:
Why does my sprite player move faster when I move the mouse? I'm trying to develop a simple game made with Pygame (Python library).

I have a sprite object which's the player and I move it using arrow keys. If I don't move the mouse, the sprite moves normally, but when I move the mouse, the sprite moves faster (like x2 or x3). The player object is inside the charsGroup var.

I've run the game in W7 and in Ubuntu. Same thing happens in both OS.

I have more entities which move like NPCs and bullets but they don't get affected, just the player. Given this, I think that the problem maybe has a direct connection with the player moving system (arrow keys).

Here is the update() method of the player object:

def update(self):

    for event in pygame.event.get():
        key = pygame.key.get_pressed()
        mouseX, mouseY = pygame.mouse.get_pos()
        if event.type == pygame.MOUSEBUTTONDOWN:
            self.bulletsGroup.add(Bullet(pygame.image.load("bullet.png"),
                                          self.rect.x + (self.image.get_width()/2),
                                           self.rect.y + (self.image.get_height()/2),
                                            mouseX, mouseY, 50, 50))

        if key[pygame.K_RIGHT]:
            if not self.checkCollision():
                self.rect.x += 10
            else:
                self.rect.x -= 10
        if key[pygame.K_LEFT]:
            if not self.checkCollision():
                self.rect.x -= 10
            else:
                self.rect.x += 10
        if key[pygame.K_UP]:
            if not self.checkCollision():
                self.rect.y -= 10
            else:
                self.rect.y += 10
        if key[pygame.K_DOWN]:
            if not self.checkCollision():
                self.rect.y += 10
            else:
                self.rect.y -= 10

And here is the while loop:

while True:

    if PLAYER.healthBase <= 0:
        GAMEOVER = True

    if not GAMEOVER:
        mapTilesGroup.draw(SCREEN)
        charsGroup.update()
        charsGroup.draw(SCREEN)
        npcsGroup.update()
        npcsGroup.draw(SCREEN)
        drawBullets()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()

    if GAMEOVER:
        myfont = pygame.font.SysFont("monospace", 30)
        label = myfont.render("GAME OVER!", 1, (255, 255, 0))
        SCREEN.blit(label, (400, 300))

    freq.tick(0)

    pygame.display.flip()

I don't know what more you can  need to help me, but anything you need (more info or code) just ask for it!

sentences:
Advices on multiplayer implementation I am developing a top down shooter and my singleplayer is pratically finished so now I want to move on to develop multiplayer but I have some questions and I am seeking for some advices.
In my game a match is constituted by a character(two in a multiplayer match) , monsters, projectiles, boosts and spawn points.
Here is my initial solution:
Characters- Send to the game server my character(position, if it´s dead or not,currentHealth,etc) and receive the other player character from the server. Thinking about using UDP because I want real time positions
Monsters- My strategy for this one is having the server randomly choosing one of players´computer to handle the spawn of the monsters .The list of monsters is sent to the server and the other player gets it. Thinking about using TCP because a lost package would imply that the round will have less monsters than it should have
Projectiles- When a player clicks the left button to shoot a projectile, the input is sent to the server. This means that the projectiles list would be instanciated in the server and both players will have to get it from it. 99% sure I will use UDP because a lost projectile wouldn´t have a major impact on the match.
Boosts- Probably the same strategy as the monsters. Pretty sure I will be using TCP because if the boost doesn´t spawn in that round it completely alters the match.
I am looking for critics to the strategies I am planning to implement as well as some advices

sentences:
What threading strategy does a game like Transport Tycoon use? Transport Tycoon is a simulation game where you control a transport company, place railroad tracks and trains, airports, bus depots, boats etc. Now the game is about 15 years old and I remember running it on a 486sx25 with 4Mb of RAM without any problems.

I was recently thinking about modern simulation game requirements and how high they are for relatively little increase in graphics and gameplay, so how did they managed to pull it with so little resources back in the day?

Does each train car have a thread, that moves it every 100ms, sleeps, wakes, recalculates position and does crash detection, and goes back to sleep?

Or is it one thread that moves every 100ms? What happens if there is too much work to do in each 100ms interval?

sentences:
2D game engine for UI - suggestion needed I am planning on making a simple real-time strategy game from the series Stargate Universe. For those who don't know, in the series' center is a spaceship called Destiny. It has a nice control room, with a control interface, what has a holographic control screen. The game basically would run on this. That's what I want to do, easily.

Can you suggest me ANY free 2D engine, what has:
- A top-view area for combat and ship management

Many UI elements what can be used easily
a top-on GUI part, where the actual GUI can be put
a nice GUI for putting all together (a game development framework or workbench)

And written in:

C#
ActionScript (Flash)

It is a bit reverse-like, as at the bottom of the layers would be the UI, over it the buttons, and over them would be the actual playground (battlefields, ship elements, etc).

Can you please help me?

sentences:
Calculate values in a game, which depends from stats and balance them So, I am basically lost at this point, trying to balance things.

In design phase; I did assign certain values to stats (imagine a standard set of any RPG you ever playe, to make things streamlined).

Now, I would like to start to introduce variants that does not depend directly on a stat; a good example could be "fatigue".

In my system, I have the value for strenght, and energy. Strength is constant (it may grow, but for the calculation purpose it is the constant part), so if I want to calculate fatigue:

strenght (0-99) constant
energy (0-99)
fatigue = [(strenght / energy)*10]

Easy...but when I plug in numbers, hell break loose.

Imagine that the character has a strenght of 100, start at 100 with energy, and each x steps, energy diminish, increasing his fatigue.

Strenght = 100
energy = 100; fatigue = (100/100)*10 = 10
energy = 90; fatigue = (100/90)*10 = 11,1
energy = 80; fatigue = (100/80)*10 = 12,5
energy = 40; fatigue = (100/40)*10 = 25
energy = 20; fatigue = (100/20)*10 = 50

This would work like a charm, maxing at 100 when energy is at 10%; but if the character has lower strenght, say 15, I end up with values as above, that are as following

Strenght = 15

1.1
1.6
1.8
3.7
7.5
15

This means that I don't get even close to 100 for fatigue, when energy is at 10% (I am at 15). So I am actually not sure how do you create formulas for parameters interaction in a game? The more complex I make it, the greater is the variance among the results; while Ideally I am aiming at having the character to take longer to reach 100 fatigue, if his strenght is higher, while it should reach fastr the limit, if the strenght is slower.

But in any case; when the energy reach 10%, the fatigue should be equivalent to 100.

Any suggestion wouold be appreciated; spending too much time on this, which should be pretty straight forward.

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:
In Unity, what does the camera script's "Behaviour missing" error mean? I started in Unity few days ago and made a cube with a tank control style. Now I'd like to create controls similar to 3D fighting games (Gunz, Blade Symphony, …): Control body direction with the mouse and walk with WASD.

However, the Camera is giving me a error called "Behaviour missing" each time I try, with all the cameras scripts I saw. I think that is a error with tagging the character movement in the camera, but I don't know how to do that.

What might be the problem?

sentences: How does my GPU know what game is running? I am trying to understand how game ready drivers work. How does my gpu know what application i am running and which application to use a specific driver optimization. For example the new nvidia driver makes some improvements to devil may cry 5 . how does my gpu know that I am running DMC 5. Is there a code in that application the driver recognizes? or does it not care what application i am using and treats every application the same.

sentences:
How can I blend grass decals in a transparent alpha channel in 3D? LibGDX I'm new to 3D and trying to create grass simulation using decals in libGDX.

I'm following the logic outlined here.

Atm my grass decal is a billboard of grass stems with a transparent background. I've placed 3 decals together in the form of a triangle.

When I pan the camera around at times the decals blend together but most of the time you can see the outline of the decal and you can distinguish between the pngs.

Can someone please help me understand a way to blend my decals better?

The decal:
http://www.reinerstilesets.de/3dtextures/billboardgrass0002.png

The code:

public class Grass implements Screen {
    private FirstPersonCameraController camera_control;
    private PerspectiveCamera camera;

    private Mesh floor_mesh;
    private Vector<Texture> grass;

    private Vector<Decal> decals;
    private DecalBatch decalBatch;
    private Vector<TextureRegion> grass_regions;

    private ShaderProgram shaderProgram;
    private Stage stage;

    @Override
    public void show() {
        stage = new Stage();
        decals = new Vector<Decal>();
        grass = new Vector<Texture>();
        grass_regions = new Vector<TextureRegion>();

        //camera
        camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        camera.near = 0.01f;
        camera.far = 10f;
        camera.position.set(1, 2, 5);
        camera.update();
        camera_control = new FirstPersonCameraController(camera);
        camera_control.setVelocity(3);
        camera_control.setDegreesPerPixel(.25f);
        Gdx.input.setInputProcessor(camera_control);

        //grass
        grass.add(new Texture("billboardgrass0002.png"));

        for(Texture t : grass){
            grass_regions.add(new TextureRegion(t));
        }

        decalBatch = new DecalBatch(new CameraGroupStrategy(camera));
        for(int i = 0; i < 3; i++){
            decals.add(Decal.newDecal(0.75f, 1.25f, grass_regions.get(0), true));
        }

        //set grass
        decals.get(0).setPosition(1f, 0, 1f);
        decals.get(1).setPosition(1.1f, 0, 1.1f);
        decals.get(1).setRotationY(45);
        decals.get(2).setPosition(.8f, 0, 1.1f);
        decals.get(2).setRotationY(-45);
    }

    @Override
    public void render(float delta) {
        //gl
        Gdx.gl20.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        //Gdx.gl20.glClearColor(1, 1, 1, 1);
        Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
        Gdx.gl20.glEnable(GL20.GL_DEPTH_TEST);
        Gdx.gl20.glEnable(GL20.GL_TEXTURE_2D);
        Gdx.gl20.glEnable(GL20.GL_BLEND);
        Gdx.gl20.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
        Gdx.gl20.glCullFace(GL20.GL_NONE);

        //camera
        camera_control.update();

        //disable depth writing
        Gdx.gl20.glDepthMask(false);

        //draw grass decals
        for(Decal d : decals){
            decalBatch.add(d);
        }
        decalBatch.flush();

        //stage
        stage.getViewport().update(1280, 720, true);
        stage.act(delta);
        stage.draw();
    }

    @Override
    public void resize(int width, int height) {}

    @Override
    public void hide() {}

    @Override
    public void pause() {}

    @Override
    public void resume() {}

    @Override
    public void dispose() {
        shaderProgram.dispose();
        decalBatch.dispose();
        decals.clear();

        for(Texture t : grass){
            t.dispose();
        }

        grass.clear();
        floor_mesh.dispose();
    }
}

Edit:
disabled depth buffer writing before drawing decals,
now looks better:

sentences:
Godot radial TextureProgress does not fully fill in after value of 61? So i've been trying to create a radial TextureProgress node in Godot engine. I created two simple png textures of two different colored circles. Both textures are the same size and contain alpha background.

I apply one texture to the "under" and the other one as "progress". Everything seems to work fine and the progress gets filled in while the value rises until value is 61 (max 100 range). The progress then just disappears. However; once i hit 100 (exactly, not 99) the progress comes back and is fully filled in.

Why am i getting this gap of nothing between 61 and 99.9?

sentences:
Adobe Air Mobile AS3 app: challenges and how to overcome them? I made a PC flash game for LD 26 - minimalism and I am working on porting it to Android.

Some questions I'd like to ask:

Is it bad to heavily use vector graphics (ie. this.graphics.lineTo()) in Mobile Air?
Does Stencyl completely alleviate this issue?
Are there any inherit disadvantages to using Air Mobile that I'm missing?
Where is the documentation for Air mobile (I googled and found no recent books or documentation pdf so far)

sentences:
Why no night sky with realistic star constellations? As an amateur stargazer I noticed that many games which have night scenarios use textures for the night sky where the stars seem to be arranged entirely randomly. It seems like they were created by an artist from scratch without looking at a star chart. Why don't they use a night sky texture where the stars are arranged like on the real night sky, so you can make out well-known constellations?

Games which take place in a fantasy or science fiction scenario are obviously excused, but why do games which take place on earth spend so much work on realism, but neglect this one aspect, even though there are plenty of public domain resources which could be used to create a realistic night sky?

sentences:
What GameEngine to choose I concider myself an amateur, but I have quite some experince in Unity3D.

Over the course of the next three years - before I can quit my job and go to colledge - I want to make ONE game.

Now the question that bothers me is which gameengine to choose:

A) Unity3D, because I know it well and the community is great (even though I didn't touch it for a year or so)

B) GoDotEngine, because it's open source, still beeing improved and very lightweight

C) Blender, because Python (though..who really uses blender for games? and I kinda hate blender)

Initially I wanted to go with GoDot, since it is  a lot like Unity and OpenSource, but I fear that the community is to small to help me out, if I get stuck and I really need to finish this, if I want to spend three years on it.

sentences:
how to get width and height of TiledMap in the latest Version of Libgdx I am making a tiled based game, I want not to let the camera show places, where there is no map... this is a obvious solution I got from a tutorial

if(camera.position.x<400){
    camera.position.x=400;
}else if(camera.position.x>map.width*map.tileWidth-400){
    camera.position.x=map.width*map.tileWidth-400;
}

if(camera.position.y<240){
    camera.position.y=240;
}else if(camera.position.y>map.height*map.tileHeight-240){
    camera.position.y=map.height*map.tileHeight-240;
}

camera.update();

but I don't know how to get width & height of the tiledMap in the latest version of libgdx

https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/maps/tiled/TiledMap.java

Seems strange... I even tried the Super classes but couldn't find. Please help.

sentences:
Flash Origin Problem with Movie Clips I'm working on a game that uses Flash for the user interface. I'm running into an odd issue with the origin of a library movie clip. Here are the steps to reproduce:

Create a new MovieClip and construct a single rectangle with both a fill and a stroke.
Set position of rectangle to (0,0) and notice that the origin is at the center of the border stroke surrounding the rectangle.
Change position of rectangle accordingly so that the origin is truly the top left (so if the stroke surrounding the rectangle was set to 10, adjust the position of the rectangle to 5,5.
Enable 9 slice for movie clip so that when you scale the rectangle it doesn't scale or distort the stroke surrounding the rectangle.
Drag an instance of the movie clip to the stage and use the free transform tool to scale it to the width of the stage. It should visibly be as wide as the stage.
Run the flash file and verify that the width during execution is not as wide as it was in design view.

So in a nutshell it seems that when you use the free transform tool, it distorts the origin even though 9 slice is enabled and it shouldn't (I would think). I understand that Flash denotes the center of a stroke to be the starting point and not the edge, which is why I adjusted the origin accordingly while editing the movie clip.

What I really need here is pixel perfect positioning for vector based components. I should be able to drag and drop a library movieclip that provides a window with a fancy border around it and scale it to whatever size I need, and place it where I need it to be without any odd positioning problems.

Here are some screenshots of the problem:

( i.imgur.com/8WU2F.png ) is a shot of my window with 9 slice enabled. You can see that the origin is correct being the top left of the window graphic.

( i.imgur.com/ciK8l.png ) is a shot of my window after using free transform to scale it to the width of the stage. It's pretty much perfect in design view

( i.imgur.com/QFUiJ.png ) is a shot of the flash application running. Notice that the window is no longer the width of the stage? I don't get it. It makes it very difficult to position because in order to get this to look right while executing, I have to make the window wider than the stage in design mode.

Any help is greatly appreciated. I'm sure it's something silly. This is pretty much bread and butter stuff that's been around since the early days of flash.

sentences: RTS Pathfinding without collision between units Options Ever since I made my units move to a certain location a problem has popped up that of course if I try to make two or more units go to the same place they fight for the same spot. Am I just being stupid and unity already has a way around this or do I need to do something specific? I have looked into flow field path finding but no way on how to implement it. I dont want to have to use a ready made script but some pointers and other options are more than welcome.

sentences:
unity - problem in limiting rotation of object? I am trying to make a game with unity.

In this game, player uses mouse to rotate a container or box around x and z (rotate to left and right and also toward the camera and opposite).

I used below code to control movement and limit it.

float zRot = transform.eulerAngles.z;
float xRot = transform.eulerAngles.x;
float yRot = transform.eulerAngles.y;
Debug.Log (
  "xDir : "  + xRot.ToString() +
  " yDir : " + yRot.ToString() +
  " zDir : " + zRot.ToString() );

if ((xRot >= 330 || xRot <= 30) && (zRot >= 330 || zRot <= 30)) {
  transform.Rotate (Input.GetAxis ("Mouse Y"), 0, -Input.GetAxis ("Mouse X"));
}
else {
  Debug.Log(xRot.ToString() + "  " + zRot.ToString ());

  transform.Rotate (-transform.rotation.x , transform.rotation.y,-transform.rotation.z );
}

The contatiner rotate 60 degrees in x and z and when it gets to the limits it stops, which is what I want. However when I rotate in both direction to the near the limits (330 or 30), the contatiner becomes out of control and it rotates freely and constantly. It's like the contatiner has passed the limits.

The questions are:

Did I used a good approach to limit the rotation and how to stop the object completely when it get to the limit of rotation?
When and why the object becomes out of control exactly?

sentences:
What data structure should I use for a 3D platformer game? I am developing a platformer game with the XNA framework, like "Metroid", but in 3D. I have to draw models, and I have the question of the title. I read many posts, and I know that the main data structures for draw polygons are octrees, quadtrees, BSP and Portals; but I read and read, and I don't know what is best.

What data structure should I use for a 3D platformer game?

sentences:
How do you make objects be pushed away from you? like pain from naruto, I wanna be able to press a button and be able to push objects
here's my push method
 void DoPush()
    {
        Collider[] colliders = Physics.OverlapSphere(transform.position, pushRadius);

        foreach (Collider pushedObject in colliders)
        {
            if (pushedObject.CompareTag("Enemy"))
            {
                Rigidbody pushedBody = pushedObject.GetComponent<Rigidbody>();

                pushedBody.AddForce(-transform.forward * 500, ForceMode.Force);

            }
        }

    }

the problem with this method is when I go behind the objects I push, they go towards me

sentences:
What are some great and useful resources for an Isometric game built on the XNA Framework? I'm currently working on an isometric game using the Microsoft XNA Framework. I'm looking of resources that would be of use for making this a successful project, such as isometric engines, physics engines, sprite engines(for isometric games), event handlers for ...

Any input would be greatly appreciated.

sentences:
What is "convexity" in the context of game design? I have overheard game designers mentioning something called convexity in games. This seems to be a game-design-specific concept, different from (although possibly related to) that in geometry or game theory. Unfortunately there are very few sources online mentioning it, let alone a definition. From what I could gather, it has something to do with player choices.

So what is convexity? How does it manifest in a game? What's an example of it, or the lack of it? Is it a good thing, a bad thing, or if it depends, when is it good, when is it bad?

sentences:
NGUI sprites become blurry on android I have this screen in the editor made with NGUI and 8 sprites:

But when I build it for android and open the game the same sprites on the screen looks blurry

I don't know what could be causing this, I have all the sprites in Point(no filter) mode, no mip maps and in True Color. Their Max Size is according to each sprite size.

I haven't touched anything strange in the atlas maker(it's only one big atlas), so it should have all default settings. What could possible be the cause of this? I have been searching but I haven't found anyone who had the same problem. Is there a setting I could be missing?

sentences:
Why are the vertices from a mesh not transforming using a camera? I am able to use a camera class to change the view and rotation of a simple quad, so I know it works, but when I move on to a more advanced geometry, such as a mesh, I am unable to affect the transform of the object at all.  The WVP matrix does change in the mesh example (using print statements), but no movement or rotation is observed.

My camera first calls

camera.SetLens(0.33f * (float)Math.PI, Width / Height, 0.5f, 1000.0f)

on initialization, where width and height is the width and height of the window, SetLens is defined here:

public void SetLens(float fovY, float aspect, float zn, float zf)
{
  FovY = fovY;
  Aspect = aspect;
  NearZ = zn;
  FarZ = zf;

  NearWindowHeight = 2.0f * NearZ * (float)Math.Tan(0.5f * FovY);
  FarWindowHeight = 2.0f * FarZ * (float)Math.Tan(0.5f * FovY);

  Proj = Matrix.PerspectiveFovLH(FovY, Aspect, NearZ, FarZ);
}

Every frame I call Draw, and it updates the view matrix of the camera. (Draw is on the bottom of this code snippet)

public void UpdateViewMatrix()
{
  var r = Right;
  var u = Up;
  var l = Look;
  var p = Position;

  l = Vector3.Normalize(l);
  u = Vector3.Normalize(Vector3.Cross(l, r));

  r = Vector3.Cross(u, l);

  var x = -Vector3.Dot(p, r);
  var y = -Vector3.Dot(p, u);
  var z = -Vector3.Dot(p, l);

  Right = r;
  Up = u;
  Look = l;

  var v = new Matrix();
  v[0, 0] = Right.X;
  v[1, 0] = Right.Y;
  v[2, 0] = Right.Z;
  v[3, 0] = x;

  v[0, 1] = Up.X;
  v[1, 1] = Up.Y;
  v[2, 1] = Up.Z;
  v[3, 1] = y;

  v[0, 2] = Look.X;
  v[1, 2] = Look.Y;
  v[2, 2] = Look.Z;
  v[3, 2] = z;

  v[0, 3] = v[1, 3] = v[2, 3] = 0;
  v[3, 3] = 1;

  View = v;
}

private void Draw()
{
  camera.UpdateViewMatrix();
  Matrix view = camera.View;
  Matrix proj = camera.Proj;
  Matrix world = Matrix.Identity;
  Matrix WVP = world * view * proj;
  d3dDeviceContext.UpdateSubresource(ref WVP, worldViewProjectionBuffer);
  ...
 }

For the camera to make changes, I call the following functions on keypress/mouse movement

public void Strafe(float d)
{
  Position += Right * d;
}

public void Walk(float d)
{
  Position += Look * d;
}

public void Pitch(float angle)
{
  var r = Matrix.RotationAxis(Right, angle);
  Up = Vector3.TransformNormal(Up, r);
  Look = Vector3.TransformNormal(Look, r);
}

public void Yaw(float angle)
{
  var r = Matrix.RotationY(angle);
  Right = Vector3.TransformNormal(Right, r);
  Up = Vector3.TransformNormal(Up, r);
  Look = Vector3.TransformNormal(Look, r);
}

In my vertex shader I just set the position of the vertex like this:

output.position = mul(worldViewProj, position);

So again, I can get it working with a simple triangle or quad, but I need to load triangles and their connectivity from a TIN and I am able to draw the mesh on the screen but my camera operations are not translating the mesh at all. Any clues on what I might be doing wrong?  For clarification, the whole mesh should be considered one object.

sentences:
OpenGL fixed function - WASD 2D movement I need to make a simple object (like a turtle) move on a 2D scene. The keys w, s, a and d, respectively, make a positive and negative translate on x-axis (move to forward and backward), and rotate 1 degree (a and d).
The problem is the simple object, will initially rotate and translate correctly (because initially the object is at the origin). But after that the commands don't work like I intend them to.
Which are the best practices to make this?
Anyone can help me?
To compile (assuming this code is saved in a file named movement2D.cpp):
g++ movement2D.cpp -o movement2D -lGL -lglut
To execute, use : ./movement2D 500 500
Here's the code:
#include <GL/glut.h>

struct point {
    int x;
    int y;
};
typedef struct point t_point;

struct object {
    int width;
    int height;
    t_point pose;
    float angle;
};
typedef struct object t_object;

void display(void);
void keyPress(unsigned char, int, int);
void initialize(int, int);
void exit(void);
void draw(void);

t_object *head, *body;

int
main(int argc, char** argv) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(atoi(argv[1]), atoi(argv[2]));
    glutInitWindowPosition(10, 10);
    glutCreateWindow("Movement");
    initialize(atoi(argv[1]), atoi(argv[2]));
    glutDisplayFunc(display);
    glutKeyboardFunc(keyPress);
    atexit(exit);
    glutMainLoop();
}

void
display(void) {
    glClear(GL_COLOR_BUFFER_BIT);

    glPushMatrix(); {
        glLoadIdentity();
        glRotatef(body->angle, 0.0f, 0.0f, 1.0f);
        glTranslatef(body->pose.x, body->pose.y, 0.0f);
        draw();
    }
    glPopMatrix();

    glutSwapBuffers();
}

void
keyPress(unsigned char key, int x, int y) {
    switch (key) {
    case 'a':
    case 'A':
        body->angle += 1;
        break;
    case 'd':
    case 'D':
        body->angle -= 1;
        break;
    case 'w':
    case 'W':
        body->pose.x += 5;
        break;
    case 's':
    case 'S':
        body->pose.x -= 5;
        break;
    case 27:
        exit(1);
    }
    glutPostRedisplay();
}

void
initialize(int width, int height) {
    head = (t_object*) calloc(1, sizeof(t_object));
    body = (t_object*) calloc(1, sizeof(t_object));

    body->width = body->height = 100;
    head->width = head->height = 20;
    body->pose.x = body->pose.y = 0;

    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glMatrixMode(GL_PROJECTION);
    glOrtho(-width / 2, width / 2, -height / 2, height / 2, -100, 100);
    glMatrixMode(GL_MODELVIEW);
}

void
exit(void) {
    free(head);
    free(body);
}

void
draw(void) {
    glColor3f(1.0f, 0.0f, 0.0f);
    glBegin(GL_QUADS);
        glVertex2i(-body->width / 2, -body->height / 2);
        glVertex2i(-body->width / 2, body->height / 2);
        glVertex2i(body->width / 2, body->height / 2);
        glVertex2i(body->width / 2, -body->height / 2);
    glEnd();
    glTranslatef(body->width / 2 + head->width / 2, 0.0f, 0.0f);
    glColor3f(0.0f, 0.0f, 1.0f);
    glBegin(GL_QUADS);
        glVertex2i(-head->width / 2, -head->height / 2);
        glVertex2i(-head->width / 2, head->height / 2);
        glVertex2i(head->width / 2, head->height / 2);
        glVertex2i(head->width / 2, -head->height / 2);
    glEnd();
}

sentences:
How to stop camera rotation after reaching a specific angle? I have a camera in my scene that I want to rotate around the player. The rotation is done when the camera rotation state is at CameraRotation.Left or CameraRotation.Right and CameraRotation.None indicates that the camera should stop rotating and just follow the player.

I want the camera to rotate around the player and stop after it reaches a specific angle (180 degrees) in the y axis in the CameraRotation.Left or CameraRotation.Right from the position the camera was at the start of the rotation. It would also be helpful if some direction is given on how to edit the SmoothFollow() method so that it follows the player with the camera still rotated.

The problem is I'm not familiar with rotations and not sure whether to use Euler angles or quaternions so any tips would help.

private void LateUpdate()
{
    if (GameManager._RotateCamera == CameraRotation.None)
    {
        SmoothFollow();
    }
    else if (GameManager._RotateCamera == CameraRotation.Left)
    {
        transform.RotateAround(player.transform.position, Vector3.up, rotationSpeed * Time.deltaTime);
    }
    else if (GameManager._RotateCamera == CameraRotation.Right)
    {
        transform.RotateAround(player.transform.position, Vector3.down, rotationSpeed * Time.deltaTime);
    }
}

// Make the Camera follow the player smoothly
private void SmoothFollow()
{
    Vector3 desiredPoistion = player.position + offset;
    Vector3 smoothedPosition = Vector3.SmoothDamp(transform.position, desiredPoistion, ref velocity, smoothSpeed);

    transform.position = smoothedPosition;

    transform.LookAt(player.transform);
}

sentences:
Are metal slug art assets free use? I'm making a mobile game and I've gotten by with completely free art assets so far, but I have an explosion from metal slug. I love it and it's perfect, but I don't want to get sued. I've seen metal slug art assets posted around the internet on various clip art websites, but haven't found any statements outright saying they're free to use in one's own commercial application.

Could someone show me a link saying whether or not metal slug assets are free to use?

sentences:
How can I rearrange layers in Unity 2D? I'm new to using Unity (2019.30a2) and am currently learning by watching Brackey's (youtube) "How to make a 2D Game in Unity"

At 6:58 he is able to rearrange his layers easily.  On my hand, I can create but am unable to change the order of the layers.

Looking at other questions on similar subjects hasn't provided me with a solution yet.  I'm currently working around it but feel this will hinder me in the future.

The screenshot of the unmovable layers is included below:

sentences:
2D Collision : detection and design So, listening to this very smart piece of advice, I've already completed a basic Tetris game. Moving on, I started a small breakout. But suddenly : a nightmare came. Collisions.

Since I've been struggling with this a lot, I read a bunch of article of the web. Being a beginner, I thought that, in the first approach, I would only use Rectangle to detect collisions.

Right.

Now I still have some problems.

First of all, all the articles I stumbled upon on the Internet told me how to detect collisions, e.g. checking if objects A and B collided with each other. But it is not what I really need. In order to respond properly, I need to tell my objects if the collision happened on the X or Y axis and then setting the new velocity according to some rules. The problem is that there are so many possibilities when making the distinction between types of collisions that I don't think I've taken the right path.

The second point (which, I believe, is really tied with the first) is the pattern in which the detection and the resolution of a collision happen.
Right now, I have a CollidableObject classes and a CollisionDetector classes which knows about these objects. Each frame, the detector is looking for collision (or at least for me, is trying) and when he finds one, it alerts each collided object, saying "Hey you ! You've have collided with Z on the X axis, change that velocity now." and the object abides.

The main issue right now is that I can detect the collision axis and therefore, when saying "Hey you ! You collided !", I cannot respond properly. In which direction should my velocity change ?

I've been thinking a lot about this lately, trying to figure it out on my own, but I haven't find something that I liked so I am asking here now.

Thank you for your answers !

(Note : I don't know if this is relevant, but I'm coding in C++ using SDL)

sentences: Unity - are particles rendered and calculated when off-screen? I have a scene where I have a lot of instances of the same particle system. As the game will go for mobile, I fear the particles are calculated even when they are not shown. So to cut it short, I would like to know if the particle system is being calculated and rendered even if off-screen.

sentences:
How to set object's / node's absolute rotation correctly? Usually when I want to rotate an object/node in my Ogre scene I call the node's rotate() method. That rotates the node locally relative to it's current rotation. So for example, when I start with 0 rotation, then rotate twice for 5 degrees about one axis, then after the second call the object is rotated by 10 degrees in total.

Now I need to set the absolute rotation of the node/object directly, regardless of its current rotation. Thus, say I don't know the objects current rotation, I need to set it say to 45 degrees on the X axis. Something like setRotation().

I know there is a setOrientation() method in the SceneNode class, which expects a quaternion object. I also know that I can get the current orientation quaternion. What I don't know: how can I use/change this current orientation quaternion to set the new absolute rotation of the node?

PS: Crosspost at http://www.ogre3d.org/forums/viewtopic.php?f=2&t=77710

sentences:
Starting my own development company I completed my postgraduate education, and I am interested in starting my own game development company.

I have a team of six members consisting of animators and artists.

I'd like you to suggest all the requirements for starting a new company and suggest whether it would be good for me to start it or not. I have a few game concepts, and I am really passionate about it.

sentences:
Array with multiple linked objects in Unity This might be too primitive, but for my use case, I need to maintain an array in which two attributes are linked to each other... For example - If I want to do Score gathering... Then I need an array which has scores and corresponding player names as each element.

So, when I do Array.Sort(PlayerScorearray) I even need the playername to be sorted in the order so that if I want to know the player with lowest score, I just go for the first element and then go to the corresponding player name.. Is it possible to do it in a simpler way? My mind can't think of a simple way to do this.

Edit : I am using C# for scripts

sentences:
Discrete mathematician? I'm studying a relatively new mathematics degree called 'discrete mathematics'. This degree intertwines mathematics and computer science such that you can solve most mathematical programming problems (and more) while being able to code them (theoretical CS).

Is this something sought after by game developers? My dream is to work for a game developing company and I want to bring something to the table that nobody else brings. In my case, hopefully exceptional mathematical knowledge. You can look at it this way: If you have a mathematical problem, you'd rather want someone of my caliber than a regular mathematician as it's IT related (again, discrete mathematics). But is it needed?

EDIT: This is NOT a duplicate of the supposed duplicate. I am not your every day mathematician which is why I believe that my question has different roots. I am specifically asking the DIFFERENCE between hiring a regular mathematician and a discrete mathematician.

sentences:
How should renderer class relate to the class it renders? I am working on making a Pong clone as a practice project. I have a PongState class with members like Ball, Paddle, Board and Score. I want to structure my code so that each object doesn't have to know how to render itself, but a PaddleRenderer class will. I also want to create a PongStateRenderer class, which may use other classes like PaddleRenderer, as well.

How should I let PongStateRenderer know about the internals of PongState so that it can render it? The Ball object in PongState know's it's own position and size, does that mean Ball has to be a public member variable so that PongStateRenderer can also know the position, or is there a better way to do this without totally breaking encapsulation? Perhaps my architecture is totally wrong, and I should use a different method?

I'm working in C# as it says in the tag but a general answer that applies to many languages could also be helpful.

sentences:
Changing the sprite position: Modify VBO data or translate it? I am beginning with VBO and I want to know if it's better use GL_STATIC_DRAW to make a quad and them translate it, or use DYNAMIC_DRAW and modify the vertex position data directly.

Also when I modify the data of a static VBO the rendering really change!
Why does this happen?
It is supposed to make STATIC object right?

sentences:
Cube map faster than 6 2D textures? - shadow mapping I've managed to implement shadow mapping to a scene. However, I had problems using a cube map so I eventually gave it up and used 6 2D texture maps instead. To make this work with 6 2D maps, during the rendering process I have to identify in which texture of the 6 each fragment belongs. I'm afraid this could be dropping my frames significantly.

I'm not gonna go into many details for now. I will upload the relevant code if necessary. My main concern is if this method makes my program slower.Will my fps increase using a cube map?

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 invisible first window on click unity3d I have a window called "red window" on scene1. When i click on the hello world button it should displays another window called green window and the first window should invisible. How it possible.

using UnityEngine;
using System.Collections;![alt text][3]

 public class window : MonoBehaviour {
 private bool render = false;
 public Rect windowRect0 = new Rect(20, 20, 120, 50);
 public Rect windowRect1 = new Rect(20, 100, 120, 50);
 void OnGUI() {
     GUI.color = Color.red;
     windowRect0 = GUI.Window(0, windowRect0, DoMyWindow, "Red Window");
     GUI.color = Color.green;
    windowRect1 = GUI.Window(1, windowRect1, DoMyWindow1, "Green Window");
 }
 void DoMyWindow(int windowID) {
     if (GUI.Button (new Rect (10, 20, 100, 20), "Hello World")) {
         }

       //GUI.DragWindow(new Rect(0, 0, 10000, 10000));
   }
  void DoMyWindow1(int windowID) {
 if (GUI.Button(new Rect(10, 20, 100, 20), "Hello World"))
     print("Got a click in window with color2222222222 " + GUI.color);
 //GUI.DragWindow(new Rect(0, 0, 10000, 10000));
 }

sentences:
Player Ai for games involving scoring goals like soccer, hockey, basketball? I've been working on a soccer game, and was thinking of different ways to program player AI's and was wondering how they actually work. The concept is probably similar to all games where there are balls and goals like Soccer, Hockey, Basketball etc.

Which algorithm do they use ? I imagine if you have the ball, you can use A*, to figure out a path passed other "enemy" players and score. That seems simple to implement.

But if you do not have the ball then then it becomes really complicated - you could either play "zone" in which case, you stay within a particular region on of the playing area, and orient yourself towards the ball. Or switch to playing "man", in which case you stick to some player on the other team.

Was wondering what other algorithms people use, as machine learning for a simple mobile game seems like over kill.

sentences:
How can I set decimal values to a Pygame rect position? I'm trying to make the gravity a bit slower, like

Dog.rect.y += 0.5
print (Dog.rect.y)
screen.blit(background, (0, 0))
screen.blit(spikeUp0.image, (0, 0))
screen.blit(spikeDown0.image, (0, 436))
screen.blit(Dog.image, (Dog.rect.topleft))
pygame.display.update()

But the dog floats. The minimum I get set to y 1 with rect methods. How can I make it slower?

Here is the complete code in GitHub Gist

sentences:
Using idle time in turn-based (RPG) games for updating If you take any turn based RPG game there will be large periods of time when nothing is happening because the game is looping over 'wait_for_player_input'. Naturally it seems sensible to use this time to update things.

However, this immediately seems to suggest that it would need to be threaded. Is this sort of design possible in a single thread?

loop:
if not check_something_pressed:
    update_a_very_small_amount
else
  keep going

But if we says 'a_very_small_amount' is only updating a single object each loop, it's going to be very slow at updating.

How would you go about this, preferably in a single thread?

EDIT: I've tagged this language-agnostic as that seems the sensible thing, though anything more specific to Python would be great. ;-)

Second edit: This game is not planning on having any animated components; that is, I'm currently running it as a wait-for-player-input then update everything and draw. So rather than X FPS it depends on the user's speed.

sentences:
DirectX 11, using Tessellation & Geometry shader in a single pass Before all, sorry for my poor english !

With DirectX 11, i'm trying to create a random map full with GPU.

Using Hull shader stage, I'm managing LOD with tessellation.

Using Domain shader stage, I'm generating the map (based on perlin noise).

Now my goal, is to compute normals in the geometry shader (normal on vertex).
For that, I must use vertex adjency, like geometry is capable of.

But here is the problem... For tessellation, my primitives must be
D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST.

But for geometry shader with 6 vertex (triangle primitive and adjency), I must use :
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ.

Think I'm missing something... It must be possible to tessellate and use the results in the geometry shader...
However, it's working with 3 points, but I cannot use the 3 others (they are 0.0, 0.0, 0.0)....

Thank you in advance for any help ;)

sentences:
How to check if gun may shoot again (because animation has stopped playing)? When the user presses the fire button, I set a trigger:
_animator.SetTrigger("HG_Shoot");

This trigger causes a "pistol shoot" animation to be played.
The gun should only be able to shoot again as soon as the shoot animation has finished.
I could check at each Update() if that certain animation is still being played like this:
 bool isAnimationStatePlaying(Animator anim, int animLayer, string stateName)
 {
     if (anim.GetCurrentAnimatorStateInfo(animLayer).IsName(stateName) &&
             anim.GetCurrentAnimatorStateInfo(animLayer).normalizedTime < 1.0f)
         return true;
     else
         return false;
 }

But I don't like the frequent checks. I would rather like to have a variable to would be set by the animator. Or I would set it at the beginning of the shoot animation.
Because there are other animations that I have to check that would disallow shooting of the gun, too, like reloading the gun.
This would make everything even more complicated.
How can I solve this problem?

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:
Enabling multisampling in Irrlicht? I'm working on a little game that uses Irrlicht. I'm pretty new to Irrlicht and I was wondering how I could enable multisampling. The device driver is EDT_OPENGL initiated as such:

IrrlichtDevice *device = createDevice(video::EDT_OPENGL,
                                        core::dimension2d<u32>(800, 700),
                                        16,
                                        NO);

How do I enable multisampling?

sentences:
Setting font color, Vulkan I am new using Vulkan, and i am trying to learn it looking tutorials and looking the vulkan examples that they provided(vulkan-master: https://github.com/SaschaWillems/Vulkan).

One of them is the Overlaytext project. In this project they teach you how to implement an overlay text in Vulkan.

Using this code, i wanted to change it to add an additional uniform to be able to change the color of the fonts. The problem is that the uniform is not getting set to the color, is always a 0 vec4(0,0,0,0) and i am not getting any warning or error.

If you can please tell me what i am missing i will be really appreciated, i dont know anymore what to do, i am out of ideas.

The code that i added or changed of this project to add this uniform is the following:

Variables in class:

glm::vec4   _color = glm::vec4(1.0f,1.0f,1.0f,1.0f);
struct {
VkBuffer buffer;
VkDeviceMemory memory;

} _colorBuffer;

Input binding and attributes of the pipeline(preparePipeline method):

std::array<VkVertexInputBindingDescription, 3> vertexBindings = {};
vertexBindings[0] = vertexInputBindingDescription(0, sizeof(glm::vec4), VK_VERTEX_INPUT_RATE_VERTEX);
vertexBindings[1] = vertexInputBindingDescription(1, sizeof(glm::vec4), VK_VERTEX_INPUT_RATE_VERTEX);
vertexBindings[2] = vertexInputBindingDescription(2, sizeof(glm::vec4), VK_VERTEX_INPUT_RATE_VERTEX);
std::array<VkVertexInputAttributeDescription, 3> vertexAttribs = {};
// Position
vertexAttribs[0] = vertexInputAttributeDescription(0, 0, VK_FORMAT_R32G32_SFLOAT, 0);
// UV
vertexAttribs[1] = vertexInputAttributeDescription(1, 1, VK_FORMAT_R32G32_SFLOAT, sizeof(glm::vec2));
// Color
vertexAttribs[2] = vertexInputAttributeDescription(2, 2, VK_FORMAT_R32G32B32A32_SFLOAT, 0);

Added starging buffer to copy the content of the color vec4 to a local device buffer(prepareResources method):

struct {
    VkBuffer buffer;
    VkDeviceMemory memory;
} colorStaging;

ErrorCheck(renderer->CreateBuffer(
    VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
    VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT,
    sizeof(glm::vec4),
    &colorStaging.buffer,
    &colorStaging.memory,
    &_color));

ErrorCheck(renderer->CreateBuffer(
    VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
    VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
    sizeof(glm::vec4),
    &_colorBuffer.buffer,
    &_colorBuffer.memory));

Copy the staging buffer to the colorBuffer uniform(prepareResources, just after the setImageLayout method and before the end command buffer):

VkBufferCopy copyRegion = {};

copyRegion.size = sizeof(glm::vec4);
vkCmdCopyBuffer(
    copyCmd,
    colorStaging.buffer,
    _colorBuffer.buffer,
    1,
    &copyRegion);

Clean up staging buffer(between stagingBuffer.destroy() and vkFreeCommandBuffers(_device, _command_pool, 1, &copyCmd); in the prepareResources method):

vkDestroyBuffer(renderer->GetVulkanDevice(), colorStaging.buffer, nullptr);
vkFreeMemory(renderer->GetVulkanDevice(), colorStaging.memory, nullptr);

Added the new binding vertex to the update command buffers(update command buffers method, just next to the other bindings):

vkCmdBindVertexBuffers(_commandBuffers[i], 2, 1, &_colorBuffer.buffer, &offsets);

Vertex shader:

#version 450 core

layout (location = 0) in vec2 inPos;
layout (location = 1) in vec2 inUV;
layout (location = 2) in vec4 color;

layout (location = 0) out vec2 outUV;
layout (location = 1) out vec4 outColor;

out gl_PerVertex
{
    vec4 gl_Position;
};

void main(void)
{
    gl_Position = vec4(inPos, 0.0, 1.0);
    outUV = inUV;
    outColor = color;
}

Fragment shader:

#version 450 core

layout (location = 0) in vec2 inUV;
layout (location = 1) in vec4 inColor;

layout (binding = 0) uniform sampler2D samplerFont;

layout (location = 0) out vec4 outFragColor;

void main(void)
{
    float color = texture(samplerFont, inUV).r;

    outFragColor = inColor*color;
}

I recompiled both shaders.

If i didnt add something will mean that i didnt change it.

Thank you for attention.

sentences:
What do I need to get an independent developer license for CryENGINE 3? I have searched Google and CryEngine forums and I can't seem to get a solid answer to this question.

I have seen threads where developers are complaining that they can't sell their game because they can't get a licence after finishing their project.

Now, I am considering using CryEngine for my game because I like the royalty system, as it means I do not have to make any upfront payments but I don't want to have to get through the game and then find that I Crytek refuse to give me a license because I didn't know what the rules were, or something.

sentences:
problem using OnStartServer() for unity multiplayer networked game UPDATE: i am still scratching my head over this. The way i see it, the Awake() function is only invoked when I load it in the Editor, but if I put the prefab Loading line into OnStartServer() it just doesnt load anything, presumably because it hasnt managed to load the prefab yet ... i think it is something to do with when it switches Scenes from the offline to online in NetworkManager, i think this script and others are being dropped because the DontDestroyOnLoad command wasnt called due to Awake not being called.

Hello everyone I am making a football game which you control one player from the team. It will connect 11v11 players per server (using a "Host" acting as server and client,  and other clients connecting to them)

I believe I have followed the examples and information provided by Unity to the letter, but I can't seem to get it working properly.

The problem: My code seems to work fine, provided I open the 'Host' instance from the Unity Editor, but if I make the full build version the Host it doesnt work.

Strangely all my player-objects will all spawn and act exactly as I intended, but the ball will not spawn unless the 'Host' instance is the one opened inside Unity Editor.
I've made the Ball a Network Identity, NetworkTransform etc and Registered Prefab in the NetworkManager in inspector.

Here's the code I am using to spawn the ball on the server, what could be the problem as I really have no ideas, thanks:

using UnityEngine;
using UnityEngine.Networking;

public class MatchdayManager : NetworkBehaviour {
GameObject ballPrefab;

private void Awake()
{
    DontDestroyOnLoad(this);

    ballPrefab = Resources.Load<GameObject>("Prefabs/Ball");
}

public override void OnStartServer()
{
    Debug.Log("on server start called");
    GameObject go = Instantiate(ballPrefab);
    NetworkServer.Spawn(go);
}

}

sentences: How can i create a 2 player turn-based board game on a separate android device using unity? im trying to make a 2 player turn-based board game, i have already made the connection between 2 device. I used photon. They both connect but i don't know how to sync them both to the game. can any one help me? i hope my question is right.

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: Liang-Barsky Line Clipping Algorithm Is it possible to generalize Liang-Barsky Line Clipping Algorithm for n-dimensional space ?

sentences:
Get a warning about extension when compile GLSL code with glslc compiler shipped with vulkan SDK Trying to compile my pixel shader,and a warning generated:

D:\CS\ComputerGraphics\vulkan\WindowsProject1>D:\ProgrammingTools\vulkan\Bin\glslc shader.frag -o frag.spv
shader.frag:3: warning: '#extension' : extension not supported: GL_KHR_vulkan_glsl
1 warning generated.

The following is my pixel shade code:
#version 460
#extension GL_ARB_separate_shader_objects : enable
#extension GL_KHR_vulkan_glsl : enable
#extension GL_EXT_debug_printf : enable
//Input
layout(location = 0) in vec3 fragColor;
layout(location = 1) in vec2 fragTexCoord;
//Output
layout(location = 0) out vec4 outColor;
//uniform
layout(set = 0,binding = 2) uniform sampler2D texSampler;
void main() {
    outColor = texture(texSampler, fragTexCoord);
}

how do I fix this?

sentences:
Approaches on 2D top-down track racing visualisation I'm considering writing a very simple management style game with the theme being motorsport racing.
I've got a good idea how to do the 'management side', but the issue I'm having is how to visually render cars and move on a track (something a bit like):

The key points (keeping it simple):

the user won't control the vehicle directly, they are the 'manager' (think football manager) - they can decide on a strategy but cannot control the vehicle
the car should stay on track (visually) - they may 'crash' (along with other events) though
the speed it goes around the track is determined by vehicle performance
a car will be aware of other near-by cars around the track - for example, if they're about to be overtaken, they may actually do a slower lap as they are defending - they may collide, along with other events

My initial thoughts are there are two key design elements here, the track and the car.
The track:

a track is composed of many segments
each segment is stored in an array
a segment (I'm not entirely sure here) but one thing it might contain is a 2D array:

(From [this](https://gamedev.stackexchange.com/questions/149966/approaches-on-2d-top-view-racing-game-track-design) answer gave an approach of using multi-dimensional arrays)
_ _ _ _ _ _ _ _ _ _
| d d x x x d d d |
| d d r r r d d d |
| d d r r r d d d |
| d d r r r d d d |
| d d r r r d d d |
| d d r r r d d d |
| d d r r r d d d |
| d d e e e d d d |
| _ _ _ _ _ _ _ _ |

_ _ _ _ _ _ _ _ _ _
| d d x x x d d d |
| d d r r r d d d |
| d d d r r r d d |
| d d d d r r r e |
| d d d d r r r e |
| d d d d d d r e |
| d d d d d d d d |
| d d d d d d d d |
| _ _ _ _ _ _ _ _ |

Above is a straight and a 90 degree corner - x exit, e entry, r racetrack and d dirt. Maybe I could create a bunch of these and create a track.
Or maybe a simpler version where I define just an entry and exit:
_ _ _ _ _
| d e d |
| d r d |
| d e d |
| _ _ _ |

_ _ _ _ _
| d x d |
| d r e |
| d d d |
| _ _ _ |

The simplified version where I define an entry e and exit x. I can add additional points r and then construct a curve/straight-line based on the x, e and r coordinates?
My idea is that the vehicle will then move across each segment and I can calculate the time it takes to complete that segment. I can then add up all segments which will give me the lap time. With this approach, I can also check the previous/current/next segment to determine if there are other vehicles it needs to defend/attack against.
The car:

store all vehicles in an array
each vehicle will always be in a segment
speed it completes the segment is determined by its performance (and segment characteristics)
vehicle can 'see' if there are other vehicles in previous/current/next segment and decide whether to overtake/defend.

I think I could make this work, but I'd be really interested to know if there are better/simpler approach - bearing in mind it's mostly a visualization and the speed and events are determined by my program.

sentences:
Loading models with opengl I'm developing a video game using OpenGL as graphic API and C++ programming language, and I'm creating all models with blender.

One question I have is how you deal with models (vertices), I mean, once you have created a model and want to load them with OpenGL you use hard-coded or a software module to load them on runtime?.

sentences:
Label does not maintain correct position within a Table I'm hoping the fix is quite simple, but this has become increasingly frustrating. I've built a minimally reproducable example. This is how the table is rendered:

And this is the corresponding code:

    private Table testTable() {
        Table table = new Table();
        Skin skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
        Label label1 = new Label("String", skin);
        Label label2 = new Label("Hello", skin);
        Label label3 = new Label("World", skin);

        table.add(label1);

        table.row();

        table.add(label2).width(100).height(100);
        table.add(label3).width(200).height(200);

        table.setFillParent(true);
        table.debugAll();

        return table;
    }

As you can see, the "Hello" and "World" labels are not centered within their logical tables. Further, even if I try .width(100).height(100).center(), or even .bottom().right(), for example, the two labels' positions are always fixed to the left, center of their logical table.

The only way I could 'fix' the problem is by excluding the .width().height(), but I need them for my UI.

Any thoughts?

sentences:
How to Implement a Very Simple Game State Manager in Unity? I’ve tried a bunch of different implementations, and trawled everything online I could get my hands on. Everything has downsides, nothing plays nicely with how Unity wants you to work.

Let’s keep it simple. You want to track in-game time. You want this to be available as a ScriptableObject. You need a MonoBehaviour to keep the time updated. You want to ensure there’s just one such GameState ScriptableObject and one such GameStateManager MonoBehaviour. You don’t want to manually add the manager to all scenes.

Is there a standard and sane way to achieve this without resorting to black magic?

To keep this grounded, here’s the boilerplate ScriptableObject:

    [CreateAssetMenu(fileName = "GameState", menuName = "ScriptableObjects/GameState")]
    public class GameState : ScriptableObject {

        /// <summary>
        /// The time passed in game, in game time, in seconds.
        /// </summary>
        public float TimePassed { get; private set; } = 0.0f;

        /// <summary>
        /// Moves the in-game time and date forward.
        /// </summary>
        /// <param name="addedGameTime">Time to add, in in-game seconds.</param>
        public void MoveTimeForward(float addedGameTime) {
            // Move the time passed forward
            TimePassed += addedGameTime;
        }

    }

And MonoBehaviour:

    public class GameStateManager : MonoBehaviour {

    /// <summary>
    /// The state of the game.
    /// </summary>
    public GameState gameState;

    // Start is called before the first frame update
    void Start() {
        // If we use a Singleton, and not drag a reference using the editor:
        gameState = GameState.Instace;
        // Mark that this should not to be destroyed when loading new scenes
        DontDestroyOnLoad(gameObject);
    }

    // Update is called once per frame
    void Update() {
        // Update the in-game time
        gameState.MoveTimeForward(Time.deltaTime);
    }

}

sentences:
Unity 4.6 New GUI Issue with GIT I am using Unity 4.6 new UI. I have my project setup on bit bucket (using GIT). It was working fine but when I cloned the project on another macbook. All the unity new UI scripts went missing. Is there any workaround for this issue ?

I am using same unity version on both macbooks. Editor Settings screenshot attached

Ref of inspector where scripts went missing.
[Editor Settings

sentences:
Open source component-based game engines? Possible Duplicate:
  Are there existing FOSS component-based frameworks?

What open source game engines with component-based design of game objects do you know? And which best of them? I mean best not in Graphics or Physics, but best in context of Behaviour, Messaging, etc.

This question is the result of inspiration by another question

Thank you!!!

sentences:
Skeletal animation: unexpected quarternion values I'm following ThinMatrix's skeletal animation tutorial and his custom written Collada parser is deriving a different rotation quaternion from each keyframe matrix than the Assimp importer library does. They are close, except the values are signed inversely and unpredicatbly.

I dug around his importer code but it's a mess. I assume he is manually performing an additional axis calculation somewhere, any ideas what it could be and why?

Original Matrix

1 0 0 0
0 -0.06466547 -0.997907 0
0 0.997907 -0.06466556 3.810999
0 0 0 1

Assimp rotation quaternion : (0.7296115 , 0 , 0 , 0.683862)

ThinMatrix's rotation quaternion : -0.72961134 , 0, 0 , 0.68386203)

And for reference, the position vec3: (0, 0, 3.810999)

Update:

With an identity matrix both Assimp and the ThinMatrix code produce (0, 0, 0, 1)

sentences:
Android/Java AI agent framework/middleware I am looking for an AI agent framework to use as a starting point in an Android game I have to create for a university research project. It has been suggested to me to use JADE, but, as far as I can tell, it's not a suitable framework for games (at least for my game idea) because it runs in a split-execution mode, and it needs an always-active network connection to a main host.

What I want is just a little something to give me a headstart. I am willing to adjust the game's features to the framework because it's more of a mockup game, and the purpose is to compare the performance of a couple of agents in the game world. The game will be very simplistic, with a minimal UI that displays various stats about the characters in the game (so no graphics, no pathfinding).

Thank you.

sentences:
Pixel-perfect 3D sprite-picking on cylidrical-billboarded sprites? Background Info

I have an OpenGL app where a player (just an AABB with an eye-height, look and move vectors), can walk along a 3D grid made of a square cells, essentially like a player walking along a Minecraft level.  The cells can also have differing heights, which qualifies it as a 3D level, rather than 2D.

On each cell, there is potential to be a static sprite, which is centered on that cell.  The sprite is rendered as a "cylindrical billboard" so that it's always facing the camera, but the base/bottom of the sprite is always rooted in the ground.  Like this https://www.youtube.com/watch?v=2-queKkSVnw

(The point I'm making is that these cylindrical billboarded sprites render a bit differently than standard sprites which would be coplanar to the view plane on the vertical axis, as well)

Here's a simple representation, where the green stick is the player, and the pink squares are the billboarded sprites which are centered on their cells.

(Note: normally, the camera view would be from the player's eyes, and thus all the pink sprites should be aligned with the player's view plane)

I also have an "arm reach" vector which is a line segment that extends outward from the crosshair a certain distance, in other words a line segment.  This line segment is slightly less than the width of one cell.  So, worst case scenario, then, is that this line segment is intersecting with three cells at once, like this:

Question

My question is how should I detect that the user's arm reach ray/segment is intersecting with a vertically billboarded sprite, knowing that the sprites may have transparent pixels?

I know that the first step would be to find which cells the ray/segment is overlapping, as shown in the previous pic as the green-highlighted cells.  The next step (in my case) shall be a 3D distance check from the player to the sprite location.  If too far, can't click it, no matter how you rotate the camera view (and distort the sprite).  After that, I'm unsure.  I assume I need to somehow first check if the ray is intersecting the billboarded sprite's "rectangle" (the pink rectangle) (I say rectangle in quotes because it will be a distorted rectangle in first person view, due to perspective angle), and then pixel-pick on the sprite and look for the transparent color, but I'm not sure how to do either of those steps.

Daggerfall somehow accomplished this.  Interacting with a billboarded sprite (i.e. a treasure pile) requires you to actually click on a non-transparent pixel of that sprite, or the click doesn't count.

Any sources on related techniques would be greatly appreciated.  Thank you for your time!

sentences:
How to implement HUD I'm wondering how one could implement an HUD in LWJGL. I've seen tutorials on this, but they don't seem to work. I know the basic structure goes like this:

init3d();
// 3d code
init2d();
// HUD

To which, of course, init3d and init2d are the GL Initialization codes. And also, how would you draw the images for the HUD (or should I ask that in a separate question)?

If this is too vague, let me know and I'll update the question.

sentences:
Materials aren't loading correctly from SketchUp into Unity I imported a SketchUp COLLADA (.dae) file from 2017 SketchUp Make, and imported it into Unity. I then clicked "Use External Materials" and the colors began to load. But I noticed quickly that one of the wings of my imported B-29 was Dark Gray, while the other way a proper color. Random parts, such as the front engine housing piece, were also dark gray. Parts of my advanced dials were also dark gray, and I immediately decided that there is now ay that I am going to manually go in and fix every single dark-gray material, but at the moment, I found no alternative.
I began with the wing. I went to assign the material that I used for the other wing, which was white, to the dark gray wing, but I found out that the other wing already had that material in use. And when I went to assign a different white color, absolutely nothing changed, aside from the fact that the wing now claimed that it had that color in use. Is there a fix for this problem? I could try importing as a .SKP file, if the reason for the issue is something to do with the COLLADA (.dae) file.
What I had was 2 wings. they were both components in SketchUp, so whatever I did to one applied to the other, Then I made them unique before importing to Unity. The Wing that won't work right is the one wing that had the USAF Insignia on it. But I doubt this is the problem, because all engines on that wing were also not colored correctly, whereas the other wing was fine. Those engines were also components, but were also made unique before the import.
Each wing has 9 groups inside of it. The other wing is identical in this sense. I imported the file from file explorer by dragging the file from file explorer and dropping it into unity.
This is what the plane looks like in Unity:

My apologies for the crude handwriting, it is difficult to draw with a touchpad.
In the image, I numbered the incorrectly-colored parts visible in the image (Right/Left references are perspective to image)
1. Left Wing. Color: Dark gray. Color intended: White.
2. Propeller blade hub. This is the part that all propeller blades are connected to. Both hubs on the two propellers on the Left Wing are colored incorrectly. Color: white. Color Intended: Grey.
3. Pistons. All piston components, such as the pistons, securing poles, and piston heads are not colored correctly; same on the other engine on the Left Wing. Color: White. Color Intended: Grey pistons, darkish-grey piston heads, and copper-orange securing poles.
4. Cowl Flaps. In the image, this appears to be a stripe in the engine. Same with the other cowl flaps on the other engine on the Left Wing. Color: Dark gray. Color Intended: White.
5. Propeller blades. All 4 propeller blades on both engines on the left wing are not colored correctly. Color: White. Color Intended: Black, with yellow tips.
6. Right-Wing Pistons. Most piston components, such as the pistons heads and securing poles are not colored correctly. Same with the other engine on the Right Wing. Color: White Piston Heads, Grey Pistons, Almost-Black Gray in the lines on the pistons, white securing poles. Color Intended: Grey pistons, darkish-grey piston heads, and copper-orange securing poles.
7. Front Engine Casing. The same error is in the other engine's front engine casing on the Right Wing. Color: Dark Gray, with an apparent shine coming from beneath the part, which shouldn't be happening (the directional light is above the engine part). Color Intended: White.
8. Rear Engine Casing. The same error is in the other engine's rear engine casing on the Right Wing. Color: Dark Gray, with an apparent shine coming from beneath the part, which shouldn't be happening (the directional light is above the engine part). Color Intended: White.

sentences:
InvalidOperationException in build only, when trying to select object in a dynamically loaded scene using Linq Here is the relevant code:

private void Awake()
{
    StartCoroutine(LoadScenes());
}

private IEnumerator LoadScenes()
{
    this.sceneLoad1 = SceneManager.LoadSceneAsync(Scene1, LoadSceneMode.Additive);

    while (!this.sceneLoad.isDone)
    {
        Debug.Log("Loading scene 1...");
        yield return null;
    }

    this.sceneLoad2 = SceneManager.LoadSceneAsync(Scene2, LoadSceneMode.Additive);

    while (!this.sceneLoad.isDone)
    {
        Debug.Log("Loading scene 2...");
        yield return null;
    }
}

private void Start()
{
    SceneManager.GetSceneByName(Scene1)
                .GetRootGameObjects()
                .Where(root => root.GetComponent<God>() != null)
                .Select(root => root.GetComponent<God>())
                .Single()
                .SpreadGospel();
}

(Scene1 and Scene2 are const strings.)

The program works fine when running in the Unity editor. However, when I make a development build, I see the follow error message:

    InvalidOperationException: Operation is not valid due to the current state of the object
  at System.Linq.Enumerable.Single[God] (IEnumerable`1 source) [0x00057] in /Users/builduser/buildslave/mono/build/mcs/class/System.Core/System.Linq/Enumerable.cs:1968
  at MySolution.GodInitializer.SpreadGospel () [0x00001] in D:\repos\MySolution\SourceCode\SourceCode\GodInitializer.cs:100
  at MySolution.GodInitializer.Start () [0x00012] in D:\repos\MySolution\SourceCode\SourceCode\GodInitializer.cs:77

... which indicates that the scene wasn't fully loaded before I tried to access the God singleton.

What changes should I make to fix the problem?

sentences:
Physics/Logic behind self-bounce What would a ball look like when it makes itself bounce. Say, for example that the ball had its own "inner power", was made out of (mostly) rubber, and pulled the top of itself inward and then released, causing itself to 'bounce' up. Is that logic correct? And is this what it would look like?

If this logic is correct, what other materials can have this effect given the scenario described above?

sentences:
closing GUI in Unity How do I close the GUI after the user enters a value? Is there any way to stop execution of the entire app (from inside this script) until a value is entered?

using UnityEngine;
using System.Collections;
using UnityEngine;
using UnityEditor;

public class Popup : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }

    string record="";

    void OnGUI() {
        //Participant Number/Record:
        GUILayout.Label ("enter participant id:");
        record = GUILayout.TextField(record);
        //GUILayout.TextField()

        if (GUILayout.Button("Submit")) {
            OnClickSavePrefab();
            GUIUtility.ExitGUI();
        }
    }

    void OnClickSavePrefab() {
        record = record.Trim();

        if (string.IsNullOrEmpty(record)) {
            EditorUtility.DisplayDialog("Unable to save record", "Please specify a valid participant record.", "Close");
            return;
        }
        // Save your prefab
        Debug.Log ("record:" + record);
    }
}

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:
Calculate The Proper X and Y Coordinate I have a class called Tile, the constructor takes an integer that represents the tile's
type. You can load a tileset ( via loadTileset() ) which initalizes the fields -

tileset
numOfTiles
tileWidth
tileHeight

My question is, in the constructor, depending on the type variable. How do I figure out the proper x and y cooridates to uses in the getSubimage() method.

So for example, if type is set to the value 2, I'd want to get the x and y position of the upper-left corner of number two.

import java.awt.image.*;
import java.awt.*;
import java.io.*;
import javax.imageio.ImageIO;

public class Tile {

private int type;
private BufferedImage tile;

// tileset attributes
public static BufferedImage tileset;
public static int numOfTiles;

public static int tileWidth;
public static int tileHeight;

// constructor
public Tile(int type) {

    // contruct tile
    this.type = type;
    // ...
    tile = tileset.getSubimage(0, 0, tileWidth, tileHeight);
}

public static void loadTileset(String filename, Dimension tileSize) {

    // load tileset
    try {
        tileset = ImageIO.read(new File(filename));
    }
    catch(Exception e) {
        e.printStackTrace();
    }

    // initalize attributes
    tileWidth  = (int) tileSize.getWidth ();
    tileHeight = (int) tileSize.getHeight();

    numOfTiles = (tileset.getWidth() / tileWidth) * (tileset.getHeight() / tileHeight);
}
}

sentences:
Use OverlapSphere to fill a list? I'm trying to fill a list with objects by using OverlapSphere.
Any Object with tag "enemy" goes in OverlapSphere radius put it in the list. This object goes out remove it from the list.

public GameObject[] listEnemy;

void Update()
{
 Collider[] hitColliders = Physics.OverlapSphere(gameObject.transform.position, 2);
    foreach (Collider hitCol in hitColliders)
    {
        if (hitCol.CompareTag("enemy"))
        {

            //// evey object with tag "enemy" put in the listEnemy.

        }
    }
}

sentences:
How do I program a fan in a platformer game? Fan physics

I have a platformer game and want to have fans in it that blow in a given direction and if the player presses the jump button they can go even further.

How do I do this?

side note:

I am working with godot engine

EDIT

My character moves on the two axes using two variables, both multiplied by speed: move_dir and y_velo. gravity affects y_velo and the arrow keys affect move_dir

sentences:
What design choice should I follow for client-server communication? My game server currently launches a thread for each connected client, and handles all data exchange through that socket in a server-blocks-until-client-requests fashion. The problem derives from the blocking, since sometimes the client state should be updated upon server demand without a previous request from the client, which is incompatible with a blocking state.

I have done some research and come up to the next possibilities:

1) Open a second connection to the client, which will only be used for sending data to the client so it can update its state.

2) Use of non-blocking sockets.

3) Use of asynchronous server.

What is the most common design to tackle this particular problem?

2 and 3 seen in https://stackoverflow.com/questions/3895461/non-blocking-sockets

sentences:
Simulate wind affecting a boat using a 2D physics engine like Box2D or SpriteKit? I'm looking for a way to simulate the forces created by wind and how it affects a boat.

In a nutshell: if wind hits a boat (sailing yacht), the bow is aligning with the wind and if the wind is strong enough, the boat will then slowly start to move.

I am not looking for a correct simulation of sails or alike. Just wind as it would affect a boat during maneuvers at slow speed.

Here's what I have tried:

Make the boat just one body and apply a force: this does not take into account the heavier stern versus the lighter bow.
Make the stern a heavy body and the bow a lighter one and connect them with a fixed joint: this will make the boat rotate if the same force is applied to both bodies but ignores the fact that once the boat is aligned with the wind, the force should be reduced.
Create many (thousands) of very small objects with little mass and apply a force to them, simulating the wind "particles" and let them hit the boat: this kills performance on slower devices.

Maybe I am missing a very simple solution that would work good enough?

sentences: How can I map regions on a world map image? I am trying to use a map of the real world, but I need to have a way to break it down by countries and regions.  Ideally down to a province level.  I figure that I'd need to be able to define polygonal regions on the image and export the points that represent the bounding polygon, so that I could check for clicks inside, and do other things with it.  I'm having a hard time finding a tool that will let me do this, that is, load in an arbitrary image and start defining polygons on it to be exported.  Or am I going about this the hard way?  Using XNA/Monogame currently if that matters in your answer.  Thanks

sentences:
What is "u" and "v" in this Navier Stokes implementation? reference: https://pdfs.semanticscholar.org/847f/819a4ea14bd789aca8bc88e85e906cfc657c.pdf

while ( simulating )
{
    get_from_UI ( dens_prev, u_prev, v_prev );
    vel_step ( N, u, v, u_prev, v_prev, visc, dt );
    dens_step ( N, dens, dens_prev, u, v, diff, dt );
    draw_dens ( N, dens );
}

Is u,v the same as x,y?

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 can I deal with tilemap position in the editor? Right now it is quite hard in Unity 2017.2 to track where is the (0, 0) coordinate in the tilemap editor, when painting. I tend to use a displayable dummy game object as a marker.

I'd like to also edit two different sets of tilemaps. One set* of tilemaps is located at (0, 0, 0) absolute position, and another set of tilemaps in, say, (32, 0, 0) position. However it is quite confusing to me (perhaps there is an option, but I can't find it) when trying to guess where is the internal center of the currently focused tilemap, to start painting. If somehow I had to paint several different tilemaps (more than two sets, say), I'd get easily dazed by the tool.

(* A set of tilemaps is not any kind of special objects, but just a concept embracing several tilemaps in the same position).

Question: Does Unity provide a way in the editor/UI to know the place of the (0, 0) coordinate inside the tilemap (when editing and focusing a specific tilemap)?

sentences:
Unity 2D Bullet AddForce does not work I got the following code :

public ParticleSystem PS;
public GameObject origin;
public float thrust = 1.0f;
public GameObject bullet;
private GameObject _bullet;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if (Input.GetMouseButtonDown(0))
    {
        Debug.Log("Pressed left click.");
        PS.Play();
        _bullet = Instantiate(bullet, origin.transform.position, origin.transform.rotation);
        _bullet.GetComponent<Rigidbody2D>().AddForce(origin.transform.forward * thrust);
    }
}

Where everything is working except the AddForce, the bullet is just dropping out of my weapon. I've made some research and my script seems to be correct. The bullet has attached a circle collider and a rigidbody2D.

Update: This did not change anything :

_bullet.GetComponent<Rigidbody2D>().AddForce(origin.transform.forward * thrust, ForceMode2D.Impulse);

And this neither :

_bullet.GetComponent<Rigidbody2D>().velocity = origin.transform.forward * thrust;

It's weird, because all of these should work actually.

sentences:
Persisting Player Prefs On Build in Android Can I ask for help/guide where I can build 2d game on android device includes the players prefs that I defined already, for example I have an "int" PlayerPrefs (PlayerPrefs.Getint ("mysavenumber")),
the data "mysavenumber" has already a saved integer value in it. How ever upon building my game and installing it on my android device it seems does not hold any value.
How can I build my game with the Playerprefs data that I have defined upon building and installing it on an android device?

sentences:
Move background with the player location I want to move background with  player location in ios . I have implemented the infinite parallax background by using the CCParallax class but i don't need it. I want to do something similar to this game http://www.youtube.com/watch?v=fNRNlLzrKmc.

my game level is large want to parallax up when player will move up. How will i do that please explain me. will i have to use CCCamera or i can do this by using CCParallax class.

Thanks,

sentences:
How to set the camera projectionmatrix so that it's 4 rays always exactly hit the corners of a defined plane? I have a camera, and I have a plane.
The plane has 4 corner points.
I need to find out how to change the projection-matrix of the camera so that the projection-rays of the camera always hit the corners of the plane.

The camera and the Plane are supposed to be movable rotateable (if possible)
The Plane is also supposed to be scaleable.

Usage:

I am making a Stereo-3D-Game with Eyetracking where my 2 Eye-Vectors hit the exact same paralax-plane.

That paralax-plane is defined.
So we have the Corner-positions of the Plane.

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:
Change axis to view world from above in Unity Developing a 2d game where you view the "table" from above (think of a card game being played on a table).  I have a candlestick on the table, but I must have something wrong because when I run it, it thinks it's on a wall versus a table because the flame goes up to the top versus "at" the camera from above.

Here's the code of that "LookAt" script:

public class CameraFacing : MonoBehaviour
{
public Camera cameraToLookAt;
void Awake() {
    cameraToLookAt = Camera.main; }
void Update()
{
    Vector3 v = cameraToLookAt.transform.position - transform.position;
    v.x = v.z = 0.0f;
    transform.LookAt(cameraToLookAt.transform.position - v);
}
}

sentences:
Creating a space game. Need help with a solution for creating dynamic spiral graphics My friend and I are working on a web based game where we want to have a blackhole-like thing rendered in some form of an engine or 3D program for us to freely manipulate adding more "arms" making it smaller or bigger and playing around with its light.

Here's a picture of our concept of the graphic element:

(smaller black hole:)

(larger black hole:)

We want help to find the best possible solution for this, and possible also some kind on guide to create these elements. So far everything is designed in photoshop but if we want the hole to be dynamic we can't use pictures.

sentences:
Instead of using yield wait for seconds can I use a UI button for async? the code below is the code I use to load my game scene ater the intro animation plays. The way it works is that it preloads the game scene because it is big enough it takes time to load and activates it after 15 seconds.

I want to use this code in a similar manner for my main menu, but instead of preloading and waiting for seconds I want it to preload and wait for UI button.

public class IntroToForest : MonoBehaviour
{
    public float WaitToLoad = 14.0f;

    void Start()
    {
        StartCoroutine(LoadScene(WaitToLoad));
    }

    IEnumerator LoadScene(float WaitToLoad)
    {
        yield return null;
        AsyncOperation asyncOperation = SceneManager.LoadSceneAsync("Forest Map");
        asyncOperation.allowSceneActivation = false;

        while (!asyncOperation.isDone)
        {
            if (asyncOperation.progress >= 0.9f)
            {
                yield return new WaitForSeconds(WaitToLoad);
                asyncOperation.allowSceneActivation = true;
            }
            yield return null;
        }
    }
}

Side note: I incorporated DmGregory's answer into my menu controller script and got this:

public class MenuController : MonoBehaviour
{
    public string SceneName;

    AsyncOperation preload;

    void Start()
    {
        preload = SceneManager.LoadSceneAsync(SceneName);
        preload.allowSceneActivation = false;
    }
    public void Go_to_game()
    {
        if (preload.progress < 0.9f)
        {
            if (PlayerPrefs.HasKey("HasSeenIntro"))
            {
            preload.allowSceneActivation = true;
            }
            else
            {
                PlayerPrefs.SetInt("HasSeenIntro", 1);
                SceneManager.LoadScene("Intro");
            }
        }
    }
}

The problem is that the UI button will not work.

sentences:
OpenGL vertex data per index Usually, vertex data is assigned to a particular vertex, like this:

[data]    [vertices]
[1.31] -> [1, 13, 5]
[84.3] -> [5, 8, 12]
[.095] -> [8, 3, 10]

Then, you would typically have an array saying which order to draw the vertices in:

[indices]
[   0   ]
[   2   ]
[   1   ]
[   2   ]

Using this, the first vertex would be drawn first, then the third vertex, then the second one, then the third one again. My question is if it is possible to assign vertex data to the index array rather than to the vertex array, like this:

[data]    [indices]
[1.31] -> [   0   ]
[84.3] -> [   2   ]
[.095] -> [   1   ]
[30.1] -> [   2   ]

So that when it draws each vertex from the index array, it uses that particular value.

Please note that I am dealing with a lot more vertices than are shown here. (17^3 to be precise) The examples I shown above wouldn't be useful by themselves, but it would make a significant difference in performance in my program if this was possible.

sentences:
Need some advice on how to decide where to implement my enemy behaviours I'm in the middle of writing a platformer game in Unity using C#. I have my character, if he presses the kick button his state switches to kicking. During this "kicking" state the character doesn't actually do anything, he only publicly exposes the kicking information such as kickForce etc.

The enemies however have a check in their update functions for the players isKicking value, if he is and the enemy lies within the range for being kicked by the player then the enemy has forces applied to itself and such. All this works fine but I've been thinking about future implementation of different enemy types, if I want to implement other types of enemies that do not behave the same this same script will not work.

To me this is inintutive, part of me thinks that the kicking behavior should be in the player class, he should retrieve all enemies within the area of kicking and run them through some sort of KickObject method. However this is my very issue, I am unsure of what the cleanest and most straightforward (and easily extendable) way of doing this is. I have this problem in general when it comes to implementing the structure of the game, i don't know the best answer and I feel that often when I am planning things they get much more complicated than I had originally planned for down the line and the structure i had in place starts to fall apart.

Any advice on this matter would be greatly appreciated.

TL:DR - For kicking enemies, should the behaviour be applied by the player or is the method of every enemy having its own "be kicked" code the better way to do this. General game development code structure questions.

sentences:
Procedural terrain generation Currently I have a procedurally generated planet using multiple octaves of perlin noise. The thing is, that I don't generate heightmap, but rather get the values of perlin function and apply them directly to vertices.

I'd like to add more surface features. Right now terrain is very rough, there are no flat areas, or rivers.

How can I add those features? Normally there would be some sort of heightmap-filtering, for example voronoi + perlin = good-looking terrain with flat surfaces.

Is it possibile to somehow mix fractal algorithms? If so how, which ones and where can I find more info about it?

sentences:
Direct3D shader compilation fails with constant buffers I've been particularly annoyed by a 'bug' for a couple days involving D3DCompile and vertex shaders with constant buffers. I'm assuming the bug is my fault (missing flag or small nuance of the poorly documented API).

During my asset compile process I compile this vertex shader:

cbuffer Frame : register(b0) {
  float4x4 model_view_proj;
  float4x4 inv_model;
  float4x4 inv_view;
  float4x4 inv_projection;
};

struct VS_INPUT {
  float3 position  : POSITION;
  float2 tex_coord : TEXCOORD0;
  float3 normal    : NORMAL;
  float3 binormal  : BINORMAL;
};

struct VS_OUTPUT {
  float4 position  : POSITION;
  float2 tex_coord : TEXCOORD0;
};

VS_OUTPUT vs_main( VS_INPUT IN )
{
  VS_OUTPUT OUT;
  OUT.position = mul(IN.position, Frame.model_view_proj);
  OUT.tex_coord = IN.tex_coord;
  return OUT;
}

With this code:

const D3D_SHADER_MACRO defines[] = {
  { "VERTEX_SHADER", "1" },
  { "D3D11",         "1" },
  { NULL, NULL },
};

D3DCompile(
  src, src_len,
  path,
  &defines[0],
  &include,
  "vs_main",
  "vs_4_0",
  D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY |
  D3DCOMPILE_OPTIMIZATION_LEVEL0 |
  D3DCOMPILE_PACK_MATRIX_ROW_MAJOR, 0,
  &blob,
  &error_msg_blob
)

I have verified (by stepping through) that my ID3DInclude implementation works and all input data is correct. However, I receive a E_FAIL with an associated error message:

error X3004: undeclared identifier 'Frame'

What gives?

sentences:
Inside realtime lighting I have a small house with point light in it. But as you see, directional and sky lighting affect inside lighting. It's too bright.

How can I make that inside is only affected by point light and not by directional light. Or maybe just a small amount of directional light.

sentences:
How to create a user-friendly magic spell system? I'm designing a small 2D top-down open-world survival-ish game with a magic spell system. The way it works so far:

The player receives a "wand" at the beginning of the game
As the player encounters new items and enemies, they gain spells to help them use those items/defeat those enemies

The problem I'm having is designing a way to cast the spells. At first, I just bound different spells to keys 0-10, but very soon the number of spells overwhelmed it, and you also have the problem of lower level spells not being used in the late game but still being bound to the most useful keys.

So, what's the best way to make a user-friendly spellcasting system? I can overhaul the way magic works in my game if needed.

EDIT: Just to clarify, I'm developing for PC in real time with large variation in spell type and purpose, although this question should apply to all platforms.

sentences:
Get mouse/touch position for NGUI event Since I am using NGUI, to capture mouse events I use their methods such as

void OnPress (bool isDown) {

}

How can I check the mouse/touch position that corresponds to this particular OnPress event?

sentences:
How to design a separated tutorial mode? I'm working on a "social" game that's about 90% completion. One of the remaining features is the tutorial mode.

Basically, the tutorial mode will restrict the user to access some parts of UI and limit the features (like store items). The tutorial will only progress if a certain event is triggered, specifically following the tutorial.

The code is ready and we already have an "almost" working game. The problem is I haven't foreseen the tutorial mode while I was doing those 90%. My requirement is there shouldn't be any loading/transition from tutorial mode to normal mode. This means I have to pick up the progress from the tutorial (no re-rendering of assets and stuff).

How should I design this in a way where I won't touch anything from my old code? I want it to be as easy as just plugging it in. I don't want to jam the tutorial in my old code since this will lead to many bugs.

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:
Using Reflection to access an array from a ScriptableObject in Unity I am trying to get access to a set of stored variables inside a scriptible object in Unity. This class (SectorDeclaration) has a method to pull a variable with a string of the variables name from it:

public Weightings[] GetVariName(string variableName)
{
    Type this_class = Type.GetType("SectorDeclaration");
    System.Reflection.FieldInfo fieldtype = this_class.GetField(variableName);
    Weightings[] fieldFind = (Weightings[])fieldtype.GetValue(null);
    return (Weightings[])fieldFind;
}

Here's the error I'm getting:

TargetException: Non-static field requires a target
System.Reflection.MonoField.GetValue (System.Object obj) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoField.cs:108)
SectorDeclaration.GetVariName (System.String variableName) (at Assets/Code/Gameplay Element/level Elements/SectorDeclaration.cs:54)
BaseGameManager.InitializeNPCSystem () (at Assets/Code/Managers/BaseGameManager.cs:87)
BaseGameManager.Start () (at Assets/Code/Managers/BaseGameManager.cs:73)

It works until the code reaches Weighting[] fieldFind = (Weighting[])Fieldtype.GetValue(null); I've used this code in another area but it is not working here, I've tried with System.object obj but it comes up with namespace doesn't contain this type, as well as with the type I am trying to access. Honestly, not sure what's wrong. If you need more information please let me know.

sentences:
how to implement motion blur effect? I wanted to know how one would implement this motion blur or fade effect behind the soccer ball  .

Here is what I was thinking . You have the balls current position and you also keep its previous position(couple of sec back). and you draw a "streak" sprite between the 2 points.

I have seen this effect lots of time implemented for projectiles in various 2d games and wanted to know if there is a standard technique.

sentences:
How to reset the world in an infinite runner game to prevent an overflowing float? Im following Mike Geig's 2D infinite runner tutorial. However, I'm seeing a potential problem of overflowing the float

How can I reset all objects and camera back again to the origin?

The approach I'm seeking is similar to the advice made by David Debnar on this question: http://answers.unity3d.com/questions/491411/best-practices-for-endless-runner-type-games.html

  Definitely player. It's a lot easier, but to prevent float overflow,
  you should pop everything back a few thousand units every few thousand
  units

sentences:
How to detect which car T-boned the other in a collision? Setup
The game has cars and collisions, and I'm trying to create the following system:

When a car T-bones another, the one getting T-boned is destroyed;
When the cars collide laterally (usually just bump into each other), a normal physics collision happens (and nothing is destroyed);
When the cars collide head-on, the lighter one is destroyed.

The cars are all instantiated from 1 prefab. This can't be changed.
Car Setup
The main body sans the bumper has a normal, non-trigger collider and the dynamic Rigidbody. It has the tag "Destructible".
A child object (which also houses the bumper model, but that shouldn't matter) has a normal, non-trigger collider for the bumper. It has no Rigidbody and reports to the parent's Rigidbody. It has the tag "Destroyer".
Attempted Solutions
1) The transform.forward solution
Get the transform.forwards of both cars and compute their dot product.

If the 2 vectors are opposite each other (or close to it), destroy the lighter car.
If the vectors are facing away from each other (or are close to parallel), let a normal collision happen.
If the vectors are perpendicular (or somewhere in that ballpark)... then I'm lost. How do I know which car T-boned which?

That brings us to the solution #2.
2) The 'multiple colliders' solution
Assign another collider to the bumper of the car and give it a separate tag (e.g. "Destroyer). As a consequence, give the other — main — collider a tag, too (e.g. "Destructible").

If a Destroyer collider hits a Destructible, the latter is destroyed.
If a Destructible hits a Destructible, a normal physics collision happens.
If a Destroyer hits a Destroyer, destroy the lighter one.

But here, I run into an issue.

You can't have multiple colliders on the same game object. Ergo, create an empty child and attach it there. I won't set it to Trigger, or otherwise it won't detect collisions with another of its type (i.e. Destroyer).
In order to destroy colliding objects, I need a script and an OnCollisionEnter() inside it.
OnCollisionEnter() won't run if neither of the game objects has a non-kinematic Rigidbody. This means I need to give the bumper colliders a non-kinematic Rigidbody.
But if I give them dynamic Rigidbodies, they'll just... float away from the car.

In other words, I need a way to create a 2nd collider but keep it firmly attached to the car. Furthermore, if the main collider covers it, then I need to exempt it from collisions with the 2nd collider (let's call it the sub-collider), and I can't use layers to do that or otherwise the sub-collider won't detect main colliders on other cars.
If I don't cover it, then I need the sub-collider to act as a normal physics collider, too, when it hits, for example, a wall, and not have the bumper sink into it. That means it needs a non-kinematic Rigidbody.
How can I solve this issue?

sentences:
WiFi Game Controller Protocol I'm wanting to use mobile devices to control a game.  I'd like to use an industry standard protocol for wifi game controllers rather than roll my own, but have been unable to find any standard.

Does there exist any industry standard wifi game controller protocol?  Is there some unofficial protocol many implement, preferably with quality Android/iPhone client implementations available?

sentences:
How do I move a Unity object with velocity instead of force? I have a 2d car in Unity that I want to move, but Unity does this using relative force & I want to use velocity.
As we know if we add force, an object will move and never stop. I want to use velocity to control movement, because then the car will stop when its velocity is zero.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GamePlay : MonoBehaviour
{
    public GameObject player;
    public Rigidbody2D rb;
    public float speed, steering;
    void Start()
    {
    }
    void FixedUpdate()
    {
        rb.AddRelativeForce(Vector2.up * speed);
        // rb.velocity = Vector2.up;
        Touch touch = Input.GetTouch(0);
        if (Input.touchCount > 0)
        {
            if (touch.phase == TouchPhase.Moved)
            {
                // Vector2 v = Camera.main.ScreenToWorldPoint(touch.position);
                float pos = touch.position.y;
                player.transform.Rotate(0, 0, pos - steering);
            }
        }
    }
}

sentences:
Unity 2D Tap to shoot at mouse position on android device Hello everyone i am really stuck at the moment and would appreciate any help if possible. I have my game where i move the player up and down with 2 buttons on the bottom left of screenshot.

I also have a button over the entire screen for tap to shoot and this moves the weapon to my finger position where i have tapped and it shoots towards that position using mouse.position.

Now the problem is when i am on my android device and i am moving up and down but when i also tap to shoot the gun it moves towards my up and down buttons and this is not what i want.

i want to be able to move with my finger and also shoot towards the second finger.

Any ideas would be greatly appreciated.

Here is my Tap to shoot button code!

public void ShootButton()
{
 timer = 0;
 Face = true;
 //if finger presses Shootbutton
 //then activate this

 Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) -
 transform.position;
 // subtracting the position of the player from the mouse position.
 difference.Normalize(); //normalizing the vector meaning all the sum of the
 vector will be = to 1.

 float rotZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;//find
 the angle in degree.

 WeaponTrans.transform.rotation = Quaternion.Euler(0f, 0f, rotZ +
 rotationOffset);
 if (reloading == false)
 {
     if (fireRate == 0)
     {
         {
             Shoot();
         }
     }
     else
     {
         if (Time.time > timeToFire)
         {
             timeToFire = Time.time + 1 / fireRate;
             Shoot();
         }
     }
 }
}

sentences:
Aspect ratio in LibGdx I'm learning LibGdx and I need some help with the camera.

Let's see, I'm making a Chu Chu Rocket! clon to start. I've loaded a TiledMap (10x10), and I've created an OrthographicCamera to show the map.
This is my camera code, written in the Map class constructor, which is invoked in the create() method:

map = new TmxMapLoader().load("data/maps/" + filename);
renderer = new OrthogonalTiledMapRenderer(map, 1.0f/24.0f);
camera = new OrthographicCamera();
camera.setToOrtho(false, 10, 10);

And this is the result, when I compile

The problem is that the tiles I used in Tiled were squares. When I load, as you can see, they're rectangles. That's a problem for me.

I've read some things about resizing, changing aspect ratio, etc, but everithing was about doing it to fit various devices resolutions / screen sizes. So, my questions are:

How to define correctly the aspect ratio for a tiled map using a ortographic camera?
When I do that, the ratio will be correct for every device?
The elements which aren't the map (like the mice) would need to be also adjusted? How?

Thanks for your answers.

sentences:
Deploying MonoGame on Android I've developed a game using MonoGame for Android (with Xamarin). When deploying to my Android device (via the Xamarin Studio IDE) it installs 3 apps - Monogame-Android-8-support, Monogame-Shared-Runtime and the actual game.

Now I'd like to know how you can package all those into one APK in order to publish the app.

sentences:
Unity3d web player fails to load textures I'm having a problem with Unity3d Web Player. I have developed a project and succesfully deployed it in a web app. It works with absolutely no problem on my PC.

This app is to be installed on two identical machines. I have installed them in both and it only works properly in one. The issue I have is on a computer it fails to properly load the models and textures, so the game runs but instead of the models I can only see black rectangles on a blue background. It has the same problem with all browsers and I get no errors either by the player or by JavaScript.

The only difference between these computers is that one that has the problem is running on Windows 8.1 and the other one on Windows 8 only. Could this be the cause of the issue?

It works fine on my computer with Windows 8.1. However both of the other computers have specs that are significantly lower than mine.

I have already searched everywhere and it seems that it has to do with the individual games, however I think it may have to do with the computer itself because it runs properly in the other two.

The specs on the computes I'm installing the app on are as follows: Intel Celeron 1.40 GHz, 2GB RAM, Intel HD Graphics

If anybody could point me in the right direction I would be very grateful

I forgot to mention, I'm running Unity Web player 4.3.5 and the version on the other two computers is 4.5.0

sentences:
Is caching tiles like this a good idea? I have a 2d int array which represents tiles on level like this:

0000000000000000000000
0000000000000000000000
0000000000000000000000
1111111111111111111111

I have a tileset vector, where each element has it's own tileX and tileY value(position of a tile in a tileset image), collision data etc. So, when I draw a level each time I draw a tile, I ask about them like this:

draw(tileset[currentTile]->tx, tileset[currentTile]->tY, tileWidth, tileHeight);

But, as you can see, there will be lots of the same elements when I iterate through for loop, so do I need to keep lastCollisionData variable in level class to reduce time used to access each tile separately?

sentences:
Can I load a SpriteFont without a content project? I'm developing a game in XNA, however, I do not want to use a content project. I'm loading all my textures through different means, and I'd also like to load my fonts without a content project.

Is there any quick way to maybe include the SpriteFont in the main game project?

sentences:
Buttons only trigger right/left movement once, not continually I have a Unity mobile project where I am trying to use right/left movement using two UI buttons situated accordingly.  The issue is that it only moves the player to the right/to the left one time, not continually when the player is holding the button down.
I'd like the player to be able to hold down a certain button and have the character move constantly in that direction until the button is released.  I've tried making the void into a Coroutine, but nothing working works.
Here is my code.  (rightCallable and leftCallable are attached to the buttons).
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class playerController : MonoBehaviour
{
    public GameObject player;
    public float speed = 1000f;
    public GameObject left;

    //this is so the player may also use the A and D keys if they want, and it works fine.
    public void Update()
    {
        var movement = Input.GetAxis("Horizontal");
        transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * speed;
    }

    //Below is what isn't working
    public void rightCallable ()
    {
        StartCoroutine("moveRight");
    }

    public void leftCallable ()
    {
        StartCoroutine("moveLeft");
    }

    IEnumerator moveRight()
    {
        var movement = 1f;
        transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * speed;
        yield return null;
    }
    IEnumerator moveLeft ()
    {
        var movement = -1f;
        transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * speed;
        yield return null;
     }
 }

sentences:
Creating installer for WinForms XNA with compiled content I have a Windows Forms application that uses a custom Graphics Device control based on Microsoft's "WinForms Series 1: Graphics Device" sample. The application makes use of a single model (the spaceship model included with the second sample) and its associated texture.

My main project includes a reference to an XNA Game Library project, which contains a Content reference to my Content project.  When I build and run the project in either Debug or Release configuration, my model and texture are compiled into XNB format and loaded into the application as expected.

However, when I create an installer (either Windows Installer or ClickOnce) and run it, the content files are not present in any form in the installed location, so obviously I get a runtime exception. I've toggled every option I can find that looks relevant. Am I missing something?

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:
LibGdx: Texturing cube results in jagged transparent edges currently I'm in the works of programming a game - surprise xD
I'm using LibGdx for this manner but I've encountered a very unknown bug I guess.
I wasn't able to get any further by searching the internet.

If you're interested in the entire source code - it's on Github

here is the code of the Block class

package richbar.com.github.treasurepyramid.block;

public abstract class Block implements EventSubscriber, Loadable {

    public abstract String getId();

    Vector3 pos;
    String name;
    Model model;
    BoundingBox bounds;
    Texture texture;
    Material attributes;

    private boolean loadedData;
    public boolean isLoaded(){return loadedData;}

    public Block(){
        Main.getInstance().addAssetListener(this, "blocks/"+getId()+".json",    Text.class);
    }

    public Block(Block block){
        Main.getInstance().addAssetListener(this, "blocks/"+block.getId()+".json", Text.class);
        pos = block.pos;
        attributes = block.attributes;
        bounds = block.bounds;
    }

    public Model getModel(){
        if(model != null) return model;
        texture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
        Material material = new Material(TextureAttribute.createDiffuse(texture));
        ModelBuilder modelBuilder = new ModelBuilder();
        modelBuilder.begin();
        modelBuilder.node();
        MeshPartBuilder mesh_part_builder = modelBuilder.part("box", GL20.GL_TRIANGLES, VertexAttributes.Usage.Position
            | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates, material);
        BoxShapeBuilder.build(mesh_part_builder, 5, 5, 5);
        return modelBuilder.end();
    }

    boolean stayUpdated = true;
    @Override
    public void eventUpdate(Event e, Object args) {
        AssetManager manager = Main.getInstance().getAssetManager();
        if(e == Event.ASSET_LOADED && manager.isLoaded("blocks/"+getId()+".json")){
            Main.logger.log("loaded blocks/"+getId()+".json");
            stayUpdated = false;
            JsonValue json = new JsonReader().parse((manager.get("blocks/"+getId()+".json")).toString());

            name = json.getString("name");
            texture = new Texture(Gdx.files.internal(json.getString("texture")));
            loadedData = true;
        }
        //generate Cube Model if Absent
        model = getModel();
    }

    @Override
    public boolean stayUpdated() {
        return stayUpdated;
    }
}

Pic of this weird behavior     ||   Changing angles only changes the jaggedness

I'd really appreciate if anyone could help me fix this issue : )

Have a nice evening,

Marco

sentences: What are the benefits of capping frames per second? (If any) I am working on a simple game in OpenGL, using SDL for display initialization and input, and it appears in terms of timing I have two options available to me. Number one being just sleeping for the optimalTimePerFrame - theTimeTakenToRender, when the optimalTimePerFrame in seconds = 1/theFramerateCap. (I'm not entirely sure if this is necessary, as it is equivalent to using vsync, which may be more accurate. If my assumption is correct then please tell me wheter or not SDL + OpenGL has vsync by default, and if not how to enable it.) The other is to measure the time since the last frame was rendered, and merely adjust movement accordingly. (The shorter time taken to render a frame, the less far entities move in that frame). In terms of performance, and decreasing flicker etc, what are the advantages and disadvantages of these two methods?

sentences:
How do I add a border to rectangles using a shader? I want to draw some rectangles with a border. Currently I render the fill with glDrawArrays(Triangles, ...) and the border with glDrawArrays(LineLoop, ...). Is there a neater way?

I'm targeting OpenGL 3.3.

Details

Illustrative excerpt:

// vertexBuffer   -> VertexAttribArray(0)
// colorBuffer    -> VertexAttribArray(1)
// texCoordBuffer -> VertexAttribArray(2)

GL.DrawArrays(PrimitiveType.Triangles, 0, 12); // 2 test rectangles

GL.DisableVertexAttribArray(1); //Disable color array
GL.DisableVertexAttribArray(2); //Disable texture array

GL.DrawArrays(PrimitiveType.LineLoop, 0, 6); // First rectangle border
GL.DrawArrays(PrimitiveType.LineLoop, 6, 6); // Second rectangle border
// Lots of draw calls for every rectangle,
// if there are more than the 2 test rectangles...

This works fine, but I don't like having to draw the additional LineLoops for every rectangle. How can I improve this?

Could I do this elegantly with a shader? Something like this:

// VertexArributes

GL.DrawArrays(Triangles, 0, vertices.Length); // Shader does the border

// DisableVertexAttributes

My current shaders

Vertex

#version 330 core

layout(location = 0) in vec4 position;
layout(location = 1) in vec4 color;
layout(location = 2) in vec2 texCoord;

uniform mat4 projMatrix;
uniform mat4 worldMatrix;

out vec4 vColor;
out vec2 texCoords[];

void main()
{
  gl_Position = projMatrix * worldMatrix * position;
  texCoords[0] = texCoord;
  vColor = color;
}

Fragment

#version 330 core

in vec4 vColor;
in vec2 texCoords[];

uniform sampler2D tex;

out vec4 fColor;

void main(void)
{
  fColor = texture2D(tex, texCoords[0].st) * vColor;
}

sentences:
How can I draw a line of the raycast hit in game view while the game is running? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraRaycast : MonoBehaviour
{
    public Camera cam;

    public LineRenderer laserLineRenderer;
    public float laserWidth = 0.1f;
    public float laserMaxLength = 5f;

    void Start()
    {
        Vector3[] initLaserPositions = new Vector3[2] { Vector3.zero, Vector3.zero };
        laserLineRenderer.SetPositions(initLaserPositions);
        laserLineRenderer.startWidth = laserWidth;
        laserLineRenderer.endWidth = laserWidth;
    }

    void Update()
    {
        Ray ray = cam.ViewportPointToRay(cam.ScreenToViewportPoint(Input.mousePosition));
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit, 100))
            if (hit.transform.tag == "Interactable")
            {
                //print("I'm looking at " + hit.transform.name);
                laserLineRenderer.enabled = true;

                laserLineRenderer.SetPosition(0, ray.direction);
                laserLineRenderer.SetPosition(1, hit.transform.position);
            }
            else
            {
                //print("I'm looking at nothing!");
                laserLineRenderer.enabled = false;
            }
    }
}

When it detect a "Interactable" object i want it to draw green line from the mouse cursor to the point where the raycast is hitting.

Now it's not drawing anything.

sentences:
How Do I Play An AnimationClip I want to play an animation but it seems that in The new version of unity it is harder.  I have an AnimationClip but I don't know how to play it.  I have been looking at this for 2 hrs now and i cant get it to work.

using UnityEngine;
using System.Collections;

public class FPSCamera : MonoBehaviour {

public float lookSensitivity = 5;
private float xRotation;
private float yRotation;
private float currentRotationX;
private Animation walking;

void Start() {
    // DONT KNOW HOW TO FIND AND START WALKING ANIMATION
}
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 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:
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:
Is it more efficient to encode rotation in a spritesheet or rotate at runtime? I'm developing a game with JavaScript and HTML5 and I'm wondering about the performance implications of sprite rotations. There are two ways that I know to rotate a sprite:

Rotate the actual sprite based on its rotational speed and velocity, as it travels along it's trajectory.
Pre-compute the rotations and store them as frames within the sprite sheet to give the illusion that it's spinning when it isn't.

On one hand, I can see how rotating some sprites in a spritesheet would be efficient because it's one image that is loaded, split into frames, and re-used.  But on the other hand, I'm not sure the calculations involved for rotating the sprite based on its velocity and rotational speed are really anything for current browsers (on computers and mobile devices) to worry about.

In my game, the canvas area is 800 x 600, and the game is using 32 x 32 sprites for everything. The "map" isn't tile-based. Of the two options above, which would be more efficient for runtime performance?

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:
Angle between two planes I have two triangles in 3d space which share 1 edge and I would like to determine if the angle between their normal vectors is "uphill" or "downhill". In other words, if you set one flat, would the angle between them be acute (uphill) or obtuse (downhill). Hopefully that makes sense.

So far I have the normal vectors of each triangle and have calculated the angle between the two triangles, however this angle is always >= 90 degrees.

Vector3 v1 = triangle1.Normal;
Vector3 v2 = triangle2.Normal;
float cosAngle = Vector3.Dot(v1, v2) / (v1.magnitude * v2.magnitude);
float degAngle = Mathf.Acos(cosAngle) * Mathf.Rad2Deg;

Is there a trick I am missing that lets me determine which direction this angle is in?

sentences:
Is AGS outdated for Point & Click Adventures? I am working on a Point and Click Adventure game being coded on the AGS engine, and just recently, the question of 'is this outdated?' has come up.

I'll admit, AGS is a rather old, and kind of went out of style with the P&C genre itself, but I have not found anything quite like it that specializes in this specific format of games.

So, is it outdated, and if so, is there a better alternative?

sentences:
Are there any Java based libraries that provide game mapping features? I'm working on a Java web based game in my spare time (springMVC / JSPs etc), and I'm wondering what are my options for dealing with the "game world" or mapping element.

My game will be 2d / text based, so I have no need for any OpenGL / Flash etc.

My initial idea was to use Google maps and provide a custom overlay, but I want to know if there are any alternatives?

For example, if I create a 2d map with all my zones, are there any libraries that will help me plot players, work out distances and so forth?

Regards

sentences:
How do I efficiently check which object causes the most gravitational force in a list of thousands of objects? I'm working on a proof-of-concept space engine, and one of its tasks is to find the object with the greatest sphere of influence towards the player; that is, the mass of the object, divided by the square root of the distance to the player. I don't see much optimization to do, as an octtree or a KDTree only works for points. Even though there might be a planet only a few thousand kilometers away, a black hole many million kilometers away might have a greater gravitational force on the player.

The current check is brute-force. I go through each object, and return the one with the highest gravitational pull on the player. I have around 10,000 objects to perform this check on, but I might increase this number to millions, later. Optimally, I want to perform the check during each frame, which currently lowers the frame rate from 1600 a second to around 100 a second, which is unacceptable.

A few ideas comes to mind, but none of which seems optimal:

Make the system run in its own thread. Great, if the user has a core they don't use for anything, but only gives more overhead if there are no more cores available.
Limiting the check to run only once every few frames, resulting in a better average frame rate. The frames that need to be checked will result in stuttering, so this seems like a bad road to go down.
Limiting the number of objects checked per frame, so no matter what, only 128 objects may be checked per frame. This has the advantages of solution 2, without the disadvantage of stuttering, as each frame is equally heavy. Still, the programmer in me somehow also dislikes this solution. Then again, game programming is quite different from what I have previously worked on.

I'm not asking solely just for the purpose of this specific system, but also to find the best practice for problems like this, where there must be a compromise between running frequently and performance.

Any suggestions specific to this problem, like how to optimize the function through a modified version of a KDTree, is also very much appreciated; but the question is directed more generally towards the best practice for such problem.

sentences:
Raycast to the movement direction after hit a collider? I'm working on PingPong game style. My ball keep rotate on all direction. I want to use raycast to show me the direction ball will take after hit a wall or collider. Example
public GameObject Ball;
public Rigidbody rg;
public float StartSpeed;
public bool StartGame = false;

void Update()
{

    if (StartGame == true)
    {
        rg.AddForce(arrow.transform.right * StartSpeed);
        var vel = rg.velocity;
        currentSpeed = vel.magnitude;
        if (currentSpeed > StartSpeed)
        {
            StartGame = false;
        }
    }

        RaycastHit hitB;
        Ray fow = new Ray(Ball.transform.position, Vector3.forward);
        if (Physics.Raycast(fow, out hitB, 200))
        {
            print(hitB.collider.name);
            Debug.DrawLine(fow.origin, hitB.point, Color.yellow);
        }

}

sentences:
How do I make educational games engaging not boring? We make educational games for school students, age 7-18; we can't have any violence or blood in them.

I have scoured Google Play and YouTube for good examples of educational games.

So far I found this math game. The cannon fires at number-enemies, to score, the player should bring their values to exactly zero.
As levels advance, the bigger numbers occur - 10, 20, 30, etc.

Why is it hard to make educational games that are not boring? It seems violence is what attracts most young people nowadays!
One big exception could be puzzles.

sentences:
How does this example make efficeint voxel engines using "chunks"? I'm currently looking in to how voxel engines works, with a view to possibly making one, myself. I see a lot of material, like "Let's Make a Voxel Engine", which talks about how to go about reducing the draw calls. What I can't seem to understand is how it actually saves draw call counts, on the basis of the logic being something like the following:

// Without chunks:

foreach voxel in myvoxels
  DrawIfVisible()

// With chunks:

foreach chunk in mychunks
    DrawIfVisible()

    // which then does ...
foreach voxel in myvoxels
    DrawIfVisible()

Surely, you save nothing by doing this; you still make a draw call for each visible voxel, and a visible voxel needs a draw call in either scenario. The only real saving I can see is that the logic that evaluates a chunk will be able to determine if a large number of voxels are visible or not, effectively, saving a bit of "is this chunk visible" CPU time. It's the draw calls that interest me; the fewer of those, the faster the application.

In case it makes any difference, I will probably be using XNA with DirectX for my engine, so don't consider my choice of example in the link above as my choice of technology. However, this question is such that I doubt it would matter.

sentences:
Require maths help calculating deflection angles of quadrants For each quadrant, I need to find a neat way of calculating the deflection angle for a small circular object striking a circle, as shown in the diagram.

Angles a and b are already known.
Angle a is always relative to 0 degrees position.
Angle b is relative to the quadrant.
The initial angle can also be greater than 180, when coming from the
other direction, as shown in the diagram the right.

For quadrant 2, in the following snippet from my code, dy and dx represent the x and y coordinates of a point on the circle:

intersectAngle = atan(dy/dx);

Initial angle is calculated from velocity vectors:

pAngle = PI - (atan2(pVel.x, pVel.y));

For quadrant 0, I came up with this for the rebound angle:

pAngle = pAngle - 2 *(pAngle - tangentAngle);

Where tangentAngel is just the intersect angle with half PI added. Thsi worked for a ball from any direction.

Moving onto quadrant 1, this works for pAngles of less than 90 deg, but not for pAngles from the other direction:

pAngle = pAngle + 0.5 * PI - intersectAngle;

Feels like I shouldn't be writing all this code and that there is a more efficient way. I realise this is an elementary question but I'm studying this so it's all new to me. Please be gentle.

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:
Offset input sent to blend tree based on Character's Local Rotation I am developing a top down twin stick shooter. I am running into a issue where if I change my character's rotation, the Unity Blend Tree animation does not play the correct animation that corresponds to that relative rotation. For example if my Character is facing north and I walk forward, the animation plays fine, but if I rotate my character 180 degrees (facing south), when I walk forward it will play the backwards animation.

https://media.giphy.com/media/cmx1aOm0UOjCed8MJT/giphy.gif

I believe this is because I am just sending the inputs from the analog stick, and not offsetting the values based on the rotation of the character. I am using 2 floats (horizontal and vertical) to control the blend tree. How can I offset the float values from the input based on the character's local rotation? Current code below,

 void Update()
{
    if (!ReInput.isReady) return; // Exit if Rewired isn't ready. This would only happen during a script recompile in the editor.
    if (player == null) return;
    GetInput();
    Move();
    Look();

}

private void GetInput()
{
    // Get the input from the Rewired Player. All controllers that the Player owns will contribute, so it doesn't matter
    // whether the input is coming from a joystick, the keyboard, mouse, or a custom controller.

    mhorizontal = player.GetAxis("Move Horizontal"); // get input by name or action id
    mvertical = player.GetAxis("Move Vertical");

    lHorizontal = player.GetAxis("Look Horizontal");
    lVertical = player.GetAxis("Look Vertical");
    //fire = player.GetButtonDown("Fire");
}

void Move()
{

    if (mhorizontal != 0 && mvertical != 0)
    {
        Vector3 rightMovement = right * moveSpeed * Time.deltaTime * mhorizontal;
        Vector3 upMovement = forward * moveSpeed * Time.deltaTime * mvertical;
        //Vector3 heading = Vector3.Normalize(rightMovement + upMovement);

        // transform.forward = heading;
        transform.position += rightMovement;
        transform.position += upMovement; animator.SetFloat("Vertical", mvertical, 0.1f, Time.deltaTime);
        animator.SetFloat("Horizontal", mhorizontal, 0.1f, Time.deltaTime);
    }

}

void Look()
{
    if (lVertical != 0 && lHorizontal != 0)
    {
        float cameraFacing = Camera.main.transform.eulerAngles.y;
        Vector3 inputVector = new Vector3(lHorizontal, 0, lVertical);
        Vector3 turnedInputVector = Quaternion.Euler(0, cameraFacing, 0) * inputVector;
        transform.LookAt(turnedInputVector + transform.position);

    }

}

sentences:
How can I replicate the look and limitations of the Super NES? I am looking to produce graphics with the same limitations / look that in the Super Nes era. I am specifically looking for graphics similar to Chrono Trigger / FF6.

It would be a lot easier to do if I had an idea of the resolution / dpi I am supposed to use. I found that the technical specs for the SNES are:

  Progressive: 256 × 224, 512 × 224, 256 × 239, 512 × 239 Interlaced:
  512 × 448, 512 × 478

But even by using these resolutions, it is pointless if I set it at 72dpi, as I will still have possibly very detailed graphics (that is the main thing, I don't want detailed graphics, I want to go pixelated).

I figured it might be related to the sprite size limit, i.e.:

  Sprites can be 8 × 8, 16 × 16, 32 × 32, or 64 × 64 pixels, each using
  one of eight 16-color palettes and tiles from one of two blocks of 256
  in VRAM. Up to 32 sprites and 34 8 × 8 sprite tiles may appear on any
  one line.

This would work for sprites (characters, objects), but what about maps? Are they built entirely from 8x8 tiles? And then, at what resolution is the end result displayed?

It might seem like I am giving the question and answers at the same time, but all of these are suppositions I am making, so could someone confirm or correct them?

sentences:
Understanding the z-axis vector from OpenGL modelview matrix I would like to shoot spheres in the current view direction in a simple scene. I use an FPS camera, so no z-rotation. The vector pointing in the correct direction should be (m[8], m[9], m[10]) where m is the modelview matrix as returned by glGetDoublev(...).

In my understanding that vector is normalized, so when I scale it by some scalar its length will equal that scalar. If I draw an object every frame and translate it by the scaled z-axis vector (plus camera position), the object should be directly in front of me, all the time, right?

However, when I run my program, the object is not in front of me all the time. It is in front of me, as long as no rotation around the y-axis is done. Here is the relevant (I think) source code:

/* camera */
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(g_cam.rx, 1, 0, 0);
glRotatef(g_cam.ry, 0, 1, 0);
glTranslatef(-g_cam.tx, -g_cam.ty, -g_cam.tz);

/* get z-axis vector */
double mm[16];
glGetDoublev(GL_MODELVIEW_MATRIX, mm);

/* should be in front of me, all the time */
glPushMatrix();
glTranslatef(g_cam.tx + 10 * mm[8], g_cam.ty + 10 * mm[9], g_cam.tz - 10 * mm[10]);
glColor3f(0, 0, 1);
glCullFace(GL_FRONT);
glutSolidTeapot(2);
glCullFace(GL_BACK);
glPopMatrix();

Note that this is not about how to place an object in front of me all the time, but rather what is wrong with my understanding, that using the z-axis vector does not work here.

I know that this is a frequent question, because I found lots of material on the internet. However, I seem to be missing something yet. It would be great if you could help me with it :)

If the problem is not as obvious as I think it is, I can prepare a small example demonstrating the issue.

sentences:
How to find the smallest distance between two 4-sided objects in 3D space? I was wondering if there is a way to calculate the smallest distance between two 4-sided objects in space. In this specific scenario, the only information I know about both of them are the 4 points that make up their vertices (so 8 points in total). Is there a way to achieve this?

Also, I'm considering that both shapes have a non-zero volume and that they do not intersect each other.

sentences:
Recommended data structure for storage and fast access of infinite chunk-based heightmap terrain I'm aiming to create a chunk based heightmap terrain in Unity.
I already have a basic multifractal simplex noise set up and working, able to generate heightfields and meshes at runtime... but only individually for the moment.

I'm attempting to work out how best to store and access each chunk.  I already have a couple of methods worked out to convert global positions to chunk coordinates and chunk-local barycentric triangle coordinates, so I can interpolate heights.  I've used that to build a method to march a camera-space-to-world-space ray across the mesh and iterate through x/z-plane intersections until it finds the height-intersection - for a fast way to look up mouse-position on the terrain without having to attach physics collision meshes for each chunk and use Unity's raycasting.  That's all working nicely.

I'm just a bit stumped now on how to implement the main infinite-grid storage that I'll generate chunk meshes from.

This is planned to be in service of a game with an isometric perspective, revealing the world as units explore fog-of-war over time... with the ability to move the camera around the uncovered terrain fairly quickly, so I'm guessing there might be limited scope for unloading previously generated chunks... it'll be an ever-expanding dataset (so I'll presumably have to be looking for ways to keep it light on memory)

I figure I can either:

Create a 2-dimensional array of float (or perhaps short - 64k height levels should probably be plenty) for the entire terrain, and dynamically resize the array as each x/z boundary is pushed back.  Generate just the terrain mesh in chunks, to keep each mesh chunk under the Unity 64k-vertex limit.
Create a grid manager class, which has some kind of dynamic data structure that stores map-chunk objects, and instantiates them/retains references to them as they're demanded, each of which would contain its own (res*res)-sized heightmap array.
Something else?

I'm assuming option 2 will have the most mileage, but what I'm most unsure about is what kind of dynamic data structure to use.  I'd guess some kind of key/object pair structure, where the key is built from the chunk coordinates?

Assuming I'll want to access height-values quickly and constantly, across chunk-boundaries, for things like my mouse-ray-intersection method, and for pathfinding code, etc... I presume I'll need a way to access chunks that is nearly as fast as looking up arrays by indices, and O(1) complexity.
Or perhaps some way of caching recently-accessed chunks or chunks that the camera is near?  Or pointers to them, or something?

As you can probably tell I'm fairly new to the gamedev side of things, but I have a VFX background, and so know my way around 3D geometry math and basic scripting.  In terms of designing/structuring/implementing a game, I'm a total novice though, so any pointers to relevant tutorials and such would be much appreciated.

sentences: Why do GPUs require game specific drivers? PC GPU driver updates often cite improvements made to performance of specific, recently released games. Why is this game-specific updating needed? How do the game-specific changes interact with the game code?

sentences:
Unity - Logic for saving and loading objects with both static and dynamic data I need help to get some structure for my save and load.

I am making a city builder, so I have Buildings thats need to be saved.

Each building has a lot of static Data, for example name, description, etc.

However it also has a lot of dynamic Data, for example worldPosition, id, etc.

My current structure looks like this:

On each Building GameObject I keep a reference to a ScriptableObject that stores all the static data.
I also store a reference to an Object that stores all the dynamic data.

This means I need 2 classes for storing Building data, which I already don't like (BuildingStaticData & BuildingDynamicData)

When I Save/Load my game I only need to store the Dynamic data, so for saving I just save the DynamicData.

For Loading I load the DynamicData, and instantiate a Building GameObject that is associated with it, then the GameObject has the reference to the StaticData.

While this works, I would prefer to have a structure where I only have a single class for BuildingData, but I also don't want to lose the power of a ScriptableObject where I can reference other Prefabs etc.

I need some help with this logic.

sentences:
Lightning bolt effect with particles is not continuous I am Drawing a lightning effect animation using this image:

Below the result:

As you can see the outcome is not a continuous purple color as I wanted it to be, but it has black spaces in between some parts.
The way i am drawing this animation is that i am drawing two LightningBolts every frame in Additive mode.
Every LightningBolt is drawn with the help of 21 random points across the width of the animation which makes 20 lines of various angles.
So I rotate the texture I have to match each angle I calculated for each of those 20 lines for the two LightningBolts I am drawing in every frame in Additive mode.

What are your suggestions to overcome this problem ?

sentences:
Problems loading Hilva tutorials I'm a newcomer to XNA, and I'm evaluating some libraries. The Hilva Graphics Engine looks interesting, and I'm trying to run their tutorials.  However, all of them give me errors.

For example, if I download the ParallaxMappingSample demo, and try to build it, I get

Error   1   Error loading pipeline assembly "C:\Users\Me\Desktop\ParallaxMappingSample\Hilva.Content.dll".  ParallaxMappingSample

I get similar errors for all of the samples.  Unfortunately, this error isn't very enlightening.  I can see the Hilva.Content.dll in the appropriate directory.  I tried removing and readding the reference from the content project, but I get the same error.

I'm not sure it's relevant, but I'm on Windows 7, I'm using Microsoft Visual Studio 2010, and XNA 4.0.

Is there an easy (or difficult) solution?

EDIT: If you happen to try this, even if you don't have a solution, let me know about it in a comment.  Whether it works for you, or if you get the same problem...either result would be something that might let me know if it's just a problem with the tutorial, or if it's on my end.

sentences:
What should I watch out for in a 3d artist's portfolio? I'm looking to hire a freelancer to help with 3d modeling. I've thought up a few qualifiers so far:

Is their topology okay for animation?
Have they demonstrated the technical capabilities necessary for my project? (Have they baked normals, AO maps, etc.)
Have they shown an ability to execute from conceptual drawings?

Are there any massively important things I should watch out for that I haven't included?

Any red flags I should be aware of, like making sure the work isn't plagiarized?

Note

I'm specifically talking about reviewing portfolio content, before interviewing them. I'm looking for things I can say yes or no to, or that I might want to question them on further in an interview.

sentences:
THREE.JS: why is the rotation only applied on the last axis used? my function:

    function rotateAroundWorldAxis2(object, radians1, radians2) {

        object.rotWorldMatrix.makeRotationX(radians1).makeRotationZ(radians2);
       // object.rotWorldMatrix;

        // old code for Three.JS pre r54:
        //  rotWorldMatrix.multiply(object.matrix);
        // new code for Three.JS r55+:
        object.rotWorldMatrix.multiply(object.matrix);                // pre-multiply

        object.matrix.copy( object.rotWorldMatrix );

        // old code for Three.js pre r49:
        // object.rotation.getRotationFromMatrix(object.matrix, object.scale);
        // old code for Three.js pre r59:
        // object.rotation.setEulerFromRotationMatrix(object.matrix);
        // code for r59+:
        object.rotation.setFromRotationMatrix(object.matrix);

    }

my object was initialized like this:
object.rotWorldMatrix = new THREE.Matrix4();

sentences:
How could an XNA game close with no exception being thrown? I've been messing with my game's network code recently (TCP/UDP sockets) and my game keeps shutting down with no exceptions being thrown at all.

It runs fine until the disconnection of a client, so I already know that it has to be related to the network.

My real problem is that no exception is thrown and the game silently exits on both the client and server sides. How's that even possible? What could end the runtime of an XNA game?

sentences:
Apple Game Center - Sharing Data between 2 SKUs possible or not? Question: Is it possible to access the same leaderboards and achievements via GC from 2 versions of a game (i.e. 2 different SKUs, one for iPhone/iPod and another for iPad. Where both are actually the same game in terms of game modes and features. For instance to be able to have different pricing)

Or: is this impossible and there is no other way than having 2 separate Leaderboards, Achievements -or- one universal binary.

Thanks in advance

*edit: typo and added remark about universal binary

sentences:
Check if a game object's component can be destroyed Developing a game in Unity, I'm making liberal use of [RequireComponent(typeof(%ComponentType%))] to ensure components have all dependencies met.

I'm now implementing a tutorial system which highlights various UI objects. To do the highlighting, I'm taking a reference to the GameObject in the scene, then I clone it with Instantiate() and then recursively strip away all components which aren't needed for display. The problem is that with the liberal use of RequireComponent in these components, many cannot be simply removed in any order, since they are depended on by other components, which have not been deleted yet.

My question is: Is there a way to determine whether a Component can be removed from the GameObject it is currently attached to.

The code I'm posting technically works, however it throws Unity errors (not caught in try-catch block, as seen in the image

Here's the code:

public void StripFunctionality(RectTransform rt)
{
    if (rt == null)
    {
        return;
    }

    int componentCount = rt.gameObject.GetComponents<Component>().Length;
    int safety = 10;
    int allowedComponents = 0;
    while (componentCount > allowedComponents && safety > 0)
    {
        Debug.Log("ITERATION ON "+rt.gameObject.name);
        safety--;
        allowedComponents = 0;
        foreach (Component c in rt.gameObject.GetComponents<Component>())
        {
            //Disable clicking on graphics
            if (c is Graphic)
            {
                ((Graphic)c).raycastTarget = false;
            }

            //Remove components we don't want
            if (
                !(c is Image) &&
                !(c is TextMeshProUGUI) &&
                !(c is RectTransform) &&
                !(c is CanvasRenderer)
                )
            {
                try
                {
                    DestroyImmediate(c);
                }
                catch
                {
                    //NoOp
                }
            }
            else
            {
                allowedComponents++;
            }
        }
        componentCount = rt.gameObject.GetComponents<Component>().Length;
    }

    //Recursive call to children
    foreach (RectTransform childRT in rt)
    {
        StripFunctionality(childRT);
    }
}

So the way this code generated the last three lines of the debug log above is the following: It took as input a GameObject with two components: Button and PopupOpener. PopupOpener requies that a Button component is present in the same GameObject with:

[RequireComponent(typeof(Button))]
public class PopupOpener : MonoBehaviour
{
    ...
}

The first iteration of the while loop (denoted by the text "ITERATION ON Button Invite(clone)") attempted to delete the Button first, but couldn't as it is depended on by the PopupOpener component. this threw an error. Then it attempted to delete the PopupOpener component, which it did, since it is not depended on by anything else. In the next iteration (Denoted by the second text "ITERATION ON Button Invite(clone)"), it attempted to delete the remaining Button component, which it now could do, since PopupOpener was deleted in the first iteration (after the error).

So my question is whether it is possible to check ahead of time if a specified component can be removed from its current GameObject, without invoking Destroy() or DestroyImmediate(). Thank you.

sentences:
How to build bullet (hit) damage detection in Augmented Reality to a real life person acting as an opponent? I am building an Android AR game using ARcore 1.18 in Unity 2019.4.5f1 (LTS). Now I want to create something like bullet damage detection just like it is built in a normal Unity 3D game.
Of course, the biggest problem is how can I even detect the real person's hitbox like it is done in a normal game? I need to somehow be able to attach the bullet damage script to the body of the real-life person in real-time.
Has anyone tried this before? How can we achieve this? I understand if I might not get a spoonfed tutorial but some help towards what should I be doing to achieve this will be greatly appreciated.
I see some other FPS Augmented Reality games which either uses Laser Tag (Father.io) or Barcodes to scan the opponents. These are definitely some great ideas to create an FPS game experience but still, if possible, I want to try it with just the mobile camera without any external support. I am ready to bear some accuracy loss :)

sentences:
How can I change a materials properties in my Unity c# code? Hello everyone I want to change my materials tiling offset in code, but the only way I found to access it other than drag-dropping to a public field in inspector is to check by name. But I then noticed the name is suffixed with ' (Instance)' .

So it seems a little odd to me having to access it this way, is there another way that I don't know about?

foreach(Material m in GetComponent<MeshRenderer>().materials)
{
    if (m.name == "card_front (Instance)")
    {
        m.mainTextureOffset = new Vector2(value * 1/13f, (int)suit * 1/5f);
    }
}

sentences:
Implementing navigatable achievement menu in javascript I am in the process of learning javascript for game design, and wanted to make a separate achievement page that the user can navigate to that will allow them to check their achievements on various games. (at the moment I am not concerned with implementing localstorage/cookies etc, I just want to work on the page for now)

So the requirements of my base idea is as follows:

Able to drag around the viewport/page to view all the achievement categories as they will likely not all be in view on smaller screens
Able to click on a category to open a small box containing all achievements belonging to that game/category
Able to mouse over all achievements in the boxes to get text descriptions of what they are
OPTIONAL: have lines connecting each box on the "overworld" to show users where nearby boxes are if they are off screen

At first, I thought I would need canvas to be able to do this. I learned a bit about it and got decently far until I realized that canvas has a lot of restrictions like not being able to do mouseover events unless manually implementing each one. Here is the current progress I was at in doing a test-run of learning canvas, but it's not very far:

var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');

canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

function resize()
    {
        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight;
        ctx.setTransform(1, 0, 0, 1, 0, 0);
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        ctx.translate(panning.offset.x, panning.offset.y);
        draw();
    }
    window.addEventListener("resize", resize);

var global = {
    scale   : 1,
    offset  : {
        x : 0,
        y : 0,
    },
};
var panning = {
    start : {
        x : null,
        y : null,
    },
    offset : {
        x : 0,
        y : 0,
    },
};
var canvasCenterWidth = (canvas.width / 2);
var canvasCenterHeight = (canvas.height / 2);

function draw() {
    ctx.beginPath();
    ctx.rect(canvasCenterWidth, canvasCenterHeight, 100, 100);
    ctx.fillStyle = 'blue';
    ctx.fill();

    ctx.beginPath();
    ctx.arc(350, 250, 50, 0, 2 * Math.PI, false);
    ctx.fillStyle = 'red';
    ctx.fill();
}

draw();

canvas.addEventListener("mousedown", startPan);

function pan() {
    ctx.setTransform(1, 0, 0, 1, 0, 0);
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    ctx.translate(panning.offset.x, panning.offset.y);
    draw();
}

function startPan(e) {
    window.addEventListener("mousemove", trackMouse);
    window.addEventListener("mousemove", pan);
    window.addEventListener("mouseup", endPan);
    panning.start.x = e.clientX;
    panning.start.y = e.clientY;
}

function endPan(e) {
    window.removeEventListener("mousemove", trackMouse);
    window.removeEventListener("mousemove", pan);
    window.removeEventListener("mouseup", endPan);
    panning.start.x = null;
    panning.start.y = null;
    global.offset.x = panning.offset.x;
    global.offset.y = panning.offset.y;
}

function trackMouse(e) {
    var offsetX  = e.clientX - panning.start.x;
    var offsetY  = e.clientY - panning.start.y;
    panning.offset.x = global.offset.x + offsetX;
    panning.offset.y = global.offset.y + offsetY;
}
body{
  overflow: hidden;
}
canvas {
  top: 0;
  left: 0;
  position: absolute; }
<canvas id="canvas"></canvas>

So I guess my question is now: what is the best way to implement this? Is it feasable to do it with canvas, or should I just scrap that and try to figure out something with div movement? Should I be concerned with performance issues and should that affect how I implement it?

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:
Can't refer mesh size after using .BakeMesh() in Unity I can't figure out how to refer to the size of a particular mesh.

The mesh is created through .BakeMesh(), then a box collider is added. Unfortunately the box collider has a scale of 1 by 1 by 1, regardless of how big the mesh I'm adding it to seems to be.

This doesn't match my understanding of how creating a box collider should work, so I've set up a Debug.Log that outputs the mesh size.

Here the plot thickens. The mesh's size just comes back at 0, 0, 0.
My attempts at getting the size of the object are as follows:

objectToMeasure.GetComponent<Renderer>().bounds.size;

objectToMeasure.GetComponent<MeshFilter>().mesh.bounds.size

objectToMeasure.GetComponent<MeshFilter>().sharedMesh.bounds.size;

Assuming I'm referring to the size of the object in the correct way, this seems like it must be an issue created by baking the object. Do I need to wait a frame (via starting a coroutine) before trying to access the size of the object, or am I referring to the wrong component of the object, or is the BoxCollider setting it's size based on objectToMeasure's scale rather than it's size in the world?

I feel sure that
objectToMeasure.GetComponent().mesh.bounds.size;
should be right, since the script I use to bake to the mesh is:
meshToBake.BakeMesh(meshToMeasure.GetComponent().sharedMesh);

I've been driving myself to the edge of sanity for 24 hours with this script not working, so advice is greatly appreciated.

sentences:
What's a good 2D game engine or framework to work on right now? Basically, I'm looking for a good, 2D game engine to build a platformer/contra-like shooter on to bolster (and when I say bolster, I really mean start) my portfolio.

I use the words "right now" in the title because I've read through some questions, and I don't really want to use anything like Java's game API for mobile phones from 2003. (Also, XNA is out of the question as I'm already working on a larger scale project in it.)

I'm fairly competent in Java, and have a basic understanding of other languages like C# and Python, but I'm totally unopposed to learning a new language while learning the engine (within reason).

The engine doesn't have to be super powerful, just free and simple enough that someone of my skill level (3rd year CS major) can get a nice horizontal slice out without too many bumps along the way.

sentences:
How to achieve dotted trail behind moving object with use of Trail Renderer? How can I achieve effect shown on picture below with use of Trail Renderer in 2D game? Is it even possible? I need dotted (dashed) trail behind my object and i can't figure it out.

don't know why stack can't load my images LINK HERE

Why trail renderer? Because I feel this is the right way to do this. Earlier, (Unity ver 5.3) I achieved this using: Mesh Particle Emitter + Particle Animator (Fade) + Particle Renderer, but sometimes it behaves strangely in multiplayer. Particles not always came out from object, sometimes they were offset. Anyway, Unity in ver. 5.5 released new component (TrailRenderer), which I would like to use (if it is possible to accomplish effect I need).

I am looking for efficient ways, so answers like "you can instantiate"dot" every X sec. at position of your moving object" ... Please no.

What I have tried.

I added to my gameobject a child (gameobject) with Trail Renderer. Then I put material into Materials array field.

Material shader currently is set to Mobile/Particles/Additive (I am targeting Mobile devices). Material Texture is:

don't know why stack can't load my images LINK HERE

I've tried different settings to accomplish my needs but with no success.

Trail Renderer -> Texture Mode -> Tile (my gameobject is followed by one dot and line)

Texture Import- > Wrap mode -> Repeat (my gameobject pulls dots without gaps behind instead leaving dots in place it was)

Also i tried different shaders, different Trail Renderer parameters with no success. Most of time, my gameobject is followed by stretched dot, line or dots without gaps which are pulled instead of left in place where object was.

sentences:
Optimal OpenGL 2D Sprite Batching (Best Practice) I am working on simple 2D engine using OpenGL (3.3+) for rendering and was wondering what the optimal method of sprite batching would be. I plan to put all sprites into one (or fewer) texture atlases. Unsurprisingly, each sprite consists of 2 triangles and 4 texture coordinates.
For simplicity, let's assume only the sprites are not animated for now.

Now to my question, I do not know what would be the optimal way to draw them. As far as I was able to dig up, I have two options:

Draw each sprite separately, which would allow me to modify the position/rotation/scale of each sprite within the shader via MVP matrices. This also means that I would not need to update the sprite data buffers (vertex pos. & tex. coords) on GPU.
Stuff all sprites' data into a single VBO and draw them all with one glDrawElements call (assuming they use the same texture atlas and shader). However, I would then need to update the VBO every frame (or at least the changed parts, which also means that I would have to watch every sprite's state).

Which of these options is better from a practical point of view? Or is there any other method to achieve what I'm trying to do?

sentences: How to select light as sun source I tried to add a sun in the lighting setting. I have a directional light in my scene, but i can't select it as sun source in lighting setting. The light does not appear in the list. Does anyone know what is wrong ?

sentences:
About HLSL array packing policy This is not a question but a confirmation if I'm correct about the behavior of HLSL arrays.

I'm working with a standard lighting vertex shader, HLSL plus C++, DirectX11.1 API. For storing my lights data I've setup a simple declaration, padded accordingly to match the packing requeriments of constant buffers:

  // C++ side
struct LightBase {
            DirectX::XMFLOAT3   pos, color;
            DirectX::XMFLOAT3   color;
            float               intensity;
            float               isOn;
    };
    struct CBUFFER_LIGHT {
        LightBase   light[MAX_LIGHTS];
        float       numActiveLights;
        float       _padding[3];
    };

The shader declares a "matching" cbuffer as:

// HLSL vertex shader
    struct LightBase {
        float3 pos;
        float3 color;
        float  intensity;
        float  isOn;
    };
    cbuffer lights : register (b3) {
        LightBase light[MAX_LIGHTS];
        float numActiveLights;
    }

Now, as I expected, it didnt work due to the HLSL memory organization policy regarding arrays. e.g; if I set the buffer from C++ with the following data:

I get the following data when accessing struct members of light[0] from shader:

See how light[0].color and other struct members  got messed up?  Seems that HLSL will organize your arrays in Vector4 elements regardless of the real type of the array element.

So the array data passed from C++ which is { -7, -1, -100, 0.44, 0.66, 0.88, 1.0, 1.0 } will be organized by HLSL as follows:

A[0] = { -7, -1, -100, 0.44 }
A[1] = { 0.66, 0.88, 1.0, 1.0 }
A[2] = { ...}

So A[0] contains .xyz for position and .x for color struct member. A[1] contains .gb for color member, intensity and isOn data.

But calling light[0].color from the shader will still try to address &light + sizeof(float3)+sizeof(float3) as defined in the cbuffer, but you will get incorrect results due to array organization policy of HLSL.

If HLSL and DirectX are so fond of FLOAT4 values, it's not better to use all float4 variables and access members (.xyzw)  as needed?
Thanks.

sentences:
Game versions update? When does a game version change

from x.x.x.x to x.x.x.x+1 like from 1.0.0.0 to 1.0.0.1

or from x.x.x.x to x.x.x+1.x ?

or from x.x.x.x to x.x+1.x.x ?

or from x.x.x.x to x+1.x.x.x ?

Should the first game version be 1.0.0.0 or 0.0.0.1?

sentences: Can you create a PhysicsSprite in Cocos Studio? I do not see the ability to enable Physics in any way in Cocos Studio, am I missing something or is this a current shortcoming of the application?

sentences:
OpenGL - Updating VAO array buffer range I am trying to stream data to a buffer which I have bound to a VAO vertex buffer binding point that I want to access through vertex attributes in the shader.

Usually I stream to buffers which I have bound as GL_UNIFORM_BUFFERs and I do it like this:

//create an immutable data storage
glNamedBufferStorage(uboID, capacity, data, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);

//map entire storage forever
mappedPtr = glMapNamedBufferRange(uboID, 0, capacity,  GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);

//bind buffer to target(GL_UNIFORM_BUFFER) binding point
glBindBufferBase(GL_UNIFORM_BUFFER, uboBinding, uboID);

//bind shader interface block to target binding point
glUniformBlockBinding(shaderProgramID, blockIndex, uboBinding);

Now the uniform block can be accessed in the shader program and i can stream to it like so:

//copy data to mapped pointer at stream offset
memcpy(mappedPtr + uploadOffset, &uploadData[0], uploadSize);

//This is the important part: tell the shader which range of the buffer to use
glBindBufferRange(GL_UNIFORM_BUFFER, uboBinding, uboID, uploadOffset, uploadSize);

//increment offset
uploadOffset += uploadSize;

If I bind a buffer to a VAO and access its data as vertex attributes in the shader, I don´t know how to give the shader the range in which the updated data can be found. I can give an offset when binding a buffer to a VAO when calling glVertexArrayVertexBuffer, but it has a few more parameters and does not seem like the right thing to call every frame. I have not gotten it to work with it, too.

Is there something like glBindBufferRange for vertex buffers bound to VAOs?

sentences:
get coordinates of origin of coordinate system in second coordinate system by knowin matrices of one point in bith systems Situation, two coordinate systems A, B. origins Oa, Ob. I have one point, for which i know modelview matrix (translatoin/orientation) in both systems. And what i need to get is modelview matrix of Ob in system A. Can please someone help me what to do with that two matrixes to get it?

thank you.

sentences:
stop object while falling The object have forwardForce.
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    public Rigidbody rb;
    public float forwardForce=800f;
    void Start()
    {

    }

    void FixedUpdate()
    {
        rb.AddForce(0,0,forwardForce * Time.deltaTime);
        if(Input.GetKey("d")){
            rb.AddForce(30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
        }else if(Input.GetKey("a")){
            rb.AddForce(-30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
        }
    }
}

Now, the issue is I want to stop that object while falling down(not on that ground anymore).The camera will keep running but, I just want to stop that object. Which means if the is not on ground anymore than velocity=0

sentences:
Math behind XNA's spriteBatch.draw() color parameter? I'm trying to make a shader that changes the color of a sprite the way the XNA spriteBatch.draw() color parameter changes color. I don't know exactly what it is called (the closest word I can think of is 'tinting' but that's not right I don't think) and it's kind of hard to explain the way it looks.

Say you set the parameter to 'Red' -- white pixels in the original texture would  become completely red, while black pixels would remain black. Grey pixels would look dark red, blue pixels might look purple, green pixels might look brownish.

If you set the parameter to 'Black' the texture would become completely black.

Does anyone know the math behind this, or what this technique is called? It's probably very simple and I'm just not seeing it.

Thanks!

sentences:
How do you spawn a component from a class in UE4? Background
I'm working on a shooter game at the moment and I'm trying to spawn an Actor Component for the weapon currently in use, in order to have less Actors to keep track of.
The problem with this is that I can't easily switch out components on the fly, without making a separate function for each weapon.

Question
Is there currently any way to spawn a component with blueprints from a class like you would do with an Actor?

sentences:
Mesh slicing/knifing with multiple planes I have a ginormous mesh which I want to cut with multiple planes.
For simplicity I want to know how to cut a mesh with single plane and repeat the logic.

Consider a X-Y plane of coords (1,1,0,0) = (a,b,c,d), from the equation ax+by+cz+d, which is the equation of the plane.

How shall I use this information to cut a mesh? Any help will be invaluable.

sentences:
How do you get player to interact with level? I suffer from this problem where I have say a class called Player and a class called Level. Now the only way I can figure out how to say make the player interact with the level is if I do something like

player.input();

level.update(player);

I would have to do something like that, but then it gets even more complicated if I have monsters and I need to add them to the level e.t.c., so how do I get the monsters to interact with the player.

So I'm struggling with this basic concept. If I use C it gets rid of this problem as I use extern and I can get the data I want so all I think about is the flow. So in C I can do something like this

switch (terrain[u.y + dy][u.x + dx])
{
case WALL:
print_msg("You cannot go there.\n");
return 0;
case FLOOR:
case DOOR:
case STAIRS:
reloc_player(u.y + dy, u.x + dx);
return 1;
}

So in here we have Player u and your moving that player around only if it doesn't hit a wall. But, I can do this because I use extern on terrain[][].

I'm really struggling. I don't really want to use C as C++ is easier with SFML and I like classes. I suppose the answer is how do I manage interaction between level, mobs and players?

If I was going to do it now I would do this

Game::Game()
{
   level.init();
   player.init();
}

void Game::input()
{
  player.input(level.getLevel()); // so yucky
}

void Game::update()
{
  player.update();
  level.update(player); /// yuck
}

void Game::render()
{
 player.render();
 level.render();
}

I could do something like this, but it gets really complicated and everything becomes a mess of passing stuff around. In particularly I need to pass the player method to the level.update() so the level knows the player has moved. Everything gets messy and I feel I can't add into the game. Plus I would need to make the level static or something.

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:
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:
Storing large amounts of voxels in file I'm making a game similar to Dwarf Fortress and I've run into a large problem from the start. How can you store such a large amount of land on disk. With every voxel holding an integer with the 28 MSB representing its type and the 8 LSB having flags like transparency or if it can be walked through a world similar to dwarf fortress would take up almost 18 000 GB. chunks(16 X 16 X 256 voxels) regions(64 X 64 chunks) and world(128 X 128 regions).

I know about Run Length Encoding which could save a lot of memory but its unpredictable because I don't know how many different block types there will be. However it will definitely use less memory so I will use it. I also thought that if I use Perlin Noise for everything I could regenerate everything from scratch if the player came close and only store the areas the player changed (and maybe towns because regenerating them could be time consuming) so I could definitely save a lot of memory there.

I read that Dwarf Fortress doesn't use Perlin Noise or anything like that, and it seems that it generates the whole map at once and saves it with data like erosion from rivers. Can anyone suggest another method that I could use to store a map as much expansive as the one in dwarf fortress?

Ok so it thought of a way to store rivers erosion, as a heightmap of subtractions to the terrain height and only store the heightmap of chunks that have rivers and also use run length encoding, then generate everything else that the player didn't change each time.

sentences:
How can I make message passing between threads in a multithreaded engine less cumbersome? The C++ engine I'm working on currently is split up into several large threads- Generation (for creating my procedural content), Gameplay (for AI, scripts, simulation), Physics, and Rendering.
The threads communicate with one another through small message objects, which pass from thread to thread. Before stepping, a thread processes all of its incoming messages- updates to transforms, adding and removing objects, etc. Sometimes one thread (Generation) will create something (Art) and pass it to another thread (Rendering) for permanent ownership.
Early in the process and I've noticed a couple things:

The messaging system is cumbersome. Creating a new message type means subclassing the base Message class, creating a new enum for its type, and writing logic for how the threads should interpret the new type of message. It's a speed-bump for development and is prone to typo-style errors. (Sidenote- working on this has me appreciating how great dynamic languages can be!)
Is there a better way to do this? Should I use something like boost::bind to make this automatic? I'm worried that if I do that I lose the ability to say, sort the messages based on type, or something. Not sure if that kind of management will even become necessary.

The first point is important because these threads do so much communicating. Creating and passing messages is a big part of making things happen. I'd like to streamline that system, but also be open to other paradigms that might be just as helpful. Are there different multithreaded designs I should think about to help make this easier?
For example, there are some resources which are infrequently written, but frequently read from multiple threads. Should I be open to the idea of having shared data, protected by mutexes, that all threads can access?

This is my first time designing something with multithreading in mind from the ground up. At this early stage I actually think it's going really well (considering) but I'm worried about scaling, and my own efficiency at implementing new stuff.

sentences:
Changes to one Unity trail renderer causes all of them to flicker I'm using Unity. So I have a prefab, and this prefab has a trail renderer component attached to it.

However, for some of the game objects I want to stop the trailer renderer at certain points in time. But doing so seems to make all of the trail renderers blink; flash off and on. I've tried changing time, disabling the component, and using Clear() while hiding the trail renderer behind the background before needing to be used. All of these makes all trail renderers flicker on the frame the change happens.

I believe providing the code won't be helpful, it's just if(x) disable-action, if(y) enable_action. What can I do?

sentences:
How to use multiple tilesets in a map? I'm currently looking at this phaser example: http://phaser.io/examples/v2/tilemaps/blank-tilemap

Here, the author creates a simple tilemap editor. In line #33 he adds a preloaded image as tileset.

The problem is: the author adds only one tileset but I'd like to add multiple tilesets to the map (via map.addTilesetImage), switch between them and paint with the "current one".

I've read multiple times on the internet that it is possible to add and use many tilesets on a single map, but so far I haven't found any examples of that and the phaser docs also don't give that away.

sentences:
Unity3D: Mathf Lerp too fast when timescale increases I have an image with a fill amount component controlled by a Mathf Lerp. The problem is, the time for completion of the Mathf Lerp function decreases more than expected when the timescale increases.

When the timescale is equal to 2 the function should take half the time to complete but it takes less than that. Any idea why?

public static float demolishTime = 6.0f

public void OnClickDemolish()
{
    InvokeRepeating("demolishProgress", 0f, 0.1f);
}

void demolishProgress()
{
    progress += (Time.deltaTime / demolishTime);
    demolishProgressBar[DemolishManager.demolishState].fillAmount = (float)Mathf.Lerp(0, 1, progress);
    if (progress >= 1) demolishCompleted();
}

sentences:
Questions about texture compression So when I choose the texture in the Inspector window I see three tabs: Default, Standalones & Android. I can choose some variants of how to compress this texture, but:

My texture is a png (so it's RGBA). When I click the Default->Format I can see stuff like Alpha 8, R 8, RGB 24 bit. So if I choose R8, for example, does that mean that my GBA channels will be thrown away?
What is the Max Size? My texture is 600x375. If I choose 512 will it clip my texture to 512x375 or what? And why it is called Max Size if I am working with a single texture right now?
If I choose Default->Format to Automatic and does not do any override on any specific platform will Unity choose default texture compression formats for a specific platform using this table?

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:
Score won't save to Android in Game Maker Studio 1.4 I have oController as the first object to run when the game is opened. In oController's Game Start event
I have the following code:
ini_open(working_directory + "SavedScores.ini");
var highscores = ini_read_real("Highscores", "Score", 0);
ini_close();

global.LastScore = highscores;

When the player has gotten their score, I use this code to save it:
if global.gameOver {

    if global.LastScore == 0 {
        global.LastScore = global.currentScore;

        ini_open(working_directory + "SavedScores.ini");
        ini_write_real("Highscores", "Score", global.LastScore);
        ini_close();
    } else {
        if global.currentScore > global.LastScore {
            global.LastScore = global.currentScore;

            ini_open(working_directory + "SavedScores.ini");
            ini_write_real("Highscores", "Score", global.LastScore);
            ini_close();
        }
    }
}

Whenever I relaunch the game on my phone, it won't load the score I got when I previously launched the game. Idk why it's not saving?

sentences:
How to choose between 2D sprites versus 3D models for a 2D game? I wanted to know how to decide between using 2D vs 3D models for games.
What are the advantages/disadvantages of using 3D models versus 2D sprites in 2D games?

sentences: How do I add AndEngine documentation in Eclipse? I am very new to AndEngine. I have just downloaded the full documentation file, but I can't attach it to Eclipse. How can I do that?

sentences: why animated tiles aren't animated? So I got some code and I'm using pytmx to load the maps, but the animated tiles don't seem to animate in my pygame game. Is there a setting to change that or do I need to write the animation code myself?

sentences:
Overlaying Menus with a State Machine I'm working on developing a game with C++, SDL, and OpenGL. I created the engine from scratch, and implemented my own state machine to handle menus and general gameplay.
Each State gets pushed into a stack and the last one gets updated and drawn, after initialization on entry. They also handle input on a per-State basis. Right now I have a State for entry point, a 'Press Any Key' prompt, a main menu, as well as a new game menu where the player enters their name.
I also batch my Sprites together for easy drawing. I simply pass a vector of Sprite pointers (as some animated sprites may be mixed in as well) to the drawing function which uploads the Sprites to a buffer and draws them. These vectors of Sprites are organized by batch type - mostly based on texture.

I'm moving on to the Exit Game menu, which displays a confirmation that the game will close and the player will be returned to their desktop. I wanted this menu to display on top of the Main Menu with a transparent black layer that darkens everything but the exit game prompt.
I can figure out the drawing part easily enough, but the problem is that the Sprites are local to the same State that created them. I am having troubles trying to decide how to 'share' the main menu sprites with the Exit Game State.
Likewise, I have the title screen background and logo. The logo animates as well. These two Sprites are visible to every title screen State. Which means I again need some way of continuously displaying a select few Sprites until further notice, such as on entry of the main game. When I get to cutscenes, I will typically need every Sprite used by the gameplay part of the game as well.

One idea I had was to store Sprites in the State Machine as opposed to the State itself. This would mean all Sprites are visible to every State, and the current State would decide which Sprites to delete and which to keep. This means that accessing the Sprites through the State would be a little more roundabout - some sort of access function through the State Machine.

EDIT: I've started implementing the first solution but putting Sprite batches into my Game Engine. The drawback is the scope of each Sprite is not so clearly defined per-State, they need to be directly deleted by the following State to determine which Sprites to keep and delete. It does also make identifying Sprites a little more difficult on transition, though I'm thinking of implementing a std::map of strings to Sprites as I'll need a naming system for cutscene scripting anyway.

I had another idea that would involve 'inheriting' Sprite batches from the previous State but that would also complicate identification of the Sprites.

ANOTHER UPDATE: I'm thinking of getting rid of AnimatedSprite as a distinct class. It just complicates the storage part. By merging it in with regular Sprites, Sprites can be animated but don't need to, and as for the extra storage needed for animations, I'm not too concerned as almost every one of my Sprites animates in some way. With this edit I store my sprites in a vector for batching, a map for naming, and a third optional pointer in my States that optimizes some menus by directly accessing Sprites rather than using map lookup. Going to try that and see how it works out.

sentences:
Why does unlocking cursor with keyup behave the same as unlocking it with keydown? To understand the difference, let me review a bit about the behavior of GetKeyUp and GetKeyDown with the following code snippet.

void Update()
{
    if (Input.GetKeyDown(KeyCode.Escape))
    {
        Debug.Log("Escape Key Down");
    }

    if (Input.GetKeyUp(KeyCode.Escape))
    {
        Debug.Log("Escape Key Up");
    }
}

Right after pressing the Esc key (and holding it), a message "Escape Key Down" is produced. Later right after releasing the key, a message "Escape Key Up" will show.
The behavior does make sense.

Now I apply this for toggling (locking/unlocking) the mouse cursor. Here is my code snippet.

void Update()
{

    if (Input.GetMouseButtonDown(0))
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

    if (Input.GetKeyUp(KeyCode.Escape))
    {
        Cursor.lockState = CursorLockMode.None;
        Cursor.visible = true;
    }
}

Right after clicking the left mouse button, the cursor becomes invisible. However, right after pressing down the Esc key, the cursor becomes visible again. The expected behavior is that the cursor will be visible right after releasing the Esc key rather than right after pressing the key.

Question

How to fix this abnormal behavior?

sentences:
A game that can balance itself over time? So after reading some history and learning about how some countries were allowed to survive by stronger countries, just so that a power gap wouldn't exist. That being said, we can assume that if this power gap did exist, eventually the world will rebalance itself one way or another.

Would that be applicable in games? Can a game (for example, Overwatch or any MMORPG) balance itself over time whether the imbalances are a result of how the classes are built or even the population of people in every faction?

I thought about it a lot and I tried finding dissimilarities between my real world example and games.

In games, you are allowed to have many identities. You can essentially have a character in every faction. In a game like OW you can pick any hero. You don't have a fixed identity that defines you like IRL so cloning the idea of a "Country/Nation" in real life to a game is nearly impossible as developers don't have power over how many characters/factions the player can have.
Nations have finite resources. All MMOs I played have infinite resources which simply doesn't make sense compared to the real world. Finite resources is what makes nations great whether by smart utilization of said resources or conquering/invading other nations.

That being said, I still have a feeling that it's possible, one day, to have a game that can balance itself over time. But to achieve that, I believe we need to put many constraints on the gameplay to mimic real life constraints that "define" a nation.

What do you guys think? What would those constraints be?

sentences:
How do I get started with fog type effects in a first person game? Hey guys, I'm currently using JME3 to learn 3d game development in java, and I have run into a situation. I would like to add fog effects to my games, but I don't even know where to start to implement this. I know how to set the camera's far frustum to limit the render distance, but that just simply makes a sharp cutoff. I'd like the fog it up a bit to make it feel more natural.

I'm looking for an answer that points me into the correct direction. I'm not looking for specific code snippets or even JME3's engine specifics. I just want to get an idea of how this stuff works in general.

Thanks!

sentences:
Texturing in OpenGL, Should texture coordinates be assigned to vertices in the shader? I attempting to texture 3D models (a cube for example) using ibo’s, with OpenGL in Java. Currently, my textures are distorted. I believe this is because only a single texture coordinate is being assigned to each vertex, as the meshes are loaded from wave front (.obj) files.

As each vertex should correspond to multiple texture coordinates, should I be assigning texture coordinates to vertices as the data is loaded from file or would it be better to assign texture coordinates to vertices in the shader?

I would appreciate example code.

sentences:
Draw many flashlights' focused lights' "circles" on a voxel engine map (and other objects) So, I've been searching the internet for a while and I still didn't understand how to create a flashlight's "circle" in front of the camera over other objects.

I found the following links:

using shader;

multi pass effect;

forum question about multiple passes and multiple effects;

shader example with multiple lights (which I can't open because its an old project).

And they give me examples and solutions about how to draw lights or other effects on objects.

But it's not clear to me yet. I'm newbie with HLSL (and still a little with XNA itself) and I don't get what should I do. I need help with the steps I should take to modify my HLSL effect* of the voxel engine to draw a white circle where the cursor points and shine the light around the camera position as the flashlight is on.

*I created a voxel engine that uses a effect (modified a little) I found in a project called TechCraft. It changes the light on the map depending of the time of the day and the sun position. But I'm not sure how it works neither, I just read a little but I'm not used to HLSL as I said. (Where could I find good HLSL tutorials?)

Do I need to make many passes and make a pixel shader and a vertex shader for each one? Or should I create many techniques? What's the difference?

Or is that a bad idea? Should I create another effect and draw again the voxel with its technique and pass?

And maybe it's not only one light. If I'm able to create a multiplayer someday, or NPCs, the game will have more than one light on at the same time. How to draw more than one circle?

I'm really lost with this, and I have no idea where should I start from. I appreciate any help; even showing already answered questions is helpful to me.

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:
How can I scale the number and challenge of enemies in an attack wave as the game progresses? I'm currently making a defense game where enemies will spawn and attack the player's army. It's similar to a Tower Defense game, except there is only one level. The enemies will keep spawning until eventually the user dies or he amasses a large enough army that they wipe out any enemy that spawns instantly (hopefully it'll be challenging enough that this won't happen).

What I'm struggling with at the moment is how to make this game get progressively harder and the probability of an enemy spawning basically eventually reach 100%.

So far I've got something similar to the following

if(Math.random() < 1 - (1/elapsed_time) && spawnTimer <= 0 ){
    spawnEnemy()
    spawnTimer = rand(); // random number between 1 and 3
}

But it seems too uniform to begin with. At the moment I'm only spawning one type of enemy, the idea being that tougher enemies are spawned as time progresses as well.

I also think I need to randomise my spawnTimer at bit more and make that get quicker as time progresses, but I just can't seen to get my head around what my logic should really look like for this whole section. Is anyone able to help with a rough idea of this kind of formula?

I'm currently using javascript to write the game, but obviously it's more about the concept.

sentences:
Reliability of Google Analytics data I have developed an iOS game and currently the game is in beta phase. I have integrated Google Analytics (GA) to understand the users' behavior. I am distributing the game to my beta testers using TestFlight.

Recently, I found that number of sessions shown by TestFlight data is not matching with that of GA's data.

I have following questions:

Is GA's data is more reliable than the TestFlight's data?
Is GA suitable analytics solution for mobile games? If not, what are the reasons for that? Is Firebase analytics more reliable compared to GA?
I am looking for an analytics solution which can help to analyze behavior of each user (per user tracking instead of aggregated data). Can Firebase analytics provide this feature?

I would appreciate any suggestions and thoughts on this topic. Thank you.

sentences:
Fast self collision/intersection detection algorithm for tetrahedral meshes I want to play with deformation of tetrahedral mesh (soft-body simulation) but I need help with self-collision detection stuff.
I found SOFA collision detection but I'm not sure that it fits for self-intersection of a tetrahedral mesh.
Can anyone suggest me good algorithm for self-collision detection? As far as I can understand, something like BVH of tetrahedra can help me, but it would be great if somebody with expertise shows me right direction.

sentences: Different Screen Sizes and Camera in Unity Now I know that no matter what the screen size is the camera will keep its height, so no worries about that. My question is, is there a way to manipulate the camera, either its orthographic size, or its viewport rect width, height, x or y so that the camera will fit perfectly on different screen resolutions. I know this a perfect solution for supporting different screens problem but how do other games do that? I mean I took some games from google play like bunny skater, or stick hero, those games look the same on Huawei P6 which has 1280x720 resoltuion, on Prestigio Multipad 4 which has 1024x768 and on HP Slate 7 which has 1024 x 600 resultion, now my question is how do they do that? I think the closest solution to this is to manipulate viewport rect of the camera, I'm saying this because I found a script that does so but it leaves black bars on top and bottom, the game looks the same on every device though but as I said it leaves black bars on top and bottom, so is there a solution on how to do this?

sentences:
calculate force betwen two objects like angry birds game I'm trying to make a game like angry birds. in the game materials break and destroy based on force they receive. really what is the right or best way to implement it in unity?

thank you for helping.

sentences:
SFXR-Like Tool for Speech Sfxr (and also Bfxr) is a great tool for generating sound-effects for games. Is there something like this for speech synthesis?

Not every game development tool and platform has a speech synthesis engine, and it would be great to at least get some decent-sounding placeholders in place to see how the usability/experience plays out. Even better if the results are tweakable, like sfxr.

I'm looking for something I can at least run on windows, though preferably (like Bfxr) I would like a web application that I can just run out of my browser.

sentences:
Efficient algorithm for simultaneously updating game objects which need to be updated I have a grid of objects like this:

 1
      +
 F

1 is equal to the constant 1, F flickers between 0 and 1 each tick,
and + is equal to the sum of the 1 and the F.

I want to update these values as described above. The 1 won't change, the F will change from 0 to 1 and vice-versa, and the + will change to the sum.

I could just do a loop:

for node in nodes {
    if(node.type == '+') {
        node.value = node.input1.value + node.input2.value;
    }
    if(node.type == '1') { ... }
    if(node.type == 'F') { ... }
}

but the problem is that this will depend on the order of iteration. If the F
is iterated on first, then it will be set to 1 from an initial value of 0, then the + would equal 1 + 1, i.e. 2. But if the + was first, the result would be 1 + 0 = 0 and the NEXT tick would be 1 + 1 = 2.

I want to do this simultaneously. So I thought I could have a map of new values:

global map = new HashMap<Node, double>();
...
map.clear();
for node in nodes {
    if(node.type == '1') {}
    if(node.type == 'F') {
        map.set(node, node.value == 1 ? 0 : 1);
    }
    if(node.type == '+') {
        map.set(node, node.input1.value + node.input2.value);
    }
}
map.forEach(k, v -> k.value = v);

but this is probably inefficient as all values have to be looped over and entries in the map must be created for each node (node count is expected to be alot, around 10,000).

How do I do this? I probably need a list of "update required" nodes but I'm not sure what to do exactly, especially to do it simultaneously.

Examples:

1
 \
  == + === + === + == (flickers between 6 and 7 starting at 6 due to F flickering)
 /        /     /
F        3     2

// Nodes can be created by the player

1 => + <= 2
     |
     |
     (equals 3)

// Player creates a node:

1 => + <= 2
     |
     |
     (factorial) ===> (equals 6)

There can be multiple of these connected nodes at a time:

1 => + <= 2
     |
     |
     (equals 3)

2 => + <= 3
     |
     |
     (equals 5)

// If the player chooses, they can connect these 2 together:

1 => + <= 2
     |
     |
     -===========
                |
2 => + <= 3     |
     |          + =====> (equals 8)
     |          |
     -===========

Nodes can be inputs to themselves, or have no inputs (in which case the inputs default to 0):

     =====> (starts at 1 in the first tick, then keeps incrementing.)
     |
1 => + <==
     |   |
     =====

sentences:
Prevent collisions between mobs/npcs/units piloted by computer AI : How to avoid mobile obstacles? Lets says we have character a starting at point A and character b starting at point B. character a is headed to point B and character b is headed to point A. There are several simple ways to find the path(I will be using Dijkstra). The question is, how do I take preventative action in the code to stop the two from colliding with one another?

case2: Characters a and b start from the same point in different times. Character b starts later and is the faster of the two. How do I make character b walk around character a without going through it?

case3:Lets say we have m such characters in each side and there is sufficient room to pass through without the characters overlapping with one another. How do I stop the two groups of characters from "walking on top of one another" and allow them pass around one another in a natural organic way.

A correct answer would be any algorithm, that given the path to the destination and a list of mobile objects that block the path, finds an alternative path or stops without stopping all units when there is sufficient room to traverse.

sentences:
Why is the position of this image changing? I have a python script to simulate a wrench moving, I have calculated it's origins position in x and y as a function of time, the problem is when I try to rotate the image, my code moves the image out of frame.

import pygame, sys
import math

screen = pygame.display.set_mode((700, 400))
wrench = pygame.image.load('prueba.bmp')
white = (255,255,255)

ox = 20
oy = 32
running = True
posX = 100 - ox
posY = 100 - oy

pygame.init()
while running:
    event = pygame.event.poll()
    if event.type == pygame.QUIT:
        running=0
        screen.blit(wrench, (posX, posY))
    if(pygame.time.get_ticks() <= 20000):
            screen.fill(white)
            t = pygame.time.get_ticks() / 1000
            print(t)
            ang = math.degrees((math.pi / 2 * math.cos(math.pi * t)))
            posX = 100 + (50 * math.cos(math.pi * t)) - ox
            posY = 100 + (20 * math.sin(math.pi * t)) - oy
            wrench = pygame.transform.rotate(wrench, ang)
            screen.blit(wrench, (posX, posY))
    pygame.display.flip()

Does anybody knows why this is happening?

sentences: Best practices for playing sounds in iPhone games What are the best practices for playing sounds in iPhone games? Specifically, what are the best practices while playing sounds simultaneously without affecting other processing much. Is there any recommendation about how sound files must be made to suit the processing?

sentences:
WP7 emulator + Microsoft.Advertising.Mobile.Xna.dll = 'System.IO.FileLoadException' occurred in mscorlib.dll I've downloaded Microsoft Advertising SDK for WP7, added reference to Windows Phone Game project, and now when I'm trying to run the game I get this in Output:

'taskhost.exe' (Managed): Loaded 'mscorlib.dll'
'taskhost.exe' (Managed): Loaded 'System.Windows.RuntimeHost.dll'
'taskhost.exe' (Managed): Loaded 'System.dll'
'taskhost.exe' (Managed): Loaded 'System.Windows.dll'
'taskhost.exe' (Managed): Loaded 'System.Xml.dll'
'taskhost.exe' (Managed): Loaded '\Applications\Install\B2719AD1-5A3C-40BE-A114-7E56C19E22D6\Install\TheGame.dll', Symbols loaded.
A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll
The thread '<No Name>' (0xd4b004e) has exited with code 0 (0x0).
The program '[229048418] taskhost.exe: Managed' has exited with code 0 (0x0).

If the reference is removed, game launches normally again.

What might be the possible solution to fix this?

sentences: Images disappear when camera zooms in there is no problem when the camera is away, but as I zoom in to the game, the images disappear and I can't see the game properly. What is the reason ?

sentences:
How to know the size of object in Unity in world units? Suppose I have some external package with objects. Suppose I place some of these object to the scene. Now how to know actual size of object in world units?

I found no any rulers or something in Unity.

The I thought I can place primitive cube and compare it, but then I realized that I don't know the size of cube too.

Is is possible to "measure" arbitrary object in Unity somehow?

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:
App icon on phone looks squished in Unity I am working on a 2D platformer. And I am alomost finished!! I am trying to work on adding the app icon. The icon that you would see on your phone. I imported the picture and added it to player settings. But when I put my game on my phone the icon looks squished. These are the settings that I imported it on

Texture Type (sprite 2D and UI)

sprite mode Single

Filter mode Blinear (not pixel art)

Here is a link to a screen shot on my phone of the icon

https://www.dropbox.com/s/jbgciscda7nykjd/app%20on%20phone.png?dl=0

Ok I am getting closer to an solution now. My first problem was that the image was not square as staed below. But now the image is smaller compared to the rest of the app icons. the resolution of teh image now is 2000X2000

Here is a screenshot of what it looks like now

https://www.dropbox.com/s/t45vylzpi3chnsf/App_Icon_2.png?dl=0

sentences:
Menu selection wont stay on selected option My Menu has a START and a QUIT option. I'm using a controller's D-PAD for selection. The game begins with START highlighted. When I push the down button on the D-PAD, it highlights the QUIT option. Problem is when I release the down button, it returns to highlighting START.

Is there a way to possibly hold the position so that if I highlight QUIT, it will stay highlighted after releasing the button?

//First starts with START highlighted:

if(menuSelect == 1 && GC.getDPADDir() == 7){ // if QUIT is highlighted, push up
        menuSelect++;
    }
    else if(GC.isButtonPressed(1)){
        // go to game
        sbg.enterState(1);
    }

if(menuSelect == 2 && GC.getDPADDir() == 1){ // if start is highlighted, push down
        menuSelect--;
    }
    else if(GC.isButtonPressed(1)){
        // quit
        System.exit(0);
    }

sentences:
ECS - System calling other systems I'm trying to build my first (2D) game with ECS but I always end up with some system calling other systems. Here's an example.

There is a RegionSystem that manages RegionComponents. On each frame, this system loops through all the RegionComponents and checks if the player is inside any of them.

When the player enters the water, the player's sprite must be changed from PLAYER_RUNNING to PLAYER_SIWMMING.

When the player steps onto a teleporter, an animation will play around the player, he'll be rotating and a new level will be loaded.

When the player steps into a hole, he will lose some health and will be repositioned in the level.

So, first of all, it needs the coordinates of the player's body to check if it is in a region (check point in rectangle). Hence it will ask the RigidbodySystem to get the coordinates.

Then if the player is inside a region, it will call PlayerSystem_OnInsideRegion(regionInfo).

In turn this function, PlayerSystem_OnInsideRegion must react differently depending on the type of the region:

for the water case, it needs to call the SpriteSystem to change a sprite, the PlayerSystem to set a boolean (m_inWater = True;) and the RigidBodySystem to get the coordinates of the player's body;
for the teleporter case, it needs to call the LevelSystem and tell him to switch to another level on the next frame;
for the hole case, well, simply descrease the member m_health of the player component, so no need to call another system here.

I have the feeling this is a horrible design and does not fit the ECS architecture. I read that people use a message system where systems can subscribe and unsubscribe to particular type of message. But I also read that it can be tricky to react to them in a proper order.

sentences:
How to compute the 2D equations of 3D circular arcs? I'd like to obtain these equations for the ellipses produced by the perspective projections of (3-dimensionally transformed) circles.

This is useful for rendering in 2D contexts which provide curve primitives. I'm using HTML5's canvas, so I get Beziers, arcs, and quadratic curves.

See here:

The projection of a sphere outside of the plane of projection is an ellipse because the view is a cone (silhouette of a sphere is a circle).

However if I want to draw my sphere using circular wireframes, that projection-cone is no longer a circular cone. So it's not your traditional conic section anymore.

How to deal with this?

sentences: What is the best online game framework for Python? I want create online game with Python. Is there any framework or library to make it easier? I would like it if the framework provided things like character attributes, such as health.

sentences: How can I separate gameview from UI most efficiently in Unity? Let me provide an image to illustrate what I mean. It is from a game called Runescape.

sentences: Splash Screen Resolution size I am using LibGDX to make a very simple game. I am going to hire someone to create a splash screen logo since I'm artistically challenged. I want to order a vector graphic so I can scale it later if needed. What would be a decent size to use as a baseline (in pixels) that would scale relatively well on desktop/android/ios/etc?

sentences:
Why is integer value not updating as a text? I have a space shooter game and I am trying to create a shield power for the player ship. My mechanic for shield is working. When I press the shield power button(P), the shield power decreases from 100 to 0 at a certain pace.

Problem is that I am trying to draw this shield power value on screen but it's just showing the starting shield power value(which is 100) and not showing the decrease in shield power value when I press the shield button.

What am I missing?

Here's the relevant code:
Game.cpp

if (keyboard->IsKeyPressed('P'))
{
    if (player_->shield == true)
        player_->shield = false;
    else
        player_->shield = true;
}

if (player_->shield && player_->shieldPower > 0)
{
    if (keyboard->IsKeyPressed(VK_SPACE))
    {
        XMVECTOR playerForward = player_->GetForwardVector();
        XMVECTOR bulletPosition = player_->GetPosition() + playerForward * 10.0f;
        SpawnBullet(bulletPosition, playerForward);
    }

    player_->shieldActive = true;
    if (GetTickCount() - player_->time > 100)
    {
        player_->time = GetTickCount();
        player_->shieldPower--;
        if (player_->shieldPower <= 40)
        {
            player_->shieldPowerLow = true;
        }
        else
        {
            player_->shieldPowerLow = false;
        }
    }
}
else
    player_->shieldActive = false;

TextClass.cpp

void TextClass::OnRender(System *system)
{
Graphics *graphics = system->GetGraphics();
FontEngine *fontEngine = graphics->GetFontEngine();
Player *player = new Player();

Game *game = system->GetGame();
game->RenderEverything(system->GetGraphics());

std::stringstream buffer;
buffer << player->shieldPower;

fontEngine->DrawText(buffer.str().c_str(), 50, 100, 0xffffffff,
FontEngine::FONT_TYPE_SMALL);
}

Player.h

class Player
{
public:

int shootDelay;
int time;
int shieldPower;
bool shield;
bool shieldActive;
bool fullShield;
bool shieldPowerLow;
bool shoot;
}

Player.cpp

Player::Player() :
shootDelay(500),
shieldPower(100),
fullShield(true),
shieldPowerLow(false),
shield(false),
shieldActive(false),
shoot(false)
{
}

sentences:
unable to see sprite in scene Getting error as floating point precision limitation I am trying to create game object by dragging image from project window to scene I am getting error as due to floating point precision limitation- it is recommended to bring the world coordinates of game object within smaller range
I am following ruby's adventure tutorial in unity learning

sentences:
How to align edge vertices of modular props snapped on a 2D grid? For a project I am working on I create some 3D props in Blender that can be put together in a modular way on a 2D grid in Unity. In Unity I generate the grid contents using these props. Now given these two simple shapes (imagine a pipe or railing in top view):

If they are put next to eachother on the grid like so (left):

I want to make a smooth transition between the two so that their edge vertices align nicely (snap together, see right image above). Note that the angle between the shapes is always the same. However there are variations like straight, left, right for each intersection and also numerous shapes.

How can I achieve this?

I have thought of the following possibilities:

Just model each possible variation in blender and use the matching prop when generating the grid (I hope I can avoid this since its a lot of effort, also it's not reusable)
Rig the shapes in Blender. In Unity move the bone transforms accordingly so that they align (I like this idea, but is it practical?)
(Somehow) mark the vertices on the edge of the shapes and move them to where they belong i.e. modify the mesh in Unity.

Are there other/better ways to achieve this? I appreciate any hints and tips.
I also know I am not the first one to try this so any guidance on where to look for resources and what terms to search for is also appreciated.

sentences:
How do I get an instance of KX_PolygonMaterial in Blender? I've got a question concerning using Python in Blender's Game Engine.

Before I start I want to state that I'm trying to change the color of an object in Blender's game engine. To do this, I'm attempting to find a way to update the texture of the object (I basically want two or three states, red, (yellow), green).

What I'm doing right now is:

scene = GameLogic.getCurrentScene();
pingMeter = scene.objects['Ping Meter'];
mesh = pingMeter.meshes;
materials = mesh[0].materials;
material = materials[0];

However, when I do print(material.__class__.__name__) it outputs KX_BlenderMaterial. Shouldn't I be getting KX_PolygonMaterial if I'm running the Blender Game Engine? Is there anyway to change color or texture with KX_BlenderMaterial because I can't find anything in the documentation. Can I get an instance of KX_PolygonMaterial out of the code above?

...or should I just take a different approach all together?

Thanks!

EDIT: I'm using Blender 2.65 which uses Python 3 in case anyone is wondering.

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:
My bullet keeps going up So I have a bullet script that fires a bullet straight in the Y direction that gets called as the bullet is instantiated. The plan is to always shoot in the same direction, straight in the Y, but to just rotate the bullet upon instantiation so that the straight is the right kind of straight if that makes sense? What i really want to know i think is how to work out the value for the 3rd property of the instantiate based on the key pressed before the fire, what makes it worse is that i dont even know how to create a rotation variable.

Instantiate(Resources.Load("P1Bullet"), transform.position, transform.rotation);

this is how i move my bullet in the bulletmove script

void Update () {
    Vector3 pos = transform.position;
    Vector3 vel = new Vector3(0, speed * Time.deltaTime, 0);
    pos = pos + transform.rotation * vel;
    transform.position = pos ;
}

sentences:
Convertion from 3D to 2D openGL Few days ago , we learned about Homogeneous Matrices in OpenGL class.
From what I have understood , using these matrices we can convert 3D objects to 2D.
However , I am facing some difficulties answering a simple question like : "Which of those matrices answering to the definition of converting from 3D to 2D (Homogeneous)" :

           A                         B                      C               D

I'm not asking you to do my homework, I know the answer it's D and C and this is all I need for this section. I just want to understand why? how it works? why A,B not and C,D yes.
Thank you.

sentences: Changing Hitbox from a single spritesheet I have different animation in a single spritesheet. I wonder how do you guys assigning these hitboxes?

sentences:
Rendering a selected part of the terrain with different shading I'm trying to understand how to modify the shading of the section of the terrain based on some user selection. In a game like Civ5, when a user selects a city or unit, that area is lit up more than the other parts of the terrain. I'm trying to implement this effect.

In the civ 5 example the selected tile is has a circle outline and the selected city has a transparent overlay that follows the height of the terrain nicely.

My current pipeline so far is at a primitive state. I render a quad and texture it with a grass texture. Then I draw a rectangular grid on top of this (a set of lines, with a slightly higher height value than the background grid). Upon selection (ie a mouse click inside the grid area), I calculate the approriate grid index by converting mouse to world coordinates and then to grid coordinates, and highlight the appropriate grid rectangle by changing the color of that particular rectangle. But, my approach gets outdated the moment I get a height map (as it assumes constant height), and looks pretty bad, hence this question.

EDIT : Added my pipeline description

sentences:
How to calculate normal from normal map in world space? (OpenGL) I'm trying to do normal mapping in a deferred renderer and I'm stuck on how to implement normal maps. I have a bool that passes whether or not to use a normal mapped value and thus, whether to calculate the TBN matrix. My vertex code for the geometry pass looks as follows:

#version 410 core

layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTexCoords;
layout (location = 3) in vec3 aTangent; // Optional Texture coordinates
layout (location = 4) in vec3 aBitangent; // Optional Texture coordinates

out vec3 FragPos;
out vec2 TexCoords;
out vec3 Normal;
out mat3 TBN;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

uniform bool hasNormalMap;

void main()
{
    vec4 worldPos = model * vec4(aPos, 1.0);
    FragPos = worldPos.xyz;
    TexCoords = aTexCoords;
    Normal = transpose(inverse(mat3(model))) * aNormal;

    if(hasNormalMap)
    {
        vec3 T = normalize(vec3(model * vec4(aTangent, 0.0)));
        vec3 N = normalize(vec3(model * vec4(aNormal, 0.0)));
        // re-orthogonalize T with respect to N
        T = normalize(T - dot(T, N) * N);
        // then retrieve perpendicular vector B with the cross product of T and N
        vec3 B = cross(N, T);
        mat3 TBN = mat3(T, B, N);
    }

    gl_Position = projection * view * worldPos;
}

Here is where I am confused:

In my calculation, I multiplied T and N by the model matrix which should have moved it into world space. Now transposing (T,B,N) should move me back into model space (I think, I'm not sure). In the fragment shader how do I use the TBN to calculate the normal in world space?

If there are better approaches, they are welcome. Thank you.

Update:
I removed the transposing of the TBN as there's no reason to transform into tangent space if we want to pass it in world space. Now that we have the TBN matrix in the fragment shader, how do we apply it so that the normal is the correct value for lighting? Currently I've done:

#version 410 core

layout (location = 0) out vec3 gPosition;
layout (location = 1) out vec3 gNormal;
layout (location = 2) out vec4 gAlbedoSpec;

in vec2 TexCoords;
in vec3 FragPos;
in vec3 Normal;
in mat3 TBN;

struct Material {
    sampler2D diffuseMap;
    sampler2D specularMap;
    sampler2D normalMap;
    float shininess;
};

uniform Material material;
uniform bool hasNormalMap;

void main()
{
    // store the fragment position vector in the first gbuffer texture
    gPosition = FragPos;

    // also store the per-fragment normals into the gbuffer
    gNormal = normalize(Normal);

    if(hasNormalMap)
    {
        gNormal = texture(material.normalMap, TexCoords).rgb * TBN;
        gNormal = normalize(gNormal);
    }

    // and the diffuse per-fragment color
    gAlbedoSpec.rgb = texture(material.diffuseMap, TexCoords).rgb;

    // store specular intensity in gAlbedoSpec's alpha component
    gAlbedoSpec.a = texture(material.specularMap, TexCoords).r;
}

but that doesn't feel right. I imagine that I would transform the sampled value from the normal map by the TBN matrix to get it in world space. Am I missing something?

sentences:
Android / IPhone / Desktop C++ Game Template I was wondering if anyone has come across any articles detailing how to set up a basic game in C++ for use in Android / IPhone / Desktop applications.

My thoughts just now are that I would like to make my game as a library and have a different project for each device which just interfaces with this library. You know the kind of thing, bootstrap the program, call some library initialize, load and run routines and occasionally pass some information to the library like input. I was hoping someone would have made a template for this kind of thing but I just had no luck finding one.

It seems to me that it's the kind of thing you really only have to do once, so I was hoping someone would have done it for me already.

sentences:
unity3d - Instantiate and fire bullet realtive to player rotation in 3D 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. Also tried putting the script on the player itself but also didn't work.

GameObject projectile =  Instantiate (bullet, transform.position, transform.rotation) as GameObject;

 projectile.GetComponent().AddForce(transform.forward * speed);

The problem is the bullets doesn't behave as intended, instead they don't appear relative to the player rotation and they just go in a very different direction. Shouldn't "Transform.Forward" mean forward in the Z position regarding the object's transform ?

sentences:
Setting up Payout on the Microsoft App Hub I am a Windows Phone 7 developer from India. I want to set up the Payout option on the App Hub for the Paid apps I release.

What's the procedure? Do I have to physically mail the W-8 form to Microsoft? Any other things I should know about?

Can I release a paid app now and set up the payout later, in a month or so?

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:
Animation doesn't play in one state I have created an Animator and two sprite-based Animations. Both Animations preview correctly. In the Animator, I have created two states and two transitions between them based on a Boolean parameter. In the GameObject's script, the Boolean value is set based on distance to the player. When the player is far away Animation A plays and when the player is close Animation B plays.
However, while the transition from Animation A to B happens correctly when the player gets close, I only see the first frame of Animation B and it doesn't animate. If while in Play mode I preview Animation B (using the Animation window controls), it animates correctly.
Meanwhile, Animation A always plays correctly when it is supposed to.
What could cause this behavior? How can I get Animation B to play during runtime and not just when previewing? What's going on?
Edit:
Some screenshots. "Saw slow" is "Animation A" above, and "Saw fast" is "Animation B".

Animator

Animator State - Slow

Animator State - Fast

Transition: slow to fast

Transition: fast to slow

Animation - Slow

Animation - Fast
The code is very simple:
bool trigger = playerDistanceSqr < (activeDistance * activeDistance);
animator.SetBool("IsFast", trigger);

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:
Instance vs individual updating I am making a game in SFML, and whilst I was making an AI moving system I was wondering which would be better, If I was to instance update all my entities at once, or individually update them via a function in each of the entity class instances.

I know that instance rendering is much faster but was wondering if this would even be needed for updating the logic of the game, afterall I'm not making a giant physics simulation.

So, I am wondering what would the effect be if I updated the game logic for each entity individually or did it via instancing. And if there is an impact is it really worth it for a game like mine where there isn't too much complexity.

sentences:
Minecraft: What is the reasonable face/vertex limit for custom models? When adding custom models to function as tile entity representations, what is a reasonable ceiling - based on performance - to maintain for individual models? Assume that the player will have the potential possibility to place as many of these as desired, but functionally it would also be reasonable to assume no more than 20 would have to be rendered at once.

If the answer has changed between significant versions of the game, it would be nice if that could be reflected

sentences:
How to combine multiple sprite sheets from multiple sources (Actionscript/Starling) In starling, it's faster if you use BitmapText instead of traditional text. Which is well great except for one issue. Right now the sprite sheet I was making was with a single Fla. I just created the sheet from Flash IDE.

The bitmap text however is generated using a tool like BMFont . Which generates it's own sprite sheet. Now, imagine I have three or four types of texts . Also for some reason I have multiple Sprite sheets of assets.

So the question is, how do I stick multiple sprite sheets together. Is there any available tool for it?

Does using multiple sprite cause performance issues?

sentences:
Converting to JSON String with JsonUtility.ToJson I am working on converting and displaying the JSON String with unity. I have done coding for it

using UnityEngine;
using System.Collections;
using LitJson;
using SimpleJSON;
using System.IO;
public class TestDelete : MonoBehaviour {

JsonData json;
void Start()
{
    Data2 data = new Data2();
    Payload2 data2 = new Payload2();
    data.command = "state";
    data.payload = new Payload2()
    {
        text = "wwwwwww",
        image = "hello"

    };
    data2.option = new Option () {
        A1 = "k",
        A2 = "J"

    };

    string dataValue =data+ data2.ToString();
    string json = JsonUtility.ToJson(data,true);
    P(json + "\t\n");

}

// Use this for initialization
void P(string aText)
{
    print (aText +"\n");
}

}

  [System.Serializable]
  public class Payload2
   {
     public string text;
     public string image;
      public Option option;

    }

  [System.Serializable]
   public class Data2
   {
     public string command;
     public Payload2 payload;
   }

   [System.Serializable]
   public class Option
    {
      public string A1;
      public string A2;
    }

This code of working fine.But with the output Iam having problem.The out is displayed as follow

{
"command": "state",
"payload": {
    "text": "wwwwwww",
    "image": "hello",
    "option": {
        "A1": "", // not getting displayed
        "A2": ""   // not getting displayed
    }
}

}

the string value A1 and A2 is not getting displayed.What will be the issue with my code.Can anybody help me sorting out this issues

sentences:
Unity Client and Multiplayer Networking/Architecture My background is in Enterprise and SaaS web infrastructure.  Zero information about games and how their networking works.  I only know about the world of browsers and RESTful APIs.

I'm planning on using Unity for the client FYI.

Authentication and Authorization

I'm planning to use Unity and Firebase.  Seems like this is fairly standard HTTP connections during the auth faze.  Nothing surprising here unless there is something I missed.

The client authenticates against a service, Firebase in this case.  And then all future calls after authentication are made using the returned credentials.

Gameplay and Player State

This part confuses me.  I assume shooters use a UDP type protocol or some proprietary protocol on top of UDP. But can a game use a REST API and HTTP or TCP connections to send client updates?

Clients would then poll the game server or have a long running connection open to request updates.  For example the Auction House in WoW.  Is there a long lived TCP connection open between the client and the server updating the auction house data every X seconds?

Then when a player submits a purchase order that same long lived TCP connection is used to update the game server state?

Or is it all literally a REST API like a SaaS app would use?  Is my experience with browsers and Single Page Apps in an Enterprise environment applicable to a WoW auction house type situation?

Thank you,
Any tips or feedback is helpful at this point.

sentences:
Why don't mmorpgs use bots? Bots in games can bad and usefull depending on the genre.

A lot of small games use bots to create a fake player base and illude the player that he is playing with real people.

The scariest thing is, that in most of these games you can't actually tell if you are playing with/against real people or bots and sometimes in shooter games bots can be way better than real people, not because they have more HP or more damage, they are not rpgs but shooter games.

And in chatting simulator games, where you actually speak to bots... Some are trashy but a few can get creative , these bots get to the point where they feel like real people... Or at least it means in my life I have encountered people that act like robots.

But there's only one genre of games where bots are not only useful but might be essential.

Rpg's

Why? Immersion.
What's the point of playing a game with an epic giant world twice the size of the real earth if the player base is a few millions (at best) ? You are gonna feel extremely lonely when exploring or you are not in a raid/battleground/dungeon.

most mmos I've explored tend to have really beautiful empy and soulless landscapes and cities... Entire cities with maybe only 30 npcs inside...

And npcs don't do anything, they are different from bots.

Bots try to replicate human behavior, they can talk with you help or try to kill you.

In some games as I have already said bots are created to make the illusion of multi-player but in mmorpgs you already know there are npcs and not every character you encounter is a person but limiting npcs to being statues that stand still in a city to sell you endless items is a waste of pure potential.

So why don't mmos use bots when lesser games can do it perfectly and make their bots seem real? What's the drawback?

sentences:
ParticleSystem: Start Color > Random between two Colors, but without interpolation? How can I set up a Particle System to use a random Color from a selection of two? I mean choosing one or the other.. not a random Color in-between these two.
I tried to use the option Start Color > Random between two Colors:

but I get interpolated colors:

sentences:
2D Polygon Collision push direction with large polygons I have a collision detection/resolution implementation that uses the Separating Axis Theorem. Detection and such works perfectly fine, as well as resolution for most objects/shapes in my game.

However, when it comes to sloped surfaces, there is a problem.

As the picture below in this post demonstrates, whenever an AABB polygon (i.e. the player) is tested against a large slope, the direction the player is pushed in will end up being incorrect. I understand why this phenomenon happens; my displacement calculation (which is used to determine if the push vector needs to be flipped) is giving improper results because the player is below the 'center' of the sloped shape, and thus the displacement calculation is reporting that +y (downward) is the direction to push away from the slope's polygon. This causes the player to get pushed into the ground, or through the slope entirely if there is no ground polygon underneath.

My displacement code looks something like this:

        MTV mtv(perpendicular, 0.f);

        sf::Vector2f center1 = GetRectCenter(shape_1.getGlobalBounds());
        sf::Vector2f center2 = GetRectCenter(shape_2.getGlobalBounds());
        sf::Vector2f dir;
        dir.x = center2.x - center1.x;
        dir.y = center2.y - center1.y;
        dir = unitVector(dir);
        bool flipme = false;

        float disp = dotProduct(mtv.axis, dir);
        if(disp < 0)
            flipme = true;

So what I am wondering, is there another solution to finding out if a polygon's displacement vector will end up towards the polygon or away from it? This displacement calculation works for rectangular shapes and smaller-sized slopes, but is obviously incorrect when the slope is large enough for its center to be navigated around.

I have also tried averaging the points together to find the centroid of the slope, but that still yields similar results.

sentences:
Perlin Noise Variations Currently I'm making a voxel survival game. About a month ago I embarked on procedurally generating terrain using Perlin noise. I understand how to use and apply it for the most part. However I do not understand how to vary terrain structure. Let me say that in a way you probably can understand because "me no grammar good".

By changing frequency and amplitude I know I can change the resulting terrain, varying it from rolling hills to jagged peaks. However the end result will always be the same: either never ending hills or never ending mountains. I don't understand really how I would mix those two "terrain structures" together to get area's of hills and area's of mountains.

sentences:
MVC with looping view For our school project we'd like to develop a game using the MVC pattern. We're all moderate new java programmers and absolutely new in game development.

With our current view (containing only menu) using swing we have no issues. But we'd like to make the menu navigation within the game loop. And there's the issue: The game loop prevents the controller to continue. The solution sounds easy, but the implementation lacks some of my/our knowledge, additional thread. I think using a separate thread for view makes handling all stuff threadsafe difficult.

Our game loop is based on nifty, which is using slick2d and this is based on lwjgl (and so on). Reverting to swing does not solve our issue, because once we're in the real game loop, the situation would be the same (so far I understand).

I hope it is understandable without posting huge amount of code. Two questions comes to mind:
How should threading be done, when my current try is having a (looping) view instance in its own thread?
(Reading a bit here on gamedev seems to call our architecture in question) Is MVC the right choice if we're using slick as framework?

sentences: How do I detect the intersection of a curve with itself? I'm developing a game in which the player can draw a line. I want to detect if that line intersects with itself. How would I do this?

sentences:
How to develop both a client and headless server together in Unity I'm making a multiplayer 2d shooter platformer in unity. And after studying the different options to program an authoritarian server and with the great help that many of you have already provided me on this site. I have decided to create my server also with a unity in headless mode in order to reproduce or simulate the physics of the games on the server with the same engine (box2d) and that the server is the one that decides the movements of the clients.
As you have told me (Thanks @DMGregory), a good option for server development in unity is to use a single project to program both client and server and thus be able to reuse the scenes and prefabs without having to clone them in 2 different projects, but with This idea I find some main problems that I do not know how to solve.

Debugging. How can I run the 2 editors of the same project in unity simultaneously to run server and client?

Separate client and server. Is there a way to separate those elements necessary for the client from those necessary for the server in unity? If not, when compiling my project to use it as a server, it will have a lot of unnecessary material (scripts, sprites, prefabs, etc.) that will make the program more heavy without necessity.

Thank you very much and sorry for my level of English

sentences:
Retrieving text from a text file and inputting it to a Text component I had a suspicion I would come across this problem. I know how to write to the file and read from it, but the following snippet isn't allowing me to input it into a text component.

public class EventHandler : MonoBehaviour
{
    string _text;
    Text text;
    private void Awake()
    {
        text = FindObjectOfType<Text>();
    }
    public string Read(string path)
    {
        _text = "";
        StreamReader reader = new StreamReader(path);
        while (!reader.EndOfStream)
        {
            _text += reader.ReadLine();
        }
        reader.Close();
        return _text;
    }
    public void chapter_one()
    {
        text.text = Read("Assets/Chapters/chapter_one.txt");
    }
}

I'm sure you guys can explain why this isn't working. I already got the reference to the Text component as well.

Edit

No errors, file exists, its filled, color is white on black background, chapter_one is the file name and yes chapter_one is called, and I put Debug.Log right in the while loop and out_side of it and I received those logs. My only thoughts are that the string is not getting returned for god knows what reason, or the text component isn't appending the text.

sentences:
How do I prevent inappropriate ads from appearing in my game? My game implements Unity ads, and is designed with a universal audience in mind. As such, I would prefer not to have 18+ ads (or even 13+ ads depending on the circumstances) appearing in it, especially since it would appeal to younger audiences as well. My question is then, how do I prevent age-inappropriate ads from appearing? Is there a way to simply set the age limit or content restrictions on Unity ads? The only setting along those lines that I can find is the COPPA toggle, and that would cause other issues (not to mention that it wouldn't do anything to the ads). I've looked in the dashboard for a while, and I've tried to research it beforehand, but the fact that they've shifted to a centralized services page, redirected all the old links (breaking them in the process), reorganized the settings in the dashboard, and 404d their FAQ post on the topic doesn't help either. Blocking ads based on a rating would work too, as I would have to get one because I am publishing to Google Play.

Edit: The second link only 404s some of the time. I just happened to get it every time before asking this question. Bad luck, I guess.

sentences:
How does server correct late input Imagine the following scene: The height one player can reach on jumping depends on how much time the button for jumping is pressed. When the player jumps, the input is sent to the server and physics are updated.

Now, imagine that for some reason, one input packet is lost or due to lag it begins to arrive late. From the point of view of server, the player is not jumping anymore, and its character will start its fall. Every other client will receive this information and let the character fall.
Then, a new packet arrives that corrects this problem. From the perspective of the player, the character is still jumping. Maybe, thanks to this extra input the character can reach a higher slope. But from the point of view of the server and rest of clients, it wont make it.

This could happen, but online games that i have played (except for long jumps and high lag) it doesnt happen. My question then is: How does the server handle this situation? It cannot wait forever for input, it must update physics and acknowledge other clients on what's going on.

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:
How to handle a player's level and its consequent privileges? I'm building a game similar to Mafia Wars where a player can do tasks for his gang and gain experience and thus advancing his level.
The game is built using PHP and a Mysql database.
In the game I want to limit the resources allowed to player based on his level.
For example:
________| (Max gold) | (Max army size) | (Max moves)  | ...
Level 1 |    1000    |       100       |      10      | ...
Level 2 |    1500    |       200       |      20      | ...
Level 3 |    3000    |       300       |      25      | ...
  .
  .
  .

In addition certain features of the game won't be allowed until a certain level is reached such as players under Level 10 can't trade in the game market, players under Level 20 can't create alliances,...etc.
The way I have modeled it is by implementing a very loooong ACL (Access Control List) with about 100 entries (an entry for each level).
However, I think there may be a simpler approach to this seeing that this feature
have been implemented in many games before.

sentences:
Trouble with assigning a model's own mesh to a mesh collider in Unity I'm trying to use a mesh collider on the player's avatar, rather than the box collider.

I've added the mesh collider to the game object (which also has a rigid body) and selected the "convex" checkbox.  However, the player still falls through all geometry, including Unity primitives, terrain, and other models.

In the mesh collider's property box, there's a value for "Mesh", which I have set to "None (Mesh)".  I was led to believe this defaults to the model's own mesh, but now I'm not certain.  If I change the value to something else from the "select mesh" list, like the cube, the collisions work.  When I click over to Select Mesh --> Scene, the list is empty.  I'm assuming I need to add the model's mesh to the list, but I can't find any documentation about that.

sentences: Best practice for map coordinate system Are there any conventions and/or best known methods around coordinate systems in game maps? Is the origin usually positioned in the center of the map? Or does it live in a corner and the map is built in a single octant of the 3D space?

sentences:
SpriteSheet in slick2d or lwjgl import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;

public class SpriteSheet {
    private String path;
    public final int SIZE;
    public int[] pixels;

public static SpriteSheet tiles = new SpriteSheet("/texture/spritesheet.png", 256);

public SpriteSheet(String path, int size) {
    this.path = path;
    this.SIZE = size;
    pixels = new int[SIZE * SIZE];
    load();
}

private void load() {
    try {
        BufferedImage image = ImageIO.read(SpriteSheet.class.getResource(path));
        int w = image.getWidth();
        int h = image.getHeight();
        image.getRGB(0, 0, w, h, pixels, 0, w);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
}

So I'm trying to load a SpriteSheet either using slick2d or lwjgl. Was wondering is this faster, than the method above. Also, how do you actually do a spritesheet class for lwjgl.

I'm just confused how you use Sprites in Slick2d. It looks like I need to create an image class and then have SpriteSheet class extend the image class.

http://slick.cokeandcode.com/javadoc/org/newdawn/slick/Image.html

sentences:
Unity Animator not animating player, but following transitions perfectly in Animator Window I am trying to animate a model in my project, and although I have been successful doing the same in other projects, I am not succeeding in this one.
The model does not seem to animate, although in the Animator window, everything looks fine, transitioning from one state to the other and going back.

I have followed the tutorials to import animations from the site where I downloaded the animation, and each animation is the same as other working animations in other projects:

The animations play as expected in the inspector window.
I have tried modifying the "Apply Root Motion" in my character and it does not work either way. My Player model has these properties:

And I have tried adding a Rigid Body but it didn't work neither. I have spend several hours trying to solve this issue and I am running out of ideas to try. How can I make the animation work as expected?
Cheers!

sentences: How to use/apply class inheritance in Enchant.js You're developing a game using Enchant.js and you just need an Enemy class which multiple enemy classes derive from and every enemy has its own sprite and stuff.

sentences:
High performance screenshots in LWRP I'm trying to capture some screenshots for my game. They need to be saved as jpgs to a folder, latency is not an issue, I don't care if it happens over 10 seconds. My number one priority is to keep the game at a steady framerate.

Some things I've tried:

I've tried ScreenCapture.CaptureScreenshot but that is super slow and the game hangs for a split second.
I've tried the old method of texture2d.ReadPixels() and EncodeToJPG() but that was unbelievably slow.
I also found a relatively new feature: https://docs.unity3d.com/2018.3/Documentation/ScriptReference/Rendering.AsyncGPUReadback.html

I found a repo using this feature to capture screenshots asynchronously: https://github.com/keijiro/AsyncCaptureTest
This requires the use of OnRenderImage(), but I'm using LWRP and OnRenderImage() isn't supported in scriptable render pipeline.

Pulling my hair out

Some metrics from my testing:

ScreenCapture.CaptureScreenshot is ~200ms.
ReadPixels() is 40-70ms.
Texture.Apply() is ~5ms.
EncodeToJPG() is 35-50ms.
File.WriteAllBytes() is <1ms.

Also posted this question here and here:

sentences:
Read function outside of code while run-time? Hi it is my first post on this community. So if i was rude or something please let me know :)

So I just started learning game development alone. It's been about 1 year since I begin to learn c and c++.
Recently I started planning to make a game for my own entertainment and future career.

I'm trying to make the game as mod-friendly as possible.
So I thought that I should make abstract classes that have most of the functions for working on run-time. Then when the game starts, the system reads mod files for filling out class information and stores that base object in some data storage made with a singleton(for easy access). And, then use a factory pattern(I hope I'm using it right) to copy the base object that I need, fill it with basic information and store it in the object storage.

The problem is, I can't figure out how I can make it so each object from each mod file acts with its own behavior.

For example:
Core mod(main game) has an abstract class named 'living entity'
'Living entity' has some information like bone structure type, mesh name, entity size, etc...
And a mod file from the core mod makes a 'human' class that has information for 'human bone type','basic human','human size' etc
The human class does not need any special functions because it only uses basic functions that the game provides.

But modder A wants to make a Vampire entity.
Vampire will have information like a human. So modder A fills up or copies the 'human' file and edits the class id value with which the system identifies objects and uses as a name.
Vampire needs new skills, health effects and custom death(leaves an ash pile instead of a corpse)
The game also has skills and health effects as a kind of component or class. So modder A fills up information but one of the skills has a unique projectile effect or one of the health effects has a unique behavior that the game does not provide
So modder A wants to override projectile or health functions only for the vampire's unique skill or health

In this case how would I support them to override functions for their own needs?
One of my idea was to read the dll and store function pointers in data storage and put the code on a base abstract object and then call it if the object has a custom function.
But I am not sure this works and that it is how people do it.
So if there is some kind of information or documentation for that please let me know
I'm arguing with this problem about month D;

sentences:
Unity UI subpixel rendering/antialiasing with Image.fillAmount? I'm using DoTween to tween the fillAmount of a UI Image. When I check the value, it changes smoothly, and in the scene view it appears to transition smooth.
However it appears jerky in the game view, and seems to step for each pixel, so it seems resolution dependent. Is there any way to have the UI render subpixels (?) or antialiased so it uses colors between green/white to have it appear to move more smoothly?
Thanks!

sentences:
pixi.js - PIXI undefined I am using pixi.js to learn about HTML5 game development. When using this line of code

var bunny = new PIXI

I get an undefined error saying that PIXI isn't defined.

Here is my HTML

<!doctype html>
<head>
    <title>PixiJS</title>
    <meta charset="UTF-8">
</head>

<body>

<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/4.2.2/pixi.min.js"></script>
<script src="index.js"></script>
</body>

sentences:
GLSL Shader Editors for Linux Are there any good IDE's for linux that lets us edit GLSL shaders and visualize their effect?

Note : Shader Designer By Typhoon Labs is a good option but I am looking for alternatives as this software has some issues with Ubuntu 11.10

sentences:
Save Texture2D to file in Monogame I'm working on a tilesheet builder tool for my game to speed up tile creation, and I need to save a generated texture2D as a png. I've tried using the .SaveAsPng function but it isn't implemented in Monogame.

Is there any way around this in monogame?

EDIT:
I've tried this:

private void SaveTextureData(RenderTarget2D texture, string filename)
    {
        byte[] imageData = new byte[4 * texture.Width * texture.Height];
        texture.GetData<byte>(imageData);

        System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(texture.Width, texture.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
        System.Drawing.Imaging.BitmapData bmData = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, texture.Width, texture.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, bitmap.PixelFormat);
        IntPtr pnative = bmData.Scan0;
        System.Runtime.InteropServices.Marshal.Copy(imageData, 0, pnative, 4 * texture.Width * texture.Height);
        bitmap.UnlockBits(bmData);
        bitmap.Save(filename);
    }

but it's giving a weird output, and I don't know why:
http://i.imgur.com/XT9Dnjj.png

Thanks for any help!

sentences:
How to only detect Actor and not background I'm making a game where I have buttons on a stage, but the background also acts as a "button". But when I press on one of the existing actors on the stage, it also registers a click in the background in addition to the click on the button. How can I fix this?

Inside constructor

button = new ImageButton(getDrawable(new Texture("PlayUp.jpg"))); //only using one image atm
button.setSize(150, 134);
button.setPosition(camera.position.x, camera.position.y);
stage = new Stage(viewport);
        Gdx.input.setInputProcessor(stage);
        stage.addListener(new ClickListener(){
            @Override
            public void clicked(InputEvent event, float x, float y) {
                System.out.println("Background touched");

            }
        });
        button.addListener(new InputListener() {
            @Override
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                return true;
            }

            @Override
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                System.out.println("Button touched");
            }
        });
        stage.addActor(button);

part of render() method

@Override
    public void render(float delta) {
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    tapCatch.batch.setProjectionMatrix(camera.combined);
    tapCatch.batch.begin();

    stage.act(delta);
    stage.draw();

    tapCatch.batch.end();

}

sentences:
Deferred rendering with both Clockwise and CounterClockwise culling I have a deferred rendering system that works well with objects that appear solid and drawn using CounterClockwise culling.

I have a problem with Clockwise culled objects that are supposed to represent hollow that display their inside faces only.

The image below shows a CounterClockwise  culled object (left) Clockwise culled object (right).

Deferred Rendering CullMode http://rhysperkins.com/XNA/CullModeDeferred.png

The Clockwise culled object faces display what would be displayed on the CounterClockwise face.  How can I get the lighting to light the inner faces for Clockwise culled objects and continue lighting the outer CounterClockwise faces as normal?

My lighting method is below

    private void DeferredLighting(GameTime gameTime)
    {
        // Set the render target for the lights
        game.GraphicsDevice.SetRenderTarget(lightMap);

        // Clear the render target to (0, 0, 0, 0)
        game.GraphicsDevice.Clear(Color.Transparent);

        // Set the render states
        game.GraphicsDevice.BlendState = BlendState.Additive;
        game.GraphicsDevice.DepthStencilState = DepthStencilState.None;
        game.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;

        // Set sampler state to Point as the Surface type requires it in XNA 4.0
        game.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;

        // Set the camera properties for all lights
        BaseLight.SetCameraProperties(game.ActiveCamera);

        // Draw the lights
        int numLights = lights.Count;

        for (int i = 0; i < numLights; ++i)
        {
            if (lights[i].Diffuse.W > 0f)
            {
                lights[i].Render(gameTime, ref normalMap, ref depthMap, ref sgrMap);
            }
        }

        // Resolve the render target
        game.GraphicsDevice.SetRenderTarget(null);
    }

I have tried adjusting the render states but no combination works for both objects.

sentences:
Unity3D Pathfinder with Crossings I'm trying to bring traffic on my street system. The main problem for me are the different lanes and crossings and to make it complete the different types of paths.

I've tried a bit with the NavMeshes, the different types I've solved with costs, so cars prefer greater streets and ignore pavements. But there is the problem how to tell pedestrians to prefer pavements and ignore streets?

And the main problem for me are crossings cause they start to switch the lanes and drive in the wrong side, turn around and so on.

I'm thinking about that NavMeshes aren't the right thing but doesn't get any better idea!?

My usecase is that I want to tell the police Car to drive from the police Station to a bank robbery (fixed coordinates) or the Bus to drive on a fixed route. So I want to have the Option to define multiple points and let them drive/walk to this (or the nearest) point - respecting the lanes and not do a U-Turn (not prefer this).

I don't want ready to use code, just an explained idea how to go.

sentences:
Present fails randomly on mixed C++ Direct3D9 app I have a mixed .NET application (managed and unmanaged code bridged by C++/CLI wrappers) which uses unmanaged Direct3D9 9.0c to do rendering inside a control which is wrapped inside a C++/CLI class which extends System.WIndows.Forns.UserControl.

Everything has been working fine for years now, but I recently put another instance of this Direct3D9 control inside a new Windows Form. That is, I have two concurrent instances of the control. I had done that before and it worked, but now I have issues. Perhaps the problem was always there, but because it's related to a race condition, it started happening now...

Ok, the details: When I try to render an image over a texture on the new instance of the control, sometimes it works, sometimes it doesn't. And when it doesn't, nothing is rendered, and from that point onwards, all Present calls fail (I log those failures). If I close the form and open it again, it might work or not. Nasty.

If I use DXGetErrorString and DXGetErrorDescription, all I get is something like:

  EFAILED Undetermined error

Not really helpful... To make matters worse, I can't reproduce the issue in my development environment; I only see it in a production box.

As far as I know, the main reason Present fails like this is a Lost Device. But I implemented the usual scheme to handle that (I can post the code if necessary), and it seems like the device is not being lost... What else can I try?

sentences:
How to determine if an object is within field of view given xyz of object, player position, and 3D vector for player view? I only have the object's position, the player position, and the vector representing the player's view, and I have the FoV (120 degrees horizontal/60 on each side, and 60 degrees vertical/30 on each side).

As I'm dealing with data that has already been recorded, I cannot use any Unity built-in functions and have to calculate it manually. My thoughts were to convert the 3D coordinates into 2D vectors, so that I can calculate if an object is in the horizontal plane first (by taking the X and Z values) and then if it is, check if it is in the vertical plane (take the Y and Z coordinates).

After, I calculate the the angle between the object and the player view to see if the absolute value of that is within the field of view (for example, if the object is on the left side of the player view, and the horizontal FOV is 120 degrees, then if the absolute value of the angle is less than or equal to 60 degrees it is within view).

Is this on the right track? I've been getting strange results (like only one of the four objects I'm looking for shows as visible throughout a log of values even though they should all at some point be visible).

Here is some code to show what I'm doing:

    public static Double angle(Vector2D obj, Vector2D bodyPos, Vector2D headDir) {

    Double result = 0.0;

    // Get the vector between the body position and the object
    Vector2D temp = Vector2D.subtract(obj, bodyPos);

    // First find dot product
    Double dotProduct = Vector2D.dotProduct(headDir, temp);

    // Now find the length of each vector and get the product of them
    Double lengthProduct = Vector2D.vectorLength(headDir)*Vector2D.vectorLength(temp);

    // Find the intermediary result
    result = dotProduct / lengthProduct;

    // Apply arc cos to find the angle between the vectors
    result = Math.acos(result);

    // Convert angle to degrees
    result = (result * 180)/Math.PI;
    System.out.println("The angle is: " + result);

    return result;
}

And here is the code that determines if something is in view by using that angle function:

    public static boolean isInView(bodyPosition objPos, bodyPosition bodyPos, headDirection headDir){

    boolean inView = false;

    Double h_angle = 0.0;
    Double v_angle = 0.0;

    // Create 2D vectors for both the horizontal and vertical FOV measurements
    Vector2D h_objPos = new Vector2D(objPos.getDirectionX(), objPos.getDirectionZ());
    Vector2D v_objPos = new Vector2D(objPos.getDirectionY(), objPos.getDirectionZ());

    Vector2D h_bodyPos = new Vector2D(bodyPos.getDirectionX(), bodyPos.getDirectionZ());
    Vector2D v_bodyPos = new Vector2D(bodyPos.getDirectionY(), bodyPos.getDirectionZ());

    Vector2D h_headDir = new Vector2D(headDir.getDirectionX(), headDir.getDirectionZ());
    Vector2D v_headDir = new Vector2D(headDir.getDirectionY(), headDir.getDirectionZ());

    // determine angle of FOV+
    Double iHFOV = FOV_H_MID * 0.5;
    Double iVFOV = FOV_V_MID * 0.5;

    // Check horizontal FOV first; if it is within that, then check the vertical
    // If both pass, then it is in view
    h_angle = Vector2D.angle(h_objPos, h_bodyPos, h_headDir);
    v_angle = Vector2D.angle(v_objPos, v_bodyPos, v_headDir);
    if ( Math.abs( h_angle ) <= iHFOV) {
        if ( Math.abs( v_angle ) <= iVFOV) {
            inView = true;
        }
    }

    return inView;
}

I found some resources that I will be reviewing in the mean time, but any help is appreciated. I haven't done any linear algebra courses so I'm trying to wrap my brain around it.

sentences:
How do I handle objects with a width and height in grid-based pathfinding? I'm using the Jumper library for Love2D to do grid-based pathfinding, which worked fine until I wanted to make larger enemies (with larger collision boxes). How do i do that?

My initial idea was to make a new map for each entity that needed pathfinding I could make a new map, with all the objects scaled up in size, but that seems way to complicated.

To give an example, I could have a wall with a passageway that is wide enough that my player has no trouble walking around it, but a giant ogre would have to walk around.

sentences: Integrating the Steamworks API achievements into your game I'm coding a game in Visual Studio 2015 and am wondering how to go about adding steam achievements to it using the Steamworks API, do I need to have my game on steam before hand or if not what's the process of adding achievements?

sentences:
How to render 2D particles as fluid? Suppose you have a nice way to move your 2D particles in order to simulate a fluid (like water). Any ideas on how to render it?

This is for a 2D game, where the perspective is from the side, like this. The water will be contained in boxes that can be broken in order to let it fall down and interact with other objects. The simplest way that comes to my mind is to use a small image for each particle. I am interested in hearing more ways of rendering water.

sentences:
How to make a character sit in Unity? So I've got the animation, it has root motion but activating it in the settings doesn't seem to do much.

What would be a good optimized way to have the character sit on the stool with the animation matching the movement? Would I need to do it through code?And if that's the case, could I specify in which frame do the movement? Or add a second animation that is in charge of Root Motion?

I know either of these two options I give could work but I'm checking to see if there is a better way or if I'm missing something here.

Thanks!

EDIT: Following DMGregory's comment I disabled the collider to see if it improved... it did change, but it isn't much better:

EDIT 2: This is how the animation preview looks like (what I'm expecting)

Then I just hold the last frame while they're sitting and play the animation backwards for when they're getting off - this is just while I get it to work.

sentences:
How would I go about implementing a globe-like "ballish" map? I am new to 3D development and I have this idea of having the game world like our globe is - a ball. So, there would be no corners in the map and the game is top-down RTS game. I would like the camera to go on and on and never stop even though you are moving the camera to the same direction all the time.

I am not sure if this is even possible, but I would really like to build a globe-like map without borders. Can this be done, and how exactly? I am using XNA, C#, and DirectX. Any tutorials or links or help is greatly appreciated!

sentences:
How should I generate and store the boundries of a cave? I am making a small cave copter game (seriously, where did this type of game come from anyway) and I am trying to figure out how to make and store the procedural generated walls. I am thinking about creating the walls by randomly picking two points away from the center of the screen. They will be no closer than the height of helicopter and no further than the edge of the screen, weighted to prefer to go in the same direction as the point prior so I end up with stalactites and stalagmites and not just noise, at set intervals of distance. To store, perhaps parallel arrays/lists, one for distance from center to top screen and one for distance from center to bottom.

Am I way off base with my thinking? I just want the cave to be varied and challenging, I just have never worked with generating data like this.

Edit: Woah, I just realized that my idea would lead to a player being able to stay in the middle of the screen and win. That isn't right at all. So the very basis of how I was going to generate is wrong.

Edit 2: I also realized I left out a very crucial point. Part of the mechanics of the game will let the player go backwards therefor the data structure should be continuous.

sentences:
How can I implement Objective-C libraries in Unity? I've been a "hardcore" developer for sometime now, as I've always worked with pure code reactive rendering, and contributed to Cocos2d library some time ago , (It is the one I used for my games) . But I've come to realize that most of the work I'm doing by setting up my game environment , user interface and everything else is becoming a bit repetitive, and complicated, as position must be tested each build , debugging sometimes involves exploring the deep down framework and I've decided to try out a full game development environment.

Some friends have recommended me Unity for mobile development (If you could give me any better advice I'd be grateful) but my main concern is my custom libraries I built on Objective C for multiplayer real time connectivity, it's probably thousands of lines and I wouldn't like to write them all over again.

Is there any way I could invoke my objective-c library in Unity ?

I know it's probably a vague question but can't seem to find where to start! Any guidance will be highly appreciated!

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:
why my shader is black in the game mode? I used this useful blending modes It's good but it just work in Editor mode.
what is the problem?!

Shader "CodeCorsair/BlendModesFX"
{
    Properties
    {
        _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}

        // This here gives hints to the shader to do pixel-time tricks
        _BlendMode("BlendMode", Range(0, 16)) = 0 // 0 is standard blend

        [HideInInspector] _BlendOp1("__op1", Float) = 0.0
        [HideInInspector] _BlendSrc1("__src1", Float) = 1.0
        [HideInInspector] _BlendDst1("__dst1", Float) = 0.0
        [HideInInspector] _BlendSrcAlpha1("__src_alpha1", Float) = 1.0
        [HideInInspector] _BlendDstAlpha1("__dst_alpha1", Float) = 0.0
    }

    SubShader
    {

    //  Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
    //ZWrite Off Lighting Off Cull Off Fog{ Mode Off }
    //LOD 110
        Pass
        {
            BlendOp[_BlendOp1]
            Blend[_BlendSrc1][_BlendDst1],[_BlendSrcAlpha1][_BlendDstAlpha1]

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma fragmentoption ARB_precision_hint_fastest
            #include "UnityCG.cginc"

            sampler2D _MainTex;
            float _BlendMode;

            struct vin
            {
                float4 vertex : POSITION;
                float2 texcoord : TEXCOORD0;
                float4 color : COLOR;
            };

            struct v2f
            {
                float4 vertex : POSITION;
                float2 texcoord : TEXCOORD0;
                float4 color : COLOR;
            };

            v2f vert(vin v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.texcoord = v.texcoord;
                o.color = v.color;
                return o;
            }

            fixed4 frag(v2f i) : COLOR
            {
                float4 color = tex2D(_MainTex, i.texcoord);
                color.rgb = 1.0 - (1.0 / max(0.001, color.rgb * color.a + 1.0 - color.a)); // max to avoid infinity

                return color;
            }

            ENDCG
        }
    }
}

when I used Transparent Queue I had this result:

sentences:
Breakout Collision Detection: Ball gets trapped inside block I'm writing a breakout clone where blocks to hit can be of various sizes and the projectile can move at different speeds, and I seem to be having some trouble getting the collision detection perfectly right.

I have a side-detection algorithm working just fine (projectile reflects in the proper direction when hitting top/side of a block), but sometimes the projectile seems to get stuck inside the blocks, especially when the projectile is moving fast. The function I have simply tells the projectile to reflect it's X or Y axis, but, when the projectile can't get away from the block in time, it gets trapped constantly reflecting on its axes, causing it to "freak out" and get trapped bouncing around inside the block itself.

I attempted to fix this by disabling collision detection for a very short time after each detected collision (defined as PROJECTILE_TICK = 0.05f in the code below), but this doesn't seem to solve the problem, and the projectile still gets trapped.

Is there a standard way this sort of problem is typically handled? I know I'm far from the first person to try and make a breakout clone, so someone must have run into this problem before.

My collision detection function is below. The blocks are referred to as "ptfm" in the code below.

 private void checkPlatformCollisions(float deltaTime) {
    tickTime += deltaTime;

    for(int i = 0; i < projectiles.size(); i++) {
        Projectile proj = projectiles.get(i);

        for(int j = 0; j < platforms.size(); j++) {
            Platform ptfm = platforms.get(j);
            if (OverlapTester.overlapCircleRectangle(proj.boundingRadius,
                    ptfm.bounds)) {

                if(ptfm.breakable) {
                    //this part works just fine; it's the else clause that's screwy

                    }
                } else {

                    //tick is so projectile wont get stuck in a reflection loop
                    //move these to the projectile class later
                    if(tickTime > PROJECTILE_TICK) {

                        //reset tick time
                        tickTime = 0;

                        if(ptfm.type == Platform.PLATFORM_TYPE.WALL) {
                            proj.reflectX();
                            continue;
                        }

                        float angle = (float) Math.atan2(ptfm.pos().y - proj.pos().y,
                                ptfm.pos().x - proj.pos().x);

                        //atan2 returns in radians
                        angle *= Vector2.TO_DEGREES;

                        if(angle < 0) {
                            angle = 360 - (-angle);
                        }

                        if ((angle >= 0 && angle <= 45) ||
                                (angle >= 315 && angle <= 359)) {
                            //hit from top
                            proj.reflectX();
                        } else if ((angle >= 45 && angle <= 135)) {
                            //hit from left
                            proj.reflectY();
                        } else if ((angle >= 135 && angle <= 225)) {
                            //hit from bottom
                            proj.reflectX();
                        } else if ((angle >= 225 && angle <= 315)) {
                            //hit from right
                            proj.reflectY();
                        } else {
                            proj.reflectX();
                        }

                    }

                }

            }

        }
    }

sentences:
How can I procedurally generate the right difficulty of enemy waves? I'm programming a space-shooter mobile game with a sandbox gameplay style similar to Defender's.
The player faces infinite waves of enemies moving towards his ship.
The game has many upgrades the player can buy to increase his ship's strength.

It is important that the difficulty of each level matches the player's skill and strength.
This includes setting the right number of enemy waves per level and the number and toughness of the enemies in them.
This must be done procedurally, since the game has no predefined set of levels laid out by a designer.

I'm interested in straightforward solutions  with more or less the desired effect, simple enough to quickly implement and test.

How should I approach this?

sentences:
Adaptive AI (Artifical Intelligence) I was thinking to make my arcade game match the players strength in the hard level mode. Like checking the score and if the human player's score is above computer's for certain number of units then the computer player would automatically increase the speed of its reactions, just like a human companion who gets more determined to fight back.

Does this sound a good idea to you? Are there other ways to approach this, so to make a game, like air hockey for a crude example, permanently challenging for anybody?

EDIT:
I agree with the answers below. I believe that most people like to win about 70% time over the computer in order to be motivated. Hence an adaptive intelligence must not be become too superior to the player and depending on human player's concentration and some random elements in the game (good 'old' quantum RND), the outcome should be always uncertain.

A nice thing about this is that such a system could handle week and strong players and would adjust to the human's learing curve.

sentences:
How can I add orbit effect to the camera? On my player I have the component Animator , Rigidbody , Capsule Collider , Third Person User Control script , Third Person Character script.

On the Main Camera there are two scripts but only one is activated for now : Camera Follow and Mouse Orbit With Zoom :

The Camera Follow script is working fine. The problem is when I'm activating the Mouse Orbit With Zoom script if I move the player with the keys WASD and also rotate orbit the camera with the mouse the player lose focus. He does change his direction according to the mouse rotation but also lost focus :

And also for some reason I can make the camera rotation to be diagonal:

The reason Main Camera is not child of the player is that it's making the camera stuttering and rotating very fast on place. That is why I added the Camera Follow script.
The Camera Follow script :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFollow : MonoBehaviour
{
    public Transform player;
    public Vector3 offset;

    // Update is called once per frame
    void Update()
    {
        transform.position = player.position + offset;
    }
}

The orbit script :
using UnityEngine;
using System.Collections;

[AddComponentMenu("Camera-Control/Mouse Orbit with zoom")]
public class MouseCameraOrbit : MonoBehaviour
{
    public Transform target;
    public float speed;

    private void Update()
    {
        if (Input.GetMouseButton(0))
        {
            transform.RotateAround(target.position,
                                            transform.up,
                                            -Input.GetAxis("Mouse X") * speed);

            transform.RotateAround(target.transform.position,
                                            transform.right,
                                            -Input.GetAxis("Mouse Y") * speed);
        }
    }
}

My game is adventure game type and the main goal is to make player movement to be with the keys and also to be able to look around like orbiting with the mouse because only following the player will not show where to go , that is why I'm trying to add orbiting, but the orbiting part is just not working good.

sentences:
To find a success list in group I try to find a success list among players for my project.
I thought If I find the winning probability of players , it would give me the success list in group.

I would like to give an example to explain in a score table.

Player A won Player B 2 times in 3 matches .
Player C won Player B 1 time in a match.
Player C won Player A 1 time in 4 matches.

My idea to find the winning probabilities:

p(Player X)=Total Winning number of Player X / Total Match Number

Thus we can calculate individual probabilities as above.

p(A)=5/8

p(B)=1/8

p(C)=2/8

The success list shows that
p(A)>p(C)>p(B)

If we get new player (Player D) and the new player gets a match with Player C. if Player D wins the match, we will get a new success list according to my formula above.

p(A)=5/9

p(B)=1/9

p(C)=2/9

p(D)=1/9

In last status: p(A)>p(C)>p(B)=p(D)

I do not feel that method is good enough because Player D won Player C but Player D is behind Player C. As a sense, I feel Player D must be more that Player C in the list.

And other disadvantages are

if a player do not make match so often ,it can go down in the list. For example , if Player A  do not make match for a while and Other players make matches,  Player A will go down in the list even if he has good winning rate among users. I feel my method does not give exact player power
If a player in middle of the success list makes so much match with a weak player, The middle player will get top in the list even the player is not good enough.

Please let me know your ideas and solutions . Which methods can be used to define for better success list? How did you solve that issues in your game project while preparing a success list for death matches.

Thanks

sentences:
How do I move an object towards a moving object? I am trying to make an AI that tries to move towards the player but I don't know how. I tried using Vector2.MoveTowards() but it just mimics my movements instead of moving towards the player. I tried everything i could think of (which was not a lot :D) but i couldn't make it move towards and touch the player! Help please :D.

Also my original code:

#pragma strict
var speed : float = 100;
var targetX : Transform;
var targetY : Transform;
var mex : Transform;
var meY : Transdorm;
function Update ()
{
var targetX = transform.position.x;
var targetY = transform.position.y;
var meX = transform.position.x;
var meY = transform.position.y;
Vector2.MoveTowards(Vector2(meX, meY), Vector2(targetX, targetY), speed);
}

sentences:
How can I properly detect my cars collisions using hitboxes? I have created two car objects and their current speed is represented as the len variable.

This is the code:

Under Blue Car Collision Event:

if (place_meeting(x,y,obj_CarRed)) { // Checking Collision
    len = 0 //Current speed
    if (len < obj_carRed.len) { // Blue Car's current speed is greater than Red's
        myHP -= obj_carRed.len/2
    }
}

So I copied the code to the other object and replaced Red with Blue. When the Red car crashes into the Blue car, the Blue car takes damage because the Red car is traveling faster than the Blue car. But when the Blue car crashes into the Red car, the Red car won't take any damage.

Later, I thought about using a Hitbox and have it as a parent for both cars, but I don't know if it would mess up the collisions, and I don't know how to tell the hitbox that it's been created by Blue Car, or by Red Car. I don't know if I should make a new hitbox for each car or one for both.

sentences:
How to handle tiles on top of players I am creating an 2d bird view tile game using the pixijs render framework.
Like pokemon or oldtime zelda.

In those games you sometimes walk behind buildings where the tile would be drawn on top of the player.

I am using an multidimensional array for each tile properties.
Where you can set ground level images and level on top of ground level images.

The 'z-index' can be changed.

Should I create an new property to flag it as an tile that can be on top of the player? Where all those tiles with that property are drawn on top of the player.
But there is an possibility that you can climb/walk on the building and the player should than be drawn on top of the tiles.

You should take the following into consideration

the game is an multiplayer game.

This could be an conflict if all the players/characters (the player,npc, cpu) are one layer and the tiles that can be drawn on top of the player are one layer. Because for example: one player is walking on top of the building and one is behind the building. You cant change the z-index of the player one lower. Because the player behind the building wil look like he is on top of it because the player is drawn on top of it by the changed z-index.

you can be drawn on top of the tile level (like walking om top of the building or mountain)
tiles can change (a building that is going to be destroyed for example) thus are not fixed

So how can I handle tiles on top of a player which can be also beneath one player but not the other?

sentences:
Subdividing a polygon into boxes of varying size I would like to be pointed to information / resources for creating algorithms like the one illustrated on this blog, which is a subdivision of a polygon (in my case a voronoi cell) into several boxes of varying size:

http://procworld.blogspot.nl/2011/07/city-lots.html

In the comments a paper by among others the author of the blog can be found, however the only formula listed is about candidate location suitability:

http://www.groenewegen.de/delft/thesis-final/ProceduralCityLayoutGeneration-Preprint.pdf

Any language will do, but if examples can be given Javascript is preferred (as it is the language i am currently working with)

A similar question is this one: What is an efficient packing algorithm for packing rectangles into a polygon?

sentences:
Jumping onto higher ground Collider issues What's the general solution to the following character animation problem (I'm using Unity)?

You have a character with a capsule collider and a jump animation that allows you to jump onto higher ground (such s boxes, etc.). The character shouldn't be able to jump unrealistically high so she goes into a crouched posture while in the air and the collider is scaled accordingly in an animation curve.

However when the character jumps onto the box to land, the character animation (and collider) want to extend back to wards the ground but there is not enough space and either collision detection fails and the character falls into the geometry or the collider starts a collision fight with the box and keeps bumping up and down, keeping the character in an airborne state.

Please see screenshots to get a better idea...

What would be a good way to work around this problem?

sentences:
Common light map practices My scene consists of individual meshes. At the moment each mesh has its associated light map texture, I was able to implement the light mapping using these many small textures.

1) Of course, I want to create an atlas, but how do you split atlases to pages, I mean do you group the lm's of objects that are close to each other, and load light maps on the fly if scene is expected to be big.

2) the 3d authoring software provides automatic uv coordinates for each mesh in the scene, but  there are empty areas in the texel space, so if I scale the texture polygons the texel density of each face wil not match other meshes, if I create atlas like that there will be varying lm resolution, how do you solve this, just leave it as it is, or ignore resolution ?

Actually these questions also applies to other non tiled maps.

sentences:
Where is the XACT documentation? All the links here are broken:

http://msdn.microsoft.com/en-us/library/bb172314.aspx

sentences:
How do I set an object's speed to arrive in X seconds? I want to move an object to a point in the game world, I have the distance value which is far the player should move. I want to complete the movement in X seconds.

I have tried many equations and formulas to no success.

Speed = Distance/Time

This one doesn't seem to give me the right result. Thing is the game is updated 60 times a second and the movement is affected by delta time.

I'm pretty sure I am not taking the framerate in consideration.

What am I doing wrong?

Edit:

This is how I calculate the speed:

int dst = 500;
int time = 2; // in seconds
float speed = dst / time;

Doing it this way is making the movement instant and the game object is not traveling the distance in 2 seconds.

Every frame each game objects gets updated this way:

p.x += dir.x * speed * deltaTime;
p.y += dir.y * speed * deltaTime;

The dir vector holds the direction of movement which is calculated on mouse click:

Vector2 dir = new Vector2(mouseX, mouseY).subtract(objectX, objectY).normalize();

Delta time calculation:

long time = System.nanoTime();
float deltaTime = (time - lastTime) / 1000000000.0f;
lastTime = time;

Please note: The game object stops upon arrival.

sentences:
How do I convert a horizontal, panoramic skymap texture into a "dome" version of itself? How do I convert the following skymap image:

into a "dome" version like the one below?

I'm looking towards making use of Adobe Photoshop for the task at hand. However, I'm at a loss on what tools I'm going to use and how I will go about it.

So, how do I convert a horizontal, panoramic skymap texture into a "dome" version of itself?

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:
What is actually drawn when glDrawArrays and glDrawElements are called? In my journey out of immediate mode I've come across a snag that I haven't been able to find a decent answer for in any tutorial or API, namely: Which data structures are actually invoked when I make a call to a glDraw* function in OpenGL3.3+?

For example, if I want to draw two 3D models and I've put their vertex data in two different VBO's, does invoking glDrawArrays draw everything set under the current VAO? Or does it only draw the currently bound VBO sampling from the currently bound texture?

I basically understand VAO's and VBO's conceptually but its down to implementation that I'm running into problems, it's a big jump to go from the "stability" of immediate mode to the a-synchronicity of modern OpenGL.

sentences:
help with shooting projectile along a curve path so i been trying to find a way to shoot projectiles along a curve path . and i found this tutorial on youtube which was really good.

i also uploaded the project in case you wanted to check it out. here

but there is problem with this script .if i move the target object somewhere above the starting point the curved path will be diapered and i get couple of errors.in fact when ever the path is about to become a straight line the errors will pop up . here is the screenshot of errors

 and here is a gif file to show when the problem shows up

and finally here is the code responsible for calculating the curve path a lunching projectiles.

 public Transform startPoint;
 public Transform target;
 public int resolution = 30;
 public float curveHight = 25;
 public float gravity = -18;

 public Rigidbody bullet;
 public LineRenderer lineRenderer;
 void Start()
 {

 }

 void Update() {

     DrawPath();

     if (Input.GetKeyDown(KeyCode.Space))
     {
         Launch();
     }

 }

 void Launch()
 {

     Rigidbody clone = Instantiate(bullet, startPoint.position, Quaternion.identity);

     Physics.gravity = Vector3.up * gravity;

     clone.velocity = CalculateLaunchData().initialVelocity;
 }

 LaunchData CalculateLaunchData()
 {
     float displacementY = target.position.y - startPoint.position.y;
     Vector3 displacementXZ = new Vector3(target.position.x - startPoint.position.x, 0, target.position.z - startPoint.position.z);
     float time = Mathf.Sqrt(-2 * curveHight / gravity) + Mathf.Sqrt(2 * (displacementY - curveHight) / gravity);
     Vector3 velocityY = Vector3.up * Mathf.Sqrt(-2 * gravity * curveHight);
     Vector3 velocityXZ = displacementXZ / time;

     return new LaunchData(velocityXZ + velocityY * -Mathf.Sign(gravity), time);
 }

 void DrawPath()
 {
     LaunchData launchData = CalculateLaunchData();
     Vector3 previousDrawPoint = startPoint.position;

     for (int i = 1; i <= resolution; i++)
     {
         float simulationTime = i / (float)resolution * launchData.timeToTarget;
         Vector3 displacement = launchData.initialVelocity * simulationTime + Vector3.up * gravity * simulationTime * simulationTime / 2f;
         Vector3 drawPoint = startPoint.position + displacement;
         Debug.DrawLine(previousDrawPoint, drawPoint, Color.green);

         previousDrawPoint = drawPoint;

         lineRenderer.positionCount = resolution;

         lineRenderer.SetPosition(i - 1, drawPoint);
     }
 }

 struct LaunchData
 {
     public readonly Vector3 initialVelocity;
     public readonly float timeToTarget;

     public LaunchData(Vector3 initialVelocity, float timeToTarget)
     {
         this.initialVelocity = initialVelocity;
         this.timeToTarget = timeToTarget;
     } }}

so,any idea what might be causing the the problem?

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:
Calculating angle a segment forms with a ray I am given a point C and a ray r starting there. I know the coordinates (xc, yc) of the point C and the angle theta the ray r forms with the horizontal, theta in (-pi, pi]. I am also given another point P of which I know the coordinates (xp, yp): how do I calculate the angle alpha that the segment CP forms with the ray r, alpha in (-pi, pi]?

Some examples follow:

I can use the the atan2 function.

sentences:
I need a professional icon for my Android/iPhone game: how should I proceed? I need a great looking icon for my mobile game.

I have a few questions regarding the process of hiring a graphic designer to do it:

Which is (are) the best website to publish the Request For Proposal ?
Is it common practice to ask for a couple of logo/icon drafts so that I can pick the one I prefer ?
When does the client usually pays the designer (at order, final delivery time?)

Any feedback or advice will be appreciated.

sentences:
Gravity independent of game updates per second Edit

Just for clarification, my sprite's 'movement' isn't the problem. If I set my Time variable to 4 seconds, then it will cross the screen in exactly 4 seconds regardless of logic updates rate per second, rendering rate per second or screen resolution.  So I am pretty sure I'm scaling the sprite's movement correctly.  What I'm pretty sure I'm not doing correctly, is scaling acceleration.

Original Question

I'm trying to implement gravity in my 2d platformer and am having a few problems understanding how to keep it consistent when I change my updates per second.

Here's what I have.

My Gameloop overview

Currently, my gameloop renders at the maximum rate allowed by device and the updates are 'clamped' to an upper limit (At the moment, 60 per second). I am working on the assumption that most of the time, my game will have no problem hitting this, even if the actual rendering dips. Thus I am doing all of my calculations based Delta Time derived from this fixed 'ticksPerSecond' value.

I don't know for sure that this will remain at 60, I may decide at some point during the development to lower this upper limit.

My Gravity - variable declaration and initial values

At the moment, I have:

float spriteYTime=7f;                //This is the (initial) amount in seconds that this sprite will take to move from the top of the screen to the bottom.
float fallAccel=.5;                  //This is the value that will subtracted from he sprite's fall speed (To make it fall ever faster)
float terminalVelocity=1.5f;         //Cap speed at this rate (1.5 seconds)

my sprite's position is worked out on dt as follows:

//Delta time
float ticksPerSecond = 60;
float dt = 1f/ticksPerSecond;
//Velocity
spriteYVel = 1/spriteYTime;
//Update position
spriteYReal = spriteYReal + (spriteYVel * dt);
//Convert to screen coordinates (will be drawn at this Y coordinate)
spriteyScreen=(int) (furmanYReal*height);

My Gravity - code

    //If my sprite's state is 'f' (meaning falling) then apply gravity
    if(sprite.getState('f')==true){
    //Calculate new position
    spriteYReal = spriteYReal + (spriteYVel * dt);
    //Convert to screen coordinates
    sprite.yScreen=(int) (spriteYReal*r.height);
    //Reduce time by fallAccel amount & update velocity value based on new time value (So sprite falls slightly faster this frame compared to the last
    spriteYTime-=fallAccel;
    spriteYVel = 1/spriteYTime;
    //Check that speed isn't faster than terminal velocity
         if (spriteYTime<spriteVelocity)
            spriteYTime=spriteVelocity;
    }

The problem

Now, this does work, but if I change my ticksPerSecond value, it goes wrong (it falls at different rates).

I know that 'Earth Normal' gravity is approximately 9.8 meters per second per second, but this is measured 'per second' whereas I (think) I need to work with 'per frame'. This is where I'm getting confused.

So, take this example:

If set my initial Time value to 4 seconds, then if it remained constant at this speed, it would take 4 seconds to reach the bottom, if I changed my ticksPerSecond, because the time value is worked out using delta, it would still take 4 seconds but if I apply 'fallAccel" to the Time value (i.e. subract it), it goes wrong when I change the ticksPerSecond value - why?

How can I get this to fall at the same rate regardless of the value of 'ticksPerSecond' - any help in understanding this would be appreciated.

sentences:
Move object to mouse direction without raycast? I have script moving object to mouse postion using raycast. But what I need now is use the mouse movement to move my object.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HoverPanel : MonoBehaviour
{

public GameObject ground;
private Rigidbody rg;
public float moveForce, speed = 2;
public Vector3 Mouse_pos;

void Start()
{
    rg = gameObject.GetComponent<Rigidbody>();
}

void Update()
{

    rg.AddForce(Input.GetAxis("Vertical") * moveForce * ground.transform.forward);

    if (Input.GetAxis("Mouse X") < 0)
    {
        //Code for action on mouse moving left
        print("Mouse moved left z");
    }
    if (Input.GetAxis("Mouse X") > 0)
    {
        //Code for action on mouse moving right
        print("Mouse moved right z");
    }
    if (Input.GetAxis("Mouse Y") < 0)
    {
        //Code for action on mouse moving left
        print("Mouse moved back x ");
    }
    if (Input.GetAxis("Mouse Y") > 0)
    {
        //Code for action on mouse moving right
        print("Mouse moved forward x");
    }

}

void FixedUpdate()
{

  /// No need to use this
  /*
    RaycastHit hitGround;
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    if (Physics.Raycast(ray, out hitGround, 500))
    {
        Mouse_pos = new Vector3(hitGround.point.x, transform.position.y, hitGround.point.z);
        transform.localPosition = Vector3.Lerp(transform.localPosition, Mouse_pos, speed * Time.deltaTime);
    }
  */
}

}

sentences:
List to hold copies of a prefab for later deletion I'm working on a game in which obstacles are Instantiated randomly 5 to 20 units ahead of the player.

When they are instantiated, I want to add them to a list so that when there are too many obstacles loaded in the game, it will remove them from the list and then delete them from the game.

I'm having trouble adding them to the list, because using obstacleList.Add(Obstacles.name); doesn't work.

Here's my code:

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

public class Generate : MonoBehaviour{

    //player position
    public Transform Player;

    // The prefab for an obstacle
    public GameObject Obstacle;

    // Holds float distance from 0 for each obstacle that is instantiated
    private float nextObstacle = 30;

    // is supposed to hold the names of all active instances of the obstacle prefab
    List<string> obstacleList = new List<string>(10);

    void FixedUpdate()
    {
        //Checks to see if the player is colser than 30 units to the most recently spawned obstacle
        if (nextObstacle - Player.position.x < 30)
        {
            //Generates a new obstacle
            GenerateObstacle();
        }
    }

    void GenerateObstacle()
    {
        // Randomly assignes a number for horizontal and vertical Transform
        int randH = Random.Range(5, 20);
        int randV = Random.Range(1, 3);

        //Instantiates an obstacle using those random values
        Instantiate(Obstacle, new Vector3(nextObstacle + randH, randV, 0), Quaternion.identity);

        //Makes that obstacle the new distance so a new obstacle can be spawned
        nextObstacle += randH;

        // Is supposed to add the name of the obstacle that was Instantiated to a list
        obstacleList.Add(Obstacle.name);

        //checks when list has more than 10 items in it
        if (obstacleList.Count > 10)
        {
            DeleteObstacles();
            // Removes the first item from the list
            obstacleList.RemoveAt(0);
        }
    }
    void DeleteObstacles()
    {
        // Supposed to destroy the copied prefab
        Destroy(Obstacle);
    }
}

sentences:
How do I efficiently implement Fog of War in a Real-time Strategy game? How is fog of war implemented in RTS games such as StarCraft II or Age of Empires? I'm making an RTS, and plan for every unit on the field to have circular vision up to a certain radius.

My first thought was having a mask that is black for every point except for points close to units, where it is transparent. The masking operation itself is fast in most graphics APIs (e.g. just call mix in a shader). The hard part is figuring out what mask to use and how to update it: updating it when any unit moves is very processor-heavy.

Is there any simpler way to manage this type of fog of war?

sentences:
Initializing a blank texture in OpenGL without artifacts I'm generating a texture atlas in OpenGL, where I want to create a blank texture and copy my sprites to it.

The texture is generated like this:

glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
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_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
  GL_CLAMP_TO_EDGE);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
  GL_UNSIGNED_BYTE, NULL);

While the sprites are copied like this:

GLenum format;
if (sprite.hasAlpha)
{
    format = GL_RGBA;
}
else
{
    format = GL_RGB;
}

glTexSubImage2D(
    GL_TEXTURE_2D, 0,
    sprite.x, sprite.y,
    sprite.width, sprite.height,
    format, GL_UNSIGNED_BYTE,
    sprite.data);

The issue is I keep getting artifacts in the texture not covered by a sprite:

Here I'm supposed to only have two slugs, one sword in the stone, one light grey tile, and one dark grey tile.

I tried creating a width * height * sizeof(GLuint) GLuint array filled with zeros and passing it to the glTexImage2D call, but that didn't seem to do anything.

sentences:
Trying to mix and mingle 3d physics with the Unity UI I have recently created a drag drop system where I drag stuff from a UI menu and then drop it to another UI. The child of the draggable UI object is a 3d model. I have attached box collider and rigidbody to this 3d object and moving the Object with rigibody.MovePosition and rigidbody.MoveRotation. The object doesn't respond to physics like if there is a box collider in the way, it just goes through it without showing any physical reactions.
I wanted to know if I can do this mixing of Unity UI which helped me in creating this drag drop and also helped scaling the UI and the 3d physics engine to get my job done.
My Project is basically an interactable toy train system where user will create a track and run the carts on it.

the snake/train follows a spline. and runs on it.
Here is a demo
https://drive.google.com/open?id=1L_ZTtYqfcJXsvjHmcNaK6gfRHRHio8h4

I am also extensively rotating the object and it's facing forward so that could be an issue ????

sentences:
Zoom Camera from C# in Unity I am creating endless running game. I want to zoom camera when player dies to the player. I have tried using camera.FieldOfView, but it does not work. Is there another way to zoom In camera to the object when particular condition becomes true.
Thanks in advance.

sentences:
Unity Facebook "An access token is required to request this resource." I have installed Facebook SDK 7.6 for Unity 5.3. It is fine with login and logout stuff things but I am having a problem when it comes to use FB.API. I want to be able to fetch players' profile pictures and names for my multiplayer game project. Each client has other's facebook profile id but I cannot use those IDs on Graph API I guess. What is the way of getting such public information using Facebook SDK.

FB.API("/" + facebookID + "?fields=name", HttpMethod.GET, OnNameReceived);

sentences:
Emission for Mobile Shaders? I need to use Emission texture to my model, but I can't find any emission parameters in mobile shaders.

I searched this on google, but there's nothing helpful to me.

How do I add emission for mobile shaders, without writing own shader code?
(I'm keep studying shader but still not good at)

sentences:
Fragment shader for lighting in isometric perspective What I'm trying to do is to achieve basic lighting in 2D from an isometric perspective.

Here I have 2 textures that are used as tiles for the ground:

Color:

Normal map:

I have a fragment shader that was adjusted a bit to my needs, but mostly made from this tutorial: https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson6

Here is my fragment shader:

uniform sampler2D texture;
uniform sampler2D normal_texture;

//values used for shading algorithm...
uniform vec2 Resolution;      //resolution of screen
uniform vec4 AmbientColor;    //ambient RGBA -- alpha is intensity

uniform vec3 LightPos[3];        //light position, normalized
uniform vec4 LightColor[3];      //light RGBA -- alpha is intensity
uniform vec3 Falloff[3];         //attenuation coefficients

void main()
{
    vec4 DiffuseColor = texture2D(texture, gl_TexCoord[0].xy);

    vec3 NormalMap = texture2D(normal_texture, gl_TexCoord[0].xy);

    vec3 Sum = vec3(0.0);
    for (int i = 0; i < 3; i++) {
        //The delta position of light
        vec3 LightDir = vec3(LightPos[i].xy - (gl_FragCoord.xy / Resolution.xy), LightPos[i].z);

        //Correct for aspect ratio
        LightDir.x *= Resolution.x / Resolution.y;

        //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[i].rgb * LightColor[i].a) * max(dot(N, L), 0.0);

        //pre-multiply ambient color with intensity
        vec3 Ambient = AmbientColor.rgb * AmbientColor.a;

        //calculate attenuation
        float Attenuation = 1.0 / (Falloff[i].x + (Falloff[i].y*D) + (Falloff[i].z*D*D));

        //the calculation which brings it all together
        vec3 Intensity = Ambient + Diffuse * Attenuation;
        vec3 FinalColor = DiffuseColor.rgb * Intensity;

        Sum += FinalColor;
    }

    gl_FragColor = gl_Color * vec4(Sum, DiffuseColor.a);
}

This shader WORKS with traditional 2D perspective. That's because in traditional perspective the ground tiles normal map would have a color scheme closer to something like this, just wouldn't be tilted to fit an isometric perspective of course.

The issue: How do I go about adjusting the math in my fragment shader to fit an isometric perspective and work with the "greenish" ground normal maps.

Here's what I'm currently getting with this shader. Light should be equally going in all directions, but it's as if it's going down a slope.

sentences: How player(sprite) in the phaser will opposite or reverse while going left and right? I am developing a game where my player has to look to see forward when I am pressing right arrow key. But how can I make it look reverse after pressing left arrow? I can create a sprite of reverse look but how can load that while pressing left and at the same time forward player should be destroyed?

sentences:
OpenGL, fetching the names of all uniform blocks in your program I want to auto-bind uniform blocks with certain named values to certain binding points when I compile a shader.  For example, I have some basic, default fixed binding points that are always used for certain things like:

0 Camera
1 Model
2 Material
3 Lights

At the moment I'm binding manually by finding the index of a named block with glGetUniformBlockIndex, and then binding it with glUniformBlockBinding.  What I'd like to do is fetch the set of all block names in my shader program.  When I iterate with glGetActiveUniformsiv, I get a list of all uniforms, which excludes block names.

Is there any way to do this without testing and failing each of my above names to see if it's an active block with glGetUniformBlockIndex?  There's no glGetActiveUniformBlocksiv, is there...

sentences:
How to create walls and rooms with Pixi I'm a JS dev but pretty new to Pixi and 2D developemnt so please bear with me as I explain this.

I want to write a simulator for short path finding (for evacuation purposes). I decided to use Pixi.js for this since it seems capable of doing everything I need to do. I followed this tutorial to try to learn how Pixi works and if its right for this.

The tutorial didn't seem to answer many questions I have and I still have some confusion. Before I dive into writing the code, I want to know how wall detection in Pixi acheived.

Take the below map for example:
It is a 800 x 800 png file (where everything but the blue is transparent[no grid lines]) that i can load into Pixi as a Sprite. I created it in Tiled editor. So it can be exported as a tilemap, JSON, CSV etc. When I export it as JSON, here is the file contents: https://pastebin.com/zGh1XmR7

The blue boxes represent walls.
I want to load in other various sprite objects so that it will look like this:

The people in the simulations cannot cross the blue walls and they cannot cross the pink circles (they represent danger zones). I intend to use easystar.js to find the shortest path to exits for the people sprites in the map.

So my question is this, how does Pixi recognise the blue walls? Is it something I have to do when creating the tileset png? Like something defined in the JSON file for the tileset atlas? Maybe SVG? Or is there a pixi function to do this?
Is this the best approach to doing this and is Pixi even the best way to do this?

I'm looking for a tried and tested solution or a pointer in the right direction.

sentences: Is there any notification when my data uploaded to VRAM is erased? When my data (vertices, textures, et cetera) is purged from VRAM, how I can know that?

sentences:
How can I switch between scenarios in a text game? I am making a text-based adventure game. How should I go about changing to another scene if the player wants to e.g. go to the house or walk down the road?

I am using Objective C, but C will work also. Here is my code so far:

printf("Welcome to Kingdom Quest! This is a text game.\nYou will be shown what is going on ");
printf("and it is up to you to decide what to do. Use words like get, go and pick up.\nDo not use any upper case letters.");

printf("\n\nYou are in a feild and it is almost nighttime. You are facing north. The only thing you have is an empty ruksak.");
printf("\nWhere do you want to go");
printf("\n>");

while (true) {

char string[256];
fgets(string, 255, stdin);

if (strcmp(string, "go north\n") == 0 || (strcmp(string, "go n\n") == 0))
{
    printf("There is a rusty old sword on the ground.");
    printf("\n>");
}
else if (strcmp(string, "get sword\n") == 0 || (strcmp(string, "pick up sword\n") == 0))
{
    printf("Sword taken.");
    printf("\n>");
}
else if (strcmp(string, "go south\n") == 0 || (strcmp(string, "go s\n") == 0))
{
    printf("Nothing is this way.");
    printf("\n>");
}
else if (strcmp(string, "go east\n") == 0 || (strcmp(string, "go e\n") == 0))
{
    printf("There is a dirt road here.");
    printf("\n>");
}
else if (strcmp(string, "go west\n") == 0 ||  (strcmp(string, "go w\n") == 0))
{
    printf("There is a small mountain up ahead, with a house on top of it.");
    printf("\n>");

}
else
{
    printf("What?");
    printf("\n>");
}

sentences:
HLSL Circle all white I have been trying to get my shader code (HLSL) to draw a simple circle but after a day and a half I am getting nowhere.  It seems people are using $$x^2 + y^2 = r^2$$ and remap texcoords but I only get a white quad.

    struct VertexShaderStruct
{
    float4 Position : POSITION0;
    float2 Tex0 : TEXCOORD0;
};

VertexShaderStruct VertexShaderFunction(VertexShaderStruct input)
{
    VertexShaderStruct output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);
    output.Tex0 = input.Tex0;

    return output;
}

float4 PixelShaderFunction(VertexShaderStruct input) : COLOR0
{
    float dx = 2 * input.Tex0.x - 1;
    float dy = 2 * input.Tex0.y - 1;
    float hyp = (dx * dx + dy * dy);

    return (hyp == 1)? circleColor : otherColor;
}

I define circleColor as blue and otherColor as white, so it seems hyp==1 always fails.

sentences:
Handling movement in an Entity Component System I'm working on a 2d RPG game in C# using an Entity-Component-System architecture, and I'm currently working on movement. Right now, I'm wondering how to organise the code so it looks a bit more.. pretty, or dignified, than it is. Currently, I have four components:

VelocityComponent - Contains the speed (velocity) of an Entity. The behaviour currently is that if an Entity does not contain a VelocityComponent, then we continue onto the next Entity, because we cannot move if we haven't a velocity.

TransformComponent - Contains the Width, Height, X and Y fields for the Entity. Basically, the position. Similar to VelocityComponent, if an Entity does not have a TransformComponent, then the GPSSystem just continues the next iteration, because we cannot move anywhere if we don't have a position.

MovementComponent - Contains a pair of co-ordinates for use as a destination position, and a boolean indicating if the Entity is currently moving.

MoveFromKeyboardComponent - Signals whether or not a key is pressed so that the Entity that this Component is attached to should move or not.

The update loop currently goes that the GPSSystem collects a list of all entities (by accessing the EntityManager. The EntityManager simply contains a key-value pairing of Guid to Entity of all active entities. All systems have access to it), then iterates over the whole lot.. It'd be better if I just posted the code;

    /// <summary>
    /// Update the GPS System.
    /// </summary>
    /// <param name="gameTime"></param>
    public override void Update(GameTime gameTime)
    {
        // Handle the movement.
        foreach (Entity entity in entityManager.GetEntities())
        {
            VelocityComponent velocity = (VelocityComponent)entity.GetComponent("Velocity");
            MovementComponent movement = (MovementComponent)entity.GetComponent("Movement");
            TransformComponent transform = (TransformComponent)entity.GetComponent("Transform");
            MovementFromKeyboardComponent movementFromKeyboard =
                (MovementFromKeyboardComponent)entity.GetComponent("MovementFromKeyboard");

            // can't do any movement manipulation without a transform (position) component.
            if (transform == null || velocity == null)
                continue;
        }

        base.Update(gameTime);
    }

However, I am unsure of how to proceed after this point. I just don't know how to manage the movement. I am aiming to have a movement style similar to Pokémon, where all Entities move one square (16 x 16) at a time and have smooth movement across those tiles, however the player can hold down a button and keep moving square after square, and when he releases that key, he stops moving (and snaps to the nearest tile if he is in the middle of two).

So, on to the question:
Am I going about this correctly? Have I got too many (or too few) components for movement? And lastly, how would I manage the fact that an Entity may have a MovementComponent and a MoveFromKeyboardComponent? I'm just confused I suppose.
I am not looking for the code for that, I am just wondering whether I am going about this correctly? This is my first whack at an entity component system, you see.

Best regards.

EDIT 1:
I should add I have now changed the structure of the System class, such that it now has a ComponentAdded and ComponentRemoved method; that is, we no longer iterate over every Entity in existence every Update(), instead we store the entities that have components we want to listen to in a data structure in the class. My question remains the same, though.

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:
PointSprite in DirectX9 I was trying to implement a particle system using PointSprites. Draw calls return D3D_OK but I don't see any particle on the screen. I'm not using Vertex Buffer for the particles, but I use two vectors of vertices and I call the DrawPrimitiveUP function. This is my code:

            CreatePntVertices();

            pD3DD -> SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
            pD3DD -> SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
            pD3DD -> SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);

            pD3DD -> SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
            pD3DD -> SetRenderState(D3DRS_ZENABLE, FALSE);

            pD3DD -> SetRenderState(D3DRS_LIGHTING, FALSE);

            pD3DD -> SetFVF(FVF_PNTVERTEX);
            pD3DD -> SetTexture(0, pTex[TEX_POINT]);

            pD3DD -> SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
            pD3DD -> SetRenderState(D3DRS_POINTSCALEENABLE, TRUE);

            pD3DD -> SetRenderState(D3DRS_POINTSCALE_A, 0.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSCALE_B, 0.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSCALE_C, 1.0f);

            pD3DD -> SetRenderState(D3DRS_POINTSIZE, 20.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSIZE_MIN, 3.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSIZE_MAX, 50.0f);

            D3DXMatrixIdentity(&mWorld);
            pD3DD -> SetTransform(D3DTS_WORLD, &mWorld);

            pD3DD -> DrawPrimitiveUP(D3DPT_POINTLIST, pntPlanets.size(), (PVOID)pntPlanets.data(), sizeof(PNTVERTEX));

            pD3DD -> SetRenderState(D3DRS_POINTSIZE, 40.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSIZE_MIN, 9.0f);
            pD3DD -> SetRenderState(D3DRS_POINTSIZE_MAX, 70.0f);

            pD3DD -> DrawPrimitiveUP(D3DPT_POINTLIST, pntStars.size(), (PVOID)pntStars.data(), sizeof(PNTVERTEX));

            pD3DD -> SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);

            pD3DD -> SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
            pD3DD -> SetRenderState(D3DRS_POINTSPRITEENABLE, FALSE);
            pD3DD -> SetRenderState(D3DRS_POINTSCALEENABLE, FALSE);

CreatePntVertices() is a function that set the position of objects and their color into two vectors of PNTVERTEX (pntStars and pntPlanets). pTex is an array of textures. mWorld is a D3DXMATRIX. pD3DD is the Device. FVF_PNTVERTEX is set as (D3DFVF_XYZ | D3DFVF_DIFFUSE). I really don't know why it doesn't work, I tried everything to make it work. Maybe, should I use a dynamic vertex buffer instead?

sentences: Unity3d : Access the OnClick parameters of Button in a script I have a button and I have attached another script "PlaySound" for this button, which plays audio on button click. As soon as the audio gets completed, I want to stop the animation which I am triggering here in OnClick of Button. How do I access the Ellen gameObject and 0 parameter which I set in the Inspector window (check the picture) in the PlaySound script

sentences:
Car movement in arcade racing game I am finishing a very basic 2D racing game with top-down perspective. I can't get the appropriate formulas to make the movement of the cars fun and addictive... Do you have tips on how to achieve that arcade feeling a lot of games have? Do you know of any guide/tutorial on this topic?

Right now, these are the formulas I am using:

// (speed changes linearly according to the user input)
direction += turnAmount.Value;
Vector3 pos = Position + new Vector3(speed.Value * (float)Math.Cos(direction), 0, -speed.Value * (float)Math.Sin(direction));

I have tested other, more complex options but this is the best I have got so far...

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:
How can I more efficiently paint grass onto a large terrain object in Unity? I'm trying to paint a grass onto a large terrain and I want it to cover the entire terrain. Since the brush size can't go past 100 it would seem that I'm stuck painting the entire thing with a small brush relative to the terrain size.

How can I more efficiently paint grass onto a large terrain object?

sentences:
If I want to become a professional game developer, is learning Win32 API a must? If I want to become a game developer, is learning Win32 API a must?

Does X-BOX or PS based game developers need to know Win32 API?

Is it possible for a professional game developer to develop games by only scripting game engines and not using Win32 API?

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:
C++ game-programming; What would be the "next step"? I'm reading C++ Primer Plus 5th Edition. I'm over at Chapter 8 exercises, which is more than half of the book to go but I was wondering what would be the "next step" after I'm through with the book?

I want to use SDL/OpenGL and whatever cross-platform open source api's and libs there are available for other components of game development.

sentences:
Quaternion.LookRotation with Joystick I am having an issue i cannot seem to figure out within my code. What this code does at the moment is that it rotates the 3D Model around the z axis but i need it to rotate around the y axis. Any help would be greatly appreciated.

void Update ()
    {
        Vector3 moveVector = (Vector3.up * joystick.Horizontal + Vector3.left * joystick.Vertical);
        if (joystick.Horizontal != 0 || joystick.Vertical != 0)
        {
            transform.rotation = Quaternion.LookRotation(Vector3.forward, moveVector);
        }

    }

sentences:
load textures using assimp I've got .obj model with .mtl materials.I load like this: When I get aiTextureType_DIFFUSE I create new texture object and then call glGenTextures, glBindTexture and etc.

for (unsigned int i = 0 ; i < pScene->mNumMaterials ; i++) {
    const aiMaterial* pMaterial = pScene->mMaterials[i];

    m_Textures[i] = NULL;
    if (pMaterial->GetTextureCount(aiTextureType_DIFFUSE) > 0) {
        aiString Path;

        if (pMaterial->GetTexture(aiTextureType_DIFFUSE, 0, &Path, NULL, NULL, NULL, NULL, NULL) == AI_SUCCESS) {
            m_Textures[i] = new Texture();
            if (!LoadTGA(m_Textures[i], const_cast<char*>(FullPath.c_str())))
            {
               ....
            }
            else {
        glGenTextures(1, &m_Textures[i]->texID);
        glBindTexture(GL_TEXTURE_2D, m_Textures[i]->texID);
        ....

How to load texture with diffuse, specular, ambient, shininess properties when they are all together in material file?

sentences:
What does the number in TextMesh.lineSpacing refer to? I have a TextMesh with some text, and mutliple lines.

The 4 examples have these settings:

lineSpacing = 220, characterSize = 10
lineSpacing = 220, characterSize = 25
lineSpacing = 220, characterSize = 30
lineSpacing = 110, characterSize = 25

I don't understand what the lineSpacing number signifies. It's not pixels. As the relative spacing between lines stays the same with different character sizes, it doesn't seem to be proportional to characterSize either.

sentences:
How can one implement a 3D Grid-based Line of Sight algorithm? I'm creating a grid based Tactical RPG game in XNA.

Image below kinda explains the idea. But if you've played Dwarf Fortress before, I'm basically trying to create that 3D line of sight and you can ignore my explanation.

(Also I don't care about how efficient the algorithm is at this time.)

Currently I am drawing a Bresenham line to each square within a radius, and each square I visit I check in the direction I am headed if I run into any walls.

The code below is my check for if a position is visible. sx, sy, sz is the change in the grid. For instance, if the line is traveling north east, sx = 1, sy = -1, sz = 0. if I'm headed straight up it would be sx=0, sy = 0, sz = 1; etc.

    private bool IsVisible(APoint Cur, int sx, int sy, int sz)
    {
        bool Visible = true;
        if (ValidCoordinates(Cur))
        {
            int newsx = -1;
            int newsy = -1;
            int newsz = -1;
            switch (sx)
            {
                case -1:
                    newsx = 3; //west
                    break;
                case 0:
                    newsx = -1;
                    break;
                case 1:
                    newsx = 1; //east
                    break;
            }

            switch (sy)
            {
                case -1:
                    newsy = 0;// north
                    break;
                case 0:
                    newsy = -1;
                    break;
                case 1:
                    newsy = 2; //south
                    break;
            }

            switch (sz)
            {
                case -1:
                    newsz = 4; // down
                    break;
                case 0:
                    newsz = -1;
                    break;
                case 1:
                    newsz = 5; // up
                    break;
            }
            if (ValidCoordinates(Cur.X + sx, Cur.Y + sy, Cur.Z + sz))
            {
                if (newsx != -1 && newsy == -1 && newsz == -1) // X only.
                {
                    if (TileArray[Cur.X + sx, Cur.Y + sy, Cur.Z + sz].AllowSight(newsx))
                        Visible = true;
                    else
                        Visible = false;
                }

                if (newsx == -1 && newsy != -1 && newsz == -1) // Y only.
                {
                    if (TileArray[Cur.X + sx, Cur.Y + sy, Cur.Z + sz].AllowSight(newsy))
                        Visible = true;
                    else
                        Visible = false;
                }

                if (newsx != -1 && newsy != -1 && newsz == -1) // X and Y only
                {
                    if (Visible && TileArray[Cur.X + sx, Cur.Y + sy, Cur.Z + sz].AllowSight(newsx))
                        Visible = true;
                    else
                        Visible = false;

                    if (Visible && TileArray[Cur.X + sx, Cur.Y + sy, Cur.Z + sz].AllowSight(newsy))
                        Visible = true;
                    else
                        Visible = false;
                }

            }
            return Visible;
        }
        return false;
    }

The Allow sight function is here:

        public bool AllowSight(int i)
    {
        if (i == -1)
            return true;

        if (i >= 0 && i <= 3)
        {
            if (TileCreateCliff && HDifferenceUp > 0)
            {
                return false;
            }
        }

        if (i == 4)
        {
            if (TileVoid)
                return true;
            else
                return false;
        }
        if (i == 5)
        {
            if (TileVoid)
                return true;
            else
                return false;
        }
        return true;
    }

This works fine when my character is on the base level, but looking up at higher elevations, or looking down just causes everything to break.

How should I implement this?

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:
Game loop with fixed timestep gives strange result So I've read the famous article at http://www.koonsolo.com/news/dewitters-gameloop/comment-page-2/#comments which describes different methods of implementing a game loop. I've tried to implement the final method that is described in the article in Javascript (ignoring interpolation for the time being):

var Timer = {
        pastTime : 0,
        currentTime : 0,
        started : false,
        //starts the timer
        start: function(){
            if(!this.started){
                this.started = true;
                this.pastTime = new Date().getTime();
            }
        },
        //gets the time in MILLSECONDS
        getTime: function(){
            return new Date().getTime() - this.pastTime;
        },
        //stops the timer but does not reset it (i.e. getTime() can still be
          called to get the time between start() and end())
        end: function(){
            if(this.started){
                this.currentTime = new Date().getTime();
                this.started = false;
                return this.currentTime - this.pastTime;
            }
        },
        //resets the timer
        reset: function(){
            this.pastTime = 0;
            this.currentTime = 0;
            this.started = false;
}

var maxFrameSkip = 5;
var nextTick = new Date().getTime();
var TICKS_PER_SECOND = 25;
var tickTimeMillis = 1000 / TICKS_PER_SECOND;

var ticksPerSecondReal = 0;
var ticksCounter = 0;

var timer = Object.create(Timer);

var loops = 0;

 function gameLoop(){
    loops = 0;

    timer.start();

    while(new Date().getTime() > nextTick && loops < maxFrameSkip){
        update();
        ticksCounter++;
        nextTick += tickTimeMillis;
        loops++;
    }

    draw();

    if(timer.getTime() >= 1000){
        ticksPerSecondReal = ticksCounter;
        ticksCounter = 0;
        timer.reset();
    }

    console.log(ticksPerSecondReal);

    window.requestAnimationFrame(gameLoop);
}

 gameLoop();

So the problem that I'm having is that the console.log(ticksPerSecondReal) should always be giving me 25 because that's the constant ticks per second that I want and have set up. What I end up getting is an alternating number that is 25 and 26. So periodically (~1 second) it will be 25 and then 26 and then 25 and so on. And sometimes (much less frequently) it will even give a result of 27. It keeps switching back and forth when it should be constant at 25. What is the issue here?

sentences:
What constraint (if any) limits crowd animation variety? I have recently noticed something in a large number of sports games relating to the animation of the crowd.

Scenario

Player holes the golf ball and the crowd all clap their hands.  Whilst the faces and attire of the crowd members are different the animation is exactly the same.  That is, the arm and hand movement of each member is identical.

Similar scenarios exist in other sports games; in football games the crowd often stand up and sit down together as well as doing things like "fist pump", wave, etc. in a perfectly synchronised manner.

Question

Why is there no (or very little) variation in the crowd animation?  Is this a memory constraint?  If so, what is the general architecure/design of this functionality and why is it so constrained?  Is it along the lines of "It is more efficient to animate a collection of objects than multiple individuals"?

Or do game developers simply not see crowd variation as an important enough requirement?

As technology and game "realism" advances so quickly, this is something that still strikes me as "wooden" and unrealistic.

sentences:
How to store variable inside an array unity? I was wondering how I can store these anims inside an array, because, the start function will be fired one time. I would like to be able to call these Animators more then one time.

    public Animator anim0;
    public Animator anim25;
    public Animator anim50;
    public Animator anim75;
    public Animator anim100;

void Start () {

        anim0 = GameObject.FindGameObjectWithTag("Campfire0").GetComponent<Animator>();
        anim25 = GameObject.FindGameObjectWithTag("Campfire25").GetComponent<Animator>();
        anim50 = GameObject.FindGameObjectWithTag("Campfire50").GetComponent<Animator>();
        anim75 = GameObject.FindGameObjectWithTag("Campfire75").GetComponent<Animator>();
        anim100 = GameObject.FindGameObjectWithTag("Campfire100").GetComponent<Animator>();

    }

sentences:
In Maya- how can I merge mulitple primitive cubes together into one parent item? (And is this actually needed for using in unity etc)? Im trying to make some 3d models in Maya and then put them into Unity as characters which I can give rigidbody to etc. (Im new to Unity and 3d modelling software, but i have a small amount of programming experience in LWJGL,  LibGDX  and XNA).

I'm focusing on making some assets out of blocks. To give a kind of 2.5D feel to a platform game.

I have made the following image but as you'll see its just a bunch of cubes. I think i need this to be turned into a single piece (but im not sure if 100% necessary or not). Of course, I will be adding animation to this by way of moving the blocks about for different frames of animation.

As I said, im very new to this so I may be doing things completely wrong.

Heres the image:

What i need is to be able to refer to this as one piece with its own transform position, scale etc that I can adjust. Currently if I select it all and try to change the scale it only changes on of the cubes scale even when all are selected.

Also once I've created this and want to add it to my game in unity, will each cube get a rigidbody when i add it or will the whole item get it as standard?

Thanks for any help

sentences:
Has anyone used PhoneGap to make 2D games for the iPhone? I love simple casual games. I've been riding the bus a lot recently and so simple, no-brainer games are great fun and well worth the small price I pay on the App Store.

It got me thinking... I know HTML5, CSS3 and JS very well. I looked into PhoneGap and it looks like it's something I could use for making apps for the iPhone.

The games I've been fleshing out myself are very simple 2D affairs. Fun, simple and high quality. That's what I'm after with my games... I also make music and my friend is an digital illustrator so together we have all the media covered.

Does any one make 2D games for the iPhone using PhoneGap?

I'm presuming that because I want to code in JS and use the HTML5 Canvas tag, that PhoneGap does nothing more than provide me a wrapper with a WebKit view?

I know it won't be as fast as using native... But is using PhoneGap a viable option?

sentences:
Android - Google play - enable download app for devices that supports opengl extension I am using OpenGL ES 2 in my game. However, for simplicity i have used some extensions like VAO. Is there a way, how to disable dowloading of my app for devices, that do not support this (and other) extensions?

I can check it in code, but that is a little late, when user already bought my game and it wont work.

sentences:
Can SFML load anything other than RGBA8888? (RGBA4444, RGB565, etc.) I can't see this mentioned in the documentation. Am I missing something obvious? Or does SFML really give you no option, forcing everything to be loaded as RGBA8888?

Searches on Google and the SFML forums have been unproductive.

sentences: How to squash stretch the Bounding box so as to get Good Physics effect I have Surrounded a game Object with a rectangular Box and applied Physics properties to that Box so that load on the computation gets reduced. But i have a problem, whenever in animation if the Game objects body part goes out of the Box then it will not collide, Is there any solutions?

sentences:
How to use continious collision detection in a dynamic AABB tree I am currently writing a game in c++ using openGL, and I am currently using a kinetic sweep and prune algorithm for the broad phase and then using GJK Raycast + GJK & EPA for the narrow phase. However I have realized that kinetic sweep and prune may not be the best choice because there are many objects in the scene that are just static and cause a lot of swapping when an object moves.
So basically I would like to implement a dynamic AABB tree for the broad phase knowing there will be only a few objects requiring continuous collision detection (but these objects are essential). However for these fast moving objects what is the best way to detect a possible collision with other objects in the broad phase? I am thinking about using an AABB that contains the object trajectory from one frame to another, is this a good idea? Or will this a lot of overhead due to many false positives?
Also I haven't read to much about dynamic AABB trees but I think I understand the idea, the idea is for each object that moved check if it's AABB if overlapping with the tree node, if it is do the same check with it's children and do so until we are at the leaves of the tree.
All help is greatly appreciated

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

sentences:
LibGDX keep camera within bounds of TiledMap I have a simple TiledMap which I can render fine. I have a player hopping (with Box2D) around and my camera follows the player around:

cam.position.set(
    player.position().x * Game.PPM + Game.V_WIDTH / 4,
    player.position().y * Game.PPM,
    0
);
cam.update();

However, the camera will move "off" the TiledMap. How could I keep my camera on the TiledMap, so when I near the edges of my map, the camera stops scrolling and the player moves towards the edge of the camera?

sentences:
Design pattern for menu transitions in C# (Unity) I am working on my first project in Unity using C# and I am currently trying to design a menu system that does the following sequence of events when a user clicks a button:

Button does some effect for some milliseconds (for example, flashes)
Menu1 does its closing sequence for some milliseconds (for example, buttons fly off screen)
Menu2 does its opening sequence for some milliseconds (for example, buttons fly on screen)

The exact animations of the UI elements don't matter for the purpose of my question.
So far, the only design pattern I've found to achieve this kind of sequence is by using coroutines. So I ended up with something like the following:
void OnStartButtonClick()
{
    StartCoroutine(_OnStartButtonClick());
}

IEnumerator _OnStartButtonClick()
{
    yield return start_button.GetComponent<ButtonController>().DoEffect();
    StartCoroutine(MenuTransition(main_menu, data_menu));
}

IEnumerator MenuTransition(GameObject menu1, GameObject menu2)
{
    // main menu to data select
    if (menu1 == main_menu && menu2 == data_menu)
    {
        yield return CloseMainMenu();
        yield return OpenDataMenu();
    }
}

public Coroutine OpenMainMenu()
{
    return StartCoroutine(_OpenMainMenu());
}

IEnumerator _OpenMainMenu()
{
    main_menu.SetActive(true);
    // main menu opening sequence here
    yield return null;
}

public Coroutine CloseMainMenu()
{
    return StartCoroutine(_CloseMainMenu());
}

IEnumerator _CloseMainMenu()
{
    // main menu closing sequence here
    main_menu.SetActive(false);
    yield return null;
}

public Coroutine OpenDataMenu()
{
    return StartCoroutine(_OpenDataMenu());
}

IEnumerator _OpenDataMenu()
{
    data_menu.SetActive(true);
    // open data menu sequence
    yield return null;
}

public Coroutine CloseDataMenu()
{
    return StartCoroutine(_CloseDataMenu());
}

IEnumerator _CloseDataMenu()
{
    // data menu closing sequence here
    data_menu.SetActive(false);
    yield return null;
}

And the code on my button likewise utilizes coroutines:
public Coroutine DoEffect()
{
    return StartCoroutine(_DoEffect());
}

IEnumerator _DoEffect()
{
    // imagine some code that does the effect
    yield return new WaitForSeconds(1f);
}

This seems to work well enough and allows me to completely control the effect-->close-->open sequence. But it's getting a bit unwieldy as I build it out for more menus and transitions between them, resulting in a ton of methods with Coroutine return type wrapping IEnumerators (which I've been prefixing with underscore). I can't help but feel like there's a more elegant way to do this, and that I am using coroutines as a crutch ...
So my question is whether there is a more suitable or efficient design pattern that can allow me to achieve the kind of sequencing of events that I want without the proliferation of Coroutines & IEnumerators? Or are Coroutines & IEnumerators exactly the devices to solve this kind of problem?

sentences:
2D player controller moves to the left, but not to the right I wrote a C# script to control a 2D player, but the script is not fully working. When I press the right arrow/d key to move the player is not moving in the right direction, but I have done the same exact thing for left key which works fine.The script shows no errors too.Kindly help me to solve the issue.The code is:

using UnityEngine;

public class PlayerController : MonoBehaviour
{
    [SerializeField] private Rigidbody2D _rb2d;
    [SerializeField] private float _speed;
    [SerializeField] private float _jump;
    private static float _tempspeed;
    private static float _tempjump;
    private bool _isRight;
    private bool _isLeft;
    private bool _isSpace;

    private void Start()
    {
        _isLeft = false;
        _isRight = false;
        _isSpace = false;
        _speed = 5f;
        _jump = 7f;
        _tempjump = _jump;
        _tempspeed = _speed;
    }

    private void Update()
    {
        ReadInput();
    }

    private void FixedUpdate()
    {
        Move();
    }

    private void ReadInput()
    {
        if (UnityEngine.Input.GetKey("d") || UnityEngine.Input.GetKey("right"))
        {
            _isRight = true;
        }else {
            _isRight = false;
        }
        if (UnityEngine.Input.GetKey("a") || UnityEngine.Input.GetKey("left"))
        {
            _isLeft = true;
        }else {
            _isLeft = false;
        }
        if (UnityEngine.Input.GetKey("w") || UnityEngine.Input.GetKey("up"))
        {
            _isSpace = true;
        }else {
            _isSpace = false;
        }
    }

    private void Move()
    {
        Vector2 speedVectorRight=new Vector2(_tempspeed,_rb2d.velocity.y);
        Vector2 speedVectorLeft=new Vector2(-_tempspeed,_rb2d.velocity.y);
        Vector2 jumpVector=new Vector2(_rb2d.velocity.x,_tempjump);

        if (_isRight)
        {
            _rb2d.velocity = speedVectorRight;
        }else {
            speedVectorRight.x=0f;
            _rb2d.velocity = speedVectorRight;
        }
        if (_isLeft)
        {
            _rb2d.velocity = speedVectorLeft;
        }else {
            speedVectorLeft.x=0f;
            _rb2d.velocity = speedVectorLeft;
        }
        if (_isSpace)
        {
            _rb2d.velocity=jumpVector;
        }
    }

When I tried to print debug statements in different parts of if statements, they work fine. The problem in my observation is in :

if (_isRight)
        {
            _rb2d.velocity = speedVectorRight;
        }else {
            speedVectorRight.x=0f;
            _rb2d.velocity = speedVectorRight;
        }

The _rb2.velocity is not accepting speedVectorRight I guess.Thanks in advance!

sentences:
How can I export the opacity of a mesh per keyframe? I'd like to export opacity of mesh materials on a per-keyframe basis from 3DS Max using a script. How can I accomplish this?

(This is basically extension to my previous question.)

sentences:
Object Composition in the Unity Editor I'm trying to learn how to use Unity for my class composition, and I was wondering if you could help me.

I'm trying to create a simple game where the player is trying to pop a bunch of balloons. However, any given balloon can only be popped if all of its conditions are met. Example conditions are:

The player color must match the balloon color
The balloon must be popped in sequence (balloon A must be popped before balloon C)
The balloon is only pop-able during a certain time window

And I'm sure you could think of more.

Balloons can have 0 to many conditions associated with them, but they follow the 80/20 principle where 80% will fall into a specific category (e.g. color-match-only, or color-and-sequence-only).

My Initial Solution

I created a "Balloon" class that contains a list of "ICondition" interfaces. When a collision occurs, the balloon loops through each condition to determine whether the balloon is pop-able or not. I populate this list within a "BalloonFactory" class. For 80% scenarios I can just pass in the name of the balloon type I want. For 20% scenarios I can pass a list of conditions.
This solution works, except for each new combination I need to change the factory code to include the new condition.

What I'd Like to Do

Instead of storing the balloon definitions in code, I'd prefer to create prefabs in Unity and use the editor to assign condition implementations to each balloon. My problem so far is that the Unity editor doesn't seem to like displaying a list of interfaces or abstract classes.

Is there some way to do what I'm trying to do here? Or is there a third option which you would recommend?

sentences:
3dsMax to Mudbox - Import Warning: UV not a complete set I'm exporting my 3dsMax model to Mudbox. The import gives me a warning that the UV set is incomplete.

First, what does this mean?  That I haven't got all the UVs unwrapped?  Web searches have brought nothing.

Also if this is the problem, is there a way to check if all UVs are unwrapped?

I'll post my map if you need it.

sentences:
Prefabs moved to before position when zooming scene I have build some pipes for waterline drawing, like following screencast:
https://youtu.be/WnJb1JwOW78
As you can see, when I zoom in the scene,  Pipes moved to lower position. When i zoom out, Pipes moved to higher position.
Actually I have changed the position and  moved down the pipe position before, the unexpected higher position was the pipe before position.
So i guessing this problem might about cache clean.
So I I try to clear the GI cache, but the problem still exist.
And then I try to build a windows executable file and run game again, problem still.
How to fix it?
I am using  Unity 2018.4

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:
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:
In Scene2D, does Actor.hasActions() no longer exist? Eclipse does not allow me to do

while (actor.hasActions()){}

saying it's undefined for type actor, but the libgdx API still has it as one of an Actor object 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:
How Lots of ComputeBuffers at Once Affect Performance Unity How will lots ComputeBuffer instances affect performance? And why?
I know that I should call ComputeBuffer.Release() on every ComputeBuffer I create, but will it affect performance if I were to have lots of open ComputeBuffers at once? and by "lots" I mean hundreds to thousands.
It of course goes without saying that all of those ComputeBuffers will be released at some point, possibly at the same time.

sentences:
How do I create a sphere by script? I want to add a sphere at runtime via script.

I have the following code which compiles fine. At runtime however, no sphere is added to the scene.

I have attached the debugger to the script, and I have set breakpoints at each line.

After the line

Material nMat = new Material(Shader.Find("Lit"));//I'm using the URP

the debugger "blanks" out, it doesn't hit the next line.

What am I doing wrong?

Thank you!

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("Lit"));//I'm using the URP

        if (nMat == null)
        {
            Debug.LogError("no mat!!\n");
        }
        nMat.color = Color.red;
        nRenderer.material = nMat;

        _Sphere.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f);
        _Sphere.transform.position = new Vector3(0, 0, 0);

    }
}

sentences:
How can I blend meshes together where they intersect? In a lot of my scenes I have things like this:

and this:

All the places I've circled are places where a prefab overlaps with another one or with the terrain.

Is there any way to make those lines softer/more natural and blend together more?

When I can, I try and hide the lines with trees or other items, but that doesn't work in every case.

I wonder if I can solve this with something like the soft particles effect. Soft particles in Unity help blur the line between a particle system and a rendered mesh. This keeps you from having jarring hard cut offs and straight lines in something that's supposed to be amorphous. (That's as far as my understanding goes) Can I use something like this to blend my prefabs together?

sentences:
GLSL shader time uniform freezed? I have a simple fragment shader to simulate "falling water". I'm using Ogre3D and opengles2, this is my code:

#version 130

uniform sampler2D valveTex;
uniform sampler2D noiseTex;
uniform float time;

uniform vec3 sprayColor;

varying vec2 uv;
varying float rand;

    void main()
    {
        gl_FragColor.w = texture2D(valveTex, uv).w;
        float noiseW = texture2D(noiseTex, uv + vec2(rand, -time)).x;
        gl_FragColor.w *= noiseW + noiseW;
        gl_FragColor.xyz = sprayColor;
    }

The shader works well and I see the animation happening, but after some time running the animation stops like if the variable time stopped updating, and the water stream looks still. What can be causing this?

Edit1: variable time is derived from Ogre's time_0_1.

sentences:
Multiplayer client-side physics I'm trying to handle all the physics on the client and correct data on the server.

e.g.

Client_1 wants to move right
Server broadcasts that
Clients simulating Client_1's movement
Client_1 sends it's coordinates to the server (every 100ms)
Server validates coordinates based on client's last position and last update (which is stored on the server)
Server corrects Client_1's coordinates on every client

But when FPS<60 players are moving faster than they should, which causes server to teleport them back.

My question is basically how to check x,y without teleporting players with high latency (or low fps).

Server:

var now = Date.now();
var clientX = ...x position sent by client...
var clientY = ...y position sent by client...
var timeDiff = Math.ceil((now - player.lastPositionUpdate)/5)*5;
var timeDiff = timeDiff > 1000 ? 1000 : timeDiff;
var pixelPer100 = player.speed/10;
var maximumPixelDiff = (pixelPer100/100) * timeDiff;
player.lastPositionUpdate = now;

if (clientX > player.position.x){
    var diff = clientX - player.position.x;
    newX = player.position.x + (diff > maximumPixelDiff ? pixelPer100 : diff);
}
..and more

Client:

update: function(){
    player.body.velocity.x = player.speed;
    tick++;
    if (tick == 6){
        tick = 0;
        sendPositionToServer();
    }
}

I'm using Phaser with Arcade Physics.

sentences:
RTS Unit AI: When to let the unit stop (due to local avoidence) I am developing an RTS-like game, that have units that move and attack.
I implemented path-finding and local-avoidance.

One problem is when multiple units being ordered to the exact same position, they can never reach the position due local-avoidance and collision.

Only this will make the units scratch each other, this will also cause the unit not able to STOP, as the unit might be still far from the target position.
And whether stopped or not is important for battle (unit can only attack when stopped).

I studied how SC2 handles this, it appears that the units will stop after a few seconds of scratching.

PS, I have used group formation to avoid the situation, but it can not be avoided, when the group are ordered to goto some impossible position, and they would cluster at the edge of the valid navmesh.

sentences:
How to draw lines with fountain pen effect in Unity? I'm working on drawing lines in Unity, I've already implemented smooth line drawing with LineRenderer. But I need lines have effect of fountain pen or gel ink pen, just as the picture showed below, I have no idea about this,  may shaders  make the effect ?can anyone help?

Now I can draw common lines with Unity:

Effect needed:

sentences:
Auto-generate optimal direction for Unity Raycast with specifications How can I have a Physics.Raycast auto-generate a direction for itself to try to hit a given target through a restricted window of space?

[Update]

After much work, my problem has slightly morphed into one about mesh colliders: given a (convex) mesh collider, how can I detect all of the points intersecting with the collider? Or, if this can be done easily, can I get one Vector3 per object that is within the mesh collider?

[/Update]

This is kind of a long question, so I'll try to explain it the best I can:

I have 3 GameObjects: a source, a target, and a "window". This window sits between the source and target.
I want the source to make a raycast that points in the direction of the target (not necessarily it's transform.position, just a direction that will make it hit the target) and this raycast must pass through (collide and continue through) the window GameObject
I would like to automatically generate this direction for the raycast to follow such that #2 happens
I would like this algorithm to also recognize if the above is not possible
As an added item, I would like this raycast to pass through (collide and continue through) any objects that may be in it's way between it and the window

Here's an image describing my issue in more detail:

How can I accomplish this?

Thank you for your help in advanced!

sentences:
DirectX Performance Issue: Rendering to texture Brief introduction:
I'm programming a game and, till now, I've runned it on my desktop. This morning I decided to try it on my laptop (a i3-4005u with a gt920m) to see cpu/gpu usage and, with my surprise, it couldn't even reach 60 fps... then I discovered that it didn't use the nvidia gpu but the intel's integrated one. I looked a bit on Google and found the problem: https://stackoverflow.com/questions/10535950/forcing-nvidia-gpu-programmatically-in-optimus-laptops.

The usage of the GPU (the Nvidia one now) was still to high for such the game I'm making (kind of 2D platform). Trying it on my desktop (gtx 780) I discovered that it uses even 50% of its power (MSI Afterburner).

A screenshot:

To generate the light map I use a render-to-texture and here is the problem: rendering the lights uses all the power (profiled with visual studio). The only difference between rendering the lights and the background is the active RenderTargetView and the only different between the default back buffer and the light map RTV is the format so I changed it:

textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; //it was DXGI_FORMAT_R32G32B32A32_FLOAT

After that the gpu usage dropped to 3-4% (and the game looks the same).
Now I'm wondering why things changed. Can you help me?

Still now rendering the lights is the most expensive things and I can't understand why (the shader is simpler than the sprites' one. I can post the code if you want, but is a basic "load data from texture and output")

The first draw call is for lights, then there is the background's one.
I really can't understand what's going on.

P.S
I also found that using a borderless window instead of the fullscreen mode by default adds a 10% of usage on the gpu, while fullscreen mode uses all the cpu power (100% of usage). Can you help me again understanding why?

sentences:
How would I make my player controls respond quicker? I'm working on this game in Unity 2D where the user swipes to make a game object move in the direction that the user swiped in. Currently, when the user swipes it takes about a quarter of a second for the game object to respond and move in the new direction. What should I do to make the controls respond quicker? I know that with Input.GetAxis, I could make it Input.GetAxisRaw to make it more responsive. Right now it's like Input.GetAxis but I'm trying make it like Input.GetAxisRaw. (I can't use Input.GetAxisRaw because this is for a mobile game). Thanks.

private Rigidbody2D rb;
private Vector2 moveVelocity;

in void Update():

if (Mathf.Abs(lp.x - fp.x) > Mathf.Abs(lp.y - fp.y)) {   //If the horizontal movement is greater than the vertical movement...
                    if ((lp.x > fp.x)) {   //Right swipe
                        if(moveVelocity != Vector2.left) {
                            moveVelocity = Vector2.right;
                        }
                    }
                    else {   //Left swipe
                        if(moveVelocity != Vector2.right) {
                            moveVelocity = Vector2.left;
                        }
                    }
                }
                else {   //the vertical movement is greater than the horizontal movement
                    if (lp.y > fp.y) {   //Up swipe
                        if(moveVelocity != Vector2.down) {
                            moveVelocity = Vector2.up;
                        }
                    }
                    else {   //Down swipe
                        if(moveVelocity != Vector2.up) {
                            moveVelocity = Vector2.down;
                        }
                    }
                }

And void FixedUpdate():

void FixedUpdate() {
    rb.MovePosition(rb.position + moveVelocity * speed * Time.deltaTime);
}

sentences:
How can I implement fixed joints in a 2D physics system? I'm developing a simple, 2D physics system to complement an entity/component game object framework. So far, I have implemented some basic, tutorial-level physics. An entity that is affected by physics must have two components:

Transform (translation, rotation, scale; may have parent transform)
Rigidbody (mass, list of forces)

The physics engine currently uses Verlet integration to move entities - that is, velocity is derived from the current and previous positions of an entity, and is not explicitly stated anywhere.

I would now like to start implementing some joints, starting with the basics and perhaps expanding as I grow more familiar with the concepts.

The first joint I attempted to implement was extremely simple - the fixed joint, whereby two entities are 'fixed' together and their transforms may not change relative to each other. My approach was to make one entity an immovable child of the other - that is, to set the transform of A as a local transform relative to B and disable movement of A by passing all accumulated forces of the rigidbody of A to the parent, B. Already this seems hackish and inflexible and has issues with gravity (B ends up with two gravity forces acting on it) - I'm clearly heading in the wrong direction.

I have searched for some literature on the subject but have only found either very basic tutorials that only cover what I've already done, or articles with advanced mathematical formulae that are difficult to follow or relate to simulation in any meaningful way.

This leads to two questions:

How are fixed joints normally implemented?
Are there any good 2D physics simulation tutorials aimed at those without a degree in physics or mathematics?

sentences:
What are valid ranges of space dimensions used in OpenGL? I want to know what the valid ranges of all the spaces in OpenGL are.

Specifically:
Maximum and Minimum Clip space X, Y, and Z (gl_Position)
Maximum and Minimum gl_FragCoord X, Y, and Z
Maximum and Minimum gl_FragDepth value

sentences:
Is it a good idea to use the RDM socket type for multiplayer games? I am currently developing a MOBA/RTS style game with an authoritative networking structure. Of course, the server needs to send a big number of packets every second, answering requests from the clients. The packets are split into commands and states. Commands contain all the actions a unit has performed since the last send-procedure, and states include the position and rotation data about a unit.
Commands are sent over TCP because they need to be in the right order and reliable for synchronized gameplay, individually to every client, states over UDP through a multicast group that consists out of the player clients because I interpolate, and a lost packet will not create any damage then.

Today i came across the RDM socket type, selectable through the C# Socket constructor, and I thought that this maybe is what I really want? My TCP connections currently do not make use of the seamless streaming of bytes as I wrap my data into packets and send them in constant intervalls. is the RDM socket type what I want? Having reliable connection-less packets send over PGM sounds really promising to me.

sentences:
Periodic updates of an object in Unity I'm trying to make a collider appear every 1 second.  But I can't get the code right.  I tried enabling the collider in the Update function and putting a yield to make it update every second or so.  But it's not working (it gives me an error: Update() cannot be a coroutine.)

How would I fix this?  Would I need a timer system to toggle the collider?

var waitTime    : float = 1;
var trigger     : boolean = false;

function Update () {

        if(!trigger){
            collider.enabled = false;
            yield WaitForSeconds(waitTime);
        }
        if(trigger){
            collider.enabled = true;
            yield WaitForSeconds(waitTime);
        }
    }

}

sentences: How to activate GearVR Menu in my own Unity-Apps? So in normal GearVr-Apps, which you can download from the marketplace, you can activate the GearVr Menu to control brightness etc. with a long click on the back button. But this does not work for all of my apps which I made with Unity for the GearVr, is there something special I have to import into my project?

sentences:
How do I avoid obstacles on a predefined path? I want is a character to walk along a path defined as a waypoint sequence. For example, a soldier patrolling around a castle.

However, I want the soldier to avoid (dynamic) obstacles, without deviating from the path too much.

How can this be done?

sentences:
Low Level Audio Engine Sample Rate Conversion First off, there seems to be a sparse number of audio programming tutorials out there so if anyone knows of some good resources I would be very appreciative. Now on to the topic at hand!
I am using WASAPI for the audio engine that I am trying to develop and I am having difficulties reformatting data from a read audio file data into a format that the audio device is prepared to receive. Specifically I am wondering how games generally handle converting the sampling rate of a read audio file into the requested sampling rate of the device. I saw an example where linear interpolation was used but read elsewhere that such a filter introduces too many artifacts, so again I'm wondering what a practical algorithm would be for game design, something good enough that can be achievable in a high work load real time environment.
On a separate note, would it be safe to assume that most games store the majority of its audio assets in an uncompressed audio format to save the CPU the work of uncompressing the data or are there more benefits to be gained from having less data to load from the hard drive.
Thanks in advance for the help.

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:
How can I support a background more complex than a flat color? I'm a beginner at making 2D games. Up until now, I always created my games with a black background, or a fixed color. This is because my sprites always have a black (or a solid color) background, and I have to set the background of the game black so the sprites won't be moving around with a black box surrounding them.

Now I want to be able to set the background of the game to an image or texture.

What do I need to do in order to achieve that? Is it possible to design sprites without a background in the first place? Currently if I need a sprite of a guy standing, I would draw the guy on a black rectangle. Is it possible to set the rectangle to be transparent instead of black?

sentences:
Plot and Story design basics I have made several games but they have all been space invaders or mario style.

Following my last question (thank you for all the great answers) I am trying to write out a plot line and a plan for the events that will take place.

The problem I am having is that my story's tend to resemble things that already exist like films or other games I have played.

The events to feel like a mix of various other games I have played.

So apart form become a more creative person does anyone have any advice. Has anyone written a fairly lengthy story for a game and have pointers or does anyone know any good books on the subject.

Any thoughts would be welcome, story of event ideas to.

FYI the game has a final fantasy style battle system and a pokemon catch/raise system.

sentences:
Issue with interpolation on a burn shader (lerp and smoothstep) I'm trying to create a simple burn shader. See here for more info on the method I'm using. However, I don't get why replacing the smoothstep with a lerp results in completely different results. Am I missing something from my knowledge of maths? As far as I know they should return similar values given the same parameters.

// clips materials, using an image as guidance.
// use clouds or random noise as the slice guide for best results.
Shader "Custom/Dissolving" {
Properties {
  _MainTex ("Texture (RGB)", 2D) = "white" {}
  _BorderTex ("Border Texture (RGBA)", 2D) = "white" {}

  _EdgeColor ("Edge Color", Color) = (1,0,0)
  _EdgeSize ("Edge Size", float) = 0.1

  _SliceGuide ("Slice Guide (RGB)", 2D) = "white" {}
  _SliceAmount ("Slice Amount", Range(0.0, 1)) = 0.2

  [MaterialToggle] UseClipInstruction ("Use Clip Instruction", Float) = 0
}
SubShader {
  Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  //Cull Off
  Blend SrcAlpha OneMinusSrcAlpha

  CGPROGRAM
  //if you're not planning on using shadows, remove "addshadow" for better performance
  #pragma surface surf Lambert alpha addshadow

  struct Input {
      float2 uv_MainTex : TEXCOORD0;
      float2 uv_SliceGuide : TEXCOORD1;
      float _SliceAmount;
  };

  sampler2D _MainTex;
  sampler2D _BorderTex;
  sampler2D _SliceGuide;
  half _SliceAmount;
  half _EdgeSize;
  half3 _EdgeColor;

  void surf (Input IN, inout SurfaceOutput o) {
    o.Alpha=1;

    //Green is a good color for estimating grayscale values
    half fragSliceValue = tex2D(_SliceGuide, IN.uv_SliceGuide).g;

    #ifdef UseClipInstruction
    clip(fragSliceValue - _SliceAmount);
    #else
    //TODO: look for an alternative to this
    if (fragSliceValue - _SliceAmount<0)
        o.Alpha=0;
    #endif

    half rampX = smoothstep(_SliceAmount,_SliceAmount + _EdgeSize, fragSliceValue);
    half3 ramp = tex2D(_BorderTex,half2( rampX,0) ) * _EdgeColor.rgb;
    o.Emission = ramp * (1-rampX);

    o.Albedo = tex2D(_MainTex,IN.uv_MainTex);
  }
  ENDCG
}
Fallback "Diffuse"
}

Left is the result of smoothstep (the provided code), right is what happens when I replace smooth with lerp.

sentences:
Why do my point lights disappear when another nearby light is above 1.85 range? I'm making a game with a dungeon setting in Unity 3D. Many torches line the walls. I'm using a point light over each torch to simulate the flame. However, when two torches are across from each other, and one goes above the 1.85 range, the other disappears completely, giving off no light.

What might be causing this?

sentences:
How to animate a character with props in Blender and then have these props modifiable in Unity3D? I have created a fully rigged and fully animated humanoid model in Blender with rigging based on Unity's Mecanim standards for humanoid models.

Now, I want to create custom animation for it in Blender where it's attacking with a sword. I also want to create a sheathing/unsheathing animation.

Also, once the model is imported into Unity, I want to be able to replace the sword and the sheathe props with another model, but still be able to retain the animation.

What's the best way of doing this?

Do I need to modify the rig to include the sword and sheathe meshes? Will adding new bones break my model's compatibility with Mecanim?
If I'm going to add new bones, then that means I will have to include the mesh data of the sword and sheathe to the model, but if that's the case, then how can I replace the sword and sheathe models in Unity if the sword and sheathe are part of the character model?
If the sword and sheathe aren't going to be part of the character armature, then how can I create their animations in Blender which Unity will use?

Fig. 1. The model and its armature.

sentences:
2D Sprites vs UI Image Scripts in Unity I am doing a 2D casual puzzle where the user can drag and drop some pieces into a board. The pieces are 2 or 3 or 4 tiles. Each tile may have text over the sprite.

Target platform: Mobiles and tablets.

I wonder if the right approach is to use 2D sprites or to use UI images for displaying the board, the tiles and the pieces on it.

On one side, doing all the game based on UI elements seem weird.
On the other side, if I do it based on sprites, how do I attach texts on the sprite?

Which approach should I pick?

sentences:
How to handle dynamic hierarchical entities in ECS Here's the analogy:
I have an organism which is composed of cells which can be further composed of a medley of attachments.

What I have currently is a sort of event chain between child/parents to handle attaching and detaching components (which could affect anything along the chain) which doesn't involve ecs at all, they are functions in the entities.

Now I've used event components already (for mouse events on objects).
If I wanted the system to be pure, would I create an attach component when I attach components etc? Even then how would I get all the necessary recipients to the system that consumes the component? Is it even worth it to handle it this way instead of a chain of functions? Is there a better way?

sentences:
Devkitpro msys errors Whenever I try to install devkitPro, I get these command prompt windows for short periods of time with the following errors:
error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
:: Synchronizing package databases...
 msys                                           206.2 KiB   729K/s 00:00 [#######################################] 100%
 msys.sig                                       438.0   B   214K/s 00:00 [#######################################] 100%
error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: failed to update msys (invalid or corrupted database (PGP signature))
 dkp-libs is up to date
 dkp-windows is up to date
error: failed to synchronize all databases

error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: database 'msys' is not valid (invalid or corrupted database (PGP signature))

error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: database 'msys' is not valid (invalid or corrupted database (PGP signature))

error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: database 'msys' is not valid (invalid or corrupted database (PGP signature))

Interestingly enough, when I go to the C:/devkitPro folder, I find that I have no devkitpro related files in there whatsoever - just an msys2 folder. I did manage to find a repository online with the files that would have been installed... but when I try to build a project, it says that it can't find the appropriate .specs file.
I would like to know if there is any way I can properly install devkitPro on my windows 10 device. Thanks in advance

sentences:
Inspector stuck on Editor Settings Probably a silly question, but I'm having an issue where I can't view the properties of an object in the inspector window. It seems to be stuck on "Editor Settings". If I click an object I can't view its properties.

Any idea what's going on it's confused me for the past 20 minutes.

sentences:
Advice needed for a physics engine I've recently started a project, building a physics engine.
I was hoping you could give me some advice related to some documentation and/or best technologies for this.

First of all, I've seen that Game-Physics-Engine-Development is highly recommended for the task at hand, and I was wondering if you could give me a second opinion.Should I get it?
Also, while browsing Amazon, I've stumbled onto  Game Engine Architecture and since I want to build my physics engine for games, I thought this might be a good read aswell.

Second, I know that simulating physics is highly computation intensive so I would like to use either CUDA or OpenCL.Right now I'm leaning towards OpenCL, because it would work on both NVIDIA and ATI chipsets.What do you guys suggest?

PS: I will be implementing this in C++ on Linux.

sentences:
Unity SceneView Positionning object with mouse position in Editor script I would like to create an editor tool who can change the position of an object in the scene view into other object in the world, based on mouse position, like in the picture bellow (the red pyramid is my object to positionnate/rotate)

I would like to do a raycast from the scene view camera to the mouse position (or something like that), to get the gameObject over the mouse, and then get the position of the verticle / normal for position and rotation of my gameObject

For now, I have tryed some code who didn't work, I have my object named "preview", and inside the methode OnSceneGUI() in a editor script i have managed to move my preview object, but now I have to know where to put it...
Thanks !

EDIT: here some of my try:

Transform previewPoint; //here my transform

void OnSceneGUI()
{
   PointCreator();
}

 private void PointCreator()
  {
  //test 1
      Camera sceneCam = SceneView.GetAllSceneCameras()[0];
      Vector3 spawnPos = sceneCam.ViewportToWorldPoint(Event.current.mousePosition);
      previewPoint.position = spawnPos;

      //test 2
      Vector3 mousePosition = Event.current.mousePosition;
      mousePosition.y = SceneView.currentDrawingSceneView.camera.pixelHeight - mousePosition.y;
      mousePosition = SceneView.currentDrawingSceneView.camera.ScreenToWorldPoint(mousePosition);
      mousePosition.y = -mousePosition.y;

      previewPoint.position = mousePosition;

  }

sentences: How can I create a car mod for GTA: Vice City? I am a player of GTA games. I want to create my own car for GTA: Vice City. How do I create a mod that adds a new car to the game?

sentences:
CrossPlatformInput Prefabs - Button handler to move? I am currently trying to put two buttons on my UI that move a character left and right if touched down (Held). I would like to use the cross platform input, and would like the buttons to change the value of the Horizontal axis as my "A" and "D" keys would...

And my code for moving my character is as follows:

private void Update()
    {
        isGrounded = Physics2D.OverlapCircle(groundChecker.position, .15f, groundLayer);

        float move = CrossPlatformInputManager.GetAxis("Horizontal") * moveSpeed;
        playerRB.velocity = new Vector2(move, playerRB.velocity.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:
How should I set up UDK with Git and CruiseControl? For a new project in UDK, I'd like to set up a Git repository for version control and a CruiseControl.NET-based continuous integration solution. The good news is that he first part seems easy enough and CruiseControl.NET can work off Git repositories. The bad news is that according to my searches, nobody has ever tried to do this.

Ideally, I'm looking for a step-by-step guide on how to set up such a development environment assuming more than one development computer, one central repository for the "master" branch, and one machine for building and packaging the binaries via CruiseControl.NET.

Related:

Version control system for game development with UDK?
Options for UDK and version control repositories?
CruiseControl.NET and Git

sentences:
Add XNA math references to non-xna project I'm developing some game with server/client structure, and the client will predict the movements, but it should be validated by the server.
In the client part, I got it moving nice, but now I'm trying to test it with the server calculating the movement. The problem is the client I use the xna classes like Quaternion, Vector3, Matrix, etc. Is there anyway to get this XNA classes in the server without making it a xna project??

I found a site with sources of the classes like XNA geomtries, but when I tried it out, it dont got the same results, so I'm still looking for the sources of it, or someother sources that gets at the same results for me to add into the server

sentences:
Why is the Enemy not changing direction when entering the collider? I'm really new to Unity, and I'm trying to make a 2.5D platform game. I want to make my enemies walk on a platform and turn when they reach the end of the platform so I placed two triggers at the beginning and at the end of it to change the direction of the enemy.

public class BanditScript : EnemyScript{
    // Start is called before the first frame update
    private Rigidbody rb;
    private Vector3 moveDir;
    private bool left;
    void Start(){
        left = true;
        speed = 1;
        player = GameObject.FindWithTag("Player");
        animator = GetComponent<Animator>();
        minDistance = 1;
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update(){
        IsNear();
        if (near) {
            //attack
            animator.SetBool("isAttacking", true);
            animator.SetBool("isMoving", false);
        }
        else {
            MoveOnPlat();
            animator.SetBool("isAttacking", false);
            animator.SetBool("isMoving", true);
        }
    }
    void MoveOnPlat() {
        animator.SetBool("isMoving", true);
        if (left)
            moveDir = transform.forward;
        else {
            moveDir = -transform.forward;
        }
        rb.velocity = moveDir * speed;
    }
    private void OnTriggerEnter(Collider other) {
        if (other.tag == "platEndL") {
            left = false;
            transform.rotation = Quaternion.Euler(0, 90, 0);
        }
        if (other.tag == "platEndR") {
            left = true;
            transform.rotation = Quaternion.Euler(0, -90, 0);
        }
    }
}

This is my class, the issue is that the enemy keeps moving in the same direction despite everything. Can you help me?

sentences:
Which collider to use on "island" situation? I have a 2d-top-down-unity game where the player is on an island. The shape of the island is random generated and he is not able to "escape" from the island.

So which Collider should I use for realizing this?

Is there some form of an "inverted" collider? Are colliders able to have a hole in them? Or should I create a polygon collider with a small gap (This could be quite difficult if the polygon bends the wrong way)?

sentences:
OpenGL slower than Canvas Up to 3 days ago I used a Canvas in a SurfaceView to do all the graphics operations but now I switched to OpenGL because my game went from 60FPS to 30/45 with the increase of the sprites in some levels. However, I find myself disappointed because OpenGL now reaches around 40/50 FPS at all levels. Surely (I hope) I'm doing something wrong. How can I increase the performance at  stable 60FPS? My game is pretty simple and I can not believe that it is impossible to reach them.

I use 2D sprite texture applied to a square for all the objects. I use a transparent GLSurfaceView, the real background is applied in a ImageView behind the GLSurfaceView.

Some code

    public MyGLSurfaceView(Context context, AttributeSet attrs) {
        super(context);
        setZOrderOnTop(true);
        setEGLConfigChooser(8, 8, 8, 8, 0, 0);
        getHolder().setFormat(PixelFormat.RGBA_8888);
        mRenderer = new ClearRenderer(getContext());
        setRenderer(mRenderer);
        setLongClickable(true);
        setFocusable(true);
    }

    public void onSurfaceCreated(final GL10 gl, EGLConfig config) {
        gl.glEnable(GL10.GL_TEXTURE_2D);
        gl.glShadeModel(GL10.GL_SMOOTH);

        gl.glDisable(GL10.GL_DEPTH_TEST);

        gl.glDepthMask(false);

        gl.glEnable(GL10.GL_ALPHA_TEST);
        gl.glAlphaFunc(GL10.GL_GREATER, 0);

        gl.glEnable(GL10.GL_BLEND);
        gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);

        gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
    }

    public void onSurfaceChanged(GL10 gl, int width, int height) {
        gl.glViewport(0, 0, width, height);
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();

        gl.glOrthof(0, width, height, 0, -1f, 1f);

        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
    }

    public void onDrawFrame(GL10 gl) {
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();

        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

        // Draw all the graphic object.
        for (byte i = 0; i < mGame.numberOfObjects(); i++){
            mGame.getObject(i).draw(gl);
        }

        // Disable the client state before leaving
        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    }

mGame.getObject(i).draw(gl) is for all the objects like this:

    /* HERE there is always a translatef and scalef transformation and sometimes rotatef */

    gl.glBindTexture(GL10.GL_TEXTURE_2D, mTexPointer[0]);

    // Point to our vertex buffer
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
    gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTextureBuffer);

    // Draw the vertices as triangle strip
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, mVertices.length / 3);

EDIT:

After some test it seems to be due to the transparent GLSurfaceView. If I delete this line of code:

    setEGLConfigChooser(8, 8, 8, 8, 0, 0);

the background becomes all black but I reach 60 fps. What can I do?

sentences:
RPG level-experience formula I want to make an RPG game and I would like an advice on how should I create my level-experience formula. I saw this formula http://rsdo.net/rsdonline/guides/Experience%20formula.html#PHP and I created a formula myself and I want to ask you which would be better.

    RuneScape rates                     My rates

    Level 2 - 83 xp                     Level 2 - 35
    Level 3 - 174 xp                    Level 3 - 84
    Level 4 - 276 xp                    Level 4 - 150
    Level 5 - 388 xp                    Level 5 - 238
    Level 10 - 1,154 xp                 Level 10 - 1,087
    Level 100 - 14,391,160 xp           Level 100 - 311,017

As you can see at level 100 RuneScape's xp is very big and my level 100 is equal with RuneScape's Level 61. Is it better if the xp grows very fast at one point or depends on how I make my game?

sentences:
What's the economical design difference for a global auction house or seperate auction traders? I'm playing The Elder Scrolls: Tamriel Unlimited and there we have local auction houses. (Thy don't have auctions, but I keep the term to not get confused in the following text.)

I can see the advantage that guilds (who own these AHs) can set up their own little economy, which is a nice feature.

On the other side I always have to check several guild traders to see which one offers my searched item for the lowest price.

On the forums, people are discussing heavily whether a global auction house should be introduced or not. This may have pros and cons, too, but I'm not too involved in this game design to really set up a mind for that.

Backers argument that an global AH leads to a more regulated market, easier to use and a seller will reach a broader audience (reads: When you put in an item, you can be sure that there may be a buyer.)

On the other hand critics say that this will make only really useful items get a massive increased price and common used items will drop their prices to their normal selling price.

But are these concerns really true? Would the introduction of a global AH really have such a big impact on the game's economy? And if yes, will they more tend to even the prices or really make most of the items useless for selling?

You could also ask vice-versa: If a game already has global AH, what would the impact be if they replaced it with local auction houses?

What is the difference for the game's and players' economy if you introduce a global or local auction house system?

For clarification: I do ask this for the matter of The Elder Scrolls: Tamriel Unlimited. But you can also subject this to other games. (This should be more a theoretical question for a developer's decision.)

sentences:
Procedural Dungeon Generation: Is there a simple algorithm to make sure all of these rooms get connected using minimal corridors? Is it possible to get a hive-like structure, connecting all the rooms without having too many corridors? (Too many being 3-4+ corridors coming from a single room)

Below is the output of how my rooms look, basically they randomly placed.

What I'm hoping to get corridor-wise.

sentences:
What is an easy way to work subsurface scattering into a raycaster? I've got some neat effects with path tracing:

I want to add in an ability to do subsurface scattering, but I'm unsure of the general algorithm.  With path tracing, it's:

foreach pixel:
    trace( ray into scene )
        color = 0
        if( ray hits an object )
            if( that object is emissive )
                color += object.emissive_color
            if( that object is translucent )
                color += trace( object.refracted ray into scene )
            if( that object is specular )
                color += trace( object.specularly-reflected ray into scene )
            if( that object is diffuse )
                color += trace( object.random-direction reflection ray into scene )

        return color

That's the rough outline.  Where does subsurface scattering go and how can I integrate it?

sentences:
How to write "Hello World" for N64 purely from scratch? As an experiment I want to code a "Hello World" program for N64 using only assembly code, using no headers, tools, helper files, etc.

I just want to write the assembly code bare bones from absolute scratch, assemble it and have it run through a demanding emulator that can show me the output.

I can't find enough info on how to send the correct data to the RSP for video output though. Can anyone offer me a hand here? Not on helping me program, but with information regarding N64's RSP and how to program it to display text, etc.

sentences:
Two Points Rotating Around Circle? Currently I am working on a 2D game just like duet game, it is my first game
(Unity 2D).

When I press left key both points rotate fine. But when I press right, the points are not rotated.

So my problem is why do both points rotated only in one direction

Code:

public class TouchControll : MonoBehaviour
{
  float movespeed = 3;
  float angle = 45;

  void Update()
  {
    if (Input.GetKey(KeyCode.LeftArrow))   // when i m press leftarrow both point should be rotate fine
    {
        transform.Rotate(Vector3.forward * Time.deltaTime * Input.GetAxis("Horizontal") * angle * movespeed);
        Debug.Log("moveleft");
    }

    if (Input.GetKey(KeyCode.RightArrow))  // problem is here when i m press right arrow key both point are not rotated
    {
        transform.Rotate(Vector3.forward * Time.deltaTime * Input.GetAxis("Vertical") * angle * movespeed);
        Debug.Log("moveright");
    }
  }
}

Output:

create a empty gameobject:

first circle

second circle

sentences:
Why does Farseer 2.x store temporaries as members and not on the stack? (.NET) UPDATE: This question refers to Farseer 2.x. The newer 3.x doesn't seem to do this.

I'm using Farseer Physics Engine quite extensively at the moment, and I've noticed that it seems to store a lot of temporary value types as members of the class, and not on the stack as one might expect.

Here is an example from the Body class:

private Vector2 _worldPositionTemp = Vector2.Zero;

private Matrix _bodyMatrixTemp = Matrix.Identity;
private Matrix _rotationMatrixTemp = Matrix.Identity;
private Matrix _translationMatrixTemp = Matrix.Identity;

public void GetBodyMatrix(out Matrix bodyMatrix)
{
    Matrix.CreateTranslation(position.X, position.Y, 0, out _translationMatrixTemp);
    Matrix.CreateRotationZ(rotation, out _rotationMatrixTemp);
    Matrix.Multiply(ref _rotationMatrixTemp, ref _translationMatrixTemp, out bodyMatrix);
}

public Vector2 GetWorldPosition(Vector2 localPosition)
{
    GetBodyMatrix(out _bodyMatrixTemp);
    Vector2.Transform(ref localPosition, ref _bodyMatrixTemp, out _worldPositionTemp);
    return _worldPositionTemp;
}

It looks like its a by-hand performance optimisation. But I don't see how this could possibly help performance? (If anything I think it would hurt by making objects much larger).

sentences:
How can I return the class as a Transform in the array instead of each property? public class TransformInfo
    {
        public string sceneName;
        public string name;
        public Transform parent;
        public Vector3 pos;
        public Quaternion rot;
        public Vector3 scale;
    }

Then the method:

public static TransformInfo[]  LoadTransformInfo()
    {
        string jsonTransform = File.ReadAllText(@"d:\json\json.txt");
        if (jsonTransform == null)
        {
            return null;
        }

        TransformInfo[] savedTransforms = JsonHelper.FromJson<TransformInfo>(jsonTransform);

        return savedTransforms;
    }

The return is:

But then when using it:

var test = TransformSaver.LoadTransformInfo();

Each item in the array contain the the TransfomInfo but instead I want it to return a Transform with already the info.

So I can do for example:

Transform test1 = test[0];

Instead make a loop and assign each property from the Test to the new Transform test1.

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:
How to start an animation just once on an event in libGDX I am trying to show an explosion animation which i created using a few textureregions and created Animation missileblastAnimation from those textureregion like this -- >

 TextureRegion[] explosion = { explodemissile1, explodemissile2, explodemissile3, explodemissile4, explodemissile5,
                 explodemissile6, explodemissile7,explodemissile8, explodemissile9, explodemissile10, explodemissile11,
                 explodemissile12, explodemissile13, explodemissile14,explodemissile15, explodemissile16, explodemissile17,
                 explodemissile18};
        missileblastAnimation = new Animation(0.1f, explosion);
        missileblastAnimation.setPlayMode(Animation.NORMAL);

I have this following code in the render method -- >
Note:-  explosionstarted is set to true when missile hits the ground

  if(explosionstarted){//check if the missile hits the ground to start explosion animation
       batcher.draw(AssetLoader.missileblastAnimation.getKeyFrame(runTime),
                              100, 300-102, 50, 102);
      if(AssetLoader.missileblastAnimation.isAnimationFinished(runTime)){
     // i found that isAnimationFinished tells if animation is finished or not but i still cant understand the passing runTime thing
          explosionstarted = false; //reset the boolean to make the animation stop drawing
        }
    }

Problem is the animation is not playing as it should i.e sometimes it plays too much fast . sometimes it skips first few frames and jumps to ending frames.
What is the right way to do this?
Is there any other way i can check if the animation is completed ?

sentences:
Child GameObject doesn't follow parent's transform Look at this picture first:

I have model that has sword in his hand. I added a cube named "Attack Collision" and located to blade position. And then set the hand to parent.

But when the game starts, sword moves but it's children "Attack Collision" doesn't move at all.

The funny thing is in the scene, I tried to move the "sword", but only it's children "Attack Collision" was moved.

Seems like the sword is somekind of locked, because it's transform can be change but not applied at all, it's just stand still there and only it's children that made from Unity was moved like this:

I made this model and animation by Blender and imported to Unity as .FBX file.

What am I missing?

sentences:
How to Iterate thru game object and access scripts by name? I'm using a "toggle visibility" script on many objects in my scene, and in my gameController class I'm storing references to them in an array like this:
public Fields[] fields;

then I access them by the array index:
fields[0].setVisibility(true);

This works fine, but this list is growing and everything is getting unmaintainable.
So I would like to iterate thru the references to the objects, find the script by its game object name, and call the required function setVisibility(state).
A call, if possible should look like this:
GameObjectName.ScriptName.FunctionCall.State

In this way, I would have a clear overview of my code.
Is this possible in Unity C#?

sentences:
How can I debug a GameObject's rotation? I have a model of a dragon, with an animation of it flying.  When I play the animation in the Animator's preview, the dragon flies in a straight line, but when I run it in-game, it flies around in circles about 10 units in diameter.

If the turning isn't coming from the animator, it has to be coming from somewhere else, but I have no idea where.  There aren't any scripts on the dragon that would influence it like that.  Is there any way to discover what's causing my dragon to turn?  (It's times like this that I really miss the ability to set a memory breakpoint on an object when working in .NET.  That would make this trivial!)

sentences:
Draw a never-ending line in XNA I am drawing a line in XNA which I want to never end. I also have a tool that moves forward in X-direction and a camera which is centered at this tool. However, when I reach the end of the viewport the lines are not drawn anymore. Here are some pictures to illustrate my problem:

At the start the line goes across the whole screen, but as my tool moves forward, we reach the end of the line.

Here are the method which draws the lines:

        private void DrawEvenlySpacedSprites (Texture2D texture, Vector2 point1, Vector2 point2, float increment)
{
    var distance = Vector2.Distance (point1, point2);    // the distance between two points
    var iterations = (int)(distance / increment);       // how many sprites with be drawn
    var normalizedIncrement = 1.0f / iterations;        // the Lerp method needs values between 0.0 and 1.0
    var amount = 0.0f;

    if (iterations == 0)
        iterations = 1;

    for (int i = 0; i < iterations; i++) {
        var drawPoint = Vector2.Lerp (point1, point2, amount);
        spriteBatch.Draw (texture, drawPoint, Color.White);
        amount += normalizedIncrement;
    }
}

Here are the draw method in Game. The dots are my lines:

protected override void Draw (GameTime gameTime)
{
    graphics.GraphicsDevice.Clear(Color.Black);
    nyVector = nextVector (gammelVector);
    GraphicsDevice.SetRenderTarget (renderTarget);
    spriteBatch.Begin ();
    DrawEvenlySpacedSprites (dot, gammelVector, nyVector, 0.9F);
    spriteBatch.End ();

    GraphicsDevice.SetRenderTarget (null);
    spriteBatch.Begin (SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, camera.transform);
    spriteBatch.Draw (renderTarget, new Vector2 (), Color.White);
    spriteBatch.Draw (tool, new Vector2(toolPos.X - (tool.Width/2), toolPos.Y - (tool.Height/2)), Color.White);
    spriteBatch.End ();

    gammelVector = new Vector2 (nyVector.X, nyVector.Y);
    base.Draw (gameTime);
}

Here's the next vector-method, It just finds me a new point where the line should be drawn with a new X-coordinate between 100 and 200 pixels and a random Y-coordinate between the old vector Y-coordinate and the height of the viewport:

        Vector2 nextVector (Vector2 vector)
    {
        return new Vector2 (vector.X + r.Next(100, 200), r.Next ((int)(vector.Y - 100), viewport.Height));
    }

Can anyone point me in the right direction here? I'm guessing it has to do with the viewport.width, but I'm not quite sure how to solve it. Thank you for reading!

sentences:
How to set end of joint that has fixed transform? I'm implementing chains locked the door, and used Hinge joints to linked the chains like this picture:

As you can see, last chain doesn't have connected body because it is end. And when the game starts, links were broken:

How to make last chain just hang in the position like first hinge object?

Also, chains are too way swaying, is there a way to reduce it? I increased every chain's mass to 100~1000, but seems nothing changed. Give it too much mass results broken joints.

Any advice will very appreciate it!

sentences:
2D collisions between 2 arrays I'm trying to do collision detection between bullets and enemies in my game. But it's very unpredictable and sometimes it works, sometimes it doesn't (bullet goes straight through without doing anything) and sometimes it kills the script returning "Uncaught TypeError: Cannot read property 'x' of undefined".

The collision detection is just a trivial for loop like this:

if (enemies.length > 0 && bullets.length > 0) {
    for (a = 0; a < bullets.length; a++) {
        for (b = 0; b < bullets.length; b++) {
            if (bullets[a].x + 36 >= enemies[b].x && bullets[a].x <= enemies[b].x + 56 && bullets[a].y >= enemies[b].y && bullets[a].y + 6 <= enemies[b].y + 69) {
                bullets[a].Delete();
                enemies[b].Delete();
            }
        }
    }
}

The .Delete() function is just a reference to arr.splice(index, 1) in the objects. Of course I didn't expect this to be perfect, but I'm surprised by the random behaviour of it. What could cause this and how can I improve the collision detection?

sentences:
OnTriggerEnter : is it called in both collider object? I've 2 object: a Player and a Bonus object.

In both script I've "OnTriggerEnter" script.

In Player OnTrigger I:
  Take Bonus value and add it to my Player (health, point, ammo)

In Bonus OnTrigger I:
  Play audio (when take it), Play Particle System and so on...

But, it seems it's called only Player's OnTriggerEnter ... Why ?

In Unity, if I have OnCollision/OnTrigger enter in both object, which event is called ? Both ?

Thanks

sentences:
How to get the blocks seen by the player? I'm writing a Minecraft-like game using Ogre engine and I have a problem. I must optimize my game, because when I try draw 10000 blocks, I have 2 FPS... So, I got the idea that blocks display of the plane and to hide the invisible blocks. But I have a problem - how do I know which blocks at a time are visible to the player?

And - if you know of other optimization methods for such a game, write what and how to use them in Ogre.

sentences:
Art style - setting - gameplay I'm looking for resources describing art style - setting - gameplay relationship (from game design perspective).

For example, Fallout's colour palette most often is the dark one, models - realistic and not cartoonish. Setting - post nuclear holocaust. Auditory - mature players.

I could also take a different example like Borderlands. Art style is cartoonish, comic but not childish. Setting - vault raiding/monster killing on an alien planet. Auditory - mature players, but still appealing to teenagers (I suppose 13 and up).

Pixar and Nintendo games tend to be both cartoonish and childish. Setting - simple or movie based. Auditory - definitely kids, yet can be entertaining for adults for a limited time.

GTA - cartoonish, comic and somehow childish (especially the first one), yet auditory is definitely mature. Setting - working for crime syndicate/free roaming.

Let's say I create and epic fantasy game (setting). How should I choose most appropriate art style for my game? Are there any canons in art style like there are canons in literature (western, eastern, etc...) How does art style alone suggest what kind of gameplay one should expect? One can release concept art, but setting is generally kept secret so that player could uncover it while playing.

sentences:
Instantiating GameObjects in Custom Game Engine So,i'm having a bit of an issue with instantiating my gameobjects into to universe(My Scene object).
I can create an empty object from scratch and populate it from there with ease,my problem starts when i try to clone the gameobject which i just created.
My steps are

I create an empty gameobject (GAMEOBJECT A)
I add an component to it (COMPONENT A)
Now i create a gameobject B from A
GameObject B created,and the component A is in the component list of the gameobject B
I try to get the component using inheritance but nullptr returns

It seems when i try to clone components,it returns only the base class pointer.There i try to recreate the derived class and add it to new gameobject's component list but obviously i fail.

If i cant solve this with inheritance how can i solve it ?
is there better way to implement such a desing ?
or i just fail to use inheritance in c++.If it's, can you guys point out what am i doing wrong here

This is my GameObject AKA RGameElement
class RGameElement
{
protected:
    vector<RElementComponent*> Elements;
public:
    template <class T>
    T* GetComponent() {

        int elementSize = Elements.size();

        for (int i = 0;i < elementSize;i++)
        {
            T* pr = dynamic_cast<T*>(Elements[i]);
            if (pr != nullptr)
                return pr;
        }
        return nullptr;
    }
    template <class T>
    T* AddComponent() {

        T* newElementComp = new T();
        Elements.push_back(newElementComp);
        return newElementComp;
    }
    void AddComponent(RElementComponent* targetComponent)
    {
        RElementComponent* newElement = new RElementComponent();

        *newElement = *targetElement;

        Elements.push_back(newElement);
    }

    /*void AddComponent(RElementComponent* targetComponent);*/
    vector<RElementComponent*> GetComponent() const;
}

This is my Component AKA RElementComponent
class RGameElement;

class RElementComponent
{
public:
    RGameElement* RootGameElement;
    virtual RElementComponent GetReference() { return RElementComponent(); };
    virtual void Setup() {};
    virtual void StartLogic() {};
    virtual void UpdateLogic() {};

}

and this my Instantiate via gameobject ref function
RGameElement* RUniverse::Instantiate(RGameElement* targetGameElement)
{
    RGameElement* newElement = new RGameElement();

    vector<RElementComponent*> components = targetGameElement->GetComponents();
    int componentSize = components.size();

    for (int i = 0;i < componentSize;i++)
    {
        newElement->AddComponent(components[i]);
    }

    Elements.push_back(newElement);
    return newElement;
}

sentences:
Unable to create a blueprint containing multiple actors I'm having some trouble in Unreal 4.23. According to the documentation, if I select a bunch of Actors and hit the Blueprints button in the toolbar, I should get an option to "Convert Selection To Blueprint Class," which then gives me a choice of three options of what to do with the different objects before creating the blueprint. Instead, I get "Convert Selected Components To Blueprint Class," the dialog asking me what to do with the objects does not show up -- it goes straight to the one asking where to save the blueprint -- and the blueprint it generates is a mess: textures get changed, the names of the actors are lost, and all of the objects are "dropped on the ground" rather than being positioned where they had been relative to each other!
The objects in question are a character (Skeletal Mesh) and several sub-objects representing the character's clothing (also skeletal meshes, attached to the character as sub-objects in the World Outliner hierarchy.) I basically want to do the same thing you can do in Unity: take this character and save it as a prefab so I can make copies of it easily in different maps. From researching the documentation and various forum posts, it seems like making them into a Blueprint using the Harvest Components option is the best way to do that, but that option is never showing up! This problem persists even after closing and restarting Unreal.
Anyone have any idea why the editor is not behaving as documented, and what I can do about it?
(And yes, I know about Prefabricator.  This is supposed to be for Marketplace content, though, where third-party dependencies are discouraged.)

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 to determine the visibility of a single vertex, given a viewpoint? I have a 3D triangle mesh, and I want to know, given a viewpoint (defined by a model, view and projection matrix), if a certain vertex is visible or not.

My approach was to render the mesh using standard software rasterization (I can't use OpenGL/DX), i.e. project all the triangle vertices to screen-space, then loop through each triangle's bounding-box and rasterize/shade the pixels inside the triangle (using barycentric coordinates). I'm also using a z-Buffer here, and the rendering works fine.

To find out if a certain vertex point is visible, my naive idea was then to just project that vertex from 3D to 2D using the same matrices, and comparing the z-value I get for that pixel to the value in the z-Buffer.

However, this approach does not work, I get vertices flagged as visible that should be invisible and vice versa.

I believe this is because of the following: When I render the triangles, I loop over the bounding-box of the triangle and set the color and depth value by interpolating a value between the 3 triangle vertices, using barycentric coordinates. Thus, the depth value written to the z-buffer for a given point (x, y) on screen is a linear combination of the z-value of the 3 vertices that make up the triangle. In contrast to that, when I project the single vertex later, I render the exact point, independent from any triangles, and thus get a different z-value for the same (x, y) location on screen.

Is my assumption on why it is not working correct, and how would I correctly determine the visibility of a vertex in the mesh?

Update: Let me clarify what's going on with this picture:

Let's say v0 = (1.1, 1.1), v1 = (6.7, 2.1), v2 = (3.7, 6.7) after projection to screen-space.
When rendering/rasterizing the triangle, I have a loop

for x = 1 to 7 // from floor(min(v0.x, v1.x, v2.x)) to ceil(max(v0.x, v1.x, v2.x))
    for y = 1 to 7 // same for y
        current_pixel_center = (x+0.5, y+0.5); // we want calculations to use the center of pixels
        alpha = ..., beta = ..., gamma = ...; // calculate the barycentric weights for current_pixel_center
        if all 3 bary. weights > 0 // means the pixel is inside the triangle
            z_value_of_curr_pixel = alpha * v0.z + beta * v1.z + gamma * v2.z;
            // Do the z-test and then draw the pixel at position (x, y), and set the z-buffer at (x, y) to the new value 'z_value_of_curr_pixel'

So the pixel at position (1, 1) in my drawing gets some color and z-value based on the barycentric weights calculated for this point, it is close to v0 so probably something like alpha = 0.95, beta = 0.02, gamma = 0.03.

Now, in contrast to that, I am later interested in knowing if the single vertex v0 is visible (I don't have any information about triangles at that point). So I project the vertex v0 which will land at (1.1, 1.1) in screen space and end up with a z-value as well. However this z-value will be different than the one that is in the z-buffer for this pixel, because the z-value in the z-buffer has been calculated using the barycentric weights of the triangle for the middle point of the triangle. So I can't determine if the vertex v0 is visible or not.

To rephrase: The z-value in the z-buffer is from the red dot in the image (produced when rendering the triangle), and it is different from the z-value of the projection of the vertex v0 which is exactly at position v0.

sentences:
Electricity and Magnetism: Relevant? The computer science major at my university requires that I take a sequence in either biology, chemistry, and physics, plus an additional natural science course (which I might fill with meteorology).  Since I'm into game development, physics is the obvious choice.  That, and I go to a big pre-med school; why damage my GPA being weeded out from a path I never wanted to take?

There are two main versions of the physics sequence, both covering the same material; one in three semesters, one in two, which I'm interested in.  The course descriptions (the best info I can get right now) follow;

  PHY 131: Classical Physics I

  First part of a two-semester physics sequence for physical-sciences or
  engineering majors who have a strong mathematics background and are
  ready for a fast learning pace. It covers mechanics, wave motion,
  kinetic theory, and thermodynamics. Calculus is used concurrently with
  its development in MAT 131. Three lecture hours and one recitation
  hour per week. The Laboratory component, PHY 133 (Lab 1), could be
  taken concurrently.

Since that's motion, waves, etc. it's obviously extremely useful, and therefore worthy of my attention.  No question there.  I'm going to take this in Spring of '13.

  PHY 132: Classical Physics II

  Second part of a two-semester physics sequence for physical-sciences
  or engineering majors who have a strong mathematics background and are
  ready for a fast learning pace. It covers electromagnetism, electric
  circuit theory, and optics. Calculus is used concurrently with its
  development in MAT 132. Three lecture hours and one recitation hour
  per week. The Laboratory component, PHY 134, may be taken
  concurrently.

(For reference, the descriptions for the three-semester versions are at this link, because they're a bit more descriptive.)

What I want to know is this; besides the obvious things like possible game design elements, does the material in PHY 132 play any significant role in game physics or similar?  If so, what are some examples?

I ask because if I can skimp on the material, I might take a PHY 132 equivalent online next summer at some community college.  That way I can ease the pressure on myself and free up a slot for something interesting.

At the very least, I might take a PHY 126 (part 2/3) equivalent online so I can take the more relaxed PHY 127 (part 3/3) that fall.  But I'd prefer the former option.

Any tips?

sentences:
How should I set camera in Blender for example to render a sprite which can be used in an isometric map? I am trying to render some 3D model in blender and use them as a texture sprite in a game which uses Apple’s SpriteKit.
I have an isometric map with tiles size : 32 as width and 24 as height, Since I use same size tile whole over the map (isometric) I need to use an orthographic projection I think! please tell me if I am wrong but I was pretty sure! anyway...

I am using Blender to render my sprites (3D models) but I can not set the camera direction to have the rendered image really fit with the map.
The attached picture shows the problem, take a look at the building.

I have also attached the geometric math that I have used to create my render script in Blender.

I found out that if I use a 32,24 tile I need to look at from 29Deg 29Min 28Sec but it seems not alright as the iOS simulator shows!

Can anyone help me on this? How do I have to prepare my sprite to fit well on my isometric map?

Those who have experience with isometric map games are welcome to answer and I really appreciate it.

Here is the code I wrote in python to render the 3D Model, I have also set the camera to Orthographic manually.

import bpy
cam = bpy.data.objects["Camera"]
def look_at(cam, point):
    loc_camera = cam.matrix_world.to_translation()
    direction = point - loc_camera
    # point the cameras '-Z' and use its 'Y' as up
    rot_quat = direction.to_track_quat('-Z', 'Y')
    # assume we're using euler rotation
    cam.rotation_euler = rot_quat.to_euler()
meshObj = bpy.data.objects["plate"]
meshObj.rotation_mode = 'XYZ'
#meshObj.rotation_euler = (0,0,0)
d = meshObj.dimensions
# Finding maximum dim of the object
objectScale = 1
if d[1] >= d[2]:
    objectScale = d[1] / 16
elif d[2] >= d[1]:
    objectScale = d[2] / 16
cam.rotation_mode = 'XYZ'
cam.location = (20.416*objectScale,20.416*objectScale,20.416*objectScale)
#cam.rotation_euler = (0.7853,0.7853,0.5147)
cam.rotation_euler = (0.7853,0.7853,0)
look_at(cam, meshObj.matrix_world.to_translation())
alamp = bpy.data.objects["Lamp"]
alamp.location = (17.416*objectScale/4,17.416*objectScale/4,20*objectScale/4)
print("Scaling ",objectScale)
bpy.context.scene.render.filepath = "/Users/iman/Documents/Render/ISOBUILDING.png"
bpy.ops.render.render(write_still=True, use_viewport=True, scene="Camera”)

sentences:
Bitmap & Object Collision Help Is it possible to detect when an object and a bitmap collide. I have an arraylist of sprites that I am shooting with an image. I tried using this method here but as soon as the bitmap appears the sprite disappears, this is in the Sprite class:

public boolean isCollision(Bitmap other)
{
    if(other.getWidth() > x && other.getWidth() < x + width && >other.getHeight() > y && other.getHeight() < y + height);
    return true;
}

sentences:
Why are we not using integers in game physics? We can use integer for game physics (or without physics, simply object representation): mass, position and rotation, where the integers represent, for example, the number of milligrams, millimeters or (1/56000) of a degree. However, almost all game code I've seen recently use floating points.

Is it slower to use integers for game physics calculations? Are there any other advantages and disadvantages from the developer's point of view for using integers? Or it is because all our hardwares

sentences: Are global shader variables slower than texture look ups? I want to send quite a bit of data to the GPU, the data will never change (or will change very rarely) after it has been created.  Is there a performance impact to using global shader variables or should I pack the data into a texture to perform look ups?

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:
Required number of images for octagonal tiles I'm planing to write a game based on octagon tiles. Currently I'm wondering how many images I really need. That is something about graph theory, I know that, but not only.

I want to connect each side of the eight sides, but in some cases I also want to connect all eight sides or just two so the complexity grows immense. If I'm not totally confused that ends in 88 which is 2048. Well of cause there are already many dublicated e.g. left to right is equal with right to left. When I'm very tricky I can rotate the image of left to right which I rotate by 90° to get top to buttom. I'm sure there are quiet more things like like mirroring.

My question is now how many images do I really need?

Here is my basic idea as image, of cause it still has some problems, as you can see on my image too but I think it should not be too hard to find a simple solution for such cases.

sentences: stepOffset wont work I made a model of a staircase in blender and loaded it into unity. Now my player cant go up the stairs while it can walk up a slope just fine. I have tried puting the stepOffset at different levels,

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:
How can I combine my scrolling effect with the vertex lit shader? I want my shader to work in both Forward and VertexLit rendering modes. I'd written a texture scrolling shader, but I also want to consider lighting which is produced by Vertex lit shader. I can't add my effect directly in the vertex lit shader, so I'd created 2 passes: the lighting one and the effect one. Here's my code now:

SubShader
{
    Tags
    {
        "RenderType" = "Opaque"
        "LightingMode" = "Vertex"
    }
    Pass
    {
        Name "Hardware lighting pass"
        Tags { "LightingMode" = "Vertex" }

        Zwrite On
        Cull Back

        Material
        {
            Diffuse [_Color]
        }

        Lighting On
    }

    // At the second pass we'we turned the multiplicative blending on to combine our texture
    // effect with the ightin that has been couputed at the previous pass.
    Pass
    {
        Name "Effect-applying pass"
        Tags { "LightingMode" = "Vertex" }

        // If you're change this, you must then change the light calculation algorithm
        Blend One DstColor
        Lighting Off
        Cull Back

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag

        // texture samplers
        uniform sampler2D _MainTex;
        uniform sampler2D _AlphaMask;
        uniform sampler2D _ManaTexture;
        uniform sampler2D _Noise;

        // float values
        uniform float _ManaFloatSpeed;
        uniform float _ShinessSpeed;

        struct VertexInput
        {
            float4 pos : POSITION0;
            float4 col : COLOR0;
            float4 uv : TEXCOORD0;
        };

        struct FragmentInput
        {
            float4 pos : POSITION0;
            float4 col : COLOR0;
            half2 uv : TEXCOORD0;
        };

        // In the vertex shader we're just applied MVP-transform to our object
        FragmentInput vert (VertexInput i)
        {
            FragmentInput o;
            o.pos = mul(UNITY_MATRIX_MVP, i.pos);
            o.uv = i.uv.xy;
            o.col = i.col;
            return o;
        }

        // 1) Sample our fancy texture to get the pixel color
        // 2) Get the color value of scrolled pixel of the noise texture
        // 3) Set the alpha channel of an output color value to prevent glow at the textured areas
        half4 frag(FragmentInput i) : COLOR0
        {
            float4 col = i.col * tex2D(_MainTex, i.uv);

            // Now reading from the separate mask, later it will be col.a by default (this instruction will desappear)
            col.a = tex2D(_AlphaMask, i.uv).r;

            // Epsilon to prevent dx9-11, and GLES tolerance pass (not 0.0f)
            if(col.a > .0001f)
            {
                // Sample two textures and get the value from the alpla layer
                float4 tl1 = tex2D(_ManaTexture, float2(i.uv.x, i.uv.y + (_Time.y * _ManaFloatSpeed)));
                float4 tl2 = tex2D(_ManaTexture, float2(i.uv.x, i.uv.y + (_Time.y * (_ManaFloatSpeed * 2))));
                float alphaValue = tex2D(_Noise, float2((i.uv.x + _Time.y * _ShinessSpeed), (i.uv.y + _Time.x))).r;

                return half4((tl1 * tl2).rgb, alphaValue);
            }
            else
            {
                return col;
            }
        }
        ENDCG
    }
}

The problem is... Yep, 2 passes, which is extremely undesirable. How can I calculate vertex-lit lighting and apply my effect in the single pass?

sentences: Finding Surface of Inner Volume mesh I am working on the generation of Hexahedral mesh generation using octree based discretization. I have a volume mesh (Hexahedral), using isomorphism I need to project the outermost surface vertices of inner mesh onto original mesh. Could anyone help me on how to extract the surface of inner mesh?

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:
Draw textured circle / 2D shape in SceneKit I have the following code to create a circle Path and a SCNShape from this path.  orbit_gradient.png is a horizontal 1px high image that represents a gradient.

let material = SCNMaterial()
material.isDoubleSided = true
material.lightingModel = .constant
material.diffuse.contents = UIImage(named: "art.scnassets/orbit_gradient.png")

let shapePath = Path.circle(radius: radius, segments: 512)

let orbitShape = SCNShape(shapePath)
orbitShape.materials = [material]
self.orbitNode.geometry = orbitShape

The problem I have is that when applying the texture to this geometry I'm just left with a white circle.  If I set the diffuse to be UIColor.red it displays as red.  What I want to accomplish is a stroked circle that appears to gradually fade, creating a rotating trail effect.

sentences:
Make object face another object on a sphere I have a game I'm working on in Unity where there are two objects on a sphere at random locations (and random rotations). I want one of the objects to always rotate so that if it were to fire a bullet (the end goal) that it would fire at the other object along the shortest arc around the sphere.

The problem I'm facing is that I don't know how to create a rotation for an object that is on the surface of a sphere, and have it point towards the other object.

I can also see an issue after this where I would need it to point towards the other object in the shortest distance because there will always be two directions it can point towards.

Has anyone done something like this? Definitely stuck on this one.

sentences:
Qt opengl glTexImage2D in a widget I was doing an OpenGL display, where I render in an opengl context (GLUT).

But now I would like to integrate it into a big project that does not use the Qt OpenGL API at all (QGLWidget, QOpenGLWidget, …).

So I would have to display on QWidget for example using the function glTexImage2D () because it can take a Qimage input ((GLvoid *) Qimage.bits ())

sentences:
How to access an animation properties from the animator? I'd like to change the property speed of an animation from the animator. For example, I'd like the player to be able to reload faster with upgrades. So I have a basic reload animation on the gun animator, and I would like to change its speed depending on the reload speed level the player has. But I can't find how to change this property in C#.

Here is what I have so far :

void Start() {
    gunAnim = gun.GetComponent<Animator> ();
}

void Update() {
    if (Input.GetKeyDown (KeyCode.R)) {
        gunAnim.Play("reload");
        reloadSound.Play();
    }
}

sentences:
How can I disable an NGUI button when I pause my game? There is an NGUI button in my game, which when pressed increases the player's power.

When I press the escape key, my game pauses completely. But the button still functions normally. Here's how I check for pausing:

void Update ()
{
    if(Input.GetKeyDown("escape"))
    {
        if(isPaused && Time.timeScale == 1.0f){
            Time.timeScale = 0.0f;
            AudioListener.volume = 1;
        }
        else
        {
            Time.timeScale = 1.0f;
            AudioListener.volume = 0;
        }
    }
}

I'd like the button to be deactivated when the game is paused. It should be visible, but not be clickable or anything. How can I achieve that?

sentences:
Would it be a good idea to offload tasks like navigation to the GPU? So I was reading through my copy of GPU Pro 2 and I came across a chapter for building a rendering pipeline for real-time crowds. The implementation uses render targets on the GPU to update agents and finite state machines while also performing frustum culling and level of detail sorting. With this approach, the test case in the chapter is able to easily render about 8,000 characters walking in a crowd.

My question is have any games started taking advantage of the GPU for task other than rendering and physics such as game object updating and AI? And if so, are there any conceivable disadvantages to their implementations?

I ask this because I'm thinking about going this route with my game using D11 DirectCompute to create and simulate large scale space battles. Off the top of my head, I think the GPU would at least be a good tool in calculating and blending steering behaviors.

sentences:
How can I clip my sprite as it passes through a portal in a 2D scenario, using OpenGL? This is a very simple question, but after a brief search and reading through the "similar questions" I could not yet find an answer.

I'm creating a 2D game using OpenGL and came across a problem: Let's say I wanted to create portals. An Entity can move into a portal A and come out of the corresponding portal B. Transforming the coordinates and velocity of the entity is easy, but this would create "hard" texture-teleportation.
Which means: while half of the entity is in the A-portal, it won't be rendered on the corresponding B side.
How would I create a smooth transition?

My first Idea was: I define "exit"- and "entry"-zones containing the transformation function (Matrix). Now when an Entity enteres the exit-zone the entity is also drawn at the entry zone using the transformation-matrix relative the the entry/exit-zones. But drawing it twice would still give me the difficulty, that I need to clip the entity on the portals "backside". (The entity shall vanish behind portal A when entering).

So my second thought was, that there should be a solution using (vertex?) shader? But how would such a shader look like? (Example code would be nice, but not neccessary. I'd rather want to have a "what the shader would do" answer). Would I define Uniforms (exit- and entry zones) which the shader would clip/transform ("move") the vertexes from?

How does a typical solution for this clipping look like? Or where could I read some information about these kind of problems? I only found some to 3D versions, where the view of portal B should be rendered in portal A. But this does not solve the object-moving-through-it problem...I think
In my opinion changing the draw-order, or rendering something above the backside of the portals is not the right way to go, since this could create strange behavior in certain situations. (Portal B is just behind portal A for example. One of both would be overdrawn I think.)

sentences:
Spherical fragment shader shockwave regardless of screen dimensions I've been working on a shockwave shader based on some examples I've looked at. My primary issue is that the screen/resolution dictates the shape of the shockwave. I need it to be spherical, but with default screen shapes it's an oval.

I can resolve the issue by reverse the resolution ratio calc but that winds up stretching the actual texture.

https://www.shadertoy.com/view/XlfBWj

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
    float offset = (iTime- floor(iTime))/iTime;
    float CurrentTime = (iTime)*(offset);

    vec3 WaveParams = vec3(10.0, 0.8, 0.1 );

    vec2 center = vec2(0.5, 0.5);

    vec2 uv = fragCoord.xy / iResolution.xy;

    //float ratio = iResolution.y/iResolution.x;
    //WaveCentre.y *= ratio;
    //texCoord.y *= ratio;

    float dist = distance(uv, center);

    vec4 Color = texture(iChannel0, uv);

    if (dist <= CurrentTime + WaveParams.z &&
        dist >= CurrentTime - WaveParams.z) {
        //The pixel offset distance based on the input parameters
        float Diff = (dist - CurrentTime);
        float ScaleDiff = (1.0 - pow(abs(Diff * WaveParams.x), WaveParams.y));
        float DiffTime = (Diff  * ScaleDiff);

        //The direction of the distortion
        vec2 dir = normalize(uv - center);

        //Perform the distortion and reduce the effect over time
        uv += ((dir * DiffTime) / (CurrentTime * dist * 40.0));
        Color = texture(iChannel0, uv);

    }

    fragColor = Color;
}

sentences:
How can I change view to orthographic using a menu? I'm writing the custom menu using MenuItem and I'm stuck trying to make scene view orthographic when 5 is pressed. What is the object or method I can use to set scene's view to orthographic (I don't mean the main camera, but the main view shown in the window).

This is a C# code of what I was trying to achieve:

[MenuItem("View/SetOrtho _5")]
static void SetOrtho() {
    var scene = ... //assign scene
    scene.setOrtho(true); //set orthographic view to the scene
}

sentences: How to use particle editor for libgdx? In the libgdx wiki, this particle editor is recommended. And this blog was helpful. But the problem is that I am not sure yet how to use it for my game. Let's say I want to have a fire-effect in my game. How can I get help for this particle editor?

sentences:
Dictionary of common names for code objects I'm looking for a common dictionary of terms (much like design patterns have a common language for how things interact) that are specific to games.

For instance, if I'm making a game of pong with a high level of complexity, I want to name things accordingly.

I've seen some visual objects that a user can interact with called a widget, some non-interactive ones called a doodad (back when I played with starcraft map editor anyway). Is there a proper name for the frame rate clock? Is there a proper name for the game clock (the clock that is about the movement of objects in the world but not the visual drawing)?

I just want a dictionary so I can speak the same language and not make up things as I go. I'm concerned I'm going to create things named doodads, whosits, whatsists, and flim-flams... and I don't want to do that.

sentences:
Code for inventory function not working I'm working on an inventory, and I've ran into some problems. Some code in my CollisionDetection class doesn't work properly.

My CollisionDetection class contains functions that involve mouse and item collision. You can pick up and place down items in your inventory, you can stack and split stackable items and you can replace items.

These is an example of the working function:

If you look closely you can see that the item that I'm holding with the mouse is drawn above the other item.

This is the example of the broken function:

I need to click twice before the item finally switches.

If you look closely you can see that the item that I'm holding with the mouse is drawn below the other item and the function doesn't work properly.

I think it has to do with the layer that the item is drawn on...

The stack/replace code (the whole function uses i which is the item. The function is started by a for loop that loops through the item and inventory tiles lists):

Item i2;
// Searches item 2
i2 = items.Find(x => x.itemBox.X == r.X + 9 && x.itemBox.Y == r.Y + 9 && !x.clicked && x != i);

// If the item intersects another item (item 2)
if (i.itemBox.Intersects(i2.itemBox))
{
  // If the item is stackable
  if (i.stackable && i2.stackable)
  {
    // Hiding one item visually
    if (!i.hide_Box_Def)
    {
      i2.quantity += i.quantity;
      i.hide_Box_Def = true;
      i.error = true;

      // Bool for changing the item state (picking up/ placing down)
      // But these 2 lines of code are not really used, I wrote these trying to fix this problem.
      i.m_Switch2 = true;
      i.watch.Start();
    }
  }
  // When the item is not stackable -> item needs to be replaced by another item
  else
  {
    // Item 1 (attached to the mouse)
    // clicked: a bool that attaches the item to the mouse
    i.clicked = false;

    // itembox: collisionbox for the item
    i.itemBox.X = i2.itemBox.X;
    i.itemBox.Y = i2.itemBox.Y;

    // Oldposition for the item
    i.oldPosition.X = i.itemBox.X;
    i.oldPosition.Y = i.itemBox.Y;

    // info bool: do/ do not show item info
    i.info = false;

    // Item 2 (in inventory)
    // mouse_Click_Left: bool that changes the item state (picking up/ placing down)
    i2.mouse_Click_Left = true;
    i2.info = true;
    i2.clicked = true;
    i2.itemBox.X = (int)coords.X - 15;
    i2.itemBox.Y = (int)coords.Y - 15;
  }

Summary:

The code works when the item that's attached to the mouse is above the other item.

The code doesn't work when the item that's attached to the mouse is below the other item.

UPDATE

I fixed the first problem, so I changed the question a bit.

sentences:
How can I find the difference between rotations represented as angles in [0, 360]? What is the easiest way to find the difference between two 2D rotations/directions?

I want to test if one rotation is within 10° of another. I would just subtract, but there are some problems because I want to keep each rotation between 0 and 359. E.g. 0 is within 10° of 359, but simple subtraction would claim that they're 359 degrees apart.

sentences:
Handling complex selection mechanics in RTS-style game When we look at complex RTSs where a simple left button mouse click can mean twenty or more different things, depending on the game and UI state, the code handling this interaction and assigning the right interaction action to the input can easily end up messy and tightly coupled to everything, creating a ball-of-mud architecture/The Class That Does Everything related to interaction.
How can I deal with this situation?
Here's an example of the complex selection mechanics that I'm looking for:

Single left click to select a friendly unit.

If friendly unit is in a group, the group is selected.

If the group is already selected, select the unit.

Single left click to select an enemy unit.

If friendly unit/group already selected, then issue attack order on unit.

If friendly unit/group already selected and enemy unit is in an enemy group, then issue attack order on enemy group.

Same thing but if target is allied non-controllable, then friendlies move towards target.

Etc.
How can I handle this complex selection system, taking into account complex states?

sentences:
How to use multiple textures in OpenGL ES 2.0? I am working in OpenGL ES 2.0.

I load two png images as my textures with the libSOIL. I need to use one of them as the texture for the background and another one as the texture of a rotating cube.

In OpenGL ES 2.0, the adding texture operation is in the shader. I don't know how to add the different textures to the different places in a shader. How do I do that?

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:
2D Motocross physics I'm looking into making a 2D motocross bike game with plausible physics.

It should look like this:

For a first try, I've created only the player (a motocross driver) and the map (consisting of only straight lines; no curves, to keep it simple).

How should collisions between the motocross bike and the track affect the bike's position and velocity? The bike should rotate if only one of the wheels touches the ground and speed up if the back wheel touches the ground. Pretty standard bike game stuff.

How do I achieve this behaviour?

sentences:
Moving my character/camera makes environnement jerky I'm learning to make a Tilebased game with Unity and for that I use the Zelda alttp assets.
I just have Tiles, a Camera and a moving Character with a rigidbody2D and a CircleCollider.

When the Camera follows the Character, the scene feels Jerky.

Info:

The Camera uses the 2D Pixel Perfect package.
The Character is moving via Rigidbody2D.MovePosition() in the FixedUpdate Method:

code:

void Update()
{
    float yInput;
    float xInput;

    #region yMovement
    if (Input.GetKey(keyMoveTop))
    {
        if (Input.GetKey(keyMoveBot))
        {
            yInput = 0f;
        }
        else yInput = 1f;
    }
    else if (Input.GetKey(keyMoveBot))
    {
        yInput = -1f;
    }
    else yInput = 0f;
    #endregion

    #region xMovement
    if (Input.GetKey(keyMoveLeft))
    {
        if (Input.GetKey(keyMoveRight))
        {
            xInput = 0f;
        }
        else xInput = -1f;
    }
    else if (Input.GetKey(keyMoveRight))
    {
        xInput = 1f;
    }
    else xInput = 0f;
    #endregion

    //Walking
    isWalking = Input.GetKey(keyMoveWalk);
    moveDirection = Vector2.ClampMagnitude(transform.right * xInput + transform.up * yInput, 1f);
}

private void FixedUpdate()
{
    _rb.MovePosition(_rb.position + moveDirection * (isWalking ? walkSpeed : runSpeed) * Time.fixedDeltaTime);
}

You can see the problem here:
https://youtu.be/MA2zZPME5X4

Edit: Added all my movement code

sentences:
Slick2D: Animation not being parsed from spritesheet correctly I have a 960x960 spritesheet with each tile being 192x192.  I initialized my spritesheet and animation like so:

spritesheet = new SpriteSheet("resources/spritesheets/player.png", 192, 192);
walkingLeft = new Animation(spritesheet, 3, 0, 0, 1, true, 20, true);

When I attempt to render the animation, I get a java.lang.ArrayIndexOutOfBoundsException: -1 error.  This error doesn't occur when I'm creating an animation from images in the same row.  Therefore, I'm assuming that the error is being caused because of the way Slick is handling horizontal scanning (going to the next row after reaching the end).

sentences:
Unity: Slow deployment to Android devices? From the time I hit "Build & Run", I wait 2 minutes (each) for Unity 5 to push to two different 'Droids. Fresh project, one script to generate a simple mesh, and no other assets. I am deploying via a USB 2.0 port.

IIRC from using Unity 4 in 2012, the same was true then, including for iOS deployments.

Is this to be expected? My dev machine is an i7 with 16GB RAM and everything else is fast.

sentences:
Rendering multiple textures on same image for terrain with index buffers (LWJGL 3) I have started with LWJGL3 and trying to built game engine. I'm stuck on generating terrains and this is my second big problem and I'm exhausted so I need some advice on how to solve my problem.

What I want to achieve :
I want to have all textures in one place and to have some kind of texture map that I will use to render specific texture at that place.

example:
textures

map

but result is

Only thing that I think is problem is because I use same points (index buffers)

So instead of 8 points, I have 6. Is it possible that then texture gets all messed up?

Should I use all points, even if they are at same or almost the same location? But then I would have a lot more vertices than actually need it.

sentences:
Make an arrow to point at a direction from UI I want to have a guiding arrow on the left side of UI. The arrow is child of the player's camera and it's rendered from another camera into render texture. The render texture is displayed on the screen. The arrow is rotated via transform.LookAt(targetPosition) The problem I'm having is that although it does point in the right direction, form player's point of view it looks like the arrow is pointing somewhere else.

I want that arrow to point from the point where it's placed on the UI. It should look something like this:

I tried to do this:
  Vector3 direction = targetPosition - _arrowRawImage.rectTransform.position;
_transform.LookAt(direction);
but it didn't work.

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: Pinball flippers: Joints or not? When making pinball flippers in Unity C#, what would be the pros and cons of using a simple mesh transform -- where the mesh is properly centered around the wanted pivot, so its rigidbody could be torque force rotated -- vs creating the flipper with a joint? Thanks!

sentences:
Websocket server thread per connection I'm creating an html5 multiplayer game and am looking at how to create a websocket server.

I've been looking at various libraries and one thing I noticed is that each one will create a new thread for every client that connects. Now I'm fairly new to websockets, but I know that in the past when it came to game server design that a thread per connection was bad practice.

Is that true for websockets? Why is there a need to a new thread for every connection?

sentences:
How can I calculate a vertex normal for a hard edge? Here is a picture of a lovely polygon:

Circled is a vertex, and numbered are its adjacent faces.  I have calculated the normals of those faces as such (not yet normalized, 0-indexed):

Vertex 1 normal 0:   0.000000   0.000000    -0.250000
Vertex 1 normal 1:   0.000000   0.000000    -0.250000
Vertex 1 normal 2:  -0.250000   0.000000     0.000000
Vertex 1 normal 3:  -0.250000   0.000000     0.000000
Vertex 1 normal 4:   0.250000   0.000000     0.000000

What I'm wondering is, how can I determine, taken as given that I want this vertex to represent a hard edge, whether its normal should be the normal of 1/2 or 3/4?  My plan after I glanced at the sketch I used to put this together was "Ha!  I'll just use whichever two faces have the same normal!" and now I see that there are two sets of two faces for which this is true.

Is there a rule I can apply based on the face winding, angle of the adjacent edges, moon phase, coin flip, to consistently choose a normal direction for this box?

For the record, all of the other polygons I plan to use will have their normals dictated in Maya, but after encountering this problem, it made me really curious.

sentences:
Can this script be edited to create a "shotgun" type spread when firing? [Top down shooter] I have this code and I'd like to add a shotgun to the game by slightly modifying the code. I've looked online for any example but everything I find is for FPS not a TDS.

void Shoot ()
{
    timer = 0f;

    gunAudio.Play ();

    gunLight.enabled = true;

    gunParticles.Stop ();
    gunParticles.Play ();

    gunLine.enabled = true;
    gunLine.SetPosition (0, transform.position);

    shootRay.origin = transform.position;
    shootRay.direction = transform.forward;

    if (Physics.Raycast (shootRay, out shootHit, range, shootableMask))
    {
        EnemyHealth enemyHealth = shootHit.collider.GetComponent <EnemyHealth> ();
        if(enemyHealth != null)
        {
            enemyHealth.TakeDamage (damagePerShot, shootHit.point);
        }
        gunLine.SetPosition (1, shootHit.point);
    }
    else
    {
        gunLine.SetPosition (1, shootRay.origin + shootRay.direction * range);
    }
}

I have a basic understanding of most of this code. I don't quite understand how shootRay.direction understands transform.forward means always the front of player. As DMGregory stated adding a variable of some sort that runs through a for loop firing multiple different angles (or simply different coordinates if making angle rays is over my head) is the route I first thought of but I cannot find a way to implement it. I'm having issues with understanding how to manipulate ray coordinates because they cannot be changed by floats which is the extent of my current knowledge of problem solving.

sentences:
Need help with algorithm for generating connected bricks in Pick A Brick clone I want to make a clone of an Amiga 500 game, Pick A Brick, a 2D game where the goal is to clear a table of bricks by matching them up, following certain rules. I am getting nowhere when it comes to the algorithm for generating the layout of the bricks. I have added the rules of the game (as I remember them) below.

The player wins the game by clearing all tiles before the time runs out.
Tiles are cleared by clicking on a pair of them and if the following is true:

The tiles must be of the same type (there is only one pair of each type).
There is a clear path between them (more on path in the points below).
The path from a tile must always start towards an (clear) edge of the screen.
The path between the tiles must be u-shaped.

(edit) NOTE: In the video the path is not always the u-shaped. I do not recall if the path shown is just a shortcut or not, but regardless, in my version I do not want to allow removing tiles "from inside out".

I have done some manual testing/prototyping using both outside in and inside out approaches, with variations on both. So far, nothing I have come up with has really come close. I kind of dislike asking a question like this since it is so specific, probably not of general interest and may take up more than a little time for anyone interested in helping out. That being said, some people enjoy coming up with algorithms and "solving stuff", and the community may learn something from the answer, so, a post it is.

(edit) Clarification. The algorithm must provide a solvable solution.

sentences:
Is there a way to run Unity without rendering the scene on the monitor (headless)? I am doing some machine learning and I get my environment from Unity in the form of images but the training is taking too long and it keeps me from doing anything else on my system. Is there a way to hide the simulation rendering?
Any help will be highly appreciated.

sentences:
Event queue: tell or ask? I'm working my way through a lot of game development resources, coming from a completely different field of software development, I'm interested in learning what patterns are frequently used in game development, and which aren't.

During my research, I wanted to know if/how event queues are handled in games, and came across Game Programming Patterns' post about Event Queues. (as an aside, what an awesome resource that book is!)

In it, Bob Nystrom gives an example of a "play audio" queue, where one part of the system can produce/enqueue the playing of an audio fragment, and the audio handler/consumer can act on that request whenever it can.

I like this pattern a lot, but the end-result still feels like it results in domains being crossed, because the sender (in this example the part of the system that deals with a unit dying) has to ask the audio system to play the "deathSoundID" sound using playSound(deathSoundID) (which, in this case, then enqueues that request for the audio engine to pick up as soon as it can).

What I expected to be proposed is that the sender in this case tells the audio engine that an event occurred (by having the audio engine listen for events from this specific game system), at which point the audio engine can then determine if/how it wants to act on that specific event.

Now, admittedly, there's still crossing of domains here, as in my example, the audio engine now has to have some kind of (huge) case statement that couples any game event to an audio-related action, but you no longer have to litter unrelated functions with calls to playSound, and it also forces you to be a good citizen, and allow other systems to act on whatever action you just took, be it the audio engine in this case, or the "gamepad rumbler" engine that wants to rumble your gamepad because you've just slain a large enemy.

Another downside to this is that you need many more queues for all your systems (if you want to avoid some kind of global event queue, which I think you should), which might not be practical/performant enough to do, so perhaps that's the reason why it wasn't chosen here.

Either way, as a newcomer to game development, I'm interested to hear why one would be preferable over the other, and in what situations that would be the case.

sentences:
How is console game development done? I'm curious what the process is for development for a game console such as Wii, Playstation, or Xbox. Do I need to use some game engine and compile for each platform?

What IDE is used? Any C++ IDE? Are all console games built in C++?

sentences:
How to represent a map in a top-down perspective game with low algorithm complexity? This is the first time I develop a video-game, and I am kind of lost.

I would like to know about ways on representing 2D maps on a top-down perspective game...

(Like this one: vengadoravg.github.io/1/game.html btw, this is the first game I develop)

So far, I've found one way to represent a 2D map in a top-down perspective game:

Using a matrix. Where a normal floor place is represented by some number (or character), the obstacles are represented by a different number, and the enemies by another different number. This matrix would allow me to run graph theory algorithms and crazy things, but i think it would be, algorithmically, very complex, because the graph would be really populated and dense. Thus, all the sprites should be the same size, otherwise, the matrix would be really, really big.

Are there any other (better) ways?

In terms of algorithm complexity, which of them are the best to run graph theory algorithms?

I apologize if the question sounds subjective... but i think the superiority of an approach can be determined by its algorithmic complexity :)

sentences:
How to make a game object scale up from another game object I have a GameObject. I'm trying to make another GameObject grow in scale from touching this GameObject, and when a set amount of scale is reached, destroy this GameObject. My problem is that when I access ScaleUp, it dosn't add any scale to the other GameObject.

How do I scale another GameObject? Here is my ScaleUp script:

using UnityEngine;
using System.Collections;

public class ScaleUp : MonoBehaviour
{

    public GameObject Player;
    public PlayerMovement PlayerScript;

    private float playerScaleX;
    private float playerScaleY;

    public float scaleUp = 10.0f;

    void Start()
    {
        Player = GameObject.FindGameObjectWithTag ("Player");

        PlayerScript = Player.GetComponent <PlayerMovement>();

        playerScaleX = Player.transform.localScale.x;
        playerScaleY = Player.transform.localScale.y;
    }

    void OnTriggerEnter2D (Collider2D other)
    {
        if (other.tag == "Player")
        {
            playerScaleX += scaleUp;
            playerScaleY += scaleUp;

            Debug.Log ("GROW");
        }
    }
}

sentences: What are the benefits or drawbacks of splitting the player animation system from the wall collision system into multiple objects pinned to each other? I'm currently making a simple platformer in GameMaker Studio 2 and I've had people telling me that I need to separate the two things into an invisible wall collider mover and animation sprites pinned on top of it. I've also had people telling me that's overcomplicated and stupid. But I've never heard the reasons why I would or should do it either way.

sentences:
Scene - human speed correlation I am writing a really simple game with a scene (horizontal plane) and a human moving to the right of the plane (watching the simulation from the +z axis).

The scene contains some trees, which I am moving towards -x axis in order to create the animation effect (by adding a float to their current position).

The human just walks or runs with increasing/ decreasing the angular velocity of one of his legs.

The question comes down to, how can I combine this two entities in order to correlate the change of the speed of the human with the change of the variable that is responsible for making the animation of the scene?

Should I convert the angular velocity to velocity?

sentences:
In a browser, is it best to use one huge spritesheet or many (10000) different PNG's? I'm creating a game in jQuery, where I use about 10000 32x32 tiles. Until now, I have been using them all separately (no sprite sheet). An average map uses about 2000 tiles (sometimes re-used PNG's but all separate divs) and the performance ranges from stable (Chrome) to a bit laggy (Firefox). Each of these divs are positioned absolutely using CSS. They do not need to be updated every tick, just when a new map is loaded.

Would it be better for performance to use spritesheet methods for the divs using CSS background-positioning, like gameQuery does?

Thank you in advance!

sentences:
"Fading" effect between different screens? I'm not sure what the correct word for it is, but I'm thinking like the fading effects when you move between different screens in Powerpoint or Keynote; that the screen fades black before the new screen is shown instead of instantly change.

The "screens" I'm talking about are actually two pictures, and since it's for an adventure type game I thought it'd be cool if it could be done.

Does anyone know a good way to implement this?

sentences:
How to access "move" values from move node in Rain behavior tree? I have a blend tree for the NPC that takes an "input magnitude" value--0 to 1.0--for how fast the character should move...and an "angular input" float-- negative pi to positive pi--for how fast the character should turn.

How do I get the rain behavior tree to update these values correctly in the behavior tree "set parameter" leaves?

I see that I can set the parameter with some kind of variable name, but I don't see where I can specify that variable with a script...and I don't see how I can access the "move" instructions given from the move node on the behavior tree, and use them to set the variables either.

How would I accomplish this steering with Rain?

sentences:
Detect if square in grid is within a diamond shape So I have a game in which basically everything is a square inside a big grid. It's easy to check if a square is inside a box whose center is another square:

*** x
*o*      --> x is not in o's square
***

**x
*o*      --> x IS in o's square
***

This can be done by simply subtracting the coordinates of o and x, then taking the largest coordinate of that and comparing it with the half side length.

Now I want to do the same thing but check if x is in o's diamond, like so:

  *
 **x
**o**    --> x IS in o's diamond
 ***
  *

What would be the best way to check if a square is in another square's surrounding diamond-shaped area, given the diamond's half width/height?

sentences:
Windows Phone 8.1 Monogame Content.Load exception need some help, just trying to load compiled .fx (.xnb) file by monogame (version 3.4.0.456) in Windows Phone 8.1 enviroment by this code

MainEffect = Game.Content.Load<Effect>("chessboard");

there is a some delay, about 3-4 seconds, and then i get

  SharpDX.SharpDXException
  "Additional information: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect."

Tried different files, but seems no matter how complex the are, behaviour is the same.
Even this simple effect gives an error:

float4x4 World;

struct VertexShaderInput
{
    float4 Position : SV_POSITION0;
    float4 Color : COLOR0;
};

struct VertexShaderOutput
{
    float4 Position : SV_POSITION0;
    float4 Color : COLOR0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    output.Position = mul(input.Position, World);
    output.Color = input.Color;
    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return input.Color;
}

technique Specular
{
    pass Pass1
    {
        VertexShader = compile  vs_4_0 VertexShaderFunction();
        PixelShader = compile ps_4_0 PixelShaderFunction();
    }
}

But for Windows 7/8/10 its works well. Any ideas ?

sentences:
XNA 4.0 SpriteFont not displaying all Characters Am looking for a little help and trying to use SpriteFont in my XNA 4.0 game but the problem is am displaying to string "This is a test" but all that's displayed on the screen is "This is     st" so the "a te" are missing from the screen.

The space is there for the characters but the letters are not.

The code am using is:

spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
spriteBatch.DrawString(font,"this is a test",new Vector2(692,372),Color.White);
spriteBatch.Draw(texture,new Rectangle(0,0,100,100),Color.White);
spriteBatch.End();

Any help with this would be great!

sentences:
Rendering Tilemap Tile Layer Side by Side for Infinite/Endless Runner Game I was strugeling this for days how to implement tilemap into libgdx and box2d with infinite/endless scheme. I can load a single map and display everything on screen. But placing 2 or more tilemap side by side got me headache. I know currently not possible to offset/add x value position of tilemap. What I do right now is use setview for camera of it's render method. This is my map helper and currently I works with 3 renderer for 3 tilemap as a test...

public class MapHelper {
private Array<OrthogonalTiledMapRenderer> renderer = new Array<OrthogonalTiledMapRenderer>();
private int number;
private float oldDistance, currentDistance;
private String layer = "world";

public MapHelper(Callback callback) {
    this.callback = callback;
    number = 0;
    item = new ItemMap[3];
}

public void render(CamHandler cam) {
    for(int r = 0; r < renderer.size; r++) {
        if(item[r] != null) {
            renderer.get(r).setView(cam.getCam().combined, item[r].distance, 0, item[r].getWidth(), item[r].getHeight());
            renderer.get(r).render();
        }
    }
}

public void updateMap(CamHandler cam) {
    if(mapOut(cam)) {
        number++;
        if(number > 2)
            number = 0;
        loadMap(number);
    }
}

/**
 * Check if camera reach the current distance, then build new map
 * @param cam
 * @return
 */
private boolean mapOut(CamHandler cam) {
    float x = cam.getCam().position.x + cam.getCam().viewportWidth / 2;
    Utils.log("pos cam x "+x+" current distance "+currentDistance);
    return x >= currentDistance;
}

private void loadMap(int map) {
    AssetsManager.loadMap(map);
    if(item[map] != null) {
        renderer.set(map, new OrthogonalTiledMapRenderer(AssetsManager.map));
        item[map].set(TileHelper.getMapWidth(AssetsManager.map, layer), TileHelper.getMapHeight(AssetsManager.map, layer), currentDistance);
    } else {
        renderer.add(new OrthogonalTiledMapRenderer(AssetsManager.map));
        item[map] = new ItemMap(TileHelper.getMapWidth(AssetsManager.map, layer), TileHelper.getMapHeight(AssetsManager.map, layer), currentDistance);
    }

    oldDistance = currentDistance;
    currentDistance += TileHelper.getMapWidth(AssetsManager.map, layer);
    callback.onLoad();
    Utils.log("load new map "+map+" distance "+currentDistance);
}

public Array<OrthogonalTiledMapRenderer> getRenderer() {
    return renderer;
}

public Array<Body> getBodies(World world) {
    return new MapBodyBuilder().buildShapes(AssetsManager.map, world, oldDistance);
}

private ItemMap[] item;

private class ItemMap {
    private float distance, mapWidth, mapHeight;

    ItemMap(float w, float h, float distance) {
        mapWidth = w;
        mapHeight = h;
        this.distance = distance;
    }

    private void set(float mapWidth, float mapHeight, float distance) {
        this.mapWidth = mapWidth;
        this.mapHeight = mapHeight;
        this.distance = distance;
    }

    private float getWidth() {
        return mapWidth * Constants.WORLD_TO_SCREEN;
    }

    private float getHeight() {
        return mapHeight * Constants.WORLD_TO_SCREEN;
    }
}

private Callback callback;

public interface Callback {
    void onLoad();
}

public void startOver() {
    clear();
    currentDistance = number = 0;
    loadMap(number);
}

private void clear() {
    for (OrthogonalTiledMapRenderer render : renderer) {
        render.dispose();
    }
}

}

With above class, I can display and load new map on screen when camera reaching the map end. But the tile layer texture keeps wrong position. Please give me an advice.

sentences:
Why is my mesh generation algorithm not working properly? I am trying to generate a grid in OpenGL ES, using known methods for triangle strips and stitching as shown in:
this post and this post

The code below, generates the vertices for a 4x4 grid with a spacing of 1 unit and then indices for a triangle strip to render the mesh as is commonly done. The coordinates as shown look fine and the indices look fine too. I am just not able to figure out what is wrong. The output is as shown in the attached image.

I hope its something silly that I am overlooking.

int total_verts = width * height;
int verts_first_plus_last = width *2;
int verts_between = total_verts - verts_first_plus_last;
int rows_between = height - 2;
int total_indices = verts_first_plus_last + (2*verts_between) + (2*rows_between);
float vertices[] = new float[total_verts*3];
short indices [] = new short[ total_indices  ];

float xCoord = 0f;
float yCoord = height - 1f;
float zCoord = 0f;

for(int x=0;x<total_verts;x++)
{
    vertices[x]   = xCoord;
    vertices[x+1] = yCoord;
    vertices[x+2] = zCoord;

    System.out.print("(" + xCoord + "," + yCoord + "," + zCoord + "),");

    xCoord= (xCoord + xDelta) % width;
    if(xCoord == 0 )
    {
        yCoord = (yCoord - yDelta) % height;
        System.out.println();
    }
}

System.out.println("\n\nIndices:");

int vert_no = 0;
int ctr =0;
int vert_ctr = 1;

boolean fwd = true;
//0,4,1,5
while(ctr < total_indices)
{
     if(fwd)
     {
         indices[ctr] = (short) vert_no;
         ctr++;
         fwd = false;
     }
     else
     {
         indices[ctr] = (short) (vert_no + width);

         if( vert_ctr % width == 0 && vert_ctr < total_verts - width)
         {
             indices[ctr+1] =  (short) (vert_no + width);
             indices[ctr+2] =  (short) (vert_no + 1);
             ctr+=3;
         }
         else
         {
             ctr++;
         }

         vert_no++;
         vert_ctr++;
         fwd = true;
     }

}

for(int x=0;x<indices.length;x++)
{
    System.out.print(indices[x]+",");
}

Vertices Generated:

(0.0,3.0,0.0),(1.0,3.0,0.0),(2.0,3.0,0.0),(3.0,3.0,0.0),
(0.0,2.0,0.0),(1.0,2.0,0.0),(2.0,2.0,0.0),(3.0,2.0,0.0),
(0.0,1.0,0.0),(1.0,1.0,0.0),(2.0,1.0,0.0),(3.0,1.0,0.0),
(0.0,0.0,0.0),(1.0,0.0,0.0),(2.0,0.0,0.0),(3.0,0.0,0.0),

Indices:

0,4,1,5,2,6,3,7,7,4,4,8,5,9,6,10,7,11,11,8,8,12,9,13,10,14,11,15

sentences:
What do gameplay programmers do? Game development has lots of fronts... gameplay, physics, graphics, etc. and whenever I look up the answer for this question it's always something vague like: "extended knowledge of c++, c# or whatever".

But what exactly does that mean? Does the gameplay programmers know lots of openGL, directX? maybe lots of vectors, matrices? Do they need to know some network programming?

So what kind of coding and other tasks do gameplay programmers do?

sentences:
Why is there a huge update-delay in my client/server code? I'm working on my Java game with Libgdx and having trouble with the network code. I can create a server, make multiple clients connect to it, but there is a huge delay between the player's input and the movement.

This is basically how it should work:

SERVER:     (Launch and listen to connection.)
CLIENT: I want to connect
SERVER:     OK, here is the map and all other data
CLIENT: I pressed "D"
SERVER:     OK, I move this player, here is your position
CLIENT: I received my position

On the 2 last steps, when I pressed an input, the server gets it correctly and updates the position and immediately sends the position to the player, but here is my problem:

Server log (the numbers are X- and Y-coordinates):

Sat Sep 20 18:49:16 CEST 2014 : Send 2356.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Send 2358.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Send 2360.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Send 2362.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Send 2364.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Send 2366.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2368.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2370.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2372.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2374.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2376.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2378.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2380.0 1376.0

Client log:

Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0

As you can see, the player receives the data at the wrong moment. Here is when the client start to receive

Sat Sep 20 18:49:18 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:18 CEST 2014 : Receive : 2338.0 1376.0
Sat Sep 20 18:49:18 CEST 2014 : Receive : 2340.0 1376.0
Sat Sep 20 18:49:18 CEST 2014 : Receive : 2342.0 1376.0
Sat Sep 20 18:49:18 CEST 2014 : Receive : 2344.0 1376.0

As you can see, there is almost a 2 seconds of delay (something like 1.6 / 1.7s).

This is how I send/receive data:

Sending:

synchronized(this.gestionPlayers) {
   for(GestionPlayer gp : this.gestionPlayers) {
        if(this.serializablePlayer.size() > 0)
            gp.sendPlayer(this.serializablePlayer);
    }
}

sendPlayer function:

try {
    this.objectOut.writeObject(sp);
    this.objectOut.reset();
} catch (IOException e) {
    this.actif = false;
    e.printStackTrace();
}

Receiving:

Vector<SerializablePlayer> p =
    (Vector<SerializablePlayer>) this.objIn.readObject();
this.map.addNewPlayers(p);
this.map.multiplayerRender();

SerializablePlayer contains the player's ID and coordinates.

If you need more information, just ask. This is the last step in my multiplayer game and I'd be happy if you could help me! :)

sentences:
How can I make the space craft takeoff/landing by code with logic? The code so far :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnimFlyertransportationController : MonoBehaviour
{
    public Transform transformToMove;
    public GameObject JetFlame;
    public float speed;
    public bool takeOffLand = false;

    private Animator[] animators;

    private void Start()
    {
        TurnAllAnimtorsOff(transform, false);
    }

    private void Update()
    {
        if(takeOffLand)
        {
            TakeOff();
        }
        else
        {
            Land();
        }
    }

    private void TakeOff()
    {
        float step = speed * Time.deltaTime;
        var v3 = new Vector3(transformToMove.localPosition.x, 7, transformToMove.localPosition.z);
        transformToMove.localPosition = Vector3.MoveTowards(transformToMove.localPosition, v3, step);
    }

    private void Land()
    {
        float step = speed * Time.deltaTime;
        var v3 = new Vector3(transformToMove.localPosition.x, 0, transformToMove.localPosition.z);
        transformToMove.localPosition = Vector3.MoveTowards(transformToMove.localPosition, v3, step);
    }

    private void TurnAllAnimtorsOff(Transform root, bool onOff)
    {
        animators = root.GetComponentsInChildren<Animator>(true);

        foreach (Animator a in animators)
        {
            if (onOff)
            {
                a.enabled = true;
            }
            else
            {
                a.enabled = false;
            }
        }
    }
}

The problem :

I need to call the function TurnAllAnimtorsOff but each time only once when taking off and when landing. When taking off it should first turning all animators and flame to true turn them on then taking off and when landing first to land when reaching height target when landing finished then call the function again and turn off all the animators and the flame.

I added this flag bool variable takeoffland as helper but now the object is taking off and engine and animators turning on but now it's not landing anymore :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnimFlyertransportationController : MonoBehaviour
{
    public Transform transformToMove;
    public GameObject JetFlame;
    public float speed;
    public bool takeOffLand = false;

    private Animator[] animators;
    private bool takeoffland = false;

    private void Start()
    {
        TurnAllAnimtorsOff(transform, false);
    }

    private void Update()
    {
        if(takeOffLand)
        {
            if(takeoffland == false)
            {
                TurnAllAnimtorsOff(transform, true);
                JetFlame.SetActive(true);

                takeoffland = true;
            }
            TakeOff();
        }
        else
        {
            Land();
        }
    }

    private void TakeOff()
    {
        takeoffland = false;

        float step = speed * Time.deltaTime;
        var v3 = new Vector3(transformToMove.localPosition.x, 7, transformToMove.localPosition.z);
        transformToMove.localPosition = Vector3.MoveTowards(transformToMove.localPosition, v3, step);
    }

    private void Land()
    {
        float step = speed * Time.deltaTime;
        var v3 = new Vector3(transformToMove.localPosition.x, 0, transformToMove.localPosition.z);
        transformToMove.localPosition = Vector3.MoveTowards(transformToMove.localPosition, v3, step);

        if(takeoffland)
        {
            TurnAllAnimtorsOff(transform, true);
            JetFlame.SetActive(true);
        }
    }

    private void TurnAllAnimtorsOff(Transform root, bool onOff)
    {
        animators = root.GetComponentsInChildren<Animator>(true);

        foreach (Animator a in animators)
        {
            if (onOff)
            {
                a.enabled = true;
            }
            else
            {
                a.enabled = false;
            }
        }
    }
}

sentences:
Black screen when building apk Unity Alright, I have a bit of a confession to make: I accidentally posted this question in the wrong place: Stack Overflow. Whoops. Anyway, here's my problem. Sorry if you've seen this before. Here's the original post.

I've been struggling with this issue for a few days now. Windows builds for my game work fine, but when I build it to Android, it loads, shows the "made with Unity" screen, then fades to black. Now, I know the next scene (an animated logo) is running because it is playing the audio in real time. However, nothing in the scene is visible. Then, the UI for the in-game loading screen appears. Normally, the game would then load, and it does, but again, the camera thinks there are no sprites in the scene. I can still play the game, and the audio sounds just normal, but I can't see. Then, when I die, the game-over UI appears, and I can use it as normal. The shop-menu works absolutely fine, but the game itself does not. It's as if Unity decided that all SpriteRenderers in the game just didn't exist, and that the camera background color was now black. There are no scripts or animations causing this directly, as it does work in editor and on a PC build. The game also works fine using Unity remote, but the build has the issue. I also made sure that none of the textures were too large for Android (to the point where not one of them is larger than 256x256, which looks terrible but proves a point).

Now, before anyone asks, yes, I have seen the other question on this topic, and no, sadly, it did not help. My camera is set to "solid color", not "don't clear." I tried "skybox" too, just to be safe. I have also tried disabling post-processing, hoping that Android was just unable to handle it. It did nothing. I have even tried entirely disabling all of the sprites in the scene, but even then, the background is still black, indicating that the camera is still not playing nice. Also, here is a screenshot showing the quality settings for the Android build.

sentences:
Find a line that connects the outer most points in a set of points Does anyone know an efficient algorithm to find the edge of a point cloud? Hopefully the picture in the link can illustrate what I mean. It's a plus if the algorithm can handle point clouds that are distinctly separated in space. The algorithm only needs to work in 2D.

Many thanks!!

http://uploadpic.org/storage/2011/4n68m1OYLSYIGt8vfuJrK1LnA.png

sentences:
Finding translation component of a 4x4 matrix inverse I have 4x4 matrix (A) (maya softw):

|Xx Xy Xz 0| - basis of X and dummy 0
|Yx Yy Yz 0| - basis of Y and dummy 0
|Zx Zy Zz 0| - basis of Z and dummy 0
|Tx Ty Tz 1| - Position x, y, z and dummy 1

In this case, I know there is no scaling or sheer, so the upper-left 3x3 portion is a pure rotation matrix. That means I can invert this portion by taking the transpose.

So inverting the matrix should give me something like this:

|Xx Yx Zx 0|
|Xy Yy Zy 0|
|Xz Yz Zz 0|
|T? T? T? 1|

But I don't know how to find the T? values that correctly invert the translation component of the matrix. It's not just the inverted position (T-1)

My thinking so far:

Matrix of an untransformed object at the origin - (I - identity):

| 1  0  0  0 |
| 0  1  0  0 |
| 0  0  1  0 |
| 0  0  0  1 |

Matrix of a translated object (Tx=3, Ty=4, Tz=5) (A):

| 1  0  0  0 |
| 0  1  0  0 |
| 0  0  1  0 |
| 3  4  5  1 |

Inverse matrix of A (A'):

| 1  0  0  0 |
| 0  1  0  0 |
| 0  0  1  0 |
|-3 -4 -5  1 |

Matrix of translated and rotated(Y=90) object(B):

| 0  0 -1  0 |
| 0  1  0  0 |
| 1  0  0  0 |
| 3  4  5  1 |

inverse matrix of B (B'):

| 0  0  1  0 |
| 0  1  0  0 |
|-1  0  0  0 |
| 5 -4 -3  1 |

Strange things start to happen when you take two differently-rotated matrices with the same translation and you get different inverse translations!

It seems like some dot product is involved in the translation calculation.

sentences:
Is there any way to make xTile work with MonoGame? I am currently in the process of planning and developing a game. I use MonoGame as my framework, and I also planned to use xTile with tIDE to manage my tiles, but it only works with XNA 4.0, but my project (of course) only references the MonoGame.Framework and not the Microsoft.Xna.Framework, which means that some classes are defined in assemblies which are not referenced.
I know MonoGame is a continuation of Xna, but as the Assembly has a different name/ID, xTile of course doesn't recognise it.
Is there any way to support xTile when using MonoGame? If there isn't, is there any alternative to xTile?

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:
Collision Detection in Java for a game Im making a game in Java with a few other people but we are stuck on one part of it, making the collision detection. The game is an RPG and I know how to do the collision detection with the characters using Rectangles, but what I dont know how to do is the collision detection for the maps. What I mean by that is like so the character cant walk over trees or water and that stuff but using rectangles doesnt seem like the best option here.

Well to explain what the game maps are gonna look like, here is an example:

Now I could use rectangles to get bounds and stop the player from walking over the trees and water but that would take a lot of them.

But is there another easier way to prevent the player from walking over the trees and obstacles besides using Rectangles?

sentences:
Slick UnicodeFont displays in different location depending on the screen size? I am using the Slick2D library to draw text. The text draws perfectly, however it is in the wrong location!

I could easily draw it in the correct location, however the problem is that the "correct location" is very different depending on the size of the screen - And my game needs to be able to have the screen size changed.

Here is the render method for the text:

 public static void render() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);
    glUseProgram(0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glMatrixMode(GL_PROJECTION);
    glLoadMatrix(orthographicProjectionMatrix);
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    glLoadIdentity();
    glDisable(GL_LIGHTING);
    font.drawString(0, 0, "OMG ITS TEXT!", Color.green);
    glEnable(GL_LIGHTING);
    glPopMatrix();
    glMatrixMode(GL_PROJECTION);
    glLoadMatrix(perspectiveProjectionMatrix);
    glMatrixMode(GL_MODELVIEW);
}

So, how can I set the text to be in the middle of the screen irrespective of screen size?

Thanks!

sentences:
Obscure primitive data types against cheating im trying to create lightweight value obscurer, against possibility to blatantly change primitive values in memory editor. Such as cheat engine. Here's what i have to far.

/// <summary>
/// Obscure for type int.
/// </summary>
public class ObscuredInt{

    public ObscuredInt() {
        this.value = 0;
    }

    public ObscuredInt(int value) {
        this.value = value;
    }

    private int _a;
    private int _b;

    /// <summary>
    /// Current obscure value.
    /// </summary>
    public int value {
        get {
            return _a + _b;
        }
        set {
            _a = Random.Range(int.MinValue, int.MaxValue);
            _b = value - _a;
        }
    }
}

usage

ObscuredInt health = new ObscuredInt(5);
health.value = 10;

printInConsle(health.value);

This works by simply never storing actual value, but rather a combination of two integers, which sum represents the value. That way the value is actually never cached long time in the memory. So finding it in a primitive way using cheat engine is not possible.

My question

I've seen other examples of obscuring, which involve conversion to binary or string hashing or other quite heavy operations.

This example is of course much more lightweight, how is this example worse than more advanced hashing or conversions. What flaws do you see with this example? What can you suggest?

Thank you

sentences:
which quarter of a triangle the point is in I've got a world made out of squares. The square are devided in four triangles like this:

The corners have their heights stored in a 2D array and the center height is the average of the corners. To calculate the players Y-coordinate I have to know in which triangle he is standing on. How can you calculate in which quarter the player is by the X and Y coordinates?

EDIT:

My algorithm:

bool h1 = false, h2 = false;

if(posZ < posX - posZ) //something weird going on here
{
    h1 = true;
}
if(posX < posZ - posX) // and here
{
    h2 = true;
}
if(h1 && h2)
{
    triangle = 0;
}
if(h1 && !h2)
{
    triangle = 1;
}
if(!h1 && !h2)
{
    triangle = 2;
}
if(!h1 && h2)
{
    triangle = 3;
}

This algorithm tries to find in which triangle you are. There is something wrong in that math.

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:
What data should a generic collision detection system gather? I'm working on a relatively generic 2D AABB collision detection system for a game engine, and I've re-written it more times than I'd like to admit, due to not calculating or recording specific details of each collision. Right now, this is what I'm collecting:

Collision time as a fraction of an update cycle in the game loop.
Location of the collision.
ID of the colliding object.

Each object has a Set that holds this data for each collision (I'm working with a component/entity system) so other systems can use the recorded data. The problem I just ran into was that I needed to know which side of the object the collision takes place on.

What other values or points of interest should I calculate or record, per collision? What do you look for in a standard collision detection system?

sentences:
Platformer Crouching problems I'm trying to implement a crouching system to my 2D platformer. The problem is, I don't want the character to be able to do anything else except jumping when it's crouching. I have many functions but I think posting the movement function here would be enough. When I gain velocity and then press crouch, I skid across the platform, and stop.
First, my crouch function:
private enum State { idle, running, jumping, falling, crouching}

    void Update()
{
    //crouch
    if(Input.GetButton("Crouch"))
        {
        animator.SetInteger("state", 4);
        Crouch();
        }
    else
    {
    boxCol.size = new Vector2(0.5454721f, 1.8065f);
    }
}

 void Crouch()
{
    boxCol.size = new Vector2 (0.6933689f,1.44953f);

}

And here is my movement function. I tried to fix it by adding the if condition on top of it, but when I run and crouch, it slides a lot before stopping. What can I do to fix that? The character already has a physics material with zero friction. I know I can make the velocity zero if the player is crouching but that would just kill the gameplay. I need to add a smooth stopper. I'm not sure how to make a decelerating script and use it in my case.
public void Move()
{
     if(animator.GetInteger("state") != 4)
     {
            float x = Input.GetAxis("Horizontal");
            float moveBy = x * speed;
            rb.velocity = new Vector2(moveBy, rb.velocity.y);
                if (x > 0f)
                {
                transform.localScale = new Vector2(1, 1);
                isRight = 1;
                isLeft = 0;

                }
                else if (x < 0f)
                {
                transform.localScale = new Vector2(-1, 1);
                isLeft = 1;
                isRight = 0;
                }

    }
}

sentences: Blender How to unlock transform on bone I was trying to create IK constraint following a Nathan Vegdahl tutorial, and everything was nice and shiny, until i tried to actually move a bone. It's not moving, only rotating. I see that transform lock panel on location is grey and completly locked, and i have no idea what's wrong.

sentences:
Fixed timestep updates with a variable timestep update Many suggest that a game loop looks something like this. See:

http://gameprogrammingpatterns.com/game-loop.html

http://www.koonsolo.com/news/dewitters-gameloop/

https://gafferongames.com/post/fix_your_timestep/

while (1) {
    lag += Chronograph.getDelta();
    while (lag >= msPerTick) {
        update(msPerTick);
        lag -= msPerTick;
    }
    render(lag);
}

However, is it equally viable to have a game loop as follows?

while (1) {
    lag += Chronograph.getDelta();
    while (lag >= msPerTick) {
        update(msPerTick);
        lag -= msPerTick;
    }
    update(lag); // 0 <= lag < msPerTick
    lag = 0;
    render();
}

I'm posing this question because my game should only be drawing sprites in the render call. Everything else should be handled by updates, particularly when sprites advance frames. In other words, the logic for advancing sprite frames should be handled by updates and rendering shouldn't have any affect on the state of my sprites.

sentences:
Issues with events changing game state I am currently experimenting with creating a turn based game using Unity and am trying to come up with a sensible architecture for structuring my game systems.

So far I have decided to base everything around Game states. A game state represents a sort of "mode" of the gameplay, for instance "Select unit state" or "Game over state". A global game state manager holds a stack of these game states and can be called with pop (remove top game state), push (push the provided game state onto the stack) and replace all (pop all existing game states and push provided game state). Update is called on the top most element of the stack every logic frame.

I also have Entities which exist on the scene and represent stuff like as game units, terrain, projectiles etc. These are standard gameObjects with behaviors, unity lifecycle etc.

Finally there are a bunch of services which provide methods to handle stuff like menus and camera.

The idea is that the game states handle the "logic" of the game such as player input, transitions between game states, calling the services and controlling/modifying entities.

I also use events to facilitate the communication between state, entities and systems to avoid coupling too much. These events are stuff like "Unit destroyed" and "Objective complete" which are listened to usually by entities, calls to move the camera, create entities and such are still called normally using the relevant service methods.

Whilst this system works in theory I am having some issues with the interactions between events and game state logic. Consider the following:

Update of performActionState:

void update() {
  // Do something.
  Messanger.fireEvent(EventType.ACTION_COMPLETE);
  GameSystemManager.pushState(new NewTurnState());
}

Objectives system listening for action complete:

void handleActionComplete() {
  if (checkObjectivesAllComplete()) {
    GameSystemManager.pushState(new GameCompleteState());
  }
}

What I want to happen is for the objectives system to push a game complete state and finish the game. What actually happens is that the handle action complete pushes the game complete state, the rest of the perform action state update runs and a new turn state is pushed.

The above example might be a bit simplistic but I see this as an underlying issue with my architecture. Most events would be fired due to a change in the state of the scene or completion of something, for instance a unit being destroyed or a unit entering a trigger area. The probability of the game logic needing to change state from the game states is quite high in these cases usually.

I could easily fix the above sample in a number of ways, for instance I could move the checking of objectives into the start of NewGameState and invoke a pushGameState there instead to end the game but all the ways I can think of at the moment seem like hacks which will greatly increase coupling (New game state doesn't need to care about objectives) and code spaghetti.

Any advice for ways I could potentially architecture around issues like this?

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:
Calculating the illumination level of an object In my (UE4) scene I have an object and several (point) light sources. The object can move around, getting closer and away from all those light sources. Now I need to calculate for each light source how much it affects the object at its current position (i.e. distance from the light).

Every light source has three important values:

Intensity: How bright the light shines (integer vlaue 0..10000)
Attenuation: Radius around light, how far it visibly influences the scene
Falloff exponent: Radial falloff around light (inverse squared by default, or can be an integer between 2 and 8)

Now, depending on how far the object is from a light source, it is more or less affected by the light. If the object is outside the attenuation radius, it is not affected at all by the light. I am not so much interested in the light intensity, but more in the distance between the object and a light.

For each light I am interested in a value between 0 and 1. So the easy way would be to simply calc: 1 - distance / attenuation. But I would like to take the falloff exponent into account. Any ideas how to accomplish that?

sentences:
AI using character controller makes unwanted change to it's y position The enemy parent object does not have any colliders except for the character controller. It starts out with y = .57 and immediately jumps to y=1.6355 because of my call to CharacterController.Move(.)

A code snippet is as follows:

myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(targetPos - myTransform.position), rotationSpeed*Time.deltaTime);
Vector3 forward = myTransform.TransformDirection (Vector3.forward);
character.Move (forward * moveSpeed * Time.deltaTime);

The above occurs in my update function. I am reluctant to post more code because this is for an assignment.

I feel like I've tried everything. Using rigidbodies, I fixed this problem but then the enemies began to overlap when they got close. So I reverted back to character controllers. In either case I have been trying different ways of keeping y constant, freezing it, making the y rotation component zero, you name it.

One other thing I'll note is that the enemy moves to this y position regardless of where it is initially placed. My main character also starts a distance in the sky and falls down. It so happens that the y position it ends up is this same one that the enemy teleports to.

EDIT: Also I am on Unity 5.2
EDIT 2: This is for a script I use to make the AI follow my player. It is similar to many you will find just googling, because I based it off of those. I have even tried other people's scripts and had the same problem.
EDIT 3: If I put the enemy lower to the ground (say y=.55) he will not pop up like before. However, he doesn't move toward the player anymore.

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:
How can I acheive a smooth 2D lighting effect? I'm making a 2D tile based game in XNA.

Currently my lightning looks like this.

How can I get it to look like this?

Instead of each block having its own tint, it has a smooth overlay.

I'm assuming some sort of shader, and to pass the lighting values for the surrounding tiles to the shader, but I'm a beginner with shaders so I'm not sure.

My current lighting calculates the light, and then passes it to a SpriteBatch and draws with the tint parameter. Each tile has a Color that is calculated before draw in my lighting algorithm, which is used for the tint.

Here is an example on how I currently calculate lighting (I do this from left, right, and bottom too, but I got really tired of doing this frame by frame...)

So actually getting and drawing the light so far is no problem!

I have seen countless tutorials on fog of war and using gradient circular overlays to create smooth lightning, but I already have a nice method to assign each tile a lightning value, it just needs to be smoothed between them.

So to review

Calculate Lighting (Done)
Draw Tiles (Done, I know I will need to modify it for the shader)
Shade tiles (How to pass values and apply "gradient)

sentences:
NavMeshAgent is not calculating a new path I have the following code that gets run when a game object collides with a trigger. When the object is created, it is created within an initial trigger which fires the SetNextWaypoint code below and it works fine.

protected NavMeshPath path;
protected NavMeshAgent agent = null;

void Start () {
    path = new NavMeshPath();
    agent = GetComponent<NavMeshAgent>();
}

public void SetNextWaypoint(Vector3 location){
    agent.ResetPath();
    path.ClearCorners();
    agent.CalculatePath(nextWayPoint, path);
    agent.SetPath(path);
}

Once the agent enters a new waypoint (it may not have reached its destination yet) SetNextWaypoint is called again and when it does the agent just stops where it is, and doesn't move anywhere.

sentences:
Making smooth walk/jump/fly etc animations i am soon gonna start with developing my own game for the iOS, i have the plan and idea of the game ready. BUT i have 1 question. How do people make such a smooth animation? Lets take for example: Angry Birds, if you pull on the rope to shoot the bird everything looks so smootthh or take Tiny Wings for example.., how did they make this? Did they made an image for every frame of the animation in photoshop and putted it in a plist? or how?

Ty in advance!

sentences:
Rotation pitch/yaw reverse problems when picking a tile (2.5D) Set-up: 3D world, isometric sprite rendering (4 fixed angles).
This transform matrix is used as camera:

 _transform =
            Matrix.CreateRotationZ(Roll) *
            Matrix.CreateRotationX(Pitch) *
            Matrix.CreateTranslation(new Vector3(-cameraPosition.X , -cameraPosition.Y, -cameraPosition.Z))* //this matrix controls camera position
            Matrix.CreateScale(new Vector3(_zoomScale)) * //scale representing zoom level. This one applies to the textures too
            Matrix.CreateScale(new Vector3(_textureScale)) * //world scale to fit current texture pixel size.
            Matrix.CreateTranslation(new Vector3((_port.screenWidth / 2) - TileOffset, _port.screenHeight / 2, 0)) //offset for having focus in center of screen instead of top left corner + little offset so it will be a tile center
            ;

Roll=-45, Pitch=60. Result:

I've hoped to find a quick picking solution in the inverse matrix:

_inverseTransform =
           Matrix.CreateTranslation(new Vector3(-(_port.screenWidth / 2) + TileOffset, -_port.screenHeight / 2, 0))*
            Matrix.CreateScale(new Vector3(1/_textureScale)) *
            Matrix.CreateScale(new Vector3(1/_zoomScale)) *
            Matrix.CreateTranslation(new Vector3(cameraPosition.X, cameraPosition.Y, cameraPosition.Z))*
            Matrix.CreateRotationX(-Pitch)*
            Matrix.CreateRotationZ(-Roll)
            ;

It doesn't work as expected.
If i remove rotation from matrix build, everything works. The interesting part is if i leave roll component only, everything works too.
I've tried transposed matrices, inverted matrices, rotating on -angle, FromPitchYawRoll matrix (inverted/transposed/-angles). Every time roll works, pitch and yaw aren't.
Pitch only/yaw only can't be inverted too.

It's probably something basic in the matrix math/rotation principles, but i'm failing to grasp it. Any help would be appreciated.

--code removed, not relevant to the case--

Some gifs for better understanding.
Current implementation do this:

If we switch the pitch off, inverse matrix work as intended (white dots mark real tiles grid. Graphical tiles aren't rotated, of course.)

EDIT:
After some matrix calculations i've realised simple thing. Let's point the mouse on the tile (0,2). If i dump all transformations but pitch by several degrees, then tile (0,2) will be drawed somewhere on (0, 1.25).

But if i'll apply inverted (or transposed, or "rotate by -value") matrix to the mouse position (0,2), i'll get same (0, 1.25), which means that the mouse is pointing at (0,1) tile. While it should point at (0, 3). And i don't know how to invert this correctly.

I've also discovered this. But, as you can see in the first answer, knight666 is using scale instead of pitch rotation.

sentences:
Masking cameras for Voronoi splitscreen I would like to mask a camera to only render to a certain (non-square) region of the screen, to be used as an overlay, for splitscreen, or any other application.
The goal is obviously to prevent any unnecessary rendering from that camera, so I specified performance, but I'm also happy to hear the easiest to implement option as well.
What I'm considering so far:

Stencil shader on a mesh in front of the camera - but my understanding is that doing so would require modifying all shaders on world objects, which isn't ideal. Is there an easier way I'm missing?
Transparent mesh with a cutout - I could cut out a hole in a mesh and the solid part would block rendering of objects behind it, but I'm not sure how to make that part be transparent so other things can render

I'm using Unity 2019 LTS and the built-in render pipeline
I feel like there must be a simple answer I'm missing but maybe I'm wrong?

sentences:
GLSL blur shader algorithm results in a lumpy blur? I'm writing a Gaussian blur shader and it's coming along pretty well. However, when I run it on a circle, the result is lumpy.

I'm using a simple nested for loop to create the blur. Here's the code in it's current form:

int samples = 10;
int sampledist = 1;
float rt_h = 720; // render target height
float rt_w = 1280; // render target height

vec4 effect(vec4 col, Image tex, vec2 texcoord, vec2 screencoord)
{
   vec3 final = vec3(1.0, 0.0, 0.0);
   final = Texel(tex, texcoord.xy).rgb;
   for (int i=-samples; i<samples; i++)
   {
      for (int j=-samples; j<samples; j++)
      {
         final += Texel(tex, texcoord.xy + vec2(i*sampledist, j*sampledist)/vec2(rt_w, rt_h)).rgb * .01;
      }
    }
    return vec4(final, 1.0);
}

(Note: I'm using a variation of the regular GLSL language for Love2D, so the above code isn't completely valid GLSL shader code)

What is wrong with my algorithm?

sentences:
How does this formula for generating water waves work? I have been trying to implement the wave equation described in this paper ("Water Simulating in Computer Graphics," Kai Li and Liming Wu) in Java. Part of the paper discusses modeling waves as a sum of sine waves ("sine wave piling"); in that section there an equation for describing a single sine wave:

Y（x，y，t）= A * cos（w *（x，y）+ wt * t + FI;

where

A = amplitude of wave
L = wave length
w = spatial angular frequency
s = speed
wt = temporal angular frequency
d = direction
FI = initiatory phase

I understand that it returns a vector, but I don't see what this section of the formula means:

w *（x，y）

I believe that w is a vector, but I'm not sure if it's a 3D vector or 2D vector, and how it is used. If you have time, could you please explain this formula to me?

sentences:
How should I design my classes in a game? I'm stuck for ideas on classes in game programming. This is probably more of an opinion based question. I'm looking for information that is proving hard to find on the internet.

Say I have a class called  Bullet or Mob, the name doesn't really matter it's just an example. With this, there are two options I can think of.

Have the class purely as a way of storing data and nothing else. So I could have, for example, properties such as EntityID, Velocity, HealthPoints, NumberOfAttacks.
I would then have some other part of the game which iterates through every instance of every object and update the properties from there.

Example: During the iteration, it checks what type of object it is, such as Bullet etc. Once it has checked this, it will calculate where the bullet should move to next based upon the Velocity property.
Or, have the same properties within the class, but also have all the code for updating it's own properties in there too. Example: The bullet has some kind of Update() method which get's called periodically by the game engine. This Update method would then take it upon itself to calculate the new Velocity and update it's position etc.
Some combination of the both? Something else I haven't thought of?

Which of these options is the more commonly used approach in game programming? What are the benefits or disadvantages of these different methods?

Have I got it all completely wrong?

sentences: How do I add materials to a glTF model in Godot Engine? I'm using glTF Embedded files because I was told they are the best files to use with Godot, so I got a pack of a bunch of really lovely trees and other things to use in my game. But when I import it, it has all the materials on the side with the base being completely white. I know how to add textures onto things but it seems there is no way to add anything to the model? How would I use these materials then? Is this my fault or the model creator's fault?

sentences:
How do I draw a tilemap within unity3d? I'm pretty new to Unity and after a bit of googling around I have come up with this code to draw my tilemap (the script is attached to my camera).

I am simply trying to use nested for-loops to draw a grid of grass tiles, here is my code:

public class DrawMap : MonoBehaviour {

    // Use this for initialization
    void Start () {

        Sprite grass = (Sprite)Instantiate(Resources.Load("Grass"));
        float x, y;

        for (int i = 0; i < 20; i++) {
                        for (int j = 0; j < 20; j++) {
                            x = i * 1.28f;
                            y = j * -1.28f;
                            Instantiate(grass, new Vector3 (x, y, 0f), Quaternion.identity);

                        }
                }
    }

    // Update is called once per frame
    void Update () {

    }
}

I keep getting an error where I initialize "grass" saying the it cannot cast the source type from the destination type. I created "grass" to be a prefab from a slice of a spritesheet that i imported.

Any help would be greatly appreciated

sentences:
Which key bindings to use for switchable primary and secondary attacks? I am making a game in which the player can have a primary and secondary weapon (like an ability). These are my current planned key bindings:

 Action | Effect
-----------------
 Click  | Shoot primary weapon
 WASD   | Move
 Space  | Use ability (secondary weapon)
 Q      | Previous primary weapon
 E      | Next primary weapon
 ???    | Previous/Next ability (secondary weapon)

I am trying to think of a way to switch the secondary weapon. Here are some options I have thought of and why I have rejected them:

scroll wheel

some mice don't have scroll wheels

R / F

awkward, also primary weapon switch is horizontal and this is vertical

shift / ???

cannot think of another key

So, what is a good key binding for switching a secondary attack?

sentences:
What are pros and cons of Voronoi shatter? I have seen some Voronoi shatter videos on Youtube.

What is your experience with it?

What are the pros and cons in time complexity, resource complexity, implementation difficulty...?

Does it emulate how a real material would react?

sentences: Heightmaps on the GPU Originally I was doing all terrain calculations in a vertex shader and simple modifying the positions of the vertices from there. I would now like to use normal maps and I cannot think of any way of using these with this current method. So my question is: how can one create a heightmap (as a texture) on the gpu in a pixel shader? Thanks for any replies/suggestions.

sentences:
Tower Defence game scoring system I am in the process of developing my first game on android mobile platform, it’s a tower defence game and I am currently busy designing the scoring system.

At the end of the stage when the user has defeated all the waves of enemies I want to take his score and somehow calculate a rating out of 3 Stars.

What will the best way be to calculate a score?
When should I increment the score during gameplay for example when an enemy dies?
And how do I calculate if the score is worth 1-3 Stars at the end of the stage?

Basically I want help or any ideas on how the formula should look like and how to calculate if the user scored a 1.. 2... or 3 Stars.

My variables in game :

Every enemy has a value:   Example $5

The stage has a number of life’s before you are defeated: Example 20

Each stage starts with money that you buy your towers with: Example $120

Each towers costs money:  Example $30
A stage can consist of 1 or more waves of enemies.

Any help or ideas would be appreciated as I am new to game development….

sentences:
Discover x,y coordinates given set arc distance and rotation I have a turn-based car simulation.  My vehicles have a maximum speed they can travel in a round, as well as a maximum amount they can change their heading over the course of a round.  Say, 20 meters and 45 degrees.

Knowing the starting position of a car (x,y coordinates), and its starting heading (orientation), I want to find the end-of-round coordinates for the car turning its maximum amount and moving its maximum speed.  (And values in-between, as well!)

There has to be some simple math formula for this, but I haven't found it yet.  I also happen to be working in Unity.

sentences:
How to make a simple HUD with no library I am writing a simple game in c++ using opengl in a windows system.

I have the scene and I need some informative text to appeared to the left top/bottom of the screen

I am printing these messages with a little plane and the text on it, but I want them to be aligned at the corners of the screen.

So I've read this question here and I thought it seemed quite good and closer to my needs.

So, this is some of my code already used:

In init function of openGL:

glShadeModel (GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glClearDepth(1);
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);

In the Resize function:

if (window_height == 0) window_height = 1;
glViewport(0, 0, window_width, window_height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, (float)window_width/(float) window_height, 1.0, 550.0);

And finally in the render function:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -250); //is used for making the scene visible
RenderScene();
glutSwapBuffers();

I've tried using the ready3D() and then RenderScene() functions but the scene looked a lot different to what I was aiming.

How can I achieve this simple HUD (printing messages aligned to the window's corners)?

Edit #1:

This is what I see (terrain and message below):

I want the message to be aligned at the bottom left corner as well as other messages.

sentences:
Java 2D - Cannot get code to work for generating points for a line with a start point and Angle I am developing a Java 2D video game.  I am trying to write code to generate points for a line (actually a projectile path), at a specified angle, from a given start point.  There seems to be something wrong with my Math.  The points are to be used for moving a projectile from the top of the screen, towards the target (a submarine) which sits at the bottom.

I am suspicuous issue has to do with fact the origin of Java 2D coordinate system is 0,0 at top of the screen, not at bottom left for cartesian coordinate system.  Note: I am not a Math person.  So please excuse me if I am getting the terms wrong.

Here is what I am doing:

xloc, yloc - the initial location of the projectile I want to move towards the sub location

// Get slope of the line
float m= ((float)((int) yloc - subYcoord))/((int) xloc - subXcoord);

double radians= Math.atan(m);

double ycoord= yloc;
double xcoord= xloc;

int speed= 1;

// This is how I am attempting to generate the points for the path for the projectile to take

while (true) {

    xcoord += speed * Math.cos (radians);
    ycoord -= speed * Math.sin (radians);

    if (((int) ycoord)>= gunBaseYcoord) {

        break;
    }

    // WayPoints is my list of points to move the Projectile towards the sub at    bottom of the screen

    Point aPoint= new Point((int) xcoord, (int) ycoord);
    wayPoints.add(aPoint);
}

This does not seem to work for angles of 245 degrees.

As an example, if x,y are: 660, 35 (this would be my start point for the projectile), and subXcoord, subYcoord are: 169, 500

I get a slope of: -.947 (should be like: 245 degrees)

The radian is: -.758

I get degrees of: -43 (now this doesn't look right)

Appreciate any help with this!
Thanks!

sentences:
How to detect when the mouse is over a particular enemy collider, without falsely selecting bullet colliders? I have an enemy shooting around. My game mechanic involves hovering over the enemy with the mouse to drain its health. While the enemy is moving, you need to follow it with your mouse. If you don't succeed to follow it and the mouse leaves the enemy's collider, the enemy's health should be refilled.

The trouble is that the enemies' bullets have also a collider, and OnMouseOver acts weird when more colliders appear on top of each other.

How can I only select a particular Layer for the enemy to detect only that layer without acknowledging the bullets layer?

My Code so far:

public class FightDarkalls : MonoBehaviour
{

    [Header("Guidance Light On?")]
    public bool _guidanceLight = false;
    [Header("Target Settings")]
    public GameObject _monster;
    public GameObject _targetEffect;
    public Animator _TargetEffectAnim;
    public LayerMask _monsterLayer;
    int _layer;
    [Space]
    [Header("Damage Darkall")]
    public float damage = 0.1f;
    public float damageSpeed = 2.5f;
    [Header("OBJs to deactivate when Darkall dead")]
    public GameObject[] _deactivateOBJsOnDeath;
    [Header("Health Settings")]
    public GameObject _healthBar;
    public float startingHealth;
    public float health;
    public GameObject _deathDarkallParticle;
    //Animator
    private Animator _anim;

    Vector2 mousePosition;
    public LayerMask _interactLayer;

    private void Start()
    {
        _targetEffect.SetActive(false);
        _anim = GetComponent<Animator>();
        _TargetEffectAnim = _targetEffect.GetComponent<Animator>();
    }

    private void Update()
    {
        CheckIfGuidanceIsActive();

        _healthBar.transform.localScale = new Vector2(health, 1f);

        _deathDarkallParticle.transform.position = Vector2.Lerp(_deathDarkallParticle.transform.position, _monster.transform.position, 100f * Time.deltaTime);

        SetMousePosition();
    }

    void CheckIfGuidanceIsActive()
    {
        if (GameObject.Find("_GuidanceLight").GetComponent<FollowCursor>   ()._guidanceActivated == true)
        {
            _guidanceLight = true;
        }
        else
            _guidanceLight = false;
    }

    private void OnDrawGizmos()
    {
        Gizmos.DrawSphere(mousePosition, 1f);
    }

    private void OnMouseOver()
    {
        if (_guidanceLight)
        {
            //[DAMAGE]\\
            health -= damage * Time.deltaTime * damageSpeed;
            _anim.SetBool("TakeDamage", true);
            //Activate Target Effect
            _targetEffect.SetActive(true);
            _TargetEffectAnim.SetBool("OnDarkallOver", true);
            //Damage the target
            //Kills the target
            if (health <= 0f)
            {
                foreach (GameObject _dOBJs in _deactivateOBJsOnDeath)
                {
                    _dOBJs.GetComponent<SpriteRenderer>().enabled = false;
                }
                //Change Cam Shake to another OBJ
                GameObject.Find("Main Camera").GetComponent<CameraShake>().CamShakeEffect(0.1f, 0.5f);
                health = 0f;
                _deathDarkallParticle.SetActive(true);
                _deathDarkallParticle.GetComponent<ParticleSystem>().Play();
                _monster.gameObject.SetActive(false);
                Destroy(_monster.gameObject, 3f);
            }
        }
    }
    private void OnMouseExit()
    {
        _anim.SetBool("TakeDamage", false);
        //If failed to kill, reset health
        health = startingHealth;
        //Deactivate Target
        _targetEffect.SetActive(false);
        _TargetEffectAnim.SetBool("OnDarkallOver", false);
    }

    void SetMousePosition()
    {
        mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    }
}

sentences:
Tech Tree layouts for games? I'm trying to do a tech tree GUI for my game, but i have limited width and the tree has alot of branches, the problem is if I make them small to fit the width, the tech tree is too small to read.

For example the AOE one is very large (in width):

I could allow scroll bar but as its web based, scrolls are quite ugly. So i was wondering how to deal with branches which slowly cause the tech tree to get wider as you go down the tech tree and how you would fit such a design in a limited space.

Are there different known designs for tech trees that any one knows of so i can look at their types. I don't know the names given to the types of tech tree layouts. But am hoping to find one that is not overly complex for the user aswell.

sentences:
How to extend a line to infinity? In my game I have a line that simulates the trajectory of a gun shot, fired by the main character.
The line starts at the character and ends at the mouse position at the moment of the click.
What happens is that sometimes the click is before the target. So the line does not extend to the target. I wish I could extend the line, at least to the end of the room.
What happens:

What I would like to happen:

Line:
(x1,y1,x2,y2)

(obj.x,obj.y,mouse_x,mouse_y)

Attempt based on liggiorgio's answer:

sentences:
How do I efficiently display image tiles in Unity 4.3 free I previously wrote a TileEngine with SFML that I would like to port to Unity3D 4.3, but have not found a way to draw a tile on the screen programmatically in Unity.

All I am looking for something akin to SFML's RenderTexture(), and not a plugin or something from the asset store.

I am using Unity 4.3's new 2D tools/workflow, and as such need a method that will work with the 2d viewport.

sentences:
Behaviours: Should I always return a reference to the behaviour on its methods? I'm writing a small game to sharpen my programming skills, and I've chosen to use behaviors (that basically is a class that modifies its parent, to do things like movement, damage and stuff) to avoid duplicating code... maybe...

Whenever I need to modify the properties of a behavior, I need to get it from the "Actor", like this:

actor.getBehaviour(BehaviourType).method();

It's OK until I need to modify multiple properties, like following:

actor.getBehaviour(BehaviourType).method();
actor.getBehaviour(BehaviourType).setFoo(10);
actor.getBehaviour(BehaviourType).setBar("privet", "russian_hello");

Wouldn't that be more convenient if I just return a reference to the behavior on every method (every method needed)?:

actor.getBehaviour(BehaviourType).method().setFoo(10).setBar("privet", "russian_hello");

I apologize for any mistakes or broken logic (including broken grammar).

Thank you very much and have a nice day/afternoon/night/pokemongo/vim>sublime but i use sublime anyways!

sentences:
Push and damage player pawn when hit by rotating pawn? (UDK) I'm working on a game in which the player runs around a level themed as a pinball machine.  There are flippers that react to the presence of pinballs by flipping (as one would expect pinball flippers to do).  The problem that I'm having is that if the player is in the path of the flipper as it rotates, the player is instantly killed.  The desired behavior is that the player is damaged and pushed away from the moving flipper.

I've tried all sorts of things to make this stop happening.  Currently, in the flipper, I have the following code to handle the collision:

event Bump(Actor other, PrimitiveComponent otherComp, Object.Vector hitNormal)
{
    local vector pushVelocity;

    if(/*If Flipper is moving and is bump()ing the Player*/)
    {
        pushVelocity = hitNormal * CalcLinearVelocity(vsize(location - other.location));
        player.TakeDamage(playerDamage, none, player.Location, pushVelocity * 2.1f, class'DamageType', , self);
    }
}

By using all sorts of logging, I can determine that the code in question is being called when the flipper hits the player and the player is being killed on the first frame this collision occurs--logging within the if() block only appears once.  And yes, playerDamage is a value low enough that it would take many hits to kill the player.

Does anyone have any insight as to why the player is immediately dying instead of being damaged and pushed away?  Or what sorts of things I should try to get my intended behavior?

sentences: How do I convert a greyscale height map to .3ds format? I was given some height maps to use for game development, but they are in grayscale PNG format. How can I convert them to 3DS format?

sentences:
Am I allowed to name a game after some song? Just to ask a quick question, which I don't know where to ask: If I were to make a game, would I be allowed to call it "Buffalo Soldier [some more words]"? Since it's a song by Bob Marley I am not sure if this would get me into all kinds of legal trouble because of copyrights, which I obviously want to avoid.

By the way, the game doesn't have anything to do with Bob Marley or the music industry. I just thought a game about a buffalo soldier would be nice!

sentences:
Alpha From PNGs Butchered I have a pretty vanilla Monogame game. I'm using PNG for all my sprites (made in Photoshop). I noticed that XNA is butchering the aliasing; no matter what I do, my graphics appear jaggedy.

Below is a screenshot. The bottom half is what XNA shows me when I zoom in 2X using a Matrix on my GraphicsDevice (to make the effect more obvious). The top is when I pasted the same sprites from Photoshop and scaled them to 200%.

Note that partially transparent pixels are turning whiteish.

Is there a way to fix this? What am I doing wrong?

Here's the relevant call to draw to the SpriteBatch:

spriteBatch.Draw(this.texture, this.positionVector, null, Color.White, this.Angle, this.originVector, 1f, SpriteEffects.None, 0f);

(this.positionVector can easily be Vector.Zero; Color.White as 100% alpha, I think; this.Angle can be a real angle (small > in the image) or zero (the orb itself).

sentences:
DirectX sampling a Texture2DArray interpolates between textures unintentionally I'm trying to texture my procedurally generated terrain. Previously I used an array of textures e.g. Texture tex[8], however in the shader you can't access this by index unless you chain if statements (ew), so I switched to using a Texture2DArray where instead you use a 3D UV where the Z component is the texture index. I use texassemble to generate a DDS file containing the Texture2DArray so it can be loaded in with ease.
For whatever reason, DirectX(11) seems to interpolate the Z component whenever the Z changes, resulting in seeing a slice of other textures in the array. I should add I'm trying to change the texture on the same piece of geometry. But I need to do this due to having multiple procedurally generated biomes.

I sample the texture in the pixel shader like so
float4 texCol = Tex.Sample(Sampler, v.UV);

My sampler is set up like this
CD3D11_SAMPLER_DESC samplerDesc(D3D11_FILTER_ANISOTROPIC,
    D3D11_TEXTURE_ADDRESS_WRAP, D3D11_TEXTURE_ADDRESS_WRAP, D3D11_TEXTURE_ADDRESS_CLAMP,
    0.f, maxAnisotropy, D3D11_COMPARISON_NEVER, border, 0.f, FLT_MAX);

The unwanted interpolation in question

sentences:
How can I stop the ball from bouncing forever without changing the gravity? I am using Monogame in Visual Studio 2019 and I need to find a method to make the ball that I fired with the cannon stop after bouncing from the ground, and while doing this, I have to not change the gravity.

gravity = 10;
yFriction = 0.2;

    public override void Update(GameTime gameTime)
    {
        position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds;

        velocity.Y += gravity;

    }
    public void CheckBounce(SpriteGameObject other)
    {
        if (!this.CollidesWith(other)) return;

        CollisionResult side = this.CollisionSide(other);
        Bounce(side);

        // Relocating the ball if it's in the wall
        switch (side)
        {
            case CollisionResult.LEFT:
                position.X = other.Position.X + other.Width + this.Center.X;
                break;
            case CollisionResult.RIGHT:
                position.X = other.Position.X - this.Center.X;
                break;
            case CollisionResult.TOP:
                position.Y = other.Position.Y + other.Height + this.Center.Y;
                break;
            case CollisionResult.BOTTOM:
                position.Y = other.Position.Y - this.Center.Y;
                break;
        }
    }

    public void Bounce(CollisionResult side)
    {
        switch (side)
        {
            case CollisionResult.BOTTOM:
                velocity.Y *= yFriction;
                Stop();
                velocity.Y *= -1;
                break;
            case CollisionResult.TOP:
                velocity.Y = Math.Abs(velocity.Y) * yFriction;
                break;
            case CollisionResult.LEFT:
                velocity.X = Math.Abs(velocity.X) * xFriction;
                break;
            case CollisionResult.RIGHT:
                velocity.X = Math.Abs(velocity.X) * -xFriction;
                break;
        }
    }
    public void Stop()
    {
        if (velocity.Y <= gravity)
        {
            velocity.Y -= velocity.Y;
        }
    }

At this moment it puts it's velocity.Y to 0. But the problem is the gravity. After bouncing because it doesn't collides, it keeps adding velocity to the ball. As a result I printed out this variables:
After gravity adding
39.01105
After gravity adding
49.01105
After Friction
9.80221
After Stop
0
After bounce
0
After gravity adding
10
After gravity adding
20
After gravity adding
30
After gravity adding
40
After Friction
8
After Stop
0
After bounce
0
After gravity adding
10
After gravity adding
20
After gravity adding
30
After gravity adding
40
After Friction
8
After Stop
0

And keeps so on.
Thank you all in advance.

sentences:
How to serialize animation state? In Unity, I have an Animator on a character.
Upon saving/loading the game, I want to preserve the pose and animation state the character is in.
However, I can see no way to read/write all the data from the Animator/Animation Controller in such a way that I can store it in and retrieve it from a binary file.
Is there a non-obvious way to achieve this?

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:
Unity - Apply different Near/Far clip plane value for different layer I am Lerping the Near value of my camera, from 0 to 38, and it gives this result:
change near clip plane effect

As you see, it gives a nice effect. But now I would like the effect to occur only for one specific layer. How can I do that?

sentences:
Confusion with the texture coordinate system in XNA I am creating a cow out of primitive shapes, and am using the minecraft cow texture as a placeholder. To create the primitive model I have created a 'model' class and created a sub class 'ModelCow' which inherits from the Model class. Each model contains a List of the component class which is like a sub part of the model. In the creation of the components a texturemap for each component is created, which defines the locations of each texture foreach face for that cube in a texture map for that cow.

The way each texture is determined is the top left pixel of the texture and the bottom right, I had to go through each texture and find the top left x and y and divide them by the width and height respectily - the same thing with the bottom right. The thing is the textures are all one pixel off what they should be i.e it is shifted right too far or one pixel is missing. The question is what am I doing inncorrectly. Am I meant to start counting from zero when I get the x and y/ top and right coordinates for the texture. Also in this case the actual width and height of the texture and subtracted by one, i.e. 32 is 31 and 64 is 63

Example of what I am doing is:

AAAAAAAA

AAAAAAAA

A#AAAAAA

AAAAAAAA

the '#' would be 1, 2 and the width would be 7 and the height would be 3. Is this correct?

Here is the code:

    float width = 63f;
    float height = 31f;

    // Body
    TextureMap bodyMap = new TextureMap();
    bodyMap.Add(new Vector4(28f / width, 4f / height, 39f / width, 13f / height), FaceDirection.ZIncreasing);
    bodyMap.Add(new Vector4(40f / width, 4f / height, 51f / width, 13f / height), FaceDirection.ZDecreasing);
    bodyMap.Add(new Vector4(18f / width, 14f / height, 27f / width, 31f / height), FaceDirection.XDecreasing);
    bodyMap.Add(new Vector4(28f / width, 14f / height, 39f / width, 31f / height), FaceDirection.YDecreasing);
    bodyMap.Add(new Vector4(40f / width, 14f / height, 51f / width, 31f / height), FaceDirection.XIncreasing);
    bodyMap.Add(new Vector4(52f / width, 14f / height, 61f / width, 31f / height), FaceDirection.YIncreasing);
    components.Add(Shape.BuildCube(new Vector3(0, 0, 0), new Vector3(0.7f, 0.7875f, 1.30f), bodyMap));

Whereas the first two coordinates are the top left and the last two are the bottom right. X and Y respectively.

sentences:
Help understanding HLSL - newbie questions Just starting out with HLSL, please bare with me :)

There are times I'm a little confused by the syntax for instance in the pixel shader of an example I am following we have the following input and output:

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 Depth : TEXCOORD0;
    float3 Normal : TEXCOORD1;
};

struct PixelShaderOutput
{
    float4 Normal : COLOR0;
    float4 Depth : COLOR1;
};

PixelShaderOutput PixelShaderFunction(VertexShaderOutput input)
{
    PixelShaderOutput output;

    // Depth is stored as distance from camera / far plane distance
    // to get value between 0 and 1
    output.Depth = input.Depth.x / input.Depth.y;

    // Normal map simply stores X, Y and Z components of normal
    // shifted from (-1 to 1) range to (0 to 1) range
    output.Normal.xyz = (normalize(input.Normal).xyz / 2) + .5;

    // Other components must be initialized to compile
    output.Depth.a = 1;
    output.Normal.a = 1;
    return output;
}

Now one of the parts that confuses me is

output.Depth = input.Depth.x / input.Depth.y;

I'm confused because I thought Depth is a float4, which to my understanding is a 4-component vector. Doesn't input.Depth.x / input.Depth.y return a scalar value? What is happening in this assignment?

Secondly, and similarly

output.Normal.xyz = (normalize(input.Normal).xyz / 2) + .5;

Wouldn't normalize(input.Normal).xyz / 2 return a 3-component vector, with each element divided by 2? What does it mean then to add that 3-component vector to a scalar .5?

I feel like I'm missing something obvious here that I'll probably slap my forehead when someone points it out.

Also one more question - by the time the float4 Position arrives at the pixel shader from the vertex shader output, at this point are the coordinates in clip-space [-1,1] or are they still in camera-coordinates but with the homogeneous w-component (eg before the perspective divide) ? Is the w-component usually equal to the z-component?

sentences:
How can you tell if you are a large player on a large map or a small player on a small map? If everything is scaled by a constant factor, can you tell that the world is smaller or larger?

I think you could look down at the ground and see that it's "closer".
But how do you know what should be the correct distance? What visual clues give it away?

Edit: The player controller has an FPS camera!

sentences:
How can I make the loop only once when it's inside OnGUI? The script is EditorWindow type.

private void OnGUI()
{
var selections = Selection.objects.OfType<GameObject>().ToList();
        if (selections.Count > 0)
        {
            for (var i = selections.Count - 1; i >= 0; --i)
            {
                var selected = selections[i];
                transformSelection.Add(selected.transform);
            }

            TransformSaver.SaveTransform(transformSelection.ToArray());

            tempTransformSelection = transformSelection;
            transformSelection = new List<Transform>();
        }
}

When I select with the mouse a object in the Editor Hierarchy it will keep making the loop nonstop since selections.Count is large then 0.

I tried to add after the loop:

selections = new List<GameObject>();

But it didn't help.

I want that it will make the loop and the whole code inside the if (selections.Count > 0) only once each time when selecting one or more objects in the editor.

If I select one object make the whole code once if I then selected another more object make the whole code over again for the two selected objects and so on but make it once. Now it will keep making the loop over and over again even if I didn't select more other objects.

Since in the editor the first object is still selected it will keep making the code the loop over and over again.

This is what I tried:

var selections = Selection.objects.OfType<GameObject>().ToList();
        if (selections.Count > 0 && isSelected == false)
        {
            for (var i = selections.Count - 1; i >= 0; --i)
            {
                var selected = selections[i];
                transformSelection.Add(selected.transform);
            }

            TransformSaver.SaveTransform(transformSelection.ToArray());

            tempTransformSelection = transformSelection;
            transformSelection = new List<Transform>();

            isSelected = true;
        }

The flag boolean isSelected is global variable and set to false as init.

UPDATE what I tried:

var selections = Selection.objects.OfType<GameObject>().ToList();
        int currentSelectionCount = selections.Count;
        if (currentSelectionCount != lastSelectionCount)
        {
            lastSelectionCount = currentSelectionCount;
            for (var i = 0; i < currentSelectionCount; ++i)
            {
                var selected = selections[i];
                transformSelection.Add(selected.transform);
            }

            TransformSaver.SaveTransform(transformSelection.ToArray());

            tempTransformSelection = transformSelection;
            transformSelection = new List<Transform>();

            Selection.objects = new UnityEngine.Object[0];
        }

But when I select object in the editor in hierarchy it's immediately unselecting the object since the line:

Selection.objects = new UnityEngine.Object[0];

sentences: The recommended road map to be a good graphics/game engine programmer I am a computer science student and I am developing with C/C++ and Python and I want to begin learning graphics tools to start developing with game engines, especially the Blender Game Engine. So what is your recommendation for me to learn and to read? And recommend me a road map for it.

sentences:
How do I expose a variable from a class in Unreal Engine 4 to blueprints? I would like to expose to blueprints the variable CurrentTouchInterface in the class APlayerController, just like the method APlayerController::ActivateTouchInterface.

So, I'm guessing I have to change the header file PlayerController.h from this

/** The currently set touch interface */
UPROPERTY()
class UTouchInterface* CurrentTouchInterface;

To something like this

/** The currently set touch interface */
UPROPERTY(BlueprintReadOnly, Category="Game|Player")
class UTouchInterface* CurrentTouchInterface;

The point is, what do I need to do for the engine's editor to start showing the exposed variable CurrentTouchInterface in blueprints?

I'm working with UE 4.9 downloaded from the Epic Games Launcher application.

sentences:
Why would one have "waves" in each stage of a tower defense game? For example, in Plants vs Zombies, the zombies come in waves.  If I recall, there's always at least two waves. The first and easier wave and then when you get 90% through the stage there's a "final wave" which is shorter, harder, and has a bunch of zombies all come at once.

My question is, why would a game decide to announce when you change from one wave to the next?  They could have just let the level progress from start to finish without this if they wanted to.

Does this make the game more fun for some reason?  Where can I learn more about this technique (eg: does it have a name)?

sentences: Android multiplayer via bluetooth How do I transfer game commands between 2 android devices via bluetooth first of all is possible to do this??If possible then someone please help in doing so.Thank u

sentences:
Learning Web Development and Game Development at the same time? I'm a junior-level developer, currently working full time and trying to get experience with working with ASP.NET MVC. I love web development, and want to continue to pursue it as my career, but I also love gaming and have done a few game tutorials with Monogame/XNA, and love that as well.

For anyone that has been in this situation, Can you tell me, from experience, if you noticed any form of degenerative results when trying to split focus between a full-time career in another field and beginning game development? I am looking for concrete examples of people who managed to split their time, and what their experience was like. I'm concerned that if I focus on game development on my spare time, then my growth in web development might suffer. I hope to use your input to determine for myself, how I should split up my free time, and manage my "Extracurricular" web projects, AND game development projects, so that I don't end up as a jack of all trades, master of none. I don't know why this is such a hard decision for me. :(

sentences:
What should I keep in mind when developing a game to be multiplayer? I am making 2d game, and it will be a game where players can move on in a 2D world and there will be physics with projectiles and such.

So far, I don't have much, just a tile engine a few other things.

But this game is going to be fully multiplayer, and I've never made a multiplayer game before. Obviously I can't be making multiplayer as I develop the game, I kind of have to make it and then hope it works once I add multiplayer.

So my question is, is there anything I should keep in mind when developing this game to be multiplayer? I'm not asking, how to make it multiplayer, thats a whole other question. I just don't want to have to re-develope everything because I did something wrong that does not work with multiplayer?

Edit: Also, as a side question, do you have any advice on what general order to create the game, and when to add multiplayer?

sentences: LibGDX - i need an event like mouseMoved but it shouldn't care about which buttons are pressed Using ClickListener I have events like enter(), exit(), and mouseMoved(). But when I have any mouse buttons pressed, moveMoved() won't fire because that's how it works. There is touchDragged() but this will only fire if touchDown happened on Actor (or Actor's tap square). I'd like an event that would fire even if any mouse buttons was pressed outside Actor and his tap square, and keep firing each time mouse is moved over the Actor. How to do it?

sentences:
Multiplayer object interpolation Currently I'm participating in a multiplayer game project as a network developer. Unfortunately, however, I'm facing an interpolation problem which makes game objects look like they are 'jumping/teleporting' sometimes. Images don't look smooth compared to the server even if the client runs at 60 frames per second.

Things about the architecture:

Based on client/server model. server sends regular transform updates at every 33 milliseconds (30fps).
Client receives and stores position updates in a queue. then, plays them from 1 second behind using interpolation between each update.
Before processing the next packet, client calculates the sent time between current and next packet to find out how many milliseconds this interpolation should take. at every frame, it deducts the delta time from the interpolation time. so, if interpolation time reaches a number equal or less than zero, it iterates to the next packet (if the value is less than zero, it means that there is a time fragment. so the client also considers that time fragment for interpolation of the jumped packet at the same frame.)
Client doesn't deal with rigidbody; only position and rotation.

I'm using Unity3D's LERP method from the Vector3 class. Using SLERP didn't solve the problem.

Any ideas? Everything looks great on paper.

sentences:
How to make a character that moves like a slinky? I have a school assignment to make a 2D platformer game, with a character that moves like a slinky:

(Animated example from the assignment linked above)

At first, the character needs to grow in height over time
When the player presses a button, the character starts to bend toward the next platform
Its height when you press the button determines whether it will hit the next platform
After that it must shrink to its initial size, and it goes over again.

How can I approach this?

sentences:
How to design a replay system So how would I design a replay system?

You may know it from certain games like Warcraft 3 or Starcraft where you can watch the game again after it has been played already.

You end up with a relatively small replay file. So my questions are:

How to save the data? (custom format?) (small filesize)
What shall be saved?
How to make it generic so it can be used in other games to record a time period (and not a complete match for example)?
Make it possible to forward and rewind (WC3 couldn't rewind as far as I remember)

sentences: GLFW window becomes unresponsive when asking for input! I am trying to write a simple C++ game using OpenGL. In my render loop i ask for text based input from the user but this causes the GLFW window to become unresponsive. I suspect that this happens because the window does not like it when the main thread is paused from std::cin so it behaves weirdly. If i remove the input prompt the window behaves perfectly. Can someone confirm if this is the case and what workarounds are there to fix it?

sentences:
Getting into the details of game engine programming I am interested in learning game programming, but I really have an interest in the lower level engineering in games. I have OpenGL experience, and I am really interested in learning more about implementing AI, Physics, etc. I have a computer science degree, so I really like getting into technical stuff.

Many times when I ask about this sort of thing, I get a lot of "Use an engine", "Use Unity3d", "Why waste your time writing code that already exists", etc, etc. My idea was to use simpler libraries such as SFML or XNA so that I could learn how to implement the more complex systems.

The thing is, although I do want to write games, I want to learn things that using something like Unity simply doesn't teach you. My goal is not to make a current generation quality 3D game to sell, I just want to make some cool smaller games and learn all I can about the programming side of game development.

Is this something that people just do not do anymore?

It seems like everywhere I turn people are using Unity or UDK or GameMaker. I fully understand why you would use a tool like these, but I cant see how they would suit my purposes.

So where does someone like myself turn? Am I trying to learn something that people just do not bother doing anymore? Is the innovation in this area gone and just all about gameplay now?

I'm sorry if this question seems silly, but I am genuinely interested in knowing more about this and meeting more people who are interested in this sort of thing.

sentences:
How many database connection should use in a MMO game server? Game server links to database, how many database connection should use? The data update works like this:
update role object to database every X minutes, commit all updates every Y minutes.

There are 3 ways:

Only one database connection
One worker thread one database connection and set transaction level to "Read Uncommitted". Worker thread loop all roles in it to do update & commit periodically
One game session one database connection and set transaction level to "Read Uncommitted". A dedicated thread to loop all connections to do update & commit periodically

Method 1 has a problem which database connection object needs shared by multiple worker threads, for JDBC, connection class is thread safe, but I don't know what about C++ such as MySql driver. If it have to use mutex to make thread safe, there will be a performance degrade: all worker threads have to synchronize their data frequently.

Method 2 has a problem to update old data. One map in game server run in dedicated worker thread. For example, role A in map 1 which compute by thread 1. role A transport to map 2 which compute by thread 2. This might cause thread 1's commit call after thread 2's commit call, so the older update which already executed in thread 1 commit after thread 2's commit.

Method 3 seems is a waste of system resource. Because in MMO there is no need to be transaction isolation, any change in a game session should be immediately seen by other sessions. In contrast with web app, so many connections has litte meaning. However the "Read Uncommitted" isolation level can let other session read data which has not committed yet.

==================================

I forget there is a thing called connection pool. Generally it is thread safe implemented so I do not need to care synchronization problem anymore. And the connection number is dynamic so I can leave problem of how many connection number to it. Only I do is get a connection from it.
So, method 1 & 3 both practical.

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:
Unity 5 How Do I Set Text of Text Component of Input Field How do I set the text of the new Input Field's Built In Text UI Object in Unity 5+?

 myInputFieldText.text = "Text Value I Want";

The code above does not work to set the text inside of a InputField's Text. Thanks

sentences:
How to control an actor movement in UDK This might be very basic, but I couldn't find something relevant to what I need (see below). I am working on a very basic thing: a 3D environment with some buildings, and actors walking inside it. It looks like following:

I mainly want to manage to have one actor standing around, idling, and another walking around the area. Right now, this is done through matinee + skeletal mesh groups, and forcing a looped animation on the actors:

But I realize this is super caveman-level. So I've build an AnimTree, linking the idling and directional animations to the corresponding nodes. But then, I'm stuck. I added the AnimTree in the actors properties, but nothing happens. I've tried MoveToActor, but no success - is there a thing to set to allow an actor to move? Also, I place the actors on the map manually (they are supposed to be unique), should I spawn them instead?

Every tutorial I find explains how to use an AnimTree for the player character, which is not what I want. I need a way to move the actors. I tried to look for AI tutorials, but only found UT3 bots-modifications, which is not what I need either.

Since I have so much trouble finding how to do this through Kismet, I'm starting to suspect this has to be done through scripting/coding, but I would like to be sure there is no way to do it through Kismet before going that route.

Every bit of answer about how to tell an actor something along the lines of "go in that direction as much as you can, then when you hit a wall turn 45° and continue" would be awesome.

I'll be happy to move/edit the question if there is any problem with it

sentences:
My SFML sprite Move() function: FeedBack? Hey so I'm making a pong game with SFML and in the process made a function that takes a Time, Speed, Angle of movement, buffer for the movement on the X axis, and buffer for the movement on the Y axis.

I then implemented this function into my custom mySprite class, more specifically into it's update() function which updates its Position using the above function to calculate its new position.

However I'm worried that giving the function the FrameTime() of the Window (the time since the frame was last updated) is not the best choice as the sprites might start jumping around if there's lag between frame updates or other problems.....

Finally I would like to know how my organization, planning, etc is..  Thanks!

my UPDATED, WORKING Code:

   #include<SFML/Graphics.hpp>
#include<SFML/System.hpp>
#include<cmath>
#include<vector>
#    define M_PI 3.14159265358979323846

sf::RenderWindow Window;

template<typename T>
void CalculateMove(T Time, T Speed, T Angle, T& buffX, T& buffY)
{   //Make the degrees positive
    if(Angle<0) Angle= 360+Angle;
    //determine what quadrant of circle we're in
    unsigned int  Quadrant= 1;
    if(Angle>90)  Quadrant= 2;
    if(Angle>180) Quadrant= 3;
    if(Angle>270) Quadrant= 4;

    //anything above 90 would be impossible triangle
    Angle= (float)(Angle-(int)Angle)+(float)((int)Angle%90);

    // calculates x and y based on angle and Hypotenuse
    if((int)Angle!=0){
        if(Quadrant==2 || Quadrant==4) Angle=90-Angle; //The unit circle triangle is flipped otherwise, causing x and y to be switched
        buffY= sin(Angle / 180 * M_PI)/ (1.f/(Speed*Time));
        buffX= sin((180-Angle-90)/ 180 * M_PI)/ (1.f/(Speed*Time));}

    else{// Movement is a straight line on X or Y axis
        if(Quadrant==0 || Quadrant==2) buffX= Speed*Time;
        if(Quadrant==1 || Quadrant==4) buffY= Speed*Time;}

    //Quadrant Factor (positive or negative movement on the axis)
    switch(Quadrant){
    case 1: break;
    case 2: buffX=-buffX; break;
    case 3: buffX=-buffX; buffY=-buffY; break;
    case 4: buffY=-buffY; break;}
};

/////////////////////////////////////////   Mysprite    ////////////////////////////////
class mySprite : public sf::Sprite
{
private:
    float velocity;
    float angle;

public:
    // all the values needed by the base class sprite();
    mySprite(
        const sf::Image& Img,
        const sf::Vector2f& Position = sf::Vector2f(0, 0),
        const sf::Vector2f& Scale = sf::Vector2f(1, 1),
        float Rotation = 0.f,
        const float Angle= 0.f,
        const float Velocity= 0.f,
        const sf::Color& Col = sf::Color(255, 255, 255, 255)):
      Sprite(Img, Position, Scale, Rotation, Col){
        angle= Angle;
        velocity= Velocity;};

    float Velocity(){return velocity;};
    void SetVelocity(float newVelocity){velocity=newVelocity;};
    float Angle(){return angle;};
    void SetAngle(float newAngle){angle=(float)(newAngle-(int)newAngle)+(float)((int)newAngle%360);};

    void Update(){
        float frameTime= Window.GetFrameTime();
        float X=0,Y=0;
        SetRotation(angle);
        CalculateMove(frameTime,velocity,angle,X,Y);
        Move(X,-Y);
    };

    void Accelerate(float PPS){velocity+=PPS;};
    void Turn(float degrees){
        angle=(float)((angle+degrees)-(int)(angle+degrees))+(float)((int)(angle+degrees)%360);};

    void Reflect(float CollAngle){
        SetRotation(-GetRotation());
        angle=360-angle;
        //TODO: factor in the collision angle
    };
};

sentences:
How do I stop my gun from pointing at the player? I'm making a game where you shoot enemies in Unity, but I can't figure out how to stop the player from pointing the gun at himself.
I've tried detecting if the gun is on the left side of the player and if it's rotation on the z-axis is less than 0, but no luck

Here's the code for the gun:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GunController : MonoBehaviour
{
    public bool testbool;

    public Transform player;
    public CharacterController2D playercontroller;
    public float smoothness = 0.125f;
    public float winglength = 2;
    private Vector2 difference;
    bool facingright = false;

    public GameObject bullet;
    public int maxammo;
    private int ammo;
    private bool firing;
    public Vector3 bulletspawnpos;

    private SpriteRenderer sprite;
    public Texture2D normalGun;
    public Texture2D emptyGun;
    public GameObject emptyBottle;
    // Start is called before the first frame update
    void Start()
    {
        sprite = GetComponent<SpriteRenderer>();
        player = transform.parent.transform;
        ammo = maxammo;
    }

    // Update is called once per frame
    void Update()
    {

    }
    private void FixedUpdate()
    {
        firing = false;
        bool wasfacingright = facingright;
        if (Input.GetMouseButton(0) & ammo !>= 0 & !firing )
        {
            firing = true;
            Instantiate(bullet, transform.position+bulletspawnpos, transform.rotation);
        }
        if (player.transform.position.x - transform.position.x < 0)
        {
            facingright = false;
            sprite.flipY = false;
        }
        if (player.transform.position.x - transform.position.x > 0)
        {
            facingright = true;
            sprite.flipY = true;
        }
        if (wasfacingright != facingright) { playercontroller.Flip(); }

        difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
        float rot = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;

        Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition) - player.position;
        pos.z = 0;
        Vector3 desiredpos = player.position + (winglength * pos.normalized);
        Vector3 smoothpos = Vector3.Lerp(transform.position, desiredpos, smoothness);
        transform.position = smoothpos;
        transform.rotation = Quaternion.Euler(0, 0, rot);

    }
}

Before you point out that the ammo doesn't go down, just know I didn't add that for testing purposes.

sentences:
Is the "impossible object" possible in computer graphics? This may be a silly question but I want to know the answer to it. I saw this thing called the "impossible object", while they're many different images of this online, it's suppost to be impossible geometry.

Here is an example:

Now as far as logic goes, I know you don't have to obey it in games, such as a flying cow, or an impossible object. So that's out of the way, but what stands in my way is whether or not there is a way to draw this onto a 3D scene. Like is there a way to represent it as a 3D object? Thanks!

sentences:
Difference between using Tags and GetComponent I was implementing a basic "check if the player enter the trigger" behaviour and I get myself wondering about this question:

What the difference between this:

And this:

I guess it is a performance issue for using GetComponent every time? If not, I dont really see the point of using tags in this kind of checks.

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: Open GL ES 2.0 Android Texture,Shader, etc... loading I have gotten texture's to load along with shader's however it seems that I can only create shaders and textures in onSurfaceCreated in my implementation of the render interface. Is this truly the only place one can create shaders, textures, ...?

sentences:
how to handle the virtual Z axis in 2D games? I'm using this paper 2d framework of UE4 where a plane mapped with sprite texture is put in 3d world and therefore appears as 2D when viewed from sideways.

Its all good for games like NES mario where other than jumping you can only move along X axis.

However if you look at games like double dragon and Battletoads they have an isometric perspective and a virtual third co-ordinate axis which points outwards from the screen towards the player, you walk along this with d-pad up and down. It also works for objects in the scene such as a box or ladder which you can climb up and down along this axis, it also affects the game logic say like where your character's landing point would be when you jump.

how would you go about implementing this using 3d planes mapped to 2d textures without making some virtual co-ordinate system of your own?

sentences:
Getting the height of Keyboard on Android Hi I need to know the height of my keyboard so I can move up some textfield I have in my app. I'm using cocos2D-X but the app don't recognize the keyboardWillShow method.

Thanks

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:
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:
Calculating adjacent quads on a quad sphere I've been experimenting with generating a quad sphere. This sphere subdivides into a quadtree structure. Eventually I'm going to be applying some simplex noise to the vertices of each face to create a terrain like surface.

To solve the issue of cracks I want to be able to apply a geomitmap technique of triangle fanning on the edges of each quad, but in order to know the subdivision level of the adjacent quads I need to identify which quads are adjacent to each other.

Does anyone know any approaches to computing and storing these adjacent quads for quick lookup?

Also It's important that I know which direction they are in so I can easily adjust the correct edge.

sentences:
Why doesn't SDL2 recognize a game controller button press? SDL2 recognizes my PS4 controller but not the button presses. Here is a minimal code example.

#include <SDL2/SDL.h>
#include <stdio.h>

int main(int argc, char** argv) {
  if (SDL_Init(SDL_INIT_VIDEO) != 0 ) {
    printf("Unable to initialize SDL (%s)\n",SDL_GetError());
    printf("Exit\n");
    return -1;
  }

  SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);

  SDL_GameController *gameController = NULL;
  int numJoysticks;
  numJoysticks = SDL_NumJoysticks();
  printf("%d joysticks found\n", numJoysticks);

  if( numJoysticks <= 0 ) {
    return -1;
  }

  if( ! SDL_IsGameController(0) ) {
    printf("Error: joystick 0 is not a game controller\n");
    printf("Exit\n");
    SDL_Quit();
    return -1;
  }

  gameController = SDL_GameControllerOpen(0);

  if( ! gameController ) {
    printf("No game controller found\n");
    printf("Exit\n");
    SDL_Quit();
  }

  printf("Opened Game Controller 0\n");
  printf("Found a valid controller, named: %s\n", SDL_GameControllerName(gameController));

  if( SDL_GameControllerGetButton(gameController, SDL_CONTROLLER_BUTTON_A) ) {
    printf("Button press!\n"); // Never printed
  }

  // Exit
  SDL_GameControllerClose(gameController);
  SDL_Quit();
  return 0;
}

Here is the output I get:

1 joysticks found
Opened Game Controller 0
Found a valid controller, named: PS4 Controller

What am I doing wrong?

sentences:
Unity right mouse drag turn How would I use my right mouse button to turn a player character in unity, while only turning in the direction and speed of the drag?

Not sure if I'm meant to post this here or stackoverflow.

EDIT: game is 3D

EDIT2: Hold right click and drag to turn the camera

Edit3: Got this code

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

public class Control : MonoBehaviour {

public int speed;
public Transform tf;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if (Input.GetMouseButton(1))
    {
        tf.eulerAngles = new Vector3 (0, Input.GetAxis("Mouse X") * speed, 0);
    }
}
}

^ Code works, but after moving the mouse in the specified direction the character jumps back to its original position and kinda does this glitchy turn while moving the mouse (keeps jumping back to original position)

^ nevermind, I think that I figured it out

sentences:
What is the difference between phy_position_x and x in GameMaker: Studio? This is not covered anywhere in the documentation that I can find.

I am using the physics engine, and the reported phy_position_x and x values are different, such that (phy_position_x, phy_position_y) is (0, 0) and (x, y) is (origin x, origin y).

Why are they different and is one preferred over the other in code?

sentences:
Movement on tile map when player is the size of 4 tiles, moving in 1 tile increment I understand how to move a square around a tile map: you have a coordinate of the square (say the center), and if they player press the "up" arrow, just increment the y-coordinate by 1.

Question: How should I think about tile based movement when the player is the size of 4 squares, and still moves in 1 square increment? E.g. if the player get into a tank, and the tank is now a 2 by 2 block. Would it be significantly different?

I suppose I would have to keep track of the 4 tiles my player's tank is in. And when he presses "up", I would have to check if the forward 2 tiles are empty, then increment all 4 tiles' y-coords by 1.

sentences:
Mirror problems after building game in unity Hi I am facing a weird problem in unity when I build a particular scene.

Here is the screenshot of how the mirror looks when I play the game from inside the unity editor:

And here is how it looks once I build this scene and then play it:

The quality settings at Edit->Project Settings->Quality are these:

And the player settings at File->Build Settings->Player Settings are these:

So how do I fix this? What do I need to change or is there any other entity?

sentences:
How to compute the moves amount in a match-3 game? I have a match-3 mobile game, similar to these popular games in the store.
Mechanics are different, but the gameplay stays the same:

NxN board
X moves
Y objectives to complete to win
tons of different levels. When you complete a level, you unlock a new one

When you run out of moves, you have to buy moves or try again, so you have to think on each move.
And the problem is in the moves, I'm trying to calculate the amount of moves required for each level. I want it to be be slightly lower than the average, so it takes 3-4 attempts for an average player to complete.
I discovered that "being stuck" 2 or 3 times on a level makes it a lot more fun, than completing levels each time with a single attempt.
My current solution
I have couple hundred players and with them - some statistics.
With each level attempt (lost or won) I save it on my server to use it for calculations:
ID | Level Number | Used Moves | Lost/Won

Then, each week, I compute a sum of attempts on each level, and I do this for all players. Then, I compute a mean average on each level:
avg_lvl_attempts = sum_level_attempts / player_count

So if 3 people took level 10, all of them with 4 attempts, it would be:
avg = (4 + 4 + 4) / 3 = 4

Which means that it takes the players 4 attempts, on average, to complete level 10. Then, based on that, I increase the amount of moves on level 10 by a small amount, so it's a little bit easier for them (because I want to achieve 3 on average). And I do that for each level.
The problem with that solution is that it can produce strange results, for instance if someone had 130 attempts (it happens sometimes).
The question
Is there any algorithm, or mathematical trick to do these kind of things more accurately, like excluding edge cases etc?

sentences:
How do I deal with timeout detection and recovery in D3D? What is exactly measured when checking TDR in Windows? What do I need to do in my D3D11 app to tell TDR that long rendering is okay? I've already split the workload into smaller batches, but how do I tell TDR when this batch begins and when it ends?

I know that IDXGISwapChain::Present method will do this for me, but is it the only way?
Is ID3D11DeviceContext::Flush method doing the same thing?

sentences:
Why do my sprites have a dark shadow/line/frame surrounding the texture? I'm starting OpenGL with Apple's GLKit hand I'm having some trouble to get my sprites displayed properly. The Problem is that they all are surrounded with thin dark lines. The screen shot below shows two rectangles with a png image textures containing transparency (obviously).

The black shadows, surrounding them are definitely not part of the pngS. The green png is done without anti-aliasing the blue one has an anti-aliased border. The black border is also apparent if I draw only one sprite.

Te relevant part (hope so...) of code is:

//render the scene
-(void)render
{
    glClearColor(69./255., 115./255., 213./255., 1.);
    glClear(GL_COLOR_BUFFER_BIT);
    [shapes enumerateObjectsUsingBlock:^(AAAShape *shape, NSUInteger idx, BOOL *stop)
     {
         [shape renderInScene:self];
     }];
}

//creating and storing the effect inside shape class
-(GLKBaseEffect *)effect
{
    if(!effect)
    {
        effect = [[GLKBaseEffect alloc] init];
    }
    return effect;
}

//rendering the shape (including effect configuration)
-(void)renderInScene:(AAAScene *)scene
{
    //TODO: Storing vertices in Buffer
    self.effect.transform.projectionMatrix = scene.projectionMatrix;
    self.effect.transform.modelviewMatrix = self.objectMatrix;
    if(texture)
    {
        self.effect.texture2d0.enabled = GL_TRUE;
        self.effect.texture2d0.envMode = GLKTextureEnvModeReplace;
        self.effect.texture2d0.target = GLKTextureTarget2D;
        self.effect.texture2d0.name = texture.name;
    }
    [self.effect prepareToDraw];

    if(texture)
    {
        glEnableVertexAttribArray(GLKVertexAttribTexCoord0);
        glVertexAttribPointer(GLKVertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, 0, self.textureCoordinates);
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    }

    glEnableVertexAttribArray(GLKVertexAttribPosition);
    glVertexAttribPointer(GLKVertexAttribPosition, 2, GL_FLOAT, GL_FALSE, 0, self.vertices);
    glDrawArrays(GL_TRIANGLE_FAN, 0, self.vertexCount);
    glDisableVertexAttribArray(GLKVertexAttribPosition);

    if(texture)
    {
        glDisableVertexAttribArray(GLKVertexAttribTexCoord0);
        glDisable(GL_BLEND);
    }
}

Any ideas anyone? Thank you.

sentences:
Player doesn't move smoothly, when trying to follow position between cursor and player When my player moves, moving the camera looks like the camera is teleporting to the player, and then after loading teleporting again. I want to make it move smoothly.

When the camera is following the player position, it is moving smoothly.

Camera following code:

private void Update()
{
    Vector3 position = GetFollowingPoint();
    position = new Vector3(
        Mathf.Clamp(position.x,
                    Bounds.bounds.min.x + Camera.orthographicSize * Screen.width / Screen.height,
                    Bounds.bounds.max.x - Camera.orthographicSize * Screen.width / Screen.height),
        Mathf.Clamp(position.y,
                    Bounds.bounds.min.y + Camera.orthographicSize,
                    Bounds.bounds.max.y - Camera.orthographicSize),
                    transform.position.z);

    transform.position = position;
}

GetFollowingPoint():

return Player.transform.position + (cursor.transform.position - Player.transform.position) / 3;

Player movement: rigidbody.velocity = Vector in FixedUpdate(), Input with Input.GetKey() and Vector += Vector2.up/down/left/right.

Interpolation in Rigidbody set to Interpolate.

sentences:
How to calculate the sound volume for the left ear and right ear based on the object position & velocity, player position & forward vector? (3D sound) Please assume:

Minimum distance for 3D volume = 1.0;
Maximum distance for 3D volume = 100.0;

This is the declaration of the function:

An object can be a ball moving closer to the player.

void CalculateSoundVolume(Vec3 objectPosition,
                          Vec3 objectVelocity,
                          Vec3 userHead,
                          Vec3 userFoward,
                          float& leftEarVolume,
                          float& rightEarVolume)
{

}

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 can I incorporate physics into a procedurally generated world from a geometry shader? Essentially I want to remove the need for generating coherent noise from the CPU to the GPU. From there, I also want to generate the terrain for a three dimensional world using this noise as densities in voxel points. After this, I want to take those densities and polygonize (generate vertices) them representing the world's terrain.

This is fine and all. But, I also want to dynamically deform the world in real-time. Once I get to this point, I have a problem trying to get the vertices back to the CPU to do things like collision detection and all of the game computations that I want to involve on the CPU and not the GPU.

So the question is: how can I get a subset of the vertices back to the CPU for dealing with collisions among other things?

And one more question: is there an easy way to take a set of vertices and generate indices from them on the GPU?

I'm confused as well as to what kinds of shaders I should be using for these different things. I hear of people using a pixel shader for gathering densities and then using a geometry shader for dealing with the terrain generation from the vertices and then somehow incorporating a vertex shader to do the dynamic deformations.

I'm using C# 4.0, .NET 4.0, and XNA Game Studio 4.0.

sentences:
Why is my DX9 render target restricted to 512×512? When I use a render target higher in resolution than 512×512, I receive an image with black borders, depending on how big this texture was.

Why is this? How can I fix it?

Here's how I create the texture and render target surface:

p_Device->CreateTexture(512, 512, 1, D3DUSAGE_RENDERTARGET,
    D3DFMT_A16B16G16R16, D3DPOOL_DEFAULT, &p_renderTexture, NULL);
p_mainRenderTexture->GetSurfaceLevel(0, &p_renderSurface);

And this is the main render-to-texture function:

void RenderSceneToTex(LPDIRECT3DDEVICE9 p_Device, D3DCOLOR clearColor,
        LPDIRECT3DSURFACE9 p_renderSurface, D3DXMATRIX matView,
        D3DXMATRIX matProjection, bool drawWater, bool drawTransparent,
        bool drawSkybox, LPSTR renderTech) {
    p_Device->SetTransform(D3DTS_VIEW, &matView);
    p_Device->SetTransform(D3DTS_VIEW, &matProjection);
    effect->SetMatrix("matView", &matView);
    effect->SetMatrix("matProjection", &matProjection);
    p_Device->SetRenderTarget(0, p_renderSurface);
    p_Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
        ((clearColor != NULL)?clearColor:D3DCOLOR_XRGB(0, 0, 0)), 1.0f, 0);
    p_Device->BeginScene();
    DrawSceneObjects(p_Device, drawWater, drawTransparent,
        drawSkybox, renderTech);
    p_Device->EndScene();
    p_Device->SetRenderTarget(0, p_dx_mainRenderSurface);
}

sentences: How can I play a video in a Godot game? I'd like to know if and how it is possible for me to play a video in my Godot game. Specifically I'd like to know what video file format I need to use and what code I have to write to play that video back fullscreen.

sentences:
Intuitively, why is 3.5 the average (mean) roll of a six-sided die? Every page I could find on the web that answers this question explains it with Expected Value statistic probability math.

$$(1 * \frac 16) + (2 * \frac 16) + (3 * \frac16) + (4 * \frac16) + (5 * \frac16) + (6 * \frac16)$$

O...K... so we have a mathematical formula that tells us the average/mean/expected value but can't we explain it more simply? We have one die with six sides and every time you roll it, one of those six sides has the possibility of being rolled. Without math, why is the Expected Value 3.5?

sentences:
Rotate from Current Rotation to Another using Angular Velocity I am attempting to calculate an angular velocity that will get me from the current gameObject.transform.rotation to a given Quaternion rotation using angular velocity.  I've tried several methods but all of them seem to cause oscillation (maybe due to the gimbal nature of Vector3 for angular velocity).

Here are the pieces of code that I have tried:

Quaternion rotationDelta = Quaternion.Inverse(gameObject.transform.rotation) * remoteRotation;
return (rotationDelta.eulerAngles / PlayerMovement.BROADCAST_INTERVAL);

Another attempt using toAngleAxis:

rotationDelta.ToAngleAxis(out angleInDegrees, out rotationAxis);
Vector3 angularDisplacement = rotationAxis * angleInDegrees * Mathf.Deg2Rad;
return angularDisplacement / PlayerMovement.BROADCAST_INTERVAL;

Using Eulers:

 Vector3 difference = new Vector3(Mathf.DeltaAngle(gameObject.transform.rotation.eulerAngles.x, remoteRotation.eulerAngles.x),
                                  Mathf.DeltaAngle(gameObject.transform.rotation.eulerAngles.y, remoteRotation.eulerAngles.y),
                                  Mathf.DeltaAngle(gameObject.transform.rotation.eulerAngles.z, remoteRotation.eulerAngles.z));

 Vector3 differenceInRadians = new Vector3(difference.x * Mathf.Deg2Rad,
                                           difference.y * Mathf.Deg2Rad,
                                           difference.z * Mathf.Deg2Rad);

 return differenceInRadians / PlayerMovement.BROADCAST_INTERVAL;

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:
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:
Pro's/Con's of separating game logic and render threads Originally, I have thought that it is good practice to separate my game logic (updating) from my rendering thread.  In this threading model, the rendering thread has no limitation on frame rate and simply draws whatever information is currently made available by the updating thread.  On the other hand, the updating thread is monitored, and has a capped frame rate.

I'm led to believe this is BAD and will lead to many coding struggles down the road...

So, I'm wondering what are the POTENTIAL benefits for separating updating from rendering?
Likewise, what are the POTENTIAL benefits gained when keeping the updating and rendering in the same thread?  What are the losses for each method?

sentences:
Why do the order of uniforms gets changed by the compiler? I have the following shader, everything works fine when setting the value of one of the matrices but I've discovered that getting a value back is incorrect for View and Projection, they are in reverse order.

#version 430

precision highp float;

layout (location = 0) uniform mat4 Model;
layout (location = 1) uniform mat4 View;
layout (location = 2) uniform mat4 Projection;

layout (location = 0) in vec3 in_position;
layout (location = 1) in vec4 in_color;
out vec4 out_color;

void main(void)
{
    gl_Position = Projection * View * Model * vec4(in_position, 1.0);
    out_color = in_color;
}

When querying their location they are effectively reversed, I did a small test by renaming View to Piew which  puts it before Projection if sorted alphabetically and the order is correct.

Now if I do remove layout (location = ...) from the uniforms, the problem disappears !?

I am starting to think that this is a driver bug as explained in the wiki.

Do you know why the order of the uniforms is changed whenever the shader is compiled ?

(using an AMD HD7850)

sentences:
Failed to understand how to use glm::unProject (OpenGL 4.3) Situation:
I use OpenGL 4.3, FreeGLUT 3.0, and GLM library.

Let say i have a simple 2D object (a ball) and it moves accordingly to the simple equations:

x = x_0 + v_0 * t * cosf(alpha);

y = y_0 + v_0 * t * sinf(alpha) - 0.5 * g * t * t;

So i can be sure what are x and y in every time step.

My GLUT mouse callback is:

void onMouse(int button, int state, int mx, int my) {
    if (state != GLUT_DOWN)
        return;
    view = glm::lookAt(glm::vec3(0.0, 0.0, 10.0), glm::vec3(0.0, 0.0, 0.0), glm::vec3(0, 1, 0);
    projection = glm::perspective(45.0f, 1.0f*640 / 480, 0.1f, 10.0f);
    glm::vec4 viewport = glm::vec4(0, 0, 640, 480);
    glm::vec3 wincoord = glm::vec3(mx, 480 - my, 0.0f);
    glm::vec3 objcoord = glm::unProject(wincoord, view, projection, viewport);
}

So, when the ball moves and i click on it, i suppose to get (objcoord.x,  objcoord.y) very close to the center of the ball (x,y).

Coordinates of the ball itself (x,y) are calculated correctly. But when i click on the ball, (objcoord.x, objcoord.y) are not even close to the (x,y).
I always get very small values like (0.0012, 0.099) wherever i click on the screen.
I feel that it might be due to some Z (depth) issues, but i don't have enough knowledge here and ask for help now.

sentences:
revolutejoint doesn't seem to rotate I have a revolute joint set up as such in libgdx + box2d:

            RevoluteJointDef rjd = new RevoluteJointDef();
        rjd.initialize(body1, body2, arm.getWorldCenter());
        rjd.motorSpeed = 100.0f;
        rjd.enableLimit = false;
        rjd.enableMotor = true;
        rjd.collideConnected = false;
        world.createJoint(rjd);

The joint displays and connects fine, but it never seems to turn or rotate. After some googling some people said to increase the motor speed, but I've turned that up to ridiculous values with still no rotations. The density of both body1 & body2 are set to 1.0f, so I'm not sure what else to do (both bodies are dynamic).

sentences:
Making games In Python I'm a beginner at making games, and my eBook that I learnt Python from just made a 2D game and simple game like snake in Nokia because I want to know more Python in correlation with game development.

Can someone tell and explain to me what the Python language can do to make a game?

sentences:
How do I find rotation in 3D based on a vector/normal? I've been playing with Blender and Python, doing basic things like accessing vertices/normals,etc.

I can get the normal of each face of a mesh. I was wondering, how can I get the rotation of a face based on it's normal ? Can I 'decompose' the normal's rotation into rotation x,y,z ? If so how ?

I remember 3dsmax had something that allowed you to easily place objects on another object's faces/surface. Haven't seen that in Blender, might be handy.

sentences:
Moving at constant speed and angle The picture illustrates

I cannot figure out the math on this. The "arrows" should move at the same speed in both examples.

sentences:
Good design for skills (heal,dmg etc) I'm trying to create a good designed "skill system" for my game, but curious if anybody knows a good design?

Skills can Heal,Damage ofc, they can be single target,multiple(chain), AOE.
Instant dmg/heal or overtime. some skills can do damage and heal together and so on.

Maybe a little bit to complex for me to start, but can anybody help me?

Update:

lets say i have a Character class, and each character ofc has hitpoints and also a method TakeDamage(float amountOfDmg,Character damage_causer);

should this TakeDamage(..) method be used inside each Skill class e.g.?:

class AnySkill
{
 public:
 void Execute()
 {
   *(somehow get the character who takes damage)*->TakeDamage(damage, *(somehow get the causer)*)
 }

 private:
 float damage;
}

Would this be a good design?

class Character
{
 public:
 void SetTarget(Character* target)
  {
    target_ = target;
  }
 void TakeDamage(float damage, Character* causer)
 {
   hit_points_ -= damage;
 }
  void UseSkill1()
  {
    skill1->Execute(this,target);
  }

private:
 Character* target_;
 AnySkill* skill1;
 float hit_points_
}

class AnySkill
{
 public:
 void Execute(Character* causer,Character* taker)
{
  taker->TakeDamage(damage_value,causer);
}

 private:
 float damage_value_;
 Character* target_;
}

And somewhere:

player->SetTarget(enemy);

if(skill1_key_pressed)
{
  player->UseSkill1();
}

sentences:
How to put virtual hands in front of player? I want to have the VR hands always in front of the player. This works while walking forwards/backwards, once I rotate the camera they stay in the same place.

I know that I need to take the camera facing into account, but I am missing the math here.
Here is the code for hand translation/rotation:

    void Update()
{
    if (UnityEngine.XR.XRDevice.isPresent)
    {
        GameObject player = GameObject.Find("PlayerGameObject");
        if (hand == WebVRControllerHand.LEFT)
        {
            transform.position = UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.LeftHand) + player.transform.position;
            transform.rotation = UnityEngine.XR.InputTracking.GetLocalRotation(UnityEngine.XR.XRNode.LeftHand);
        }

        if (hand == WebVRControllerHand.RIGHT)
        {
            transform.position = UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.RightHand) + player.transform.position;
            transform.rotation = UnityEngine.XR.InputTracking.GetLocalRotation(UnityEngine.XR.XRNode.RightHand);
        }
    }
}

Update:
Having no movement implemented, looking around will make the hands always appear in front of the camera. If I add this code to the camera object, it will break  so the hands never leave their original space(they still move when I rotate the controller but they stay in the same place):

//Script is attached to the parent of the hands
public class SimpleMovement : MonoBehaviour {
void Update()
    {
        var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;
        var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f;

        transform.Rotate(0, x, 0);
        transform.Translate(0, 0, z);
    }
}

Update 2:
It seems like I got it partially working. At least for translation movement. I set the position only according to what comes out of the XR framework, now I add the player's position on top(previously I did this at the wrong spot).
What is missing now is rotating the camera with the sticks seemns different than rotating the camera with the headset. So the hands still do not respond to rotation movement of the sticks.

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 can I tell whether an object is moving CW or CCW around a connected path? Lets say we have a jagged shape:

And two creatures moving along it's outline.

Then we smooth the shape completely by pulling the corners out.

We get this:

It is easy to see now that Orange is moving CW and green CCW. How can I tell in which direction they are moving without smoothing out the shape?

New image

sentences:
Is this process for generating an OpenGL perspective projection correct? I have been programming OpenGL for a while now and I have successfully created a perspective camera, however, I can't help but shake the feeling that I am doing it wrong. The code I am using is below, is there something wrong with how I am constructing the perspective projection?

int MainWindow_SDL::execute(QCoreApplication &app)
{
    SDL_Init(SDL_INIT_EVERYTHING);
    glewInit();

    // ...

    glLoadIdentity();
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_DEPTH_TEST);
    glMatrixMode(GL_MODELVIEW);
    glDisable(GL_LIGHTING);
    gluPerspective(50, 1.33, 1, 1000);
    gluLookAt(3, m_xAxisLocation, 4, 0, 0, 0, 0, 1, 0);
    glewExperimental = GL_TRUE;

    // ...

    GameStart();
    app.exit();

    return 0;
}

I also set it up in the game loop:

void MainWindow_SDL::GameLoop()
{
    OpenGLRenderer t_renderer;
    t_renderer.PreGameRender();

    while (m_state == GameState::RUNNING)
    {
        glPushMatrix();
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glLoadIdentity();
        processInput();
        glMatrixMode(GL_MODELVIEW);
        glEnable(GL_TEXTURE_2D);
        glEnable(GL_DEPTH_TEST);
        gluPerspective(50, 1.33, 1, 1000);
        gluLookAt(m_xAxisLocation, m_yAxisLocation, m_zAxisLocation,
                  0, 0, 0, 0, 1, 0);

        t_renderer.DuringGameRender();

        SDL_GL_SwapWindow(m_window);
        glPopMatrix();
    }

    t_renderer.PostGameRender();

    GameEnd();
}

sentences:
How to handle a negative coordinate 2d map with a growing map size I love this procedural generation theory and have been messing around with it. However I'm having trouble wrapping my head around how to store my map data. Usually I store my map data in a 2d array and that works in a limited space. However my map grows as the player explores new territory. So the size of the map changes and what's more the array will only support positive indices. So if the player tries to explore west or north he runs into a black abyss of nothingness. But I what more map to generate in those directions. Unfortunately those are the negative coordinate parts of the map. Is there a way to support a negative coordinate as the player explores new area? Here is an example of the problem in action.

https://76295db93db3812642fa5ba984c042fa81ffc37c.googledrive.com/host/0B6H3TRExU5M9eEkyd2FreHhiNlU/

Try moving West or north and you'll run into the edge of the map.

sentences:
Scaling and new coordinates based off screen resolution I'm trying to deal with different resolutions on Android devices.

Say I have a sprite at X,Y and dimensions W,H.

I understand how to properly scale the width and heigh dimensions depending on the screen size, but I am not sure how to properly reposition this sprite so that it exists in the same area that it should.

If I simply resize the width and heigh and keep X,Y at the same coordinates, things don't scale well.

How do I properly reposition? Multiply the coordinates by the scale as well?

sentences: Voxel River Generation at Biome Borders or Biome Blending I'm creating a voxel (block, Minecraft like) game and I have different biomes (flatland, mountains, ect) and the problem is they are abrupt changes when biomes end /begin. I'm using 3d perlin noise, so I can't just "average out" the heights. So I thought to make rivers when biomes end /begin. Does anyone know how I could do this, or how it could work? With 3d noise I get very nice features, however the noise represents density rather than height, so I'm not sure how to go about doing "weight" and such. If not, how can I do blending with 3d perlin noise? Many thanks in advance. I'm also wondering of how  Currently, for each chunk of the world I have a certain chunkGen set, and when the biome changes (randomly determined) the chunkGen changes. Even if I were to generate on a block by block basis, I'm not exactly too sure how that could help me as the 3d perlin value I'm getting is of density. I think my best bet would be using 2d perlin with 3d perlin, the 2d for height and the 3d for ridges but I have no idea of how to implement this.  Would it also be possible to create a buffer terrain between the biomes? with the averages of the octaves, gain, frequency? EDIT: I've actually just tried buffer terrain but it doesn't work well, often enough it moves up randomly or happens in the middle of lakes.

sentences:
representing transforms without a world/global reference frame Background:

I'm trying to make a segmented/portal-based game engine
that supports impossible (non-euclidean?) geometry.

By segmented/portal-based I mean the world is divided into segments which are connected by portals.
This technique was used by the engines for classic shooters like Doom and Duke Nukem 3d.

The portals do not look or function like the portals in the game Portal, which is unfortunately what most of the results that queries containing "portal" bring up.

Each area is in its own coordinate system
with each portal defining the transformation between
the portal entrance in the origin segment and
the portal exit in the destination segment.

It is possible for there to be multiple portals connecting the segments and for those portals to have different transformations.
If I understand correctly, this makes the world non-euclidean and precludes storing a transformation for each connected segment on a segment.

Objects have transforms for each segment they are present in.
So instead of the usual transform setup of objects having a local transform, a parent transform, and a world transform
there is no world transform and it is possible to have more than one "parent" transform.

Advanced math is not my strong point.
I understand the basics of the transformations
but there are some details I don't fully grok
and almost certainly some important or useful
properties that I am not aware of.

Questions:

Where do I "store" or "collect" the results of applying transformations to an object?

Do I apply them to the object's local tranform or do I apply it to the object's transforms relative to "parent" segments?

It seems like a bad idea to accrue transformations on the local transform, but perhaps I don't understand the purpose of the local transform.

Research before asking question:

tutorial on simple portals in unreal that helped with outlining the transformation logic, but is focused on unreal and does not answer my questions.

flipcode portal rendering tutorial which gets brought out anytime there is a question about portal-based rendering. I have read through it a couple times, although the small font is hard for me to read so it is very possible I missed some details.

related question

related question

discussion on gamedev subreddit

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:
Find transformation to align two polygons at fixed points? Problem

I have a source image (arbitrary width and height c) shown here as a rectangle [X1,X2,X3,X4]. It contains two points C and D (both known coordinates within the image - X4 / top left).

Then I have a target image (might have different height a and width b than source image) that contains two points A and B (|AB| doesn't necessarily equal |CD|). There's also a source of projection S.

I need to somehow calculate coordinates of a transformed rectangle (polygon) such that:

Point C will always be mapped to A (therefore A will be equal to C) and D will be mapped to B (B = D)
Point X3 of this newly calculated polygon will lie on a line between S and A/C (now identical)
Point X4 will lie on a line from S to B/D.
Distance from parallel lines [X1,X2] and [X3,X4] will be still c. (If it turns out that it's not always possible to construct such a polygon the condition 4. can be dropped, and [X1,X2] don't need to be parallel to [X3,X4] as well)

(see below)

What I've tried

I thought I will solve it by:

shrinking width of source image by ratio of |AB| and |CD|
aligning C with A (move source image)
finding angle difference  between AB and CD
rotating source image by angle  (with center in C/A)
calculating X3 and X4

But it doesn't work universally. Steps 1-4 work well, but then changing X3 and X4 moves C (resp. D) away from A (resp. B).

sentences:
How To calculate camera boundaries Is it possible to calculate the exact camera bounds? By this I mean the white lines that represent the camera area e.g the lines in the picture:

I'm using Camera.main.screenToWolrdCoordinates to convert screen coordinates to world coordinates because I want to position the player exactly on that white line that the camera represents:

But when I calculate the boundaries using Camera.main.screenToWolrdCoordinates I get this:

The players legs are outside of that lower camera bound on y axis, it will also happen on x axis when I strict the players movement by using the value that I got from Camera.main.screenToWolrdCoordinates , I also have bouncing balls in my game that I want to strict by the same boundaries. So my question is how can I calculate camera bounds exactly by this I mean again these white lines that represent the camera view, I hope that my question is clear enought. Just to make it more clear, when I calculate the bounds using Camera.main.screenToWolrdCoordinates I just assign the Y value that I got from that calculation to the Y position of the player.

sentences:
Why is clicking too fast giving me a missingReferenceException in Unity? I made a small method that will quickly give the player a "flashlike" display when a sheep is killed. However clicking too fast will trigger a missingReferenceException. Because it registers the raycast a second time. Is this due to the delay on the DestroyObject() or something else?

private IEnumerator startFlashing(GameObject sheep)
{
    sheep.gameObject.GetComponent<Rigidbody>().freezeRotation = true;
    sheep.gameObject.GetComponent<Rigidbody>().velocity = Vector3.zero;
    sheep.SetActive(false);
    yield return new WaitForSeconds(theTimeBetweenFlashes);
    sheep.SetActive(true);
    DestroyObject(sheep.gameObject, 0.1f);
}

sentences:
YAW not working correctly with XNA I successfully draw the model, and made it move forward and backward, but when I try to make it rotates (yaw) its not working correctly, like its moving too instead of only rotate.
Here is my camera code:

public class NewCamera
{
    float aspectRatio;
    public NewPlayer player;
    Matrix viewMatrix;
    Matrix projectionMatrix;
    Matrix terrainMatrix;

    public NewCamera(float aspectRatio, NewPlayer player)
    {
        this.player = player;
        this.aspectRatio = aspectRatio;
    }

    public void Update()
    {
        Vector3 campos = new Vector3(0, 0.2f, -0.6f);
        campos = Vector3.Transform(campos, Matrix.CreateFromQuaternion(player.rotation));
        campos += player.position;

        Vector3 camup = new Vector3(0, 1, 0);
        camup = Vector3.Transform(camup, Matrix.CreateFromQuaternion(player.rotation));

        viewMatrix = Matrix.CreateLookAt(campos, player.position, camup);
        projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio, 0.2f, 500.0f);
    }

    public void SetEffects(BasicEffect basicEffect)
    {
        basicEffect.View = viewMatrix;
        basicEffect.Projection = projectionMatrix;
        basicEffect.World = terrainMatrix;
    }

    public void Draw(Terrain terrain)
    {
        terrainMatrix = Matrix.CreateTranslation(terrain.position);
        SetEffects(terrain.basicEffect);
        foreach (EffectPass pass in terrain.basicEffect.CurrentTechnique.Passes)
        {
            pass.Apply();
            terrain.Draw();
        }
        player.Draw(viewMatrix, projectionMatrix);
    }
}

And here is my player (character) code:

public class NewPlayer
{
    Model model;
    public Vector3 position = new Vector3(8, 1, -3);
    public Quaternion rotation = Quaternion.Identity;
    public Matrix worldMatrix = Matrix.Identity;

    public NewPlayer(Model _model)
    {
        model = _model;
        foreach (ModelBone bone in model.Bones)
        {
            bone.Transform *= Matrix.CreateScale(0.01f);
        }
    }

    public void RecreateWorld()
    {
        worldMatrix = Matrix.CreateRotationY(MathHelper.Pi)
            * Matrix.CreateFromQuaternion(rotation)
            * Matrix.CreateTranslation(position);
    }

    public void Draw(Matrix viewMatrix, Matrix projectionMatrix)
    {
        RecreateWorld();
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.World = transforms[mesh.ParentBone.Index]
                    * worldMatrix;
                effect.View = viewMatrix;
                effect.Projection = projectionMatrix;
            }
            mesh.Draw();
        }
    }

    public void MoveForward(float speed)
    {
        Vector3 addVector = Vector3.Transform(new Vector3(0, 0, 1), this.rotation);
        this.position += addVector * speed;
    }

    public void MoveBackward(float speed)
    {
        Vector3 addVector = Vector3.Transform(new Vector3(0, 0, -1), this.rotation);
        this.position += addVector * speed;
    }

    public void Yaw(float amount)
    {
        this.rotation *= Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(amount), 0, 0);
    }
}

So, whats wrong at the Yaw function??

EDIT:
Adding some SS to show what I mean, it appears that it yaws around camera and not player

sentences:
UIButton fails to play sound I'm doing this game where with cards you assign different beats to different channels. You drag and drop the beat to a channel and it gets added to the mixer. What I'm having trouble with is when i try to play each channel individually with an UI Button. This is the script attached to the channels:
public class ManageChannel : MonoBehaviour
{
    public AudioSource thisAudioSource;
    bool chequeo;
    string Nombre;

    public AudioMixer audioMixer;

    public void AsignaCanal (){
        Nombre = this.name; // tomo el nombre del canal actual
        thisAudioSource = this.GetComponent<AudioSource>();

        var carta = this.transform.GetChild(0); // llamo a la carta hija de este objeto
        thisAudioSource.clip = carta.GetComponent<AudioSource>().clip;
        thisAudioSource.outputAudioMixerGroup = audioMixer.FindMatchingGroups(Nombre)[0]; // asigno al AudioSource el grupo correspondiente

    }

    public void comienzaAudio (){
        if (!thisAudioSource.isPlaying){
            thisAudioSource.Play();
        }
        else {
            thisAudioSource.Stop();
        }
    }

    // Start is called before the first frame update
    void Start()
    {
        chequeo = true;

    }

    // Update is called once per frame
    void Update()
    {
        if (this.transform.childCount != 0 && chequeo) {
                AsignaCanal();
                chequeo = false;
                thisAudioSource.Play();

        }

    }
}

What the script does is when a card is dropped, it takes the clip of the card and get its into the AudioSource of the channel, and that AudioSource gets outputted to its respective channel (for example, the GameObject "Channel 1" goes to the mixer group "Channel 1" and so on). Then i've tried to build the buttons to reproduce the track of each channel individually, but using AudioSource.Play() since I believe I cannot do it with the AudioMixer directly. What i did is create a UIButton and then assign the respective GameObject Channel to the OnClick() section on the inspector, and then i choose the following function on the script that i showed before
public void comienzaAudio (){
        if (!thisAudioSource.isPlaying){
            thisAudioSource.Play();
        }
        else {
            thisAudioSource.Stop();
        }
    }

Then, every time i press the button, that function should be called. The problem is nothing happens. I'm positive the button is working because i tested with a bool value and a Debug.Log() to see if it changes values with every click, and it does. So, i honestly have no clue what the issue is. Any help would be appreciated. Thanks!

sentences:
exact point on a rotating sphere I have a sphere that represents the Earth textured with real pictures.
It's rotating around the x axis, and when user click down it has to show me the exact place he clicked on.
For example if he clicked on Singapore the system should be able to:

understand that user clicked on the sphere (OK, I'll do it with unProject)
understand where user clicked on the sphere (ray-sphere collision?) and take into account the rotation
transform sphere-coordinate to some coordinate system good for some web-api service
ask to api (OK, this is the simpler thing for me ;-)

some advice?

sentences:
Setting up a cross-platform Ogre project on a Git repository I'm looking to start a cross platform game project using Ogre, and I want to host it on a git repository. I'm collaborating with a friend on this: I'm on a Mac using Xcode, and he's on a PC using Visual Studio.

I've looked around on the Ogre site, and it seems CMake is what I should be using, but I'm not sure how to set it up with a Git repository. Would you be able to give me any pointers on where to start on this – tutorials and guides etc?

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 can I get my player's character to slide along a rail? I am creating a snowboarding game and would like my player to be able to jump on a rail and move along it if it lands on it.

I have no idea how to approach this. I have already tried using ray casts and waypoints but nothing works. I need to make sure the player moves along the rail, from any point that the player jumps onto it: e.g. if they land in the middle of the rail they keep following its curve from that point. The rails are not straight and have curves on them.

How can I get my player to be able to jump on a curved rail like this, and start sliding from the point they jumped onto it?

sentences:
Collision detection with non-rectangular images I'm creating a game and I need to detect collisions between a character and some parts of the environment. Since my character's frames are taken from a sprite sheet with a transparent background, I'm wondering how I should go about detecting collisions between a wall and my character only if the colliding parts are non-transparent in both images.

I thought about checking only if part of the rectangle the character is in touches the rectangle a tile is in and comparing the alpha channels, but then I have another choice to make... Either I test every single pixel against every single pixel in the other image and if one is true, I detect a collision. That would be terribly ineficient.

The other option would be to keep a x,y position of the leftmost, rightmost, etc. non-transparent pixel of each image and compare those instead. The problem with this one might be that, for instance, the character's hand could be above a tile (so it would be in a transparent zone of the tile) but a pixel that is not the rightmost could touch part of the tile without being detected. Another problem would be that in different frames, the rightmost, leftmost, etc. pixels might not be at the same position.

Should I not bother with that and just check the collisions on the rectangles? It would be simpler, but I'm afraid people.will feel that there are collisions sometimes that shouldn't happen.

sentences:
3D vector graphics - maintaining correct Z 'length' So I'm trying to build myself a 3D display 'engine', or whatever it ought to be called. I've been experimenting with PyGame, as it's familiar to me.

In a way this has almost been more an excuse to learn the math than to actually build a 'game engine' or anything like that, though ultimately that's why we're all programmers right? To code the next Super Mario Brothers. :) Anyway, this isn't that, it's a learning project, but unfortunately I seem to have hit a wall and I'm not entirely sure how to proceed or what to look for.

I'm unsure of how to move items smoothly on the Z-axis. 0 is the 'closest' a point gets to the screen, whereas N is the 'furthest' it could go. In the interest of (hopefully) keeping my math similar across calculations, I've set HEIGHT, WIDTH, and DEPTH all to an arbitrary value of 600.

It would appear that moving objects along the Z-axis is not quite the same as moving them along X and Y. Whereas X and Y are just addition and subtraction, Z is apparently only really effective as a percentage. Unfortunately I can't seem to find a method of incrementing Z in any way that doesn't stretch the shapes as if they're going into Warp when I move them closer to the horizon point. Likewise they squash nearly flat as they move closer to the screen.

I believe that the two most likely code candidates for weirdness are the following two snippets; one is the model's "move all the points" method, the other is a view method. Hopefully the code I'm not sharing is self-evident; Zpt is a class that contains x, y, z coordinates, and so on.

def move_pts_to_pt(self, newX=None, newY=None, newZ=None):
##This is how the model moves its points
    oldCtr = self.center
    if newX is not None:
        deltaX = newX - oldCtr.x
    else: deltaX = 0
    if newY is not None:
        deltaY = newY - oldCtr.y
    else: deltaY = 0
    if newZ is not None:
        deltaZ = newZ
    else: deltaZ = 1
    for zpt in self.zpts + [self.center]:
        zpt.x += deltaX
        zpt.y += deltaY
        zpt.z *= deltaZ

def zshape_draw(shapelist, objcolor=(255, 0, 0), objwidth=2):
##This is the view's drawing method for points with a z coordinate
    for shape in shapelist:
        drawnpoints = []
        for zpt in shape:
            z = zpt.z
            horzoff = z / DEPTH
            invhorz = 1.0 - horzoff

            newX = (zpt.x * invhorz) + (WIDTH * HOR_X * horzoff)
            newY = (zpt.y * invhorz) + (HEIGHT * HOR_Y * horzoff)
            drawnpoints.append((newX, newY))

        pygame.draw.polygon(SCREEN, objcolor, drawnpoints, objwidth)

I apologize if I've left any code out; I'm happy to re-edit my post. In any event, I cannot suss out what it is I need to do to prevent the z-values that are closest to the 'back' of the screen from increasing much faster than those closer to the screen, while still maintaining their intended 'shape' -- that is, generally looking like they aren't changing in depth as they move from z=0 to z=600 (or, whatever ends up being 100% 'away' from the screen).

sentences:
My Sprite is disappearing when it collides with my floor (libGDX) I am just starting to build the game "engine" and I am using a sprite drawn in the same position as a rectangle and the two always move together. I have another rectangle which is the floor when the two collide the sprite/rectangle will stay on top of the "floor" rectangle for a small while then it will disappear. I assume it is falling through it as when I hold the key to move the sprite up again it re-appears.

The class I am using to represent my walls and floor is here:

public class Solids {
    Array<Rectangle> floors;
    Array<Rectangle> walls;

    public Solids(){
        floors = new Array<Rectangle>();
        walls = new Array<Rectangle>();

        floors.add(new Rectangle(0, 0, 1280, 10));
    }

    public Array<Rectangle> getFloors(){
        return floors;
    }

    public Array<Rectangle> getWalls(){
        return walls;
    }

}

I am representing my character in a class called entities which looks like this:

public class Entity {

    Rectangle bottom, left, right, top;
    Sprite sprite;
    Texture texture;
    Solids solids;
    int action;
    float velocity = 100;
    float width, height;
    float velocityY = 0;

    public Entity(Rectangle b, Texture t){
        solids = new Solids();
        bottom = b;
        texture = t;
        width = b.width;
        height = b.height;
        sprite = new Sprite(t, 0, 0, (int)width, (int)height);
        this.setPosition(0, 0);

    }

    public void setPosition(float x, float y){
        bottom.x = x;
        bottom.y = y;
        sprite.setPosition(x, y);
    }

    public void draw(SpriteBatch batch){
        sprite.draw(batch);
    }

    public void moveLeft(float delta){
        bottom.x -= velocity * delta;
        sprite.setPosition(bottom.x, bottom.y);;
    }

    public void moveRight(float delta){
        bottom.x += velocity * delta;
        sprite.setPosition(bottom.x, bottom.y);;
    }

    public void jump(){
        velocityY = 15;
    }

    public void update(float delta){
        velocityY -= 50 * delta;
        bottom.y += velocityY;
        sprite.setPosition(bottom.x, bottom.y);
    }

    /*public int hits(Rectangle r){
        if(bottom.overlaps(r)){
            return 1;
        }
        return -1;
    }

    public void action(int type, int y){
        if(type == 1){
            setPosition((int)bottom.x, y);
        }
    }*/

    public void isCollidedFloor(){
        /* need to know if collided with floor or wall for jumping need two arrays also need array of entities */
        for(int i = 0; i < solids.getFloors().size; i++){
            if(bottom.overlaps(solids.getFloors().get(i))){
                action(solids.getFloors().get(i));
            }
        }

    }

    public void action(Rectangle r){
            setPosition(bottom.x, r.y+1);
    }

}

The calls worth noting to this class from the main class are as follows:

    player = new Entity(new Rectangle(0.0f, 0.0f, 128f,128f), new Texture(Gdx.files.internal("woman.png")));
    player.setPosition(1280/2, 100);
player.update(Gdx.graphics.getDeltaTime());
player.isCollidedFloor();

So my question is, why is this happening, tried just creating one Rectangle outside of the solids class and it still doesn't work. I have been playing around for hours and just cant seem to figure it out. Thanks in advance.

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:
Incorrect click event when resize on libGdx I want to use scene2D, in libGDX, to detect click on object.

I have this simple Game sample :

Stage stage;

@Override
public void create()
{
    this.stage = new Stage(1280, 720, true);
    MyActor actor = new MyActor();

    Gdx.input.setInputProcessor(stage);

    actor.setTexture(new TextureRegion(new Texture(Gdx.files.internal("plateau.jpg"))));
    actor.setScale(0.1f);

    stage.addActor(actor);

    actor.addListener(new InputListener()
    {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button)
        {
            System.out.println("down"+Math.random());
            return true;
        }
    });
}

@Override
public void render()
{
    stage.act();
    stage.draw();
}

MyActor is a simple class extending Actor with a rendertexture.
The Event is working fine at start.
But when resizing the frame, while the Actor is streched as wanted, the coordinates of the click are not updated and thus misplaced.

How to make the stage using the new size of the items as base to the event ?

Thanks.

sentences:
how to check if player stands on platform? I want to test if player stands on platform.

I have 32x32 platform sprites.

My code looks like

   for (block in blocks) {
    if (collides(playerX, playerY - 7, block.blockX, block.blockY)) {
     fall = true;
    }
  }

but it is works wrong.
My player sometimes fall while walking on other platforms.
my collision function works well but maybe 7 is not enough or too much.

sentences:
Simulation of ball movement in a 3d landscape. The easiest way? I have a landscape(generated via Perlin noise) and a ball. I want the ball to move along the geodesic(implementation of basic physics: gravitation, friction). I thought to do raycast around the ball to the landscape, choose the lowest point and move the ball to this point, but it won't work in every case and it won't allow the ball to jump (with inertia). So, what is the best way/algorithm to implement such feature?

P.S. I don't want to use any libraries.

Thanks.

sentences:
which is better performance, using a disposable local variable or reusing a global one? This is for an android game.
Suppose I have a function that is called several times for second and do some calculations involving an arraylist (or any other complex objects for what matter).
Which approach would be preffered?

local:

private void doStuff(){
    ArrayList<Type> XList = new ArrayList<Type>();
    // do stuff with list
}

global:

private ArrayList<Type> XList = new ArrayList<Type>();
private void doStuff(){
    XList.clear();
    // do stuff with list
}

sentences:
Game Maker Studio 2: Why is my variable not being properly changed? Ok, so in my game you have a party of four characters that you control one at a time, each of which can lose health and die independently of each other. All of the player character objects use essentially the exact same code controlling their "deaths", (just with their own object variables and flags that get set and triggered etc.), but for whatever reason identical code does not produce identical results for all of the characters.

In particular, one of the character classes, the Alchemist, absolutely refuses to either set their "dead" flag to True properly, or at the very least the sections of code that are dependent upon "dead" being true do not appear to be acknowledging that it is. I've gone over all its events several times and monitored its behaviors in-game very closely, and everything about its malfunctioning behavior can be traced to the fact that it's completely ignoring the "dead = true;" line in one of its events while still executing the remaining code that follows it. Absolutely nothing else in any of its events sets or modifies this variable outside of its initialization in the Create event; it's just this one line of code that works perfectly for every other character object refuses to do its one job for this object in particular, and everything is falling apart because of it.

Does anyone know why this might be happening? Is there some quirk of proper GML practice that I'm not using?

If it helps, here's the code that gets triggered when a character is made "dead"

else if(wounded and position == 0 and !dead)
{
    dead = true;
    instance_create_layer(x,y,layer,obj_alchemist_corpse);
    death_sort();
}

Everything else is just a series of If statements that are triggered by 'dead' being true, but again, it would appear that one object in particular is executing the code in the above statement without actually setting 'dead' to true, and I would like to know why or why not.

EDIT: Forget what I said about an alchemist; further testing indicates it's just the second character in your party line of four that isn't getting their flag properly set.

sentences:
Is a responsive dimension game worth it? I'm in the process of creating a Wario-Ware-like game that will be created for browsers first then likely ported to mobile. Here are the different ways I've considered setting up the dimensions of the game:

---Fixed width---

The natural go to, set width and height

Pros:

Easy to manage interaction in javascript
Don't have to worry about resizing
As a developer I know exactly how it will look and play

Cons:

It might not be playable on all platforms
It will almost always not make the best use of all of the space on the screen

---Several fixed widths---

I'm currently leaning towards this approach

Pros:

It can reach more platforms than having just one fixed width can
The developer(s) still have full knowledge of how the end product will look through testing on each size
It is fairly easy to change the javascript to match the varying set dimensions

Cons

It doesn't take up the full screen space on many screens
Have to develop javascript in a way where it works with several sizes

---Semi-Responsive---

Consistent dimension ratio, varying actual size. In my case It'd be landscape layout

Pros:

It makes good use of more of the screen
The fixed ratio makes developing easier than a non-fixed ratio

Cons:

On certain platforms it may not be playable depending on the dimensions of the game and of the device
Interaction is harder to manage in javascript than set dimensions

---Fully Responsive---

I'd force landscape mode if possible and keep a minimum height and width, but other than that it's fully responsive

Pros:

Makes use of the full screen
Able to be played on any device

Cons:

A bit harder to manage interaction in javascript

My questions:

What approach is commonly taken when it comes to making dimensions of browser based games? Is there another approach or mix of approaches that I didn't mention that would be useful? It seems that making it fully responsive would be best, but it'd be the most work

I'm also looking for any other advice on the subject

Sorry if this is too broad for this community or if it is tagged inappropriately, feel free to edit as necessary

sentences:
Occasionally nothing renders until the game window is resized - how to fix? So, I'm making a game in Java, I'm using the BufferStrategy and Graphics class to render onto the screen.

But sometimes, when I run the game nothing is rendered onto the screen. But as soon as I resize the window, everything gets rendered fine.

At first I thought it had something to do with the BufferStrategy and graphics class, but when I printed those classes in the console after the initialization, they have the same values when the game is rendering fine and when the bug occurs.

I'm confused, is there a fix for this without altering a lot of code?

I'm creating my BufferStrategy as :

canvas.createBufferStrategy(3);

bs = canvas.getBufferStrategy();
g = bs.getDrawGraphics();

I'm not sure if the bug is occuring there though...

sentences:
jMonkeyEngine ignores keyboard input Created a game login form using the Nifty GUI. The interface reacts to the movement and clicking of the mouse, but ignores the input in the text fields. Whether the program is looking for a click handler, instead of typing, or I don’t know what. What could be the case and how to fix it?

Interface/screen.xml:

<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.lessvoid.com/nifty-gui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd
https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd">
    <useStyles filename="nifty-default-styles.xml"/>
    <useControls filename="nifty-default-controls.xml"/>
    <screen id="start" controller="mygame.LoginScreen">
        <layer id="background" childLayout="center">
            <image filename="Interface/start-background.jpg"></image>
        </layer>
        <layer id="foreground" childLayout="center">
            <panel id="panel" height="25%" width="75%" align="center" childLayout="horizontal">
                <panel id="panel_left" height="100%" width="25%" align="left" childLayout="vertical">
                    <text text="E-mail:" font="Interface/Fonts/Default.fnt"/>
                    <text text="Password:" font="Interface/Fonts/Default.fnt"/>
                </panel>
                <panel id="panel_center" height="100%" width="50%" align="center" childLayout="vertical">
                    <control name="textfield" maxLength="50" font="Interface/Fonts/Default.fnt"/>
                    <control name="textfield" maxLength="100" passwordChar="*" font="Interface/Fonts/Default.fnt"/>
                </panel>
                <panel id="panel_right" height="100%" width="25%" align="right" childLayout="vertical">

                </panel>
            </panel>
        </layer>
    </screen>
    <screen id="hud" controller="de.lessvoid.nifty.screen.DefaultScreenController">

    </screen>
</nifty>

src/mygame/Main.java:

package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.renderer.RenderManager;
import com.jme3.niftygui.NiftyJmeDisplay;
import de.lessvoid.nifty.Nifty;

public class Main extends SimpleApplication {

    public static void main(String[] args) {
        Main app = new Main();
        app.start();
    }
    public String driver = "org.apache.derby.jdbc.EmbeddedDriver";
    public Nifty nifty = null;
    @Override
    public void simpleInitApp() {
        NiftyJmeDisplay niftyDisplay = NiftyJmeDisplay.newNiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
        nifty = niftyDisplay.getNifty();
        nifty.fromXml("Interface/screen.xml", "start");
        guiViewPort.addProcessor(niftyDisplay);
        inputManager.beginInput();
        flyCam.setDragToRotate(true);
    }

    @Override
    public void simpleUpdate(float tpf) {
        //TODO: add update code
        nifty.update();
        inputManager.update(tpf);
    }
}

src/mygame/LoginScreen.java:

package mygame;

import com.jme3.app.Application;
import com.jme3.app.state.BaseAppState;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

public class LoginScreen extends BaseAppState implements ScreenController {

    @Override
    protected void initialize(Application app) {

    }

    @Override
    protected void cleanup(Application app) {

    }

    @Override
    protected void onEnable() {

    }

    @Override
    protected void onDisable() {

    }
    @Override
    public void update(float tpf) {

    }

    @Override
    public void bind(Nifty nifty, Screen screen) {

    }

    @Override
    public void onStartScreen() {

    }

    @Override
    public void onEndScreen() {

    }
}

sentences:
Load/generate new resources on start up in MonoGame I've a question about loading resources at the beginning of my game written in MonoGame. I've several spritesheets which I'm loading at the beginning of the game. This take about 5-10 seconds on my computer but I've got some reports it takes up to a minute on other computers...that´s way too long.
The reason is not loading the Texture2Ds but writing new RenderTargets on Startup. I've some colored spritesheets where I generate a black/white version of it on startup. That costs the time.

Now to my question: I've tried to do this operation later in the game so the game starts more quickly and I tried to start the color-> black/white operation when the player creates a new game - that would be a perfect situation to do it. But I always got two different kind of errors:

1. Operation not called on UI thread

or

2. Cannot call Present when a render target is active

As you may have guessed I do the load operation in a separate thread so the UI doesn't get frozen. But the actual problem seems to be, that I can not do RenderTarget operations when I'm already doing SpriteBatch operations (Begin and End).

How can I solve the problem?

Would be happy for any kind of suggestion.

Yheeky

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:
Can glTexImage2D() use an already existing memory block? Can I use glTexImage2D() and / or glTexSubImage2D() (or maybe there's some other method I don't know about) with an already existing block of memory, instead of always uploading the changed pixels? I already have the changed pixels somewhere in memory, and I'd like to send a pointer to that location if possible.

The problem is that I'm likely going to update a large amount of pixels, and uploading all of them introduces a lot of overhead and wasted memory. And since the application will only run on a mobile device without dedicated GPU memory, all I'm doing now is copying a big chunk of memory to another location of the same memory...

Also, I'm looking for a solution that would work on iOS devices, since the application will only run on iOS.

sentences: what is the best way to make a bunch of platforms appear randomly on a JFrame but close enough the player can reach them? Hi I'm trying to make a screen that will have a bunch of platforms that will place themselves randomly around a JFrame. I know how to do the stuff to make the character jump and to deal with the collisions just not a way to place the platforms on the screen randomly so they are close enough together that the character could reach. Any help is appreciated.

sentences:
Change Time.timeScale during an animation event - Unity I have an animation. A few seconds after this animation starts I set an animation event that is correctly being triggered. This animation event calls a method where I am trying to modify Time.timeScaleand set it to 0.05f.

This event is calling the following method:

public void Slowmotion()
{
    Time.timeScale = 0.05f;
    //Time.fixedDeltaTime = Time.timeScale * 0.02f;
}

But this Slowmotion method is not working.

Any ideas on what may be happening?

sentences: How do I determine if a tile is a slope based on the tile image? In my game, every tile is a 32x32 texture. All the slopes are a 0 - 45 degree angle. I would like to determine, at the time I load the tile, if the is sloped by examining its texture/bitmap data. How can I do this?

sentences:
Is linear filtering possible on depth textures in OpenGL? I'm working on shadow maps in OpenGL (using C#).
First, I've created a framebuffer and attached a depth texture as follows:
// Generate the framebuffer.
var framebuffer = 0u;

glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);

// Generate the depth texture.
var shadowMap = 0u;

glGenTextures(1, &shadowMap);
glBindTexture(GL_TEXTURE_2D, shadowMap);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 1024, 1024, 0, GL_DEPTH_COMPONENT, GL_FLOAT, null);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowMap, 0);

// Set the read and draw buffers.
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);

Later (after rendering to the shadow map and preparing the main scene), I sample from the shadow map in a GLSL fragment shader as follows:
float shadow = texture(shadowMap, shadowCoords.xy).r;

Where vec3 shadowCoords is the coordinates of the fragment from the perspective of the global directional light source (the one used to create the shadow map). The result is shown below. As expected, shadow edges are jagged due to using GL_NEAREST filtering.

To improve smoothness, I tried replaced the shadow map's filtering with GL_LINEAR, but the results haven't changed. I understand there are other avenues I could take (like Percentage-Closer Filtering), but I'd like to answer this question first, if only for my sanity. I've also noticed that other texture parameters (like GL_CLAMP_TO_EDGE rather than GL_REPEAT for wrapping) don't function for the shadow map, which hints that this may be a limitation of depth textures in general.
To reiterate: Is linear filtering possible using depth textures in OpenGL?

sentences:
Xna custom mouse not allowing me to move its sprite past certain bounds I have written a Custom mouse, with a Custom sprite, using MouseState, and getting the X and Y variables. However i also have a camera that i wrote, and this allows me to leave the initial box. One sprite that can freely move this area, but my mouse gets stuck in a box that seems proportional to my screen resolution some times.

  //This is where i create the Texture, Vector and MouseState of the Custom Cursor
Texture2D Mouse_texture;
MouseState mouse_state;
Vector2 Mouse_pos;

  // This is my Resolution and i have IsFullScreen = true
graphics.PreferredBackBufferWidth = 1600;
graphics.PreferredBackBufferHeight = 900;

  // Loading the Texture
Mouse_texture = Content.Load<Texture2D>("mouse");

  // Getting the current mouse State this is in the update function
mouse_state = Mouse.GetState();

  // How i set the mouse position Simple Vector2 stuff and i never do anything else
  //   to handle the the position of the mouse
Mouse_pos = new Vector2(mouse_state.X, mouse_state.Y);

  // and this is me Drawing it
spriteBatch.Draw(Mouse_texture, Mouse_pos, Color.White);

If you need any more code let me know

sentences:
Start C# script when imagetarget is detected for Vuforia+Unity I have a script like given below which implements spirral motion of a sphere to the center (0,0,0). I want the script to start only when the image target is detected, however in my project it starts just when I open the app.  I know that the DefaultTrackableEventHandler needs to be modified, however, I am doing this for first time and I do not know how to implement this script in the eventhandler script. Where should I attach the event handler script etc...

The hierarchy and the script for spiraling motion is as given below

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

    public class spiralanti : MonoBehaviour
    {
        float angles;
        float radiuss;
        float angleSpeed;
        float rSpeed;
        // Start is called before the first frame update
        void Start()
        {
            angles = 0;
            radiuss = 1f;
            angleSpeed = 250f;
            rSpeed = 0.05f;
            angles = Mathf.Max(0, Mathf.PI);
            radiuss = Mathf.Max(0, radiuss);

            //float x = 0;
            // float y = 0;
            // float z = 0;
        }

        // Update is called once per frame
        void Update()
        {
            angles += Time.deltaTime * angleSpeed;
            radiuss -= Time.deltaTime * rSpeed;
            if (radiuss <= 0)
            {
                float x = 0;
                float y = 1;
                float z = 0;

                transform.localPosition = new Vector3(x, y, z);
            }

            else
            {
                float x = radiuss * Mathf.Cos(Mathf.Deg2Rad * angles);
                float z = radiuss * Mathf.Sin(Mathf.Deg2Rad * angles);
                float y = 1;

                transform.localPosition = new Vector3(x, y, z);
            }

            }

 }

Please Help !

sentences:
Implementing a camera on HTML5 canvas? I am trying to work out the best way of implementing a camera in my simple 2d game.

The way it is structured at the moment is my game objects all have draw functions, which are passed a canvas instance to draw themselves to (at whatever position they are currently at).

I now need to add a camera to the mix, so that i can have a bigger world, but i'm not sure of the best way to implement it.

The way I see it, I can either translate the whole canvas and let the objects carry on drawing themselves at whatever position they are at, eg:

canvas.translate(camera.position);
player.draw(canvas);

This seems easy enough, but doesn't seem right somehow. Alternatively, I could pass the camera in to the objects with the canvas, and let the objects calculate a relative screen position before drawing, eg:

player.draw(canvas, camera);
// inside the draw function:
var position = this.position.subtract(camera.position);
canvas.drawStuff(stuff, position);

But that seems wrong too. How do other 2d engines handle this? Is there an established best way of doing it, or any pitfalls I should avoid?

sentences:
Time granularity for games So far I've always used a time granularity of 1 msec (that's it, 1 millisecond is the atomic time unit).

I'm wondering if this is always fine, or if for some cases (some specific games, game components or platforms) it would be suggested to have a more accurate time unit (on the order of microseconds or, I don't know, hundreds of microseconds).

sentences:
Elongated and straight terrain perlin noise Why am I getting this kind of results with my perlin noise ? The terrain is wide or elongated or straight at the variations of the noise function.

This is the way I generate terrain:
    public void GenTerrain()
    {
        for (int x = 0; x < this.size.x; x++)
        {
            for (int y = 0; y < this.size.y; y++)
            {
                float xCoord = (float)(x + offsetMirror + origin.x) / this.size.x * scale;
                float yCoord = (float)(y + offsetMirror + origin.y) / this.size.y * scale;
                float noise = Mathf.PerlinNoise(xCoord, yCoord);

                if (noise > 0.6f)
                {
                    this[x, y].terrainType = TerrainType.Grass;
                }
                else if(noise > 0.5f)
                {
                    this[x, y].terrainType = TerrainType.Sand;
                }
            }
        }
    }

This is the way I add chunks of terrain
    void Start()
    {
        maps = new Dictionary<Vector2Int, Map>();

        Res.LoadMaterials();

    }

    void AddNeighbours(Vector2Int position)
    {
        int length = 32;
        for(int x = -length; x <= length; x++)
        {
            for(int y = -length; y <= length; y++)
            {
                Vector2Int addPos = new Vector2Int((x * size) + position.x, (y * size) + position.y);
                CheckAndAddMap(addPos);
            }
        }

    }

    void CheckAndAddMap(Vector2Int addPos)
    {
        if (!maps.ContainsKey(addPos))
        {
            AddMap(addPos);
        }
    }

    void AddMap(Vector2Int origin)
    {
        Map map = new Map(new Vector2Int(size, size), origin);
        maps.Add(origin, map);
        MapMesh mapMesh = new MapMesh(map);

        foreach (KeyValuePair<TerrainType, MeshData> kv in mapMesh.meshes)
        {
            MeshData meshData = kv.Value;
            TerrainType terrainType = kv.Key;

            GameObject go = new GameObject("Mesh");
            go.transform.SetParent(this.transform);
            go.transform.localPosition = new Vector3(mapMesh.map.origin.x, mapMesh.map.origin.y, -(int)kv.Key);
            MeshFilter meshFilter = go.AddComponent<MeshFilter>();
            meshFilter.mesh = meshData.mesh;

            MeshRenderer mr = go.AddComponent<MeshRenderer>();
            mr.material = Res.mats[terrainType.ToString()];
        }
    }

    // Update is called once per frame
    void Update()
    {
        Vector2Int playerPosition = ConvertPlayerPositionToTiles(ShootBehaviour.PlayerInstance.transform.position);
        AddNeighbours(playerPosition * size);
    }

    private Vector2Int ConvertPlayerPositionToTiles(Vector3 position)
    {
        Vector2Int result = new Vector2Int();
        result.x = (int)position.x / size;
        result.y = (int)position.y / size;

        return result;
    }

sentences:
Waiting for object's Awake() after loading a new scene synchronously I have a GameScene with an initially active GameObject in it, which has a singleton component:

public static ObjectiveManager Instance;

public void Awake()
{
    if (Instance != null && Instance != this)
    {
        Log.Info(this.GetType(), "Instance of this class already exists! CRITICAL");
    }

    ObjectiveManager.Instance = this;
}

Now, when I call:

private void StartGameScene(){
    SceneManager.LoadScene("GameScene");
    ObjectiveManager.Instance.SomeFunction(); // << singleton not initialized
}

I get an error, because ObjectiveManager is not set to an instance of an object.

As LoadScene is a synchronous operation so my guess was that Awake() is called immediately, synchronously. As I can see now, it's not.

Is there any way to determine that all of the objects on the scene have their Awake() already called, without checking each of them with some custom IsReady?

sentences:
Must I display Health and Mana to the player? I'm thinking of doing one or more of the following:

hiding the player's Health
hiding the player's Mana
hiding the player's Health from other players
hiding the player's Mana from other players

I don't know of any game that has done such things before so I'm wondering if this will have a positive effect on the players and why no game has done so before.

sentences:
How to stop camera from rotating in 2.5d platformer I'm stuck with a problem: I can not make my camera stop rotating after character.

What I already have tried: using empty game object with rigid body and locked rotation and make it parent of camera, while player being the parent of object.
Also, I've tried using few scripts from web, that did not help.

Right now I'm bad with using JS in Unity (can handle JS on website, but I dont know how to integrate it for now) and practicing the basics, making easy 2.5d platformer with basic features, so I can not write code for now.

sentences:
Problem with AssetManager in libgdx I started using the asset manager, so I could use a loading screen. Everything is working fine, but when the app enters a pause state, it unloads every asset and when it loads the screen all the assets are gone. I debugged and I found that they are waiting to be loaded again, I commit an update to do it but nothing happened.

Am I missing something? (In the pause method, I don't unload anything)

sentences: How can I implement platformer pathfinding? I've gone through A* pathfinding but could find anything on this. What I'm looking for is pathfinding for something kind of like a super smash bros level with different platforms. Can anyone point me in the right direction?

sentences:
Unity: How to transition to a different animation during the blend phase? I have a set of animations: Idle, start walking, stop walking, and walking full speed.

I have the animations all blending nicely...and the controls are fairly responsive during most of the motion...but there are odd transitions where the blends take away control--I can't transition to the walking animations when I am blending between the "stop walking" and "Idle" animations, for instance.

How do I get the animations to transfer during the blend phase??

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:
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:
What are the other three "game dynamics"? Seth Priebatsch recently gave a tedtalk entitled “Building the game layer on top of the world.” In it, Seth described four “game dynamics,” techniques used by game designers to make games fun and addictive. The four dynamics that Priebtsch described were:

Appointment dynamic-a dynamic in which to succeed, one must return at a predefined time to take a predetermined action. (Real life example: happy hour)
Influence and status-the ability of one player to modify the behavior of another's actions through social pressure. (Example: different color credit cards as a reflection of status)
Progression dynamic-a dynamic in which success is granularly displayed and measured through the process of completing itemized tasks. (Example: linkedin profile progress bar)
Communal discovery-a dynamic wherein an entire community is rallied to work together to solve a challenge. (Example: finding interesting content on Digg.com)

Seth explained these four game dynamics in his talk and added that his company has an additional three. Does anyone know (or have any theories) about what the other three game dynamics are?

sentences:
How do I blink a sprite a few times before it disappears? I need the 3d poop emoji model in the chest on the right to blink, visible-invisible-visible, several times:

This is a 3d gameObject oriented to face the camera, shaded with an unlit material.

I need the object to "blink/flash" to indicate that the item has been obtained. The object needs to be generated the moment the lid opens (done), stay unchanged until the lid pops all the way up (0.2 seconds), and flash 3 times during the 0.6 seconds the lid is up. The object is destroyed the moment the lid starts to come down again.

My code (blinking/flashing is not working)

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

public class ItemBox : MonoBehaviour
{

    bool disabled = false;
    private Animator anim;
    public GameObject item = null;

    void Start()
    {
        anim = GetComponent<Animator>();
        if (!disabled)
        {
            anim.Play("ItemBoxIdleState");
        }
    }

    // Update is called once per frame
    void Update()
    {

    }

    void OnTriggerEnter (Collider other)
    {
        if (!disabled && other.gameObject.tag == "Player")
        {
            anim.Play("ItemBoxGetItemState");
            GameObject itemClone = Instantiate(item, transform.position + new Vector3(0, 0.5f, 0), Camera.main.transform.rotation * Quaternion.Euler(0,180,0));
            Blink(itemClone);
            Destroy(itemClone);
            disabled = true;
        }
    }

    IEnumerator Blink(GameObject obj)
    {
        Renderer objRenderer = obj.GetComponent<Renderer>();
        objRenderer.enabled = true;
        yield return new WaitForSeconds(0.2f);

        for (int i = 0; i < 3; i++)
        {
            objRenderer.enabled = false;
            yield return new WaitForSeconds(0.1f);
            objRenderer.enabled = true;
            yield return new WaitForSeconds(0.1f);
        }
    }
}

Instead of blinking/flashing, the object is just there, doing nothing.

sentences:
How to raycast octree for closest leaf node? So I need to raycast a octree for closest leaf node as efficient as possible. I will be doing it on compute shader (hlsl), but I think it doesn't matter because first I need to understand the approach and math behind this process in general.
My struct looks like this:
struct OctreeNode
{
    uint  size; // size of cubic node

    uint posX; // center of node
    uint posY; // center of node
    uint posZ; // center of node

    uint childExists;
    uint isLeaf;
    uint isChild;

    uint parentIndex; //Parent node index in structured buffer
    uint minchildIndex; // Node child min index in structured buffer (+1 is next child, etc)
    uint index; //Index in structured buffer
};

Octree is rather big, so I guess I can't afford to raycast everything and then compare distances. I have been looking into https://stackoverflow.com/questions/6281415/octree-raycasting-raytracing-best-ray-leaf-intersection-without-recursion , but I do not understand the answer (especially HLSL one with hitbox what is unknow thing).
Any hints, code, directions highly appreciated.

sentences:
What is a good strategy to recruit test players for a chess app? We developed a chess app for iMessage and we would like to have people try it out and tell us their opinions.

Do you know a good strategy to give away free promo codes for the pro version of our new game?

sentences: Can I use the free version of Construct 2 on Gamejolt? According to Scirra's website, I am not permitted to use the free version of Construct 2 for commercial purposes. If I host a game I created with the free version of Construct 2 on Gamejolt where I can earn money on the game, am I violating Scirra's terms?

sentences:
Upgrade to Unity 2018.2.2f1 resulting in missing file errors from Visual Studio After being prompted by Unity to upgrade and doing so, Visual Studio is now giving me a long list of errors in the project about missing files.

Error   CS2001  Source file 'Packages\com.unity.textmeshpro\Scripts\Runtime\FastAction.cs' could not be found.  Unity.TextMeshPro   C:\Nightmare Games\Games\In Production\H0V3R\CSC    1   Active
Error   CS2001  Source file 'Packages\com.unity.textmeshpro\Scripts\Runtime\MaterialReferenceManager.cs' could not be found.    Unity.TextMeshPro   C:\Nightmare Games\Games\In Production\H0V3R\CSC    1   Active
Error   CS2001  Source file 'Packages\com.unity.textmeshpro\Scripts\Runtime\PackageResourceImporterWindow.cs' could not be found.   Unity.TextMeshPro   C:\Nightmare Games\Games\In Production\H0V3R\CSC    1   Active

There are 45 of these, and they're all in the project Unity.TextMeshPro.  I've looked for these files and they don't see to be anywhere on my PC.  Should I try reinstalling Unity or starting a new project again?  Has anyone else run into this?

sentences:
How to use modern OpenGL for 2D games? I've found a plethora of "modern" OpenGL (3.0+) tutorials for 3D, but I have found next to nothing when looking for information on how to use it for 2D game development. How can I get started using OpenGL for 2D gamedev?

Specifically, I'm interested in getting answers to the following topics:

How should I set up my various matrices for orthographic projection?
Are shaders as heavily used in 2D applications as in 3D ones? If so, what is their purpose in the 2D setting?
How should I handle the massive number of textures obviously required for a 2D game?

I apologize for the relatively broad question, but I've spent a long time searching and I've found very little useful information that applies to modern OpenGL.

sentences:
Most efficient way to create/modify terrain in real time? In my game players can modify terrain in real time, but I am not sure what is best practice for this scenario.  I have redesigned and refactored the way the player does this a few times, and am feeling at a loss.

Initially I created small blocks of terrain as GameObjects, but this I quickly realised was grossly inefficient.  Later I devised a system which procedurally generated the 3d mesh by creating vectors and tris for a much larger terrain chunk GameObject, but this is also unfit for purpose.  As I would like the player to be able to place new terrain pieces (replacing old) from premade 3d art assets.

The question is how should one string these pieces together into one map, so that the player can enjoy a large map with a fine level of control?  And for this not to break the game with inefficiency?  Consider that the terrain system is composed of blocks of premade terrain segments, like river or cliff sections.  I feel like I'm missing some basic knowledge of how and when to merge 3d meshes into GameObjects for this purpose?

sentences:
Loading encounters and collisions questions within 2D I had three basic questions regarding the creation of a 2D sandbox/openworld game much like Terreria.

Only looking for a general overview/opinion, nothing too detailed. Any links to literature that would help answer the questions below would also be helpful.

First off - Keeping track of the map using regions/chunks, lets say 512 x 512 chunks. Is it recommended to pre-load the surrounding chunks of the 'chunk in focus', so if the character enters either one there is no load time? ~Or do you simply load smaller slices of the chunk next door, in the direction of movement?

Secondly. Do I need to add a collision box to every tile that is preloaded so any NPCs that are off screen but 'next-door' can interact with the environment? Or is this going to be massively CPU intensive ? (512 x 512 x 9 tiles alone)

Third and last question. Off screen RANDOMDLY GENERATED NPCs/monsters I assume dont load and render as they enter the viewable area on the active chunk but are loaded and activated sometime before they are seen. What are the general strategies use to handle this?

For Reference: Using c# with Unity, no third party frameworks/plugins.

Many thanks
John

sentences:
Help with Chase AI? (Similar to Blue Demon) all! I'm working on a chase ai / follow player script, for a 2D project of mine, I'm going for something similar to Blue Demon where an integer value controls what enemy is on screen, and can be changed for individual instances, and it follows the players animations and directions closely, and when you make contact with the enemy, you are defeated- game over. Anyways, I've got some code 'somewhat' working, i have an enumeration that controls the state machine of the animator, however, The Update loop is the real problem here, as of right now-
// Update is called once per frame
void Update () {
    //bool isMoving = anim.GetBool("isMoving");
    if (EnemyID == 0)
    {
        //transform.position = Vector3.MoveTowards(self.position, player.position, speed * Time.deltaTime);

        if(Vector3.Distance(target.position, transform.position) <= maxRange && Vector3.Distance(target.position, transform.position)>= minRange)
        {
            anim.SetBool("isMoving", true);
            transform.position = Vector3.MoveTowards(transform.position, target.transform.position, speed * Time.deltaTime);
        }

        // Enter State
        MovingState();
    }
    else {
        IdleState();
    }

}
Instead of the object following the player, it starts to run away when the player gets near? or when the player goes to a corner, it moves diagonally? It never seems to actually follow the player consistently. Suggestions and constructive criticism are greatly appreciated, thanks in advance!
Edit:
    Animator anim;
    bool caught;
    public Animator player;
    public Transform target;
    [SerializeField]
    float speed = 5f;
    [SerializeField]
    float maxRange;
    [SerializeField]
    float minRange;

    public int EnemyID;
    State state;

The EnemyID as of now isn't necessarily set to a specific value (i.e, it is set to 0) When it is equal to that number, the Update loop is supposed to have the object follow the player at a specific speed and range, during this time, the anim reference is setting the animator boolean parameter 'isMoving' to true starting the walking animation.  If the enemy object stops moving, it should enter its idle state.
    IEnumerator IdleState()
    {
        yield return new WaitForEndOfFrame();

        anim.Play("Idle");
    }

    IEnumerator MovingState()
    {
        yield return new WaitForEndOfFrame();

        anim.Play("Move");
    }

Currently the idle state is not working, but this is alright.

sentences: Receive UDP packet in android I'm sending UDP packet to android over a wireless network from some other software . how can I receive that in android ? should I write a client in android to get the data?

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:
Standard unit value for 3d game character height? Basically I'm building a first person shooter game using DirectX9. And now, I'm working on the modeling side. But before I start modeling, I have to make sure that I create all the models with accurate size. So it doesn't look too big or too small in the game. But I'm having problem deciding the characters height value including the main character and the NPC characters. I think it would be easy to measure other models/houses/walls/doors size if I have the characters height. Otherwise, I will messed up everything.

I assume that all the characters are 1.8 meter in height, including the main one. Though not sure that how to represent that value in DirectX vector ( DirectX unit == ? ) but If I set the camera height that value, it looks too low from the ground ( in my eyes ). Now what is the next value? Should I switch to fit? Which would very big value like 6. Or is there any standard value for that case which I don't know?

I hope you guys have understand my situation. Actually I'm very new to this kind of stuffs. So hopping to get some help or suggestion which would be great for me.

sentences: Smallest, most memory-efficient way to have tiles? (C++/OpenGL) I need to have tiles in my game, just 16x16 images, there would be hundreds (or even thousands) that make up a level. Of course it's not viable to have thousands of memory-hog normal entities, but tiles are just repeated images. What's the most memory-efficient way to do tiles?

sentences:
Let a point drive on a polyline I want to create a polyline which should be quite smooth for my game. A point is following moving on the line, but can accelerate/brake and has to get slower in corners.

In the end I want to set up some stats (good acceleration, low topspeed, "good" cornering") and simulate the time it has taken to go from start to finish (drawning it to the player would be just a bonus). Yes, this will be some sort of a racing simulation.

I'm quite new to this style of games and I have no idea to do that. I don't even know how to create such a polyline I can easily use.

I don't want a finished algorithm but rather some hints in the right direction. I thought about using the angle of the corner to determine the speed, but that's not really much. I want to implement the time simulation in python, outputting the movement with html/javascript.

How would I start implementing such a mechanism?

sentences: How to stack units in a tile based game? I'm trying to make it so that no more than 5 units can be stacked on a tile. I have a Tile class that creates each tile's preferences. Should I store the units in an array or arraylist in this class?

sentences:
Creating a new GLFW window and re-using the old context causes crash I am using GLFW 3.0.2 and when I want to switch the application to fullscreen, I create a new window and intend to use the OpenGL context of the old window so I don't have to reload all the meshes, materials, etc and can just draw it again...

This is what I do when I want to create a new window, such as when first creating the window or switching fullscreen mode:

bool GLFWWindowManager::SetupWindow(const uint32_t width, const uint32_t height)
    {
        glfwWindowHint(GLFW_SAMPLES, mMSAA);
        auto newWindow = glfwCreateWindow(width, height, mWindowTitle.c_str(), mFullscreen ? glfwGetPrimaryMonitor() : NULL, mWindow);   // mWindow is NULL first time

        if (!newWindow)
            return false;

        if (mWindow)  // if old window present, destroy the old window
            glfwDestroyWindow(mWindow);

        mWindow = newWindow;
        glViewport(0, 0, (GLsizei) width, (GLsizei)height);

        return true;
    }

// the flow:
void GLFWWindowManager::Test()
{
    SetupWindow(800, 600);
    glfwMakeContextCurrent(mWindow);

    // draw meshes

    mFullscreen = true;
    SetupWindow(800, 600);

    // try to draw some meshes, crashes on GLDrawElements
}

What am I doing wrong?

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:
UE4 BlendSpace is not working as intended I am trying to set up a rifle aiming blendspace in UE4. I downloaded animations from Mixamo, added root bone and retargeted them to UE4. Then I set up the BS, but the legs of the character are behaving weirdly, they are twitching, going through each other. The animations work fine on their own, but behave that way in the BS, especially in the transition areas. Here is the video:
Video
Here is my BS:

Here is how I am setting Speed and Direction variables used in the BS:

Can someone please help me with this? I am new to UE4. How do I fix this and get a smooth Animation Blend Space?

sentences:
How do I ensure my Android build is not darker than in Editor? My scene on the Android Build looks much darker. Based on my research about the  topic, and from the texture of the light on the spheres, I assume it is because the light uses per vertex render mode on Andriod.

I am trying to force per pixel render on Android, these are the things I have tried:

set the Rendering to Important of the Light on the scene (There is only 1 directional)
check the values of my RenderPipeline asset (the one came with the LWRP Template project), the Main light is Per Pixel, Additional Light (which doesn't seem to matter) is also Per Pixel
set the Preset Light's Render type to Important in the Preset Manager

I will have infinite levels, the map changes dynamically, so Baking the light is not an option.

Can I achieve this somehow? Or at least force my editor to use per pixel so I can light up my scene more intuitively.

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 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:
OpenGL Slow rendering of half a million points on Windows How can I speed up the drawing of my points in OpenGL on Windows?

I have an Qt 5.9.1 app that shows real time Lidar data, so at a certain frequency I add points to my buffer (which I've overloaded to act as a circular buffer.)

On linux, everything is great, all my renderers combined (my lidar points, my 3D models, etc) render in a small fraction of a 60 FPS frame.  On Windows however, rendering the lidar points takes almost the time of two 60 FPS frames.  I measured this put inserting glFlush() and glFinish() after the glDrawArrays() calls.

My buffer size is about ~1/2 a million points.  I'm trying to show points that could span several km, but are usually confined to 1 km - I mention this because right now I'm not doing any explicit frustum culling.

My process is:

Load new points from a vector into my overloaded circular OpenGL buffer.  Each point is 20 bytes (position, intensity, ..)
Write all my uniform variables (MVP matrix, etc)
Call glDrawArrays
Then there's a vertex shader that just passes data through
A geometry shader that instances the points for each viewport (3)
A fragment shader that colours the points by elevation.

Explicitly:

Initialize:

auto LidarRenderer::initPointShaders() -> void
{
    point_opengl_buffer_.setUsagePattern(QOpenGLBuffer::DynamicDraw);
    initializeOpenGLFunctions();

    // Setup our vertex buffer object.
    point_opengl_buffer_.create();

    render_program_ = make_unique<QOpenGLShaderProgram>();

    // Vertex shader pretty much just passes points through
    render_program_->addShaderFromSourceFile(QOpenGLShader::Vertex,   vertex_shader_);
    render_program_->addShaderFromSourceFile(QOpenGLShader::Geometry, geo_shader_);
    render_program_->addShaderFromSourceFile(QOpenGLShader::Fragment, fragment_shader_);

    render_program_->link();
    render_program_->bind();

    // Store the vertex attribute bindings for the program.
    {
        // Create our QOpenGLVertexArrayObject
        vao_.create();
        QOpenGLVertexArrayObject::Binder vaoBinder(&vao_);

        // Bind out buffer
        point_opengl_buffer_.bind();

        glEnableVertexAttribArray(0);
        // Vertex position data, send to location = 0, 3 floats per position,
        // not normalized, stride of 20 bytes, no offset
        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 20, 0);

        glEnableVertexAttribArray(1);
        // Vertex intensity data, send to location = 1, 1 int, stride of 20
        // bytes, 12 byte offset
        glVertexAttribIPointer(1, 1, GLint, 20, 12);

        // ...

        point_opengl_buffer_.release();
    }

    render_program_->release();
}

Load new points (write to buffer):

auto LidarRenderer::loadNewPoints() -> void
{
    if (!point_opengl_buffer_.bind()) return;

    auto point_count = tmp_buffer_.size();

    // Transform the points into the proper frame
    std::transform(tmp_buffer_.begin(), tmp_buffer_.end(), tmp_buffer_.begin(),
        [&my_nav_offset_vector_](const RegisterPoint& p) { return p - my_nav_offset_vector_; });

    point_opengl_buffer_.write(&tmp_buffer_[0], static_cast<unsigned int>(point_count * sizeof(RegisterPoint)));
    point_opengl_buffer_.release();

    // Clean our vector
    tmp_buffer_.clear();
}

Paint:

auto LidarRenderer::paintGL() -> void
{
    QOpenGLVertexArrayObject::Binder vaoBinder(&vao_);
    render_program_->bind();

    // Draw all the ground points in the buffer
    glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(point_opengl_buffer_.CountVertices()));

    render_program_->release();
}

Does anything in that code look wrong?  Is there a way to possibly speed up the rendering? (I should mention that I'm still an OpenGL beginner.)

sentences:
Third-person Steering with Samsung Gear VR Unity I am working on third-person steering, where you see the object like car, plane, spaceship in front of you as you steer it. I have got the code for Google Cardboard . How can I implement this in Samsung Gear VR with Unity?

public float speed = /* some number */;

private CardboardHead head;

void Start()
{

 head = Camera.main.GetComponent<StereoController>().Head;

}

 void Update()

 {
     transform.position += speed * head.Gaze.direction;
  }

sentences:
Utility of submesh class in a 3d game engine? I've read somewhere that we use sub mesh for being able to give different materials to one mesh. But why not simply do this with scenegraph ?

I mean you have a car mesh, and instead of using submeshes for windows, wheels etc... We could have one car node which would be composed of child nodes ( wheel, window ) with differents meshes and materials.

What's the utility of submeshes while there is scenegraph ? I've noticed that in Ogre3D there is both scenegraph ( SceneNode class ) and a mesh/submesh system, why ?

sentences:
Inputting Only Alphabetical Input - Slick2D I'm trying to obtain the user input for when they enter their own name. However I would prefer to have it Alphabetically.

This is what I'm doing at the moment:

    if (input.isKeyDown(Input.KEY_A)) {

    }
    if (input.isKeyDown(Input.KEY_B)) {

    }
    if (input.isKeyDown(Input.KEY_C)) {

    }
    //continued for each letter.

Is there an easier way to obtain the input? An hopefully make sure its only alphabetical?

sentences:
How can I simulate physics on my curved LED strip? I have a LED strip with 300 LEDs that I can control one by one:

https://github.com/cipold/pyledstrip

You can think of them as Adafruit NeoPixels:

https://www.adafruit.com/category/168

I have code to detect the physical positions of all LEDs using a camera and generate an x/y heightmap:

https://github.com/cipold/pyledstrip-detector

There is some experimental code to make use of the heightmap and let pixels race along the strip like on a rollercoaster:

https://github.com/Pixe1/pyledstrip-particles
Video: http://mnagel.net/oneshot/2018-03-02/particle.mp4/975a194be7cc6fc8/particle.mp4

The "physics engine" within that code is very ad-hoc, however. I want to rewrite it into something that more explicitly encodes the physical laws of classical/Newtonian mechanics.

I can easily simulate particles with mass, position, velocity (acceleration/gravity/forces). With multiple particles and gravity between them, I would end up with some kind of solar system. Or with constant overall gravity, one particle would fall down in a straight line, accelerating all the time.

What I really want is "global gravity" but restrict the particles to move along the path dictated by the LED strip/heightmap of waypoints (one degree of freedom along that path). How can I adequately model this restriction with formulas that are still reasonably physically accurate?

sentences:
Use ARCore to detect marker and show information I'm new to AR, and am trying to use Google's ARCore to build a simple AR prototype. Basically if a logo is detected, I like to place some real-time charts or text information on the screen. Similar to this demo for placing a car on a logo using other SDKs.

Am I able to do this in ARCore (with Android Studio)? Is there any samples or examples showcasing similar concept?

sentences:
Slingshot gravity effect I am trying to make a sling-shot that fires a projectile. I want it to act like the standard sling-shot in angry birds.

So far I managed to get the "pulling" effect, ie. If I draw backwards it fires in the opposite angle of the direction my finger went, and with different speeds depending on how far I dragged the finger from the "start-position".

Touch Code/logic:

@Override
    public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        touchPos.set(screenX, screenY, 0);
        camera.unproject(touchPos);
        Vector2 temp = new Vector2(touchPos.x, touchPos.y);

        Vector2 d = temp.sub(startPos); //subtract finger-position from start-position
        float velX = d.x * FIRE_SPEED; //add speed
        float velY = d.y * FIRE_SPEED;
        d.set(velX, velY); // set the velocity

        projectile.setVelocity(d); //send velocity to object
        projectile.setFired(true); //signal the object that its been fired

        return false;
    }

Object Code:

public void update(float delta){
        if(fired){
            pos.x -=  velocity.x * delta; //since I want it to move the opposite direction of where I dragged, I subtract
            pos.y -=  velocity.y * delta;
        }
    }

How would I go about adding gravity here? I want it to shoot in the set direction, then after a certain time/distance I want it to start falling (taking into account the direction so that it looks like real gravity), exactly as in angry birds.

sentences:
Find out hit child with RaycastHit Let's assume having a (2d-) gameobject with 3 images: Head, body, feet.
By using RaycastHit2D I can find out if the gameobject was hit (for example by the mouse):

RaycastHit2D newSelectedObject = Physics2D.Raycast(cameraVector, Vector2.zero);

Now I'd like to find out if the head, body or feet was hit. How can I do that?

sentences:
The websocket messages in my online game are being served too slow Im attempting to make a online game in python, though I have ran into a problem. Basically I want the game to be playable in many regions, but the websockets are to laggy to be played in farther regions. To get around this I have implemented a system on the client that extrapolates between two values to find the speed (x and y axis change). The player will continue to move to these speeds, so if there is a lag spike, it wont be as noticeable. the server is coded in python, I use a python web-framework called Quart (flask with asyncio functions) The websockets run asynchronously to the main loop. The main problem is when the x and y values are updated on the server, they might be updated multiple times before they get served by the websocket; The result of this is an inaccurate estimate on the client side, which cause jittery movement when the clients x and y values are updated to the proper values. I would appreciate advice for resolving this issue.

Things to note:

The python web-framework I use is documented here:  https://pgjones.gitlab.io/quart/

My method for extrapolating the values on the client-side is just recording the before and after x and y values, then subtracting the before from the after.

sentences:
Draw and update order in 3d graphics In all of the code samples that I have looked at, the game loop looks something like this:

while(true)
{
   InputAndUpdate();
   Draw();

   SwapBuffers();
}

However doesn't this destroy parallelism between the CPU and the GPU? After the swap buffers call, the GPU will be sitting there idly while the CPU is handling input and updating. Then when the CPU has finished issuing draw commands, it waits until the GPU is finished rendering.
Why isn't it done like this? :

while(true)
{
   Draw(); //First issue the draw commands
   InputAndUpdate(); //Update while the GPU is busy rendering

   SwapBuffers(); //Now block and wait for the GPU to finish
}

sentences:
How do I go from a general idea to a specific draft of a design? Before starting planing your code, the data structures, the class hierarchy, you need to have a clear idea of what you want for your game.
I came across with an idea for a game, but it is too general.

I think every game starts with a general idea, but how did they take that general idea and then the came up with games like Imperium Civitas... I'm refering to the actions you can or can't do, the events, in-game materials etc.

I wonder how you should engage a blank paper. Where you should start? Is there a chain of steps that you have to follow?
Thanks.

(My idea is much more simpler than Imperium Civitas)

sentences:
What methods do game hacks use to counter anti hack systems? In popular multiplayer first person shooter games, there are often hacks such as Aimbot, Noclip, Speed, and other similar hacks which I know game developers deploy anti hack features to combat, but, wanting to know why some of these hacks are able to get past these systems, I looked up a hack for the game I'm currently playing and they claim to deploy "counter measures" against the anti hack systems.

My question is, when everything happening is being seen by the game server, how can hacks avoid the anti-hack system? Movement that's too fast for example seems impossible to hide. Moving through walls also seems impossible to hide. Finally aimbot is a difficult one, maybe there's no very good solution to detecting it, if the hack developer, for example, purposely makes it imperfect.

My question to game developers is: How can anti hack systems fundamentally detect speed, noclip, and aimbot hacks, and how can hack developers fundamentally deploy counter measures against systems to detect those three types of hacks?

sentences:
Strange lighting bug in my game I've been experiencing this lighting bug in my game.

As you can see there is a box around the player on the back wall and underneath it. the platform and back wall are 3D objects and the player is a 2D sprite. i believe i have found an option in the past but i am unable to find where it is now. I really appreciate you help and thank you all in advance

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:
How can I completely hide and protect strings from the player in Unity? I have been using Unity to create a 2D game which will be completely offline (which is the problem), the game-play needs you to enter certain strings at certain levels and Unity compiles to DLLs, which can be easily reverse engineered, so is there a way to protect those strings (the game is offline so I can't retrieve from other source)?

The game relies heavily on those strings, and yes I'm aware of Obfuscation but I want something more robust. And I know that the easy way out would be doing everything online from a data-source but I was wondering if it's possible.

It can be decompiled like this:

sentences: Unity Google VR SDK Main Camera showing Game Objects Behind Left and Right Cameras I'm trying to get a basic VR app up and running on iOS with the Unity Google VR SDK and I've run into a strange issue where my game objects are appearing behind the left and right camera views in cardboard view. In the HeadsetDemo app that is provided along with the SDK, there's just a black background but in my app that background is the default grey-blue skybox color and renders any game objects that I have in my scene. Does anyone know how to hide game objects from that main camera?

sentences:
How to calculate the price for acquisition of a mobile game I searched long and hard thru the Game Dev community here and I didn't manage to find a good enough answer for a situation that I need help with.

Here is the deal - I've spent about a year to single-handedly develop a mobile game which is a mix between MMORPG and idle battle games. Wouldn't like to go into too much depth as to which game we are talking about and who is trying to buy it but, a company I have worked for before reached out to me with a proposal to buy the game from me so they can reap the profit from it and develop it further since they are a professional game dev company while I am a single person and I can't really reach the game's full potential as far as growth and player base goes. Now the game is pretty beneficial for me since I live in a region with a very low-income standard so the money I get from the game might not be much for many other people but for me, they are equal to about 1.5 ~ 2 monthly salaries (we are talking average salary for this country). That is about 600 Euros of pure profit after I pay for all the expenses. Of course, this number fluctuates depending on different events and sales I release and general user activity. It is a free-to-play-game so the income is mostly from microtransactions for in-game rare currency and special event item packs purchases.

Now the issue I have is that I am not sure how to set a price for the acquisition. What feels right for me would be to calculate the potential average income from the game in the next 12 months and add to this the average salary per month for a game dev of my qualifications multiplied by the number of months it took me to develop it to its released state. That would round up to about 15k euros.

When I think about it 15k euro isn't a small price to pay, but the game will pay that off in the next 1-2 years, and it might even grow much faster after they make investments for advertising and release new features and so on and so on. This means that after the second year they should be on a clean juicy profit from that deal, and that sounds good to me as well since 15k euros for me is a decent sum of money considering that the game has been running for about 14 months. And lets not forget that it has been beneficial for me for the last few months so it hasn't been always uphill.

What I need really is an advice as to is this price of around 15k Euro justified and is it a good deal for both sides, since I don't want to shoot way high and blow the acquisition, but I don't want to give the game away for a low price since it really holds a lot of potential, and it is my first fully released game.

sentences:
Algorithm for staying "alive" forever I am implementing a game where the player is playing(sliding) the little red rectangle and the purpose is to not hit the black rectangles and to not move out of the inner blue rectangle. The black rectangles are moving in trajectories from left to right(right to left) and from top to bottom(bottom to top). The speed they are moving with is constant e.g. 5 pixels. You can get a better idea in this video.

One of the game modes is the following - 2 paths will be proposed by the game displayed as arrows and one of them may lead to "death", while the other will always be the right one and the user will have to choose one of them until he makes the wrong choice. The movement directions can only be top,bottom,left or right and not diagonal and the speed of the red rectangle is constant e.g. 6 pixels and the black rectangles speed is 5 pixels.
I am struggling with the algorithm for the "successful" direction for more than a week and what I have done so far is the following :

Generate a random float number between 1.0 and 2.0 seconds and then divide the generated number by 0.030 for example to get the number of moves that will be made by the black rectangles and red rectangles.
Calculate the black rectangles and red rectangle move points that will be made for the following time session by multiplying the number of moves by the speed which is 5px for the black rectangles and 6px for the red rectangle.
After I know the speed of the black rectangles and the number of moves I can tell their position in any time of the current time session.
Move the red rectangle to the left until it is being hit and remember that result e.g. 15 moves until hit. Do the same thing for right,up,down direction.
Sort the direction by the moves that can be made before hit in ascending order.
Move the red rectangle in the direction in which the most number of moves can be made.
Do the same thing until the time session ends i.e. the random float number generated in the first step.
This solution works most of the time, but some times it leads to a position where an escape is not possible. The problem is not in the code, but in the algorithm logic.
For example look at the following image :

As you can see the red rectangle will go to a position where it will be stuck by two of the black rectangles. The best possible solution in this situation would be to move to top 1 time and then to left and after that to top, because the black rectangle in the top left corner is going to top, but I really have no idea how to solve this task. What would be the optimal way to accomplish this task.
Thank you in advance!

sentences:
canvas not found in game view with unity I am working on a GearVR app with Unity3D.I have an environement and I have placed a canvas in the scene.I have set the canvas Render mode to "World Space".But when I runned my project,the canvas is getting displayed on the scene view,but in the game view the canvas is not getting on the scene.But whereas in the camera view its showing the canvas.What will be the issue?.

When I set me canvas Rendere mode to Screen Space-Overlay the canvas is getting displayed in the scene but as the lookup change,the canvas is also moving along with the camera

Can anybody please help me out.

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:
OpenGL - Quad is being separated like a two triangles after blending I wanted to add transparency for my UI elements, so I enabled blending by adding:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

before renderer and

glDisable(GL_BLEND);

after renderer.

So I tried to render simple rectangle (with glDrawArrays() because I'm using GLSL shaders).

Before I enabled blending my rectangle (1 quad) looked like this:

And now, after blending it looks like this (Like a two triangles):

Do I need some extra settings for my blending or what?

Edit:

I noticed that if I remove anti-aliasing code:

glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

glEnable(GL_LINE_SMOOTH);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);

Problem will disappear, but I want to keep anti-aliasing in my game. Any ideas?

sentences:
Is there a good alternative to a world state data structure? How do you avoid one big data structure containing all the current world state ?

Let's pretend we're in a real-time strategy game, how would you code a skill that decrease mana of units around it ?

With a world state it would look like that :

class MySpell : ISkillWithoutTarget
{
  void Cast(Unit caster, World world)
  {
    foreach (Unit target in world.Units)
    {
      if (target.distanceWith(caster) <= N)
      {
        target.Mana -= X;
      }
    }
  }
}

So my question is : Does a good alternative to "world object" exist ? Or world object is the best way to deal with these kind of interactions ?

I'm not looking for a way to organize/optimize my big data structure, but how to avoid it.
I would prefer not using this architecture because almost every piece of code can touch every game object. I'm looking for decoupling to avoid ending with bug almost untraceable.

sentences:
How to create an endless scrolling background? I need to add a scrolling background to a my game, the image is 512x512px. It's for a car game with two way traffic and I want to be able to cross over to the opposite side and drive against the traffic too. The game is in portrait mode and I use cocos2d.

How can I make this in the best possible way?

sentences:
Unity3D mobile 4G internet web request is very slow I have a windows VPS server and i have installed an Apache server on it. in my server I only have a simple text file that contains some few words.

My problem is that when I'm trying to sending a web request to my server by (4G sim card internet service ) for accessing to getting data from the text file , It works very slow .

Something about 30 or 50 secound ! but after first request if I try again there is no problem ! It works very fast !!!   It seems This slowdown will only occur in the first connection .

But in other hand if I use WI-FI internet , there is no problem and every time I try to get data it works fast.

MY problem is only with sim card internet !

This is part of my code :

    IEnumerator Get_Data()
        {
            UnityWebRequest www = UnityWebRequest.Get(servers_Address + "file.txt?t=" + UnityEngine.Random.value);

            yield return www.Send();
            string the_Data = www.downloadHandler.text;
}

Is there any problem in my code ?

My unity version is 2017.1.1

How can i solve this issue ?

sentences:
Online architecture guide I am a newbie in gamedev, and I don't know about programmer's problems that can appear during development.

So can you advice me some best practice for starting build new online multi-player game backend?

I just saw reddraft server, and I think Spring library can also do some of its features. What is big difference? Do I need learn more spring or I have to use servers like reddraft or write these tools myself?

I know that I need to learn hard and many - and the question is - what I should to learn now at the beginning?

Thanks.

sentences:
Retrieving DirectX9 Shader Input Parameters (vertex Input Layout) Is it possible to retrieve the vertex input layout from an effect file in Direct3D9?

In Direct3D11 I can achieve this by using

D3D11_SIGNATURE_PARAMETER_DESC paramDesc;
ID3D11ShaderReflection* pRefector->GetInputParameterDesc(paramIndex, &paramDesc);

to get info about the input parameters.

I wish there was a way in Direct3D9 to do the same.

sentences:
How to make a procedural tilemap island with more than one tile in unity? I have been working on a simple survival game. I made the character and some basic elements (I'm new to the field though).
But what I could figure out how to make is the world generation.
I just wanted to make a program that generates an island procedurally. I tried Perlin Noise before, but it wasn't that efficient. The results were too random.

In the past few days, I found a unity package that generates tilemap islands, and I really liked the results, but I didn't know how to make more tiles than just grass.

The problem is that I don't know how can I make a script like this because I am still new to unity. That's why I tried asking for some help.

I just want something that looks like this :

I would really appreciate any help!

sentences:
Day/Night - Rotation from a sine wave I recently found this question on stack exchange with a great answer that showed how to condense game time into a sine wave, where 1 = midday and -1 = midnight

Converting time of day into a smooth day/night variable?

I've implemented this fine as far as I can tell but I'm a little confused as to how one would get a clean rotation from this to drive a directional light.

Currently I'm using arc-sine to revert the wave to radians and then converting it to degrees but I feel like this is going against the whole process of getting the sine in the first place. It doesn't actually work correctly anyway because we can't tell what side of the unit circle we're on, at least not with my current setup.

Is there a clean way for me to extract a rotation from this sine value so a sun would rotate smoothly? Thanks!

sentences: How do I make Unity use UTF-8 and LF characters for new script files? By default, when you make a new script in Unity on Windows, it will use UTF-8 with BOM and CRLF. How do I change this to be regular UTF-8 without BOM, and LF (Unix-style)?

sentences:
Load large quantities of data in Unity3D I'm building an Android app using Unity3D where users can visualize data immersively.

The data is immutable and stored using a MySQL database hosted on cPanel.

When the user clicks a button in the environment, it starts the creation of a chart. First, contacts a .php file present in the server responsible to query the database, fetching the data and make it available to the Unity controller which then adds the points to the chart. This works fine for small quantities of data.

To increase performance, thought of exporting from MySQL as CSV and transform to one JSON, instead of querying a database or try to make MySQL transform to JSON, but I'm afraid this won't be enough.

Could also extract as CSV and use a 3rd party for reading it.

How would you load the data in such case to have the best performance?

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:
Unity3d iOS build - where are the textures? First time building and running my Unity3D app on my iPhone and it appears that all the textures are missing.  Everything is just a solid block of whatever color I made it.  When running in Unity I see everything correctly.  See images below.

To complicate things I'm using custom shaders, and all the objects are custom procedural meshes.  Quads that I build in script.  If I switch the paper backplate shader to a built in shader I still only see white on the iPhone.

So I suspect that somehow the textures just aren't making it to the iOS project.  When I look in the iOS project I can't find any textures.  Where would they be in the iOS project?  For example in Xcode under Build Phases > Copy Bundle Resources the only thing there is the Images.xcassets, which only contains the splash screens and icons.

Surely I'm missing something simple.

I tried renaming the folder where I keep my textures to "Textures".  Also my textures are not built in to the shader but added programmatically like this:

void Awake ()
{
    meshFilterComponent = GetComponent<MeshFilter>();
    Material material = GetComponent<MeshRenderer>().material;
    material.SetTexture(0, paperTexture);
    material.color = new Vector4(1f, 1f, 1f, 1f);
}

Where paperTexture is set up in the GameObject to point to the correct texture.  Is there any way to force a texture to be part of a build?  Let's say that you swap out textures in code, like swapping themes, how would you make sure they're all there to be loaded as needed?

Running On iPhone:

Running In Unity3D:

sentences:
make a sphere rolling on a roulette mesh stop at predetermined place I have a roulette and a ball(sphere) placed on it. When the game begins the roulette spins. The spinning of the roulette and gravitational forces on the ball makes it roll along the 3d roulette mesh.

Now , in this roulette game of mine I have slots from 00 to 36. I want to make sure that after the roulette stops spinning the ball comes and stops rolling at my predetermined slot.

For example : if i set the target slot as 25 in the game, every time the roulette spins, the ball moves realistically along with it BUT comes slowly to a stop at slot no: 25.

I have tried 'slerp' the ball to its target position, but the realism is lost. The ball moves through the mesh. Which i don't want. I want the ball to roll like in real life.

sentences:
Framerate-independent acceleration Is this the right way, or at least a way that works, for dealing with accelerations in variable time steps evironments?

    // Pseudo-code
    void onUpdate() {
        mySpeed += acceleration * timeElapsed; // More specifically, this part
        myPosition += mySpeed * timeElapsed;
    }

Truth to be said, I'm using a constant timeElapsed defined by (1.0f / FPS_LIMIT), FPS_LIMIT being the value of the framerate at which I want the game to be locked. Speeds and accelerations are defined in the following ways:

    #define FRAME_DURATION (1.0f / FPS_LIMIT)

    #define RUNNING_SPEED 42 * FRAME_DURATION
    #define GRAVITY 42 * FRAME_DURATION

And I have noticed that, the further I increase my FPS_LIMIT, the faster things accelerate. Well, it's obvious (or not) that I'm using flawed logic to define the acceleration constants, but I'd also like to know what then I'm doing wrong and what'd be the right way to calculate these values, because what I'll pretty much be doing through my scripts will be as simple as this:

    void onUpdate() {
        mySpeed += acceleration;
        myPosition += mySpeed;
    }

As if framerate-independence didn't even exist.

If you want to get technical, I'm using simple SFML for the fixed time steps, through a window.setFramerateLimit(FPS_LIMIT) call.

sentences:
3D/perspective Top down shooter bullet issues I'm developing a top-down shooter with multiple levels (ground for ground units, middle level for buildings, top level for air unity).

The problem is the collision. Though I can make the collider box of a bullet be long enough to reach the ground (and collide with it), the real issue is optical.

When the bullet is fired from a aircraft and collides with some object on the ground (building, ground unit) it will be optically offset due to the perspective camera, because it looks like the shot "by-passed" the target as seen below

Is there any way to make the bullets collide perspectively correct? I'm using Unity3d Engine and it offers only simple colliders (box, sphere, cylinder, mesh and wheel), though I don't think a cone-formed collider would solve this issue.

I'd need a (cheap) way to check if it's overlapping a destructible object? I thought of casting a ray from the camera through the bullet and if it hits something destructible, trigger an action, but that's quite punctual and maybe to performance heavy on certain number of bullets

sentences: How to scale objects and tiles without doubling view port in gamemaker How do I scale up tiles and sprites without acully making the view port larger than the acual view? I know that I can just scale up the images and the tileset but there must better alternative right? The reason why I dont want to make the port bigger is because then I get this kind of "pixel perfect" behaviour so 1 pixel on the image is one pixel on the screen (So it looks kind of choppy). I'm thinking I can use the draw event if there's no other alternative but how would I do that with the tileset?

sentences:
Is this a good way to "get rid of the sprite shakes" for my sprites that "target" other sprites? (XNA) I'm relatively new to XNA, but very proficient with C#. I want to know if this is the best way to solve the sprite shaking problem. I had a sprite class that can target a place/other sprite on the map and follow it.

Here's my update method:

public override void Update(GameTime gameTime)
    {
        //move this rectangle closer to the target
        float EntitySpeed = 100f; //this is actually a property
        Vector2 velocity = new Vector2();
        if (_target.GetX() < this.GetX())
            velocity += new Vector2(-1, 0) * EntitySpeed;
        if (_target.GetX() > this.GetX())
            velocity += new Vector2(1, 0) * EntitySpeed;
        if (_target.GetY() < this.GetY())
            velocity += new Vector2(0, -1) * EntitySpeed;
        if (_target.GetY() > this.GetY())
            velocity += new Vector2(0, 1) * EntitySpeed;

        //a guy on pluralsight said it's best to update velocity taking a time into consideration to account for faster/slower computer speeds
        var movement = (velocity * (float)gameTime.ElapsedGameTime.TotalSeconds);
        _position += movement; //position is a Vector2

        //is the code below a good solution to get the sprite to stop shaking?
        //if we're "close" to the target sprite, then set the position exactly
        Vector2 vectorDiff = this._position - new Vector2(_target.GetX(), _target.GetY());

        bool xReached = Math.Abs(vectorDiff.X) <= Math.Abs(movement.X);
        bool yReached = Math.Abs(vectorDiff.Y) <= Math.Abs(movement.Y);

        if (xReached)
            _position.X = _target.GetX();
        if (yReached)
            _position.Y = _target.GetY();

    }

sentences:
How to create a reasonably sized urban area manually but efficiently I have a game concept that only really works in an urban area that is of reasonable scale and diversity. In terms of what it should look like, think GTA, in terms of the size think more like a small neighbourhood with residents and a few local shops, perhaps a supermarket.

I'm mostly experienced in programming and not at all with modelling, texturing or drawing, but I've found that SketchUp allows me to design interesting looking buildings that I model after real world buildings in my own neighbourhood.

Designing these buildings and other objects can take from a few tens of minutes to a few hours. My question is: what is the best approach for a one man army like me who does manage to model buildings to create an interesting city environment in a reasonable amount of time? My game will not be based on procedural generation, the environment will actually be modelled like GTA cities.

sentences:
MonoGame: Draw thousands of quads without hardware instancing In my game, every bit of geometry is a textured quad billboard in 3D. I have many thousands of these things on screen at once, sometimes with overdraw. As I understand it, there are a few ways  I can go about drawing these:

Have a single VBO per type of quad (ie, unique set of texture coords). Batch the VBO and texture, but make multiple draw calls. Looks something like this:

foreach (Quad quad in quadTypes)
{
    // The VBO just contains 4-6 vertices.
    GraphicsDevice.SetVertexBuffer(quad._vertexBuffer);
    Shader.SetTexture(quad._texture);

    // Draw each instance using multiple draw calls
    foreach(QuadInstance instance in quad._instances)
    {
       Shader.SetWorldMatrix(instance._worldMatrix);

       foreach(ShaderPass pass in Shader._passes)
       {
           pass.Apply();
           GraphicsDevice.DrawPrimitive(TRIANGLES);
       }
    }
}

Make a single draw call by somehow combining all the triangles of all the instances of a quad type. Looks something like this:

foreach (Quad quad in quadTypes)
{
    Shader.SetTexture(quad._texture);
    // Probably can cache a vertex buffer for when quads are created/destroyed instead.
    VertexBuffer vertexBuffer = new VertexBuffer();

    foreach(QuadInstance instance in quad._instances)
    {
       // Add all of the (world transformed) triangles of this instance to
       // the vertex buffer
       vertexBuffer.AddAll(instance.CreateTriangles());
    }

    // Draw all the quads with a single draw call and vertex buffer.
    GraphicsDevice.SetVertexBuffer(vertexBuffer);

    foreach(ShaderPass pass in Shader._passes)
    {
        pass.Apply();
        GraphicsDevice.DrawPrimitive(TRIANGLES);
    }
}

True hardware instancing. This is currently how I do it in my (XNA HiDef profile) game, but I can't figure out a way to get it to work in Monogame. With true hardware instancing, each instance is represented as a vertex, and the GPU creates all the necessary duplicate vertices in a single draw call.

In general, which one of these is most desirable? 1) makes many draw calls, but saves the most memory. 2) has a single draw call, but requires creating a vertex buffer for all of the instances, which seems really inefficient, and 3) has the best of both worlds but is not widely supported. Is there a fourth way that I'm missing?

sentences:
More vertices vs more textures I'm currently working on a dynamic 'door' creator, and I'm trying to decide which is more efficient. Not much experience with 3D render speeds, so I'm asking before I choose which direction to go because its a lot of work either way. (The doors will be able to open/close.)

So I came up with two possibilities.

I generate all the triangles (as in the left picture), and go on my way.
I generate only two triangles, then create and save a whole new texture that is filled only  with pixels that are not 'covered' by the door (the others are marked as transparent). I would then dynamically add the texture to a texture atlas. Then when the outside portion (gray) of the door is drawn, it would appear as in the right picture.

Hence, more vertices, or more textures? Before I start down one road, any advice on this? Or any other suggestions?

Thoughts: Creating a new texture for each instance would eventually take up too much memory, but they would be reusable. My gut says this would be better for a small game world with not many unique doors, so maybe I should just implement both and let the user decide.

sentences:
Shader code not working While compiling the following code. I get a error

float tess = saturate((gMinTessDistance - d) / (gMinTessDistance - gMaxTessDistance));

// Rescale [0,1] --> [gMinTessFactor, gMaxTessFactor].
vout.TessFactor = tess;

if i do this it works.

float tess = saturate((gMinTessDistance - d) / (gMinTessDistance - gMaxTessDistance));

// Rescale [0,1] --> [gMinTessFactor, gMaxTessFactor].
vout.TessFactor = 0.4;

..

struct VertexOut
{
    float3 PosL       : POSITION;
    float3 NormalW    : NORMAL;
    float3 TangentW   : TANGENT;
    float2 Tex        : TEXCOORD;
    float  TessFactor : TESS;
};

Here is code for vertex shader part

VertexOut VS(VertexIn vin)
{
    VertexOut vout;

    // Transform to world space space.
    vout.PosL = mul(float4(vin.PosL, 1.0f), gWorld).xyz;
    vout.NormalW = mul(vin.NormalL, (float3x3)gWorld);
    vout.TangentW = mul(vin.TangentL, (float3x3)gWorld);

    // Output vertex attributes for interpolation across triangle.
    vout.Tex = mul(float4(vin.Tex, 0.0f, 1.0f), gTexTransform).xy;

    float d = distance(vout.PosL, gEyePosW);

    // Normalized tessellation factor.
    // The tessellation is
    //   0 if d >= gMinTessDistance and
    //   1 if d <= gMaxTessDistance.
    float tess = saturate((gMinTessDistance - d) / (gMinTessDistance - gMaxTessDistance));

    // Rescale [0,1] --> [gMinTessFactor, gMaxTessFactor].
    vout.TessFactor = tess;

    return vout;
}

Im in Directx 12 Shader model 5.0

sentences:
Port forwarding client and server? So, lets say i have a client and server sending information to each other. Do i have to port forward both the server and the client, or do i just port forward the server? If i have to do both, is there any way of not needing to port forward? Im using SFML to be specific.

This isnt on local networks and its using UDP.

sentences:
How do I implement a "sliding out of / into" effect on a settings menu similar to that in Angry Birds? I'm trying to implement a settings menu component similar to that in Angry Birds - a button control that makes an options menu slide out of it and back into it when clicked on.

I use scene2d.ui to build the UI components: a Button in a Table to implement the button control, a Table to implement the options menu, and a Stack to lay these out one on top of the other and at this moment I have the following behavior:

When the user hits the button control for the first time, then the alpha of the table component is set to 1;
When the user hits the button control the second time, then the alpha of the table component is set to 0;
And so on.

Any ideas how I can get the sliding out of and into effect on user clicks with libgdx? Similar to what Angry Birds provides.

Maybe using the TweenEngine, actions, interpolations, combinations of these?

Thanks in advance.

sentences:
Renderable object abstraction In my engine I have 2 types of 2D renderables: sprites and groups (and maybe primitives later). Sprites are just textured quads and groups are multiple renderables grouped in a single object. I have this drawcall system now:

struct Renderable
{
    virtual void Render(Renderer& renderer) = 0;
};

struct Sprite : public Renderable
{
    Texture& texture;
    // other sprite specific stuff
    void Render(Renderer& renderer) override { renderer.RenderSprite(...); }
};

struct Group : public Renderable
{
    vector<Renderable*> elements;
    // Other group related stuff like a transformation matrix
    void Render(Renderer& renderer) override
    {
        for (Renderable* r : elements)
            r->Render(renderer);
    }
};

Instead of sendig them straight to the renderer, I need an indirection. This makes rendering many (like 20K) sprites super slow. Is there a better design to avoid indirection (or even abstraction)?

sentences:
How to remove an object from a std::vector So I have a vector of bullets that show up on the screen and I do not want these bullets to live forever. I want them to "die as soon as they go off screen or collide with an enemy. How can I make sure they are removed from the array and no longer take up memory.

code:

std::vector<Bullet> bulletArray;

for(int i=0; i<bulletArray.size(); i++)
{
    bulletArray[i].MoveBullet();
    bulletArray[i].Draw();
    if(bulletArray[i].PosY<0)
    {
        //Delete object forever
    }
}

sentences:
Java OpenGL Perspective matrix not working I'm trying to render a simple triangle with OpenGL in Java using LWJGL3.
Everything is working great, but the projection matrix (perspective) is not working. In C++ I just used to apply the glm::perspective() method which works just great. But in Java, I implemented it myself since there are no libraries like GLM handling it.
So here the code for the perspective in Java :

public mat4 perspective(float fov, float aspectRatio, float zNear, float zFar){
    mat4 perspective = new mat4();

    float halfTanFov = (float) Math.tan(Math.toRadians(fov/2));
    float range = zNear - zFar;

    perspective.m00 = 1f / halfTanFov * aspectRatio;
    perspective.m11 = 1f / halfTanFov ;
    perspective.m22 = - (zFar - zNear) / range;
    perspective.m23 = -1;
    perspective.m32 = (2f * zFar * zNear) / range;

    return perspective;
}

Of course I tested this multiplication and a compared a result with my TI output, and it worked great.
Other information, the default constructor for the mat4 class is putting all the values to 0.
here is the code :

public void setZero(){
    m00 = 0; m01 = 0; m02 = 0; m03 = 0;
    m10 = 0; m11 = 0; m12 = 0; m13 = 0;
    m20 = 0; m21 = 0; m22 = 0; m23 = 0;
    m30 = 0; m31 = 0; m32 = 0; m33 = 0;
}

the viewMatrix() in the other hand is working great. It's a simple implementation of the lookAt() method.
So when it's lookAtMatrix * modelMatrix * position where the position is a vec4 the result is good.
But when I try to add the projection matrix for the MVP : perspective * lookatMatrix * model * position the result is nothing.
Here where I do it in the code :

public mat4 getViewProjection() {
    mViewProjection = MatrixTransform.getInstance().lookAt(mPosition, mPosition.add(mDirection), mUp);
    return mViewProjection;
}
public mat4 getMVP(mat4 model){
    return mPerspective.mult(getViewProjection()).mult(model);
}

And here is my simple GLSL shader (for the vertex shader ) :

#version 430

layout(location=0) in vec3 position;
uniform mat4 MVP;

void main(void){
    gl_Position = MVP * vec4(position, 1);
}

I tried other implementation of the perspective without success, so I guess my mistake is somewhere else, but sadly enough, I can't figure out where. If someone could help, it'd be great ! thank you.
If you other informations, please ask me and I'll post it.

EDIT :
Here is how I put a mat4 into a uniform :

    public void uniform(String variableName, mat4 matrix){
            int loc = glGetUniformLocation(mId, variableName);
            FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
            matrix.putIntoBuffer(buffer);
            buffer.flip();
            glUniformMatrix4(loc, false, buffer);
    }

and the method putIntoBuffer() :

public void putIntoBuffer(FloatBuffer buffer){
    buffer.put(m00);
    buffer.put(m01);
    buffer.put(m02);
    buffer.put(m03);

    buffer.put(m10);
    buffer.put(m11);
    buffer.put(m12);
    buffer.put(m13);

    buffer.put(m20);
    buffer.put(m21);
    buffer.put(m22);
    buffer.put(m23);

    buffer.put(m30);
    buffer.put(m31);
    buffer.put(m32);
    buffer.put(m33);
 }

sentences:
Using variables in other scripts I need to use a variable from the main script of a game which is the score variable public int scoreCount; I need it in the main script because it will be needed to update the score when they get past a certain point.

I need to be able to access this variable.. so add or subtract from it i.e. scoreCount++; however I am not sure how to do this, I have looked at tutorials and they make no sense for me.. could someone please explain it in more detail.

I also need to be able to use the public void UpdateScore() function from the mainscript too, do I just do it the same way as the variable or is there a different method. Thank you.

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 handle a different kinds of weapon in a single component and system in entity system? A weapon can be used as melee or range weapon, it can be thrown, toss, fired, shoot, cast (a projectile) or use to slash, bash, stab . How do I apply these to entity-system? my first approach is to create an enum class of WeaponType, a melee or range.

public enum WeaponType {
    MELEE,
    RANGE
}

public interface Weapon {
    void use();
}

Then I've create a weapon component and add weapon type data, to determine its type. For melee a weapon, it needs to have a method that handles different kind of "attack motion" like slash, bash, stab. For range weapon, it needs to have a container, factory and a method that handles different kinds of "projectile motion" like shoot, fire, throw, toss etc.. Now the problem is how could I create a method for different kinds of projectile motion, remember I am specifically using Ashley ECS framework

public class WeaponComponent implements Component {
    public Weapon weapon;
    public WeaponType type;
    // if weapon type is melee, use the below data
    public Container container // holds the created projectile
    public Factory factory // creates a different kinds of projectile object
}

// or create seperately???

public class MeleeWeaponComponent implements Component {
    ... different kinds of method also like slash, bash, stab
}

public class RangeWeaponComponent implements Component {
    ... Factory and Container
    ... different kinds of projectile motion?
}

In this idea, I can use abstract or interface but I think abstraction or is not recommended.

[Combined data suggestion] by @Ryanwhite and me

Blue line is area of effect angle covered
Green line is distance covered
Red point is the target point

public class WeaponComponent implements Component {
    public Ray ray // to handle collisions
    public float aoe; // 0.5 for melee, more than 0.5 for other weapon
    public float aoeAngleCovered;
    public float aoeAngle
    public Ammo[] // 0 for melee, 1 or more for other weapon
}

sentences:
Sanitise a high score table to remove offensive terms / usernames I'm building an app for a client, which they've requested to have a publicly-visible high score table. It'll be displaying their username, which is a free-text field that the players can input. Player count is likely to be extremely low - I’d expect 10s or 100s/day at most.

The username field will be longer than 3 characters. The names will be tied to Firebase Auth accounts, but these are created through the app, not tied to anything like Google Play or a Facebook account or anything like that. I think they’re going to be fine with deleting obviously offensive names, but they’re not going to have massive resources devoted to manual moderation.

When I was a young lad, 100% of my local arcade cabinet high score tables consisted of a bunch of swear words and offensive terms (or variations of such words).

I can't imagine the internet has improved matters at all.

How can I sanitise usernames to make them safe for display?

sentences:
MonoBehavior Script that uses UnityEditor - Best practice for Location? I've created a script which helps me auto-generate a GameObject prefab. It uses some UnityEditor, so it can't be used at runtime (and its not meant to be).

Normally, a script like this I would put in the "Editor" folder.

However, since it needs to be attached to a GameObject as a Component to do its thing, I'm not sure where I should put it. I can't store it in the Editor folder, because Unity yells at me and says I'm not allowed.

Are there any best practices defined for things like this?

sentences: Tag object in map in Unreal Is there a clean way in unreal to place text in the map to tag different buildings and areas for developper that can easily be turned on/off for all the tags in the map?

sentences:
How to generate closed curve? How can I do that? I can generate simple beziers, but how can I generate a closed curve like this:

http://www.youtube.com/watch?feature=endscreen&NR=1&v=hlDYJNEiYvU

sentences:
Transparency problem, phong model It's the first time I'm trying to implement the Phong lighting model. I'm pretty sure everything is working fine.

I was experimenting using different materials, meaning I played with Kd,Ks,Ka and Ns values when I came across this problem.

Whenever I use a material with alpha value less than one I get this weird result :

At first I thought it has to do with the normals of the model since they are all supposed to point away from the model but it doesn't seem to be the case.

Any ideas?

sentences:
XNA/MonoGame RenderTargets not working I'm having a problem with drawing 2 RenderTargets to the screen.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Content;

namespace Please
{
    class Class1
    {
        RenderTarget2D rt;
        Texture2D temp;
        Vector2 v;
        public Class1(Vector2 v,GraphicsDevice g)
        {
            this.v = v;
            rt=new RenderTarget2D(g,800,600);
        }

        public void Draw(SpriteBatch sb,GraphicsDevice gd,ContentManager cm)
        {
            gd.SetRenderTarget(rt);
            sb.Begin();
            sb.Draw(cm.Load<Texture2D>("Untitled.png"),v,Color.White);
            sb.End();
            gd.SetRenderTarget(null);

            temp = (Texture2D)rt;

            sb.Begin();
            sb.Draw(temp, Vector2.Zero, Color.White);
            sb.End();
        }
    }
}

Here's my draw function in the actual "game"

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.CornflowerBlue);
    base.Draw(gameTime);
    one.Draw(spriteBatch, graphics.GraphicsDevice, Content);
    two.Draw(spriteBatch, graphics.GraphicsDevice, Content);
}

one and two have positions (100,200) and (300,200) respectively, so, they should be drawn 100 pixels apart, however, only two is being drawn with the rest of the screen black

sentences:
Is it worth it, to try and prevent cheaters? Perhaps one of the biggest issues that plague FPS-games are cheaters.

If you use a server-authoritative model, you will prevent some level of cheating. But why do this if people can still aimbot?

sentences:
Setting collider in 3D map (blender file) New to gamedev and I also have no idea about 3D files but, I'll try to explain the best I can. We are using our own custom engine built in C++ with OpenGL (glm, gl3w, glfw, entityx)

We have a 3D map in a Blender file (.dae), We want to set the colliders for the hitboxes so the player can't step outside. My colleagues started doing it by hand, but it would take a tremendous amount of work none of us want to spend doing a trivial task.

We worked with the same map in 2D (doing the same game in 2D and 3D), and my colleagues used a program to do it visually and then importing a .tmx file (I don't really know how or what program). The question is, is there a way to do the same in 3D? They say Blender (used to create the map) does not provide the tools necessary, or they probably don't know how.

Thanks in advance and sorry if I explained something wrong, I'll gladly answer any questions.

sentences:
Main game objects as static I'm making a game for Android using Android Studio with Libgdx in Java.
In my game there are main object like Screen, ObjectFactory, SoundPlayer, Painter (Responsible for drawing) and a few more. 'til now I passed them to each GameObject that uses them but then I realized I could just make them static and every GameObject who needs them will just call them statically.
I wonder if I make these main objects static, would it hurt the performance? Because it seems like such a comfortable solution...
Thanks in advance.

sentences:
Wrong texture position on camera move When in my game i move my character, the camera follows it. I have no problem drawing this char when it is moving or moving another char when the camera is still. Now, when i move both of them, the texture position of the second character is wrong, you can see it here:

Under the hood i round the values before moving the viewport and drawing textures, and i had no problems except in this case. How can i fix this?

sentences:
Unity ScrollView not scrolling with Clamped or Elastic I have a ScrollView object in my project. It is set to Clamped.
Inside the ViewPort, I have Content and what I actually want to scroll, a TextViewMesh. The Content has a Content Size Fitter, with its Vertical fit set to Preferred Size.
The problem is, when I run it, and try to scroll, it does not scroll at all, in ScrollView to the current setting. If I set the ScrollView mode to Unrestricted, it scrolls to the infinity. What I am doing wrong? How can I set my ScrollView to scroll the text (which can vary in lenght)?

sentences:
In Unreal why is it safe to access a UTexture2D's properties from the render thread despite the documentation stating this is not allowed? I've been trying to implement something that will update textures on the render thread from a background thread. And from what I've read of the unreal engine documentation you should never access a descendant of UObject from the render thread since the game thread could deallocate it at any time. Epic describes an example of this situation in their documentation

  Here is a simple example of a race condition / threading bug:

/** FStaticMeshSceneProxy Actor is called on the game thread when a component is registered to the scene. */
FStaticMeshSceneProxy::FStaticMeshSceneProxy(UStaticMeshComponent* InComponent):
    FPrimitiveSceneProxy(...),
    Owner(InComponent->GetOwner()) <======== Note: AActor pointer is cached
    ...

   /** DrawDynamicElements is called on the rendering thread when the renderer is doing a pass over the scene. */
    void FStaticMeshSceneProxy::DrawDynamicElements(...)
    {
        if (Owner->AnyProperty) <========== Race condition!  The game thread owns all AActor / UObject state,
            // and may be writing to it at any time.  The UObject may even have been garbage collected, causing a crash.
            // This could have been done safely by mirroring the value of AnyProperty in this proxy.
    }

However the actual code they write violates this rule all of the time. There are numerous examples in FTexture2DResource accessing its Owner property which is a UTexture2D* from the render thread. Just one is

/**
 * Called when the resource is initialized. This is only called by the rendering thread.
 */
void FTexture2DResource::InitRHI()
{
  FTexture2DScopedDebugInfo ScopedDebugInfo(Owner);
  INC_DWORD_STAT_BY( STAT_TextureMemory, TextureSize );
  INC_DWORD_STAT_FNAME_BY( LODGroupStatName, TextureSize );

#if STATS
  if (Owner->LODGroup == TEXTUREGROUP_UI) <========== Accessing LODGroup from owner should be unsafe
    {
        GUITextureMemory += TextureSize;
    }
...
}

This seems to directly contradict the documentation given by Epic even though this is commonplace in their source code.

From the source it doesn't look like FTexture2DResource or any of its ancestors perform any smart pointer magic or add the UTexture2D object to the root set to prevent GC and even then race conditions would still apply.

I'll probably end up answering this one myself, but it would be great if someone happened to know this.

sentences:
Reusable skill class structure Pretty new to the whole game development scene, but I have experience in other branches of programming. Anyway, I was wondering what methods are used to implement a skill structure. I imagine a skill in itself would a class. I'm using actionscript 3 for this project btw.

public class Skill
{
    public var power:int;
    public var delay:int;
    public var cooldown:int;

    public function Skill(user:Mob, target:Mob)
    {

    }
}

Each skill would extend the Skill class and add it's own functionality.

public class Tackle extends Skill
{
    public function Tackle(user:Mob, target:Mob)
    {
        super(user, target);
        executeAttack();
    }

    private function executeAttack():void
    {
        //multiply user.strength with power etc
        //play attack animation
    }
}

This where I get stuck. How do I termine which mobs has which skills? And which skill will they later be able to retrieve (by reaching a certain level etc).
How does the player actually execute the skill and how is it determine if it hits. It's all very new to me so I have no idea where to begin.
Any links would also be appreciated.
Thanks in advance.

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:
Precomputing Visibility Having noticed that UDK (Unreal) and Unity 3 include similar pre-computed visibility solutions that unlike Quake are not dependent on level geometry, I've been trying to figure out how the calculation is done.

The original Quake system is well documented: You divide the world into convex volumes that limit both the camera and the geometry. Each volume has a list of all the other volumes that are visible from it.

Visibility would be computed by firing rays at some random distribution of points in the target volume and see if any hit. And because the position of the camera in the source volume could have an effect, those thousands of rays would have to be fired from multiple places in the source cell.

So what I'm wondering is if there's any been fundamental change to this basic scheme in the intervening 15 or so years? I can see how to adapt it to a UDK/Unity scheme that has regular source volumes and deals mostly with arbitrary meshes as the targets, but is there a better way than stochastic ray testing?

sentences:
Is it more efficient to use an A* algorithm or a line system drawn in pathfinding in C#? I was recently introduced to the A* algorithm when I asked a friend about making AI/NPC's in video games move to certain points and it sounded very interesting. I am building an FPS and it has AI that must be able to move to certain points, so the A* algorithm sounds very appealing to me.

However, as I went through the Half-Life 2: Episode 1 Developer Commentary, I found another solution that the workers at Valve have been using: a line system. I couldn't find a screenshot and alas, I couldn't find the developer node to show the system. :(

Basically, there's a whole system drawn on the level map for AI to move along. If there happens to be an enemy that shows up in a certain section that might not be on the AI's line of sight, then the AI can break out of the line and attack said enemy.

I'm building the game in C# (XNA) and I wanted to know if it would be better to use the algorithm, the line system or even both to achieve pathfinding?

sentences:
Is it more performant to index in the vertex shader or fragment shader? I have a shader that draws 2D quads from a texture atlas using instancing. I'd like to add a feature that allows me to map each of the RGBA channels in the texture using a 5x5 matrix. For example, the following would swap the red and green channels:

0 1 0 0 0
1 0 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1

I only need a few of these transformations, so my plan is to provide them to the GPU as a uniform and then index into this by passing an attribute to my shader for each quad. I think there are two approaches I could take:

Look up the 5x5 matrix once in the vertex shader and pass it to the fragment shader as a varying
Pass the index to the fragment shader as a varying and look up the matrix in the fragment shader

I'm not sure which of these approaches would be more performant. My inclination is 1, because then the lookup only has to happen once per instance, but does that mean there's more overhead in passing 25 floating point numbers via the varying?

By the way, my graphics pipeline is WebGL if that makes a difference.

sentences:
Is it unethical to make a game AI that is secretly non-competitive? In several games the AI is designed to give the player an easy time without their knowledge. This can be having a 0% chance to hit the first time you appear, enemy letting you sneak up on them by not turning around, or the lowering of difficulty when the player is hurt or has restarted several times.

I would be offended if at the end of a board game or sport I was told that a human had not tried their hardest.

Does the same ethics exist for an AI?

edit
As in the title, my main concern was keeping the handicap hidden from the player, for example, when playing a shooter it is reasonable to expect the player knows the AI has an artificial reaction time and poor aim but my question was about games that hide things such as enemies not using the best weapon or lowering their difficulty when the player is inured.

sentences:
How can I make a "paint" effect? I am wondering how one could implement "paint" in games. As a reference, I have two games I am specifically thinking about which are Super Mario Sunshine with its "goo" and Splatoon.

I'm wondering how I could replicate that kind of paint effect, where paint can be sprayed on to both the walls and floors of the environment, and on to objects.

sentences:
Specify the size of the points when building a mesh based on a point cloud I create a mesh in Unity3D based on a point cloud in this way:

// The standard sequence for creating a mesh
Mesh mesh = new Mesh();
Vector3[] points = new Vector3[numPoints];
int[] indecies = new int[numPoints];
Color[] colors = new Color[numPoints];

// Fill in points, indecies, colors

mesh.vertices = points;
mesh.colors = colors;
mesh.SetIndices(indecies, MeshTopology.Points, 0);

I learned that it is possible to set the size of points in PSIZE through Vertex Shader.  Applied such a Shader, but without result.

Shader "VertexColor"
{
    Properties
    {
        _PointSize("Point size", Float) = 5.0
    }
    SubShader
    {
        Pass
        {
            LOD 200

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            uniform float _PointSize;

            struct VertexInput
            {
                float4 vertex: POSITION;
                float4 color: COLOR;
             };

             struct VertexOutput
             {
                 float4 pos: SV_POSITION;
                 float4 col: COLOR;
                 float size: PSIZE;
              };

              VertexOutput vert(VertexInput v)
              {
                  VertexOutput o;
                  o.pos = UnityObjectToClipPos(v.vertex);
                  o.col = v.color;
                  o.size = _PointSize;

                  return o;
              }

              float4 frag(VertexOutput o) : COLOR
              {
                  return o.col;
              }
              ENDCG
          }
      }
}

Tell me, please, how to set the size of points correctly?

sentences:
AABB 2D Collision response teleports player when hit on wrong edge I'm currently breaking my head with collision detection and resolving in C++ for my 3D game engine. But currently I'm trying to get resolving to work in 2D.
The problem is that when I hit the solid object with my moving object on a specific side, it teleports the player to the edge. It's a bit hard to explain, so I gave my artistic skills a run:

Here you see, if my moving object travels from the bottom up and hits on the right side, everything works. But even if there is a little bit of an overhang on the left side, it teleports the player completely to the edge.
And it does that on every side of the AABB.

I also made a short video visualizing the problem.

This is my function to return the overlapping values:

glm::vec3 Collider::getOverlapping(AABB &other, AABB &aabb) {
    glm::vec3 overlappingAxis;

    if( (std::abs(aabb.first()->x - other.first()->x) * 2 > (aabb.size()->x + other.size()->x)) ||
        (std::abs(aabb.first()->y - other.first()->y) * 2 > (aabb.size()->y + other.size()->y)) ||
        (std::abs(aabb.first()->z - other.first()->z) * 2 > (aabb.size()->z + other.size()->z))){
        return overlappingAxis; //No collision occured
    }

    overlappingAxis.x = sign(aabb.center()->x - other.center()->x) * ((other.size()->x/2 + aabb.size()->x/2) - std::abs(aabb.center()->x - other.center()->x));
    overlappingAxis.y = sign(aabb.center()->y - other.center()->y) * ((other.size()->y/2 + aabb.size()->y/2) - std::abs(aabb.center()->y - other.center()->y));
    overlappingAxis.z = sign(aabb.center()->z - other.center()->z) * ((other.size()->z/2 + aabb.size()->z/2) - std::abs(aabb.center()->z - other.center()->z));

    for(int i = 0; i < 3; i++){ //Add a bit of an offset so that it actually moves out of the collision
        overlappingAxis[i] += sign(overlappingAxis[i]) * 0.0005;
    }

    return overlappingAxis;
}

My method(s) to figure return if there is actually an collision:

bool Collider::isColliding(AABB& other, glm::vec3& axis, AABB& aabb) {
    axis = getOverlapping(other, aabb);
    return !(axis == glm::vec3(0, 0, 0));
}

bool Collider::isColliding(AABB &other, glm::vec3 &axis) {
    return isColliding(other, axis, *m_aabb);
}

My collision resolving method:

void Collider::resolveCollisions(AABB& other, glm::vec3 *position) {
    glm::vec3 overlapping;

    if(isColliding(other, overlapping)) {
        Logger::info(glm::to_string(overlapping), 2);

        if(overlapping.x < overlapping.z){
            position->x += overlapping.x;
        }else{
            position->z += overlapping.z;
        }
    }
}

And my move method of the Physics Object:

void PhysicsObject::updatePosition() {
    AABB testAABB(glm::vec3(0.0f, 0.0f, 0.0f) + glm::vec3(3.0f, 0.0f, 1.0f), glm::vec3(1.0f, 1.0f, 1.0f) + glm::vec3(3.0f, 0.0f, 1.0f));

    m_transformation.getPosition().setPosition(*m_transformation.getPosition().getPosition() + velocity * glm::vec3(DeltaTime::getBigDeltaTime()));
    updateAABB();
    collider->resolveCollisions(testAABB, m_transformation.getPosition().getPosition());

    updateAABB();
    collider->resolveCollisions(testAABB, m_transformation.getPosition().getPosition());
}

Just to be clear: Because it's actually a 3D Engine, the Z-Axis represents the Y-Axis, if that makes sense! I just want to get 2D to work and then I extend to 3D!

I'm pretty sure I'm wrong in my resolveCollisions() method. I tried many things, but I just cannot figure out whats wrong.

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:
Unity Android build fails, error : Could not find com.android.tools.build:gradle:x.x.x Can't build for Android, error log:

CommandInvokationFailure: Gradle build failed,

And this is in it's description:

Could not find com.android.tools.build:gradle:3.2.0.

sentences: Vulkan Drawing lines I want to be able to draw single lines inside Vulkan but the only way I have managed to achieve this so far is by drawing a triangle with two of its points that ocupuy the same point in space. Is there a way to draw lines inside Vulkan and also change their width? I know I can change line width when I set the polygon mode in the rasterizer to VK_POLYGON_MODE_LINE and then set the lineWidth option, but I need to be able to do it whilst rendering all other 3D objects with VK_POLYGON_MODE_FILL enabled.

sentences:
How can I generate vertex data from an SVG? I am trying out the Phaser game engine, and am interested in making a vector graphics game (simple black and white like Asteroids), but I want to use vector graphics instead of raster PNGs.

I was looking at this example, which looks like what I want to do...

Where I am stuck is, say I draw a simple Asteroids style ship in Illustrator, consisting of 3 connected lines.  How do I export that data into an array of vertices that would work with the setPolygon() method in Phaser/Box2d?

sentences:
Get rid of the usual MUD cycles I am working on a MUD engine and I want to do it a little differently then all the MUD games I played. I find a "cycle" system very boring. One of the idea I had is to make every clients socket working in their own Thread. I am aware that it wont end with hundreds of player but I would like to know if there are problems creating "alot" of thread in a single process.

Or, what other strategy I could use if I want to make it (eg. combats) in "real-time".

I hope you guys understand the question.

Thank you.

sentences:
Exchanging data between custom-built hardware and games I have a built my own steering wheel and motion platform that I would like to connect to popular car racing games (e.g. iRacing, Dirt Rally). I need to read data such as the car's acceleration (to send to the motion platform) from these games and send information such as steering wheel's angle to the game. I have written an SDK in C++ to communicate with my steering will and motion platform. Now I need to interface different games with to that SDK.

I searched quite a bit but could not find much information about how this is generally done. Do game developers provide some sort of extension which allows third party hardware developers to communicate with their game?

Any guidance from the community is much appreciated.

Kam

sentences:
How do you rotate RigidBody2D along a given access using velocity and not transform? I am trying to rotate my player along the centre of the world in Unity3D.
All the tutorials and references I have looked through till now have left me to this working code:

void MoveAlongCurve(bool moveClockwise) {
    if (!moveClockwise)
        timeCounter += moveSpeed*Time.fixedDeltaTime;
    else
        timeCounter -= moveSpeed*Time.fixedDeltaTime;

    float x = Mathf.Cos (timeCounter);
    float y = Mathf.Sin (timeCounter);

    transform.position = new Vector3 (distFromCentre*x, distFromCentre*y,0);
}

Also this seems to work fine as well:

transform.RotateAround (Vector3.zero,new Vector3(0,0,1),speed);

Now my question is how do i move my player using velocity? I was forced to keep my body as 'kinematic rigidbody2D' however I want my player to be a 'dynamic rigidbody2D'.

My reason for this is several:
1. Movement via velocity makes it independent of the timeCounter.
2. Dynamic Bodies enable collisionDetection. Hence it is basically a requirement for my game.

Thank you so much for taking the time to read this! Any suggestions or nudges in the right direction would be greatly appreciated and if you find anything wrong in my code or approach please comment!

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:
LWJGL: loading textures of various types I googled around a bit and nobody seems to have asked this question.

I have images in multiple color formats (all of them are PNGs).  Most of them are ARGB but my bitmap fonts are gray scale, and I would like them to stay that way.  All I want to do is find out what format BufferedImage uses to store my pixel data and then use that information with glTexImage2D.  Java, in all its wisdom, seems to be determined to hide that information from me at all costs...

I also need to know how BufferedImage aligns its pixel data in both of these formats (glTexImage2D cares).

Could someone please tell me how to:

Determine the pixel format of my BufferedImage.  If it is ARGB32, I'm going to have to reorder the bytes and use GL_RGBA.  If it's grayscale, I will be using GL_INTENSITY.
Extract the actual bytes from the image.  I have seen a few examples on the web that use BufferedImage.getRaster().getDataBuffer().  This is nonsensical.  Why are there different types of buffers like DataBufferInt?  Because of Java's strong typing, I need DataBufferByte.  If this is the only way, could somebody give me specific directions to use the different type of buffers with glTexImage2D?
Figure out how the aforementioned image data is aligned.  I will use this information with glPixelStorei.

In addition, I come from C and C++ programming.  In C this was 100 lines of simple libPNG and GL calls.  Should I expect more trouble like this in the future?

sentences:
Grid pathfinding with a lot of entities I'd like to explain this problem with a screenshot from a released game, DROD: Gunthro's Epic Blunder, by Caravel Games.

The game is turn-based and tile-based.

I'm trying to create something very similar (a clone of the game), and I've got most of the fundamentals done, but I'm having trouble implementing pathfinding.

Look at the screenshot. The guys in yellow are friendly, and want to kill the roaches.
Every turn, every guy in yellow pathfinds to the closest roach, and every roach pathfinds to the closest guy in yellow.

By closest I mean the target with the shortest path, not a simple distance calculation.

All of this without any kind of slowdown when loading the level or when passing turns.
And all of the entities change position every turn. Also (not shown in screenshot), there can be doors that open and close and change the level's layout.

Impressive.

I've tried implementing pathfinding in my clone.

First attempt was making every roach find a path to a yellow guy every turn, using a breadth-first search algorithm. Obviously incredibly slow with more than a single roach, and would get exponentially slower with more than a single yellow guy.

Second attempt was mas making every yellow guy generate a pathmap (still breadth-first search) every time he moved. Worked perfectly with multiple roaches and a single yellow guy, but adding more yellow guys made the game slow and unplayable.

Last attempt was implementing JPS (jump point search). Every entity would individually calculate a path to its target. Fast, but with a limited number of entities. Having less than half the entities in the screenshot would make the game slow. And also, I had to get the "closest" enemy by calculating distance, not shortest path.

I've asked on the DROD forums how they did it, and a user replied that it was breadth-first search. The game is open source, and I took a look at the source code, but it's C++ (I'm using C#) and I found it confusing.

I don't know how to do it. Every approach I tried isn't good enough. And I believe that DROD generates global pathmaps, somehow, but I can't understand how every entity find the best individual path to other entities that move every turn.

What's the trick?

This is a reply I just got on the DROD forums:

  Without having looked at the code I'd wager it's two (or so) pathmaps
  for the whole room:

  One to the nearest enemy, and one to the nearest friendly for every
  tile.

  There's no need to make a separate pathmap for every entity when the
  overall goal is "move towards nearest enemy/friendly"... just mark
  every tile with the number of moves it takes to the nearest target and
  have the entity chose the move that takes it to the tile with the
  lowest number.

To be honest, I don't understand it that well.

sentences:
Unity wall jump issue I've got a very annoying problem that I have been stuck on for a few days and I can't figure it out.

It is for a wall jump.

I basically want my wall jump to have a bit of force away from to wall to make it look and feel better than just jumping up straight.

The problem is, when i add a force on the x axis, it does not register when i am also holding the arrow towards the wall. If I am not holding down the walking button, then press jump...then the x force works.

I have a feeling that the horizontal axis force is competing with the opposite force that i want to add to the player when he hits the jump button...

Walking code:

private void ApplyMovement()
{
    if (isGrounded)
    {
        myRigidbody.velocity = new Vector2(movementSpeed * movementInputDirection, myRigidbody.velocity.y);
    }
    else if (!isGrounded && !isWallSliding && movementInputDirection != 0)
    {
        Vector2 forceToAdd = new Vector2(movementForceInAir *  movementInputDirection, 0);
        myRigidbody.AddForce(forceToAdd);

        if (Mathf.Abs(myRigidbody.velocity.x) > movementSpeed)
        {
            myRigidbody.velocity = new Vector2(movementSpeed *  movementInputDirection, myRigidbody.velocity.y);
        }
    }
    else if (!isGrounded && !isWallSliding && movementInputDirection == 0)
    {
        myRigidbody.velocity = new Vector2(myRigidbody.velocity.x * airDragMultiplier, myRigidbody.velocity.y);
    }

    if (isWallSliding)
    {
        if (myRigidbody.velocity.y < -wallSlideSpeed)
        {
            myRigidbody.velocity = new Vector2(myRigidbody.velocity.x, -wallSlideSpeed);
        }
    }
}

Jump code:

private void Jump()
{
    if (canJump && !isWallSliding)
    {
        myRigidbody.velocity = new Vector2(myRigidbody.velocity.x, jumpForce);
        numberOfJumpsLeft--;
    }
    else if ((isWallSliding || isTouchingWall) && !isGrounded && canJump)
    {
        isWallSliding = false;
        numberOfJumpsLeft--;
        Vector2 forceToAdd = new Vector2(wallPushForce * -facingDirection, wallJumpForce *
                                         wallJumpDirection.y);
        myRigidbody.AddForce(forceToAdd, ForceMode2D.Impulse);
    }
}

Where I call The code:

void Update()
{
    CheckInput();
}

private void FixedUpdate()
{
    ApplyMovement();
}

private void CheckInput()
{
    movementInputDirection = CrossPlatformInputManager.GetAxisRaw("Horizontal");

    if (Input.GetButtonDown("Jump"))
    {
        Jump();
    }

    if (Input.GetButtonUp("Jump"))
    {
        myRigidbody.velocity = new Vector2(myRigidbody.velocity.x, myRigidbody.velocity.y * variableJumpHeightMultiplier);
    }
}

Any help would be much appreciated.

Thanks in advance

sentences:
Make UI Button Image Size Independent of Screen size Unity I have two UI Buttons with image sprites in Panel (inside canvas). I have set their sizes to 40 in the inspector. If I run game in maximize mode, buttons retain constant assigned size of the inspector, instead of adjusting themselves with screen size. I have already added Canvas Scalar component with value Scale with Screen Size. Text fonts are able to adjust with screen size present in same canvas, but button with image does not.

Any guide on this? Thanks.

sentences:
Good taunt attack design I'm making a turn based rpg and I have an attack allows for a party member to draw an enemy's focus towards it for a set number of turns. I feel an attack that draws all aggression from enemies is very strong, so I am unsure how to balance it.

Should taunted enemies get bonus attack stats to make up for the temporary loss of their AI and the ability to target weaker party members? Or is a party member being the focus of attacks something that should be rewarded, and the party member should be given temporary healing or defence to compensate for the risk they took?

sentences:
Unity 5 - Cloth Constraints I'm trying out the new Version of Unity 3D (5.0.0.4f) and figure out whats new, whats possible now. My experience with Unity 4 free is also just a little. Anyway I work with the "new" cloth component and have some general questions to different funkctions. The documentation brought no knowledge to me. So I would be thankful if one of you could explain me the different points in an accessible way.

First question touchs the constraints. When I edit the contraints (of a plane for example), there are two options to activate. What are the differents between "Max Distance" and "Surface penetration". "max Distance" is clear to me but i don't know what the second option does.

Seceond question: I have an tablecloth positioned over a sphere. In playmode when i move the sphere up and the tablecloth react correctly. But the sphere ist temporaliry visible trough the cloth. Its look like a graphicbug then, but ist there a way to prevent this?

So I hope my questions a clear enough to understand. Thanks a lot for your educational effort.

sentences:
LibGDX Overlay Game with Stage I have been working on a 2d game that is similar to billiards/pool. I've got the basic game down and now I'm working on some visual effects. One of the things I would like to do is have have numbers pop up on the screen where a scoring event occurs and then have that number "swoosh up" to the main score at the top of the screen. To accomplish this I have been trying to overlay a Stage onto my main game area so that I can add score text and then let the LibGDX Scene2d take over. I am adding the text as an actor to the stage and then assigning some actions to it to achieve the desired effect. The problem I'm having is that when I add the object I need to convert from world to stage coordinates. This is because I want to place the score popup where two balls touch, which is in world coordinates. I have tried to use the "project" method of the stage's viewport (it is a FitViewport) but the coordinates never translate correctly.

Now that I've explained what I'm trying to do, I was hoping that someone would know how I could pull this off. I'm sure it isn't difficult and that I'm missing some small detail.

Here is the relevant code:
This is the class that will be used to overlay a stage onto the main game screen.

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.utils.viewport.Viewport;

public class UIOverlay {

    private Skin skin = new Skin(   Gdx.files.internal("skins/gamePlaySkin.json"));
    private Stage stage = new Stage();

    public void init (Viewport viewport) {

        stage.setViewport(viewport);
        stage.getViewport().update(GameWorld.WIDTH, GameWorld.HEIGHT, true);
    }

    public void render () {

        stage.act();
        stage.draw();
    }

    public Stage getStage () {

        return this.stage;
    }

    public void addScorePopup (int score, Vector2 worldPos) {

        Viewport vp = stage.getViewport();
        Vector2 screenPos = new Vector2(worldPos.x, worldPos.y);
        vp.project(screenPos);

        // Some sample vectors after projection:
        // worldPos.x = 0.88585174, worldPos.y = 1.6051532
        // screenPos.x = 0.885849, screenPos.y = 1022.39484
        // Another Set:
        // worldPos.x = 0.63776636, worldPos.y = 0.8991218
        // screenPos.x = 0.63777924, screenPos.y = 1023.1009

        Label popLabel = new Label(String.valueOf(score), skin, "popupScore");
        stage.addActor(popLabel);
        popLabel.setPosition(screenPos.x, screenPos.y);

        float time = 0.5f;
        popLabel.addAction(Actions.delay(1000, Actions.sequence(Actions.moveTo(0.0f, 0.0f, time, Interpolation.sineIn), Actions.alpha(0, 0.1f))));
    }
}

This is where I set up the main game viewport:

public static void init(){
    // GameWorld.WIDTH and HEIGHT are 1280 and 1024
    m_camera = new OrthographicCamera();
    m_camera.setToOrtho(true, GameWorld.WIDTH, GameWorld.HEIGHT);
    m_viewport = new FitViewport(GameWorld.WIDTH, GameWorld.HEIGHT, m_camera);
}

When creating the UIOverlay I pass the game's m_viewport into UIOverlay.init(). I have also tried creating a new FitViewport in UIOverlay with the same dimensions as the game's viewport, but have the same behavior.

sentences:
Unity facebook SDK. Cannot login I want to show a leaderboard of facebook friends scores in a game.
So I need access to the user_friends permission.
In order to get that permission I have to send a working build using that permission to facebook that they can review.
So I need to keep my app on facebook in development mode, and test it with test users so I can build this feature and get it working.
However when I build the game and try and login to facebook I get this...

It did not give me a chance to login as a test user or anyone else. I didnt log in at all, it just went straight to this screen when I requested login.
Now the solution for this error that I have found many instances of, is to set your app 'live'. But that wont work in my case.. I need the app the be in development mode so I can test this feature.. If the app is live no-one will have access to the user_friends permission including test users.

So this seems like a paradox.
What can I do?

sentences:
How many achievements should I include, and of what challenge? I know this question is fairy broad and subjective, but I'm wondering if there's been any published research into what an optimal number of achievements is and what kind of challenge they should present. The game this question directly relates to is a shoot-em-up, but an ideal answer is fairly theoretical.

If there are too few achievements, or they are not challenging, I would expect they would fail in their goal to keep people playing. If there are too many, or they are unreasonably difficult, I would expect people to quickly give up. I personally witnessed the latter happening in Starcraft 2; a section of the achievements would have you win hundreds of games against their AI opponents (boring!)

sentences:
How do I make an object's y-axis align with a Vector3? I have a golf ball on the ground, and from a raycast, I have the normal which gives me the slope of the ground by the ball.

I have an object which is rendered on the HUD to show that slope to the player.

I have a parent object rotated -90 degrees around X, so that the indicator's Z-axis points up. This way I can do this:

Quaternion yRot = Quaternion.Euler(0, -CameraController.Instance.CachedTransform.eulerAngles.y, 0);
Vector3 displayGroundNormal = yRot * _groundNormal;
_lieIndicator3DParentCachedTransform.rotation = Quaternion.LookRotation(displayGroundNormal);

This, as far as I can tell, takes the ground normal, rotates it around the y-axis so that it shows the proper perspective given the camera's facing. Then it tells that parent object to look in that direction, which aligns its z-axis with the rotated ground normal.

This works, except the object I have also rotates around the y-axis depending on the orientation of the camera. I thought that I was throwing that information away in the second step by keeping only a Vector3 aligned with the ground normal rotated for the camera position.

So I want this:

Not this:

sentences:
tic tac toe computer opponent I am just starting to do some very very very basic game dev(in java), i'm trying to create a game of tic tac toe but i am having some trouble implementing an a computer opponent.I just wanted to know if there is anyway to do this other than check every possibility with if statements.This is my best attempt at this but it is kinda broken. ie if points (1,1) and (2,2) are equal to x then it will think that (0,2) is the "best" move but in that situation there would be no "best" move.

some background info on the code, board is a global 3,3 int array. x is just that value that would be inserted when that location is selected. Coor is a class that contain just 2 ints x and y. availableMoves is an arrayList of all the empty areas on the board.

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (i <= 1 && j <= 1) {
                if (board[i][j] == x && board[i][(j + 1)] == x && availableMoves.contains(new Coor(i, ((j + 2) % 3)))) {
                    idealMove = new Coor(i, ((j + 2) % 3));
                } else if (board[i][j] == x && board[i + 1][j + 1] == x && availableMoves.contains(new Coor(((i + 2) % 3), ((j + 2) % 3)))) {
                    idealMove = new Coor(((i + 2) % 3), ((j + 2) % 3));
                } else if (board[i][j] == x && board[i + 1][(j)] == x && availableMoves.contains(new Coor(((i + 2) % 3), j))) {
                    idealMove = new Coor(((i + 2) % 3), j);
                }
            }
        }
    }

Thanks in advance for the guidance

sentences:
Is there any simple game that involves psychological factors? I need to find a simple game in which several people need to interact with each other. The game should be simple for an analysis (it should be simple to describe what happens in the game, what players did). Because of the last reason, the video games are not appropriate for my purposes. I am thinking of a simple, schematic, strategic game where people can make a limited set of simple moves.

Moreover, the moves of the game should be conditioned not only by a pure logic (like in chess or go). The behavior in the game should depend on psychological factors, on relations between people. In more details, I think it should be a cooperation game where people make their decisions based on mutual trust. It would be nice if players can express punishment and forgiveness in the game.

Does anybody knows a game that is close to what I have described above?

ADDED

I need to add that I need a game where actions of players are simple and easy to formalize. Because of that I cannot use verbal games (where communication between players is important). By simple actions I understand, for example, moves on the board from one position to another one, or passing chips from one player to another one and so on.

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: Is it possible to use true Blinn-Phong lighting on Unity Android/IOS? I've noticed that the Unity's Legacy Shaders/Specular shader does not work on mobiles due to the lighting model being incompatible. I then tried using the Mobile/Bumped Specular shader, but this shader does not support non-directional lights. So I tweaked the mobile specular shader to remove the noforwardadd argument, but I noticed that specular highlights are improperly positioned for non-directional lights, even after removing the halfasview/interpolateview argument. Does Unity even support non-directional specular highlights on mobile devices?

sentences:
Alternative solutions to applying an overly large and detailed texture to a mesh I have a very large spherical mesh in my Unity scene (the earth), to which one very large texture is applied (a map of the earth). Now it just so happens that Unity's max texture size (8192 pixels I believe) is not enough to capture the details I need on this huge mesh.

What's the proper way to deal with this situation in Unity? That is, not only overriding the 8192 pixels limitations (although that would be nice as a temporary solution), but also making sure the overhead won't become unbearable...

Is there a way to dynamically stream higher quality sections of textures as the camera gets closer to that specific part of the mesh?

Additionally, I see the Granite add-on (http://graphinesoftware.com/products/granite-for-unity) seems to do just this (if I understood it well), but it's only for Windows, and I'm developing on a Mac. Is there any other adding out there?

sentences:
How to create smoke that spreads outward in all directions? I saw many tutorials about smoke grenade but they just use volumetric smoke. I want to make something like the smoke grenade in PUBG, where the smoke spreads in all directions; how to do that?

The Unreal Engine 4 smoke grenade throws out smoke in a particular direction, like this:

But I want something more like PUBG's that spreads smoke evenly in all directions:

sentences:
Tons of stuttering in XNA? As stated in the title, my program stutters like crazy, even though my program for the most part runs for 60 fps. During the moments it stutters, FPS momentarily drops down to 59(stats from FRAPS).

Here is an video capture of the stuttering in action. If you look closely, you can see the game stutter around 3-4 times. It is much more noticeable in real life.

http://gfycat.com/SevereCanineBabirusa

CLR Profiler shows that garbage collection doesn't run at all during that time, never mind 4 times, so it's not that.

Here's the code for movement:

            //Movement logic
            //Increase the speed
            speed = Math.Min(speed + (speedIncrement * (gameTime.ElapsedGameTime.Milliseconds / 200.0f)), maxSpeed);

            for (int i = fruits.Count - 1; i >= 0; i--)
            {
                //Move the fruits
                fruits[i].pos.Y += speed * gameTime.ElapsedGameTime.Milliseconds;
                fruits[i].rect.Y = (int)fruits[i].pos.Y;
                //Check if the fruit is past the screen. If it is, remove it from fruits
                if (fruits[i].rect.Y > screenHeight)
                {
                    fruits.Remove(fruits[i]);
                }
            }

IsFixedTimeStep is set to false, but SyncronizeWithVerticalTrace is on. Any idea what could be the cause of the stuttering?

EDIT: Apparently it was a combination of this: http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/presentationfontcacheexe-uses-50-of-my-cpu/4200fe85-458f-4f19-b791-1fe5395304da and f.lux eating up my CPU/GPU cycles.

sentences:
What is the best way to import autocad models into unity? I just got someone to create a 3d environment for my game in autocad 2015. I exported that environment and imported it into unity but that doesn't work well as I am unable to see my environment in the scene view correctly.

Any suggestions on how to do it better? I am not good with 3d modeling and I ever used autocad models in unity before. Any kind of help is highly appreciated. :)

sentences:
Vertex shader are evil for performance? I found that the vertex shaders are sometimes very useful, especially because they can generate geometries and extract and use a lot of informations from just 1 image.

The problem is that my project still isn't that big and looking to bigger project or just to commercial games, seems like the vertex shaders are rarely used.

Am I wrong or the pixel shaders are much more used than the vertex shaders?

This has something to do with performance issues and compatibility issues? What about some possible bottleneck like the memory controller/CPU ?

sentences:
Why are huge polygon amounts bad? It is always said that the polygon amount of a single modell must be as little as possible when it comes to realtime simulations such as computer games. (Or at least lower than when rendering a movie)
I am fully aware that this must be done in order to save performance. But aside from that information i cannot find why huge polygon amounts must be avoided.

(In Short: I know that polygons eat performance. I want to know why they eat performance)

So my question would be:
What happens when a frame is rendered? The polygons are surely somehow processed in the graphicard. What happens there?.
If possible i would like to have some links to sites containig this information.

sentences:
Making Procedurally Generated Top-Down Landscapes Interesting I'm working on a game with a procedurally generated world. Ideally, I'd like to generate landscapes as beautiful as Minecraft's worlds are. Minecraft has chasms, and waterfalls, and mountains, and rolling hills, and oceans, etc. But as this is going to be a top-down (actually 3/4 perspective) game, I don't believe most of that is possible. The main reason being how hard it is to try and represent height in this perspective. Zelda: A Link to the Past created the illusion of height well, but this would be very hard to recreate procedurally, and also introduces some problems such as the fact that the tallest structures have to be at the top of the map.

So, I'd like to know some techniques to make landscapes interesting in a top-down format without having to fake a 3rd dimension. (You cannot create or destroy terrain in this game, so that gives us a little more flexibility.)

EDIT: To make things a little more clear, I'm trying to avoid worlds with features that require a 3rd dimension. For example, I can't really have rolling hills or mountains. What landscape features could be added that don't require faking a 3rd dimension? One answer could be to add rivers, but that's an obvious one.

sentences:
How do you prevent inflation in a virtual economy? With your typical MMORPG, players can usually farm the world for raw materials essentially forever. Monsters/mineral veins/etc are usually on some sort of respawn timer, so other than time there really isn't a good way to limit the amount of new currency entering the system.

That really only leaves money sinks to try to take money out of the system. What are some strategies to prevent inflation of the in-game currency?

sentences: Behavior trees - Can sequences and selectors contain conditions? I can't wrap my head around this. Is it legal for parent nodes to contain additional logic ?

sentences:
Unity Shader: Make water on terrain transparent without fading I want to create a shader for a terrain to make the water fully transparent but not invisible or faded.

In this example I would want the purple square to be seen through water but not through the land.

I want the water to look exactly the same as before.

I want objects underneath the terrain to be visible through the water.

I already have a shader to make objects underneath the water look like they are seen through water.

I want to use a single camera as I would need a slow script on each of the cameras.

sentences:
In Unity, how can I register a custom file type that is always opened with my game? I want my players to be able to create their own scenes as custom levels, save them as files (say custom1.gamelevel), and open them directly in my game program by double-clicking the level file, rather than having to go through the steps of opening the game, browsing to the file in my menus, and then loading that scene/level.

I already have loading custom levels covered. I just need a way to associate this custom file type with my game which can open it.

I am mainly interested in a Windows-based solution.

How can I do this?

sentences:
Rendering only a part of text FTGL, OpenGL I'm using FTGL library to render text in my C++ project.

I can easily render text by using:

CFontManager::Instance().renderWrappedText(font, lineLength, position, text);

Unfortunately there is a situation in which this Button which displays text, is partly hidden because of resizing container in which it is situated. I'm able without any problem to draw Button's background to fit the container, but I've got a problem with doing the same with a text. Is it possible to somehow draw only text for given width and the rest just ignore?

This is a screen which presents my problem:

As you can see, the Button "Click here" is being drawn properly, but I can't do the same with "Click here" text.

sentences:
Android: Synchronizing timers across multiple devices Im writing a turn-based multiplayer game that implements a chess timer. When the current players turn starts, all devices start timing for the current player, however, as his turn proceeds, the timers fall out of sync, and at the end of his turn(say for example he took 1 minute to make a move) his time on the other players devices are sometimes up to 10 seconds ahead or behind. I understand theoretically its impossible to time-sync devices down to the millisecond, but if i can get it atleast within a second, that will work just fine. I tried the following the try overcome this:

-Sync time across devices at the beginning and end of current players turn.

-Sync time whilst it is current players turn.

-Combination of the two.

The problem with these attempts is that they cause a lot of flickering on the clock, and, at the end of the turn, when other players see the current players time increasing by 5-10 secs, they feel cheated, and it just doesnt look good. Newbie here so be gentle with your responses :)

sentences:
How to scale our multiplayer support, similar to Among Us We are a small team with the goal of creating our first multiplayer game, and we want to support multiplayer that can rapidly scale up as Among Us has successfully done.
We don't have a huge budget and we are struggling to find an appropriate way to implement multiplayer, including peer to peer (although it would be exhausting to combat cheating and make a smooth experience). Our game has no more, no less than 50 players in a very tight space.
As an example, we're looking at the indie game Among Us. They went from such a small game with barely any players, to maintaining well over 3 million CCU (concurrent users). How can we achieve similar scalability?

sentences:
Is there a way to procedurally generate the history of a world? I am somewhat intrigued by the diagram found here representing 1800 years of cultural history in an imaginary world some guy created.

This sort of thing would seem to have strong applications for game development, insofar as world design.

It looks like he did this diagram by hand. What I'm interested in is seeing if there is a way to create this sort of diagram programatically.

If you were tasked with generating diagrams in the style of the above from random values, how would you go about it? Are there any particular data structures or algorithms that you would consider?

sentences:
Setting up images for frame animation I am learning the basics of iPhone frame animation.  I have code that loops through 15 images to do an animation:

- (void)viewDidLoad
{
    [super viewDidLoad];
    UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(40, 40, 95, 70)];
    NSMutableArray *arr = [[NSMutableArray alloc] init];
    for(int i = 1; i <=15; i++){
        UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"someImage_%02d", i]];
        [arr addObject:img];
    }
    iv.animationImages = arr;
    iv.animationDuration = 1.0 / 2;

    [self.view addSubview:iv];
    [iv startAnimating];
}

I want to load images of Link from a picture I found on the internet.  How can I take this image (available as a png) and load the unique parts of the image?  I have heard of people putting multiple images into a single PNG to improve performance. How do I extract the individual images into an array for use in code like the above?

Please keep in mind this is my first time doing frame animation.  I realize this code can likely be improved.  I'm trying to keep things simple.

sentences: HDR mode in windows makes build version of Unity game look washed out I've got a 2D Unity game I've been working on. The development computer is hooked up to a TV that supports HDR. If I turn on the "Play HDR Games and Apps" switch in windows then run the build version of my game the colors all appear overly bright and washed out. It looks fine in the editor though and looks fine when the windows HDR mode is turned off. Is there a setting in Unity that can stop this problem?

sentences:
How to create an animation from several .obj files in maya? I have several .obj files. I plan to create an animation from these .obj file. Every mesh in one .obj file is correspond to one frame. And every frame only show one .obj file (meshes in others .obj files are hidden).I use Maya.

Any body has any suggestions?

sentences: Loading WAV and MP3 files with LWJGL 3? Whenever I research audio in LWJGL 3, they always use STB which can only load Ogg files. All of my audio files are in either WAV or MP3 format, and it would be annoying to have to convert all of them. Is there some other library or method I can use that would allow me to load these file formats?

sentences:
How do Minecraft know where village's buildings are if the village is not generated yet? I'm trying to understand how chunk generation works in a deep level and all the information I found does not explain how the villages are generated properly without visual glitches during generation.

I mean, if you are in an area where you should see some buildings from a village, how does Minecraft know that they must be rendered?
Minecraft generates villages from a main "structure" that probably it is not generated yet.

This video explains the village's generation properly.

So with that in main what should happen is that you could see builds appear from time to time when the "village center" of a village is generated in a new-generated chunk.

Here you have a visual representation of the circumstances I'm describing. The buildings inside the loaded area shouldn't be shown if the village is not generated yet:

The only explanation I can think about is that Minecraft generates way more chunks than the ones that are visually loaded to avoid this problem.

If this what happens, what is the generation area compared to the visual loaded area?

sentences:
I'm looking for a paper from Teknikus.dk I'm looking for this great paper about Verlet integration: http://www.teknikus.dk/tj/gdc2001.htm

I've found this link on many websites, forums, blogs, everyone is recommending it !

The website is down for more than one week.

sentences:
Android canvas.drawColor throws a null object reference I have two nearly identical methods, the first to draw a splash screen while assets are loading, and the second to draw all of the assets to the screen.  The first throws a NullPointerException on this line:

canvas.drawColor(Color.argb(255, 0, 0, 0));

Here is my error:

  Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Canvas.drawColor(int)' on a null object reference
  10-19 21:54:56.042 18973-18973/? E/AndroidRuntime:     at com.xyz.123.GameView.drawSplash(GameView.java:76)

Here is my code in full:

package com.xyz.123;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

public class GameView extends SurfaceView implements Runnable {
    volatile boolean playing;
    Thread gameThread = null;
    private Paint paint;
    private Canvas canvas;
    private SurfaceHolder holder;
    private int screenWidth;
    private int screenHeight;
    private Background1ResourceList background1ResourceList;
    private Background background1;
    private Background background2;
    private Background background3;
    private Context context;
    private SplashScreen splashScreen;

    public GameView(Context context, int screenWidth, int screenHeight) {

        super(context);

        this.context = context;

        this.screenWidth = screenWidth;
        this.screenHeight = screenHeight;

        // Initialize our drawing objects
        holder = getHolder();
        paint = new Paint();

        splashScreen = new SplashScreen(context, screenWidth, screenHeight);
        drawSplash();

        background1ResourceList = new Background1ResourceList();

        background1 = new Background(context,         background1ResourceList.getBackgroundResources(), screenWidth, screenHeight, 0.00f, 0.50f);
        background2 = new Background(context, background1ResourceList.getBackgroundResources(), screenWidth, screenHeight, 0.33f, 0.80f);
        background3 = new Background(context, background1ResourceList.getBackgroundResources(), screenWidth, screenHeight, 0.66f, 1.00f);
    }

    @Override
    public void run() {
        while (playing) {
            update();
            draw();
            control();
        }
    }

    private void update() {
        background1.update();
        background2.update();
        background3.update();
    }

    private synchronized void drawSplash() {
        if (holder.getSurface().isValid()) {
        //First we lock the area of memory we will be drawing to
        holder.getSurface();
        canvas = holder.lockCanvas();
        // rub out the last frame
        canvas.drawColor(Color.argb(255, 0, 0, 0));
        // draw the backgrounds
        splashScreen.draw(canvas, paint);
        // unlock and draw the scene
        holder.unlockCanvasAndPost(canvas);
        } else {
            System.out.println("surface not valid");
        }
    }

    private synchronized void draw() {
        if (holder.getSurface().isValid()) {
            //First we lock the area of memory we will be drawing to
            canvas = holder.lockCanvas();
            // rub out the last frame
            canvas.drawColor(Color.argb(255, 0, 0, 0));
            // draw the backgrounds
            background1.draw(canvas, paint);
            background2.draw(canvas, paint);
            background3.draw(canvas, paint);
            holder.unlockCanvasAndPost(canvas);
        }
    }

    public void pause() {
        playing = false;
        try {
            gameThread.join();
        } catch (InterruptedException e) {

        }
    }

    public void resume() {
        playing = true;
        gameThread = new Thread(this);
        gameThread.start();
    }
}

sentences:
How can I make relative movement in GameMaker studio? I know I can change the hspeed and vspeed properties on my object. Assume I do it for the directional diamond in a squared-style movement game (not necesarily snapping to tiles, but it could). So the following scenarios apply (for any constant K) for my obj_Hero object:

Pressing UP: vspeed is -K, hspeed is 0
Pressing DOWN: vspeed is K, hspeed is 0
Pressing LEFT: vspeed is 0, hspeed is -K
Pressing RIGHT: vspeed is 0, hspeed is +K
Otherwis: vspeed and hspeed are 0
Only one directional arrow at the same time will be considered (the last pressed).

My player starts from position of an obj_Start object, and wins when reaching (colliding) an obj_End object. In the meantime, an obj_Enemy will be chasing the player using a step avoid strategy to avoid the player. The player loses if the enemy collides with him. Assuming I can correctly select the enemy current direction sprite, I'm done.

So far, so good.

Now assume some parts of my game have moving platforms. They have a specific platform speed vector (PSH, PSV), assuming I have such constants.

I know I could always condition my player movement speed to be:

(K + PSH, PSV) for player moving right
(-K + PSH, PSV) for player moving left
(PSH, K + PSV) for player moving down
(PSH, -K + PSV) for player moving up
(PSH, PSV) for player not moving

But... How do I alter (relative to the platform movement, as I do with the player) the enemy movement when it is actually generated by the step avoiding strategy?

sentences:
How do I write an interface for the keyboard and mouse input? I have started to develop a simple 3D engine. I use OpenGL for rendering, and it is developed for Windows. It is all written in C.

How do I write an interface for the keyboard and mouse input? I would like to keep it as simple as possible - in contrast to the native Win32 input system.

sentences:
Optimized algorithm for line-sphere intersection in GLSL Well, hello then!

I need to find intersection between line and sphere in GLSL. Right now my solution is based on Paul Bourke's page and was ported to GLSL this way:

// The line passes through p1 and p2:
vec3 p1 = (...);
vec3 p2 = (...);

// Sphere center is p3, radius is r:
vec3 p3 = (...);
float r = ...;

float x1 = p1.x; float y1 = p1.y; float z1 = p1.z;
float x2 = p2.x; float y2 = p2.y; float z2 = p2.z;
float x3 = p3.x; float y3 = p3.y; float z3 = p3.z;

float dx = x2 - x1;
float dy = y2 - y1;
float dz = z2 - z1;

float a = dx*dx + dy*dy + dz*dz;
float b = 2.0 * (dx * (x1 - x3) + dy * (y1 - y3) + dz * (z1 - z3));
float c = x3*x3 + y3*y3 + z3*z3 + x1*x1 + y1*y1 + z1*z1 - 2.0 * (x3*x1 + y3*y1 + z3*z1) - r*r;

float test = b*b - 4.0*a*c;

if (test >= 0.0) {
  // Hit (according to Treebeard, "a fine hit").
  float u = (-b - sqrt(test)) / (2.0 * a);
  vec3 hitp = p1 + u * (p2 - p1);
  // Now use hitp.
}

It works perfectly! But it seems slow... I'm new at GLSL. You can answer this questions in two ways:

Tell me there is no solution, showing some proof or strong evidence.
Tell me about GLSL features (vector APIs, primitive operations) that makes the above algorithm faster, showing some example.

Thanks a lot!

sentences:
What is the cost of distributing through Google Stadia? Stadia's business aspects are really scarce to find.

What will the revenue models look like?
Traditional video game model (royalties) or app store model (%)?

sentences:
Approaches on detecting if a car should steer left or right considering a next direction I'm developing the A.I. of my racing game, and I'm having an unforeseen problem. I manage to get the bot to drive by itself by accelerating in the direction of an angle that is returned using the atan2 trig function considering the position of previously-defined waypoints on the track data structure. Here's the code for ai.py:

import math
import pygame

class Bot:

    def __init__(self, player, track):
        self.player = player
        self.track = track
        self.current_waypoint = 1
        self.player.states[0] = True
        self.track.choose_waypoint_path()
        self.number_of_waypoints = len(self.track.waypoint_positions.keys())
        self.get_waypoint_angle()

    def get_waypoint_angle(self):
        self.dx = self.track.waypoint_positions[self.current_waypoint][0] - self.player.car.pos[0]
        self.dy = self.track.waypoint_positions[self.current_waypoint][1] - self.player.car.pos[1]
        self.ratio = math.atan2(self.dy, self.dx)
        self.angle = -self.ratio * (180/math.pi)

    def think(self):
        if pygame.Rect(self.player.car.pos, self.player.car.dimensions).collidepoint(
            self.track.waypoint_positions[self.current_waypoint][0],
            self.track.waypoint_positions[self.current_waypoint][1]
        ):
            self.track.choose_waypoint_path()
            self.number_of_waypoints = len(self.track.waypoint_positions.keys())
            if self.current_waypoint == self.number_of_waypoints:
                self.current_waypoint = 0
            self.current_waypoint += 1
        self.get_waypoint_angle()
        self.player.car.angle = self.angle
        self.player.car.rotate()
        self.player.move()

The thing is, when I set the car angle based on the return of the atan2 function, self.player.car.angle = self.angle, the car rotates/turns in an extremely unrealistic fashion. It works, but it means that I have to gradually steer the car, and then I face this problem. I don't know when to steer left or right, because the angle can be negative. If I do this, for example:

        if self.player.car.angle > self.new_angle:
            self.player.car.angle -= self.player.car.steering_speed
        else:
            self.player.car.angle += self.player.car.steering_speed

The bot drives to the next waypoint destination by weirdly driving in circles.

So, I know the direction in which the bot should drive, but based on its previous angle, I don't know whether it should steer left or right to reach that direction.

sentences:
How can I bundle assets into an executable from my Game Maker-like editor? I am attempting to implement a simple "game-maker" solution. I'm working with Visual Studio, in C#, using MonoGame. I'd like the games my editor creates to be stand-alone executables, with their art resources bundled within them so that they are not loose in a "data" folder next to the application.

I'm not sure how to implement that, though. If I create a game from my editor, how can the resulting game data be made distributable within the executable?

I'd like it so that the end result allows you to first open the editor and create and save a game, then go to that directory and run that game with its own executable.

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:
What is a good algorithm to detect collision between moving spheres? If (for the purpose of collision detection) 3D objects are represented in a game by spheres, what is a good algorithm to detect a collision between spheres?

If each object has a position as of the last frame and a new (desired) position, what is a good algorithm that will identify collisions where the spheres didn't intersect in the previous frame, and they may not intersect in the second frame, but they did intersect somewhere in between?

sentences: How can a pygame image be colored? How can I color a Pygame image surface? I either want to change every pixel that is color A into color B, or else change every pixel into color B. Either works, so long as transparent regions remain the same.

sentences:
Implementing David Silver's Cooperative Pathfinding in Real-Time I'm currently implementing David Silver's Cooperative Pathfinding algorithm for a 2D game with grid-based movement (all eight directions).

The issue I'm having trouble wrapping my mind around is the Reservation Table with respect to real-time. I've fully implemented the algorithm in its own testbed; however, my implementation is turn-based where everybody is moving at the same speed.

The game I'm trying to integrate the group pathfinding into has real-time movement with units having different speeds.

I've compiled a few considerations I need to take into account and some that could help me implement this:

Enemies do not seek the player's character
However, some enemy units will wander
Enemies will have a different movement speed depending on enemy type
The player moves the avatar by clicking the destination (this initiates a walk)
The player can start start running by double clicking a destination (this can happen in-between grid nodes)
The player has allies that follow the avatar
Allies will run to keep up with the avatar if too far away and start walking again if close enough (this can also happen in-between grid nodes)
Speeds are not perfect multiples of each other

With those in consideration, my current partial solution consists of the following:

Because of consideration 1 and 2, enemies will share reservation tables since I can have them move on the same intervals so their times will match up
Because of considerations 3 and 8, the enemies' reservation tables will differ by movement speeds. I am thinking of doing it this way because I'm not sure how to use one reservation table for all of them if their speeds are not perfect multiples of each other.
Because of the speed-change considerations of 4, 5, 7, and 8, the player's and allies' paths will be recalculated whenever they start walking or start running since that will affect path coordination.
Because paths can be recalculated for the player avatar on the fly, I will need to have two reservation tables specifically for the player (one for walk, one for run). I would also possibly need to have two reservation tables for the allies to share (one for walk, one for run).
Because of the fact that paths can be recalculated in-between nodes, I believe I will have to limit changes of speed to only occur when a unit is directly on a node rather than being able to change speeds in-between nodes as it currently works. Otherwise, I believe I would have to calculated the time it will take to reach the next node and then track that in the reservation table as well somehow.

Finally, here are things I'm wondering about:

I must be not understanding the Reservation Table completely if coordinating units is this difficult. How do I define the time of a node in the Space-Time map if not by how long it takes one unit to get from one node to another?
Is diagonal movement going to be an issue when defining the time of a node in the Space-Time map?
Is there an easier way to handle implementing this short of implementing a different group pathfinding algorithm?
If there is another pathfinding algorithm you recommend, I am all ears, but at this point in development, there most likely isn't any time to implement something new unless coding it as well as integrating it into the game would take less time than jamming the already-coded algorithm into the game.

Feel free to suggest ways of slightly altering how enemies, the player, and the allies move if that will make implementing this significantly easier. I appreciate any help you feel like offering. Thanks for your time!

sentences:
Manually creating cycles in planar, procedural trees? I am creating a procedural map using delaunay triangulation and an MST. I'd like to have a bit more control over my final graph. Like when i was looking looking at the MST I wondered how I can connect specific points of the MST? The following image shows the MST in green and the points I want to connect in red.

I was thinking about traversing from a dead end and counting the steps. When it gets within a certain treshhold add a connection. But this might add a connection when there is still a room closer to it. So I have to check for that as well.

Same goes for entrance, exit and perhaps other important places on the graph. I want to end up with a random yet fun and playable dungeon. There must be proven concepts about controlling a graph for procedural dungeons and I would love to learn from 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:
A system that figure out the fastest (not shortest) navigation method between points for 2D spaceship with 2 axes propulsion I am working on a space themed game with space being a 2D pane. The player issue order by clicking on the coordinate for his/her ship to navigate to a certain point on the  pane.
The player ship can:

Propel forward and backward
Strafe starboard and port
Yaw starboard and port

The ship's performance on each direction varies greatly depending on configuration. Some may move faster on sides and back directions than they do forward direction.
I have combined A* and PID control for navigation but couldn't help but noticed that in many occasions where the ship could have accelerate to the full speed and turn towards the target to reach the target faster, it instead turns in place while strafing slowly until it faces the destination before accelerating.
I would like to add another calculation that let the ship knows which navigation approach it should take to minimize the time to reach the target but I have no idea which field of study I should look into or if there is a quick win scenario I could use to achieve an expected outcome.
Please kindly recommend and thank you very much in advance.

sentences:
Reasons to disable game save during combat (e.g. Mass Effect 2) So I've been playing Mass Effect 2 (PC) and one of the things I've noticed is that you can only save your game when you're not engaged in combat.  As soon as the first enemy shows up on your radar, the save button is disabled.  Once combat is over, save functionality reappears.

It seems reasonable to assume that Mass Effect 2 is a state machine, and therefore, the internal state of the program at any moment can be captured and reloaded later.  This is basically a solved problem - games have been designed this way since the Half-Life era.  It also seems reasonable to assume that BioWare knew what they were doing when they made the decision not to follow this model - it's a tried and true system; BioWare wouldn't have done it the way they did without some good reason.

What reasons are there to disable game save functionality during combat?

sentences:
How do you register two or more keys properly? I am experimenting with KeyListeners and I thought about how do I register two or more keys, this is my code so far:
package engine.listeners;

import engine.Frame;
import engine.KeyCodes;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.HashSet;
import javax.swing.*;

public class Key extends KeyAdapter implements KeyCodes, ActionListener {

    private static HashSet<Integer> keyMap = new HashSet<>();
    private Timer tm;

    public Key() {
        tm = new Timer(0, this);
        tm.start();
    }

    @Override
    public void keyPressed(KeyEvent e) {
        if (!keyMap.contains(e.getKeyCode())) keyMap.add(e.getKeyCode());
    }

    @Override
    public void keyReleased(KeyEvent e) {
        keyMap.remove(e.getKeyCode());
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        int x = Frame.moveMe.getX();
        int y = Frame.moveMe.getY();
        if (keyMap.contains(arrowLeft)) Frame.moveMe.setXY(--x, y);
        if (keyMap.contains(arrowUp)) Frame.moveMe.setXY(x, --y);
        if (keyMap.contains(arrowRight)) Frame.moveMe.setXY(++x, y);
        if (keyMap.contains(arrowDown)) Frame.moveMe.setXY(x, ++y);
    }
}

Right here, it's doing 2 registered keys properly, for example arrow left and arrow top goes diagonal left top.
But one thing I noticed, sometimes when I registered 3 or more keys, it's not working properly for example: arrow left, arrow right, and arrow up should just go up, but what happened is it ignored the key 'right', and so it continues going diagonal top left.
Is there a way to improve this? or should I implement another type of listener that is not buggy as KeyListener?

sentences:
In tools development, what languages and technologies are currently in use? I am an aspiring tools developer currently in university. Normally I use both C++ and C# to and from but as my time at university is coming to an end, what language and technologies are worth focusing on? With tools I'm not only thinking simple data-file editors, but level editors and such as well.

I have tried searching in numerous places but generally I only find questions regarding what language or tools to use for game development. As I want to create the tools rather than use them, the answers don't necessarily apply.

Seeing as C++ still seems to be the language of choice in the gaming industry, is it also still the primary language for tools? If so, what UI and core libraries are most prominent? wxWidgets and stl/boost? Plain Win32?

Or - if C++ is being phased out in favor of "easier" languages like C# - is WinForms the right pick, or is the industry moving towards WPF? Maybe scaleform internally as well?

In short, is there anything I absolutely need to know to not be just an expensive chair heater?

sentences:
Should I compress WebSocket payload data in a game where latency matters? I have started work on a new game project where users are in an open environment and fight each other in a fast-paced shoot-out. I know that compressing all of the WebSocket's payload data using zlib can be a significant improvement over non-compressed data in terms of bandwidth, but does the latency of packing/unpacking data have more advantages over not packing it?

I know using zlib on the data can have some advantages - less bandwidth and harder for hackers to read the data, but it also has a disadvantage - takes time to [un]pack.

Should I use zlib in a game where latency could be the difference between life or death?

sentences:
Can I develop Linux + Windows games using C#, .NET and OpenGL? I want to learn to develop 3D and 2D graphics with either OpenGL or DirectX. I chose OpenGL as it's being used in webGL and works cross-platform.

I already know .NET well, and the C# language just fits my style very well and I feel secure with it.

However, I want to develop a game that works on Windows and Linux. Is this possible to do with the combination of C#, .NET and OpenGL. I know that OpenGL will not be a problem.

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:
Running OpenGL app on Windows XP x86 produces incorrect texture colors I'm working with the Cen64 emulator and I compiled from source a x86 version that operates fine on Windows 10 x64. As soon as I run it on a Windows XP x86 machine the colors are then all incorrect. Here are some screenshots:

Running on Win 10

Running on Win XP SP3

  The color format is set to GL_UNSIGNED_SHORT_5_5_5_1 and the internal format is GL_RGBA:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, hres + hskip, vres,
    0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, buffer);

I'm pretty new to configuring color packing formats but it appears like some color channels are getting swapped? Maybe some sort of endianness issue going from an x64 to an x86 architecture?

Please let me know if I need to show more of my code to help debug the issue. Thanks for any help! ^_^

sentences:
Why does the object rotate to a random direction when I start dragging? I'm trying to do drag to rotate sort of thing, so far the code is fine. However when starting to drag (left clicking first), the object rotate to a random direction first which looks odd.

here is my code :

public Camera cam;
public float smoothAngle, dragPower = .3f;
public bool isRadial = true;
float angle, angleOld, angleDelta, angleRef;
Vector2 mousePosOld, mousePosDelta = Vector2.zero;

void Update()
{
  Vector2 mousePos = cam.ScreenToWorldPoint(Input.mousePosition);
  if (Input.GetMouseButton(0))
  {
    mousePosDelta = mousePos - mousePosOld;
    float rotX = (mousePosDelta.magnitude / Time.deltaTime)
                  * dragPower
                  * -Mathf.Sign(mousePos.y)
                  * Mathf.Sign(Vector2.Dot(Vector2.right, mousePosDelta));

    transform.Rotate(Vector3.forward, rotX);

    mousePosOld = mousePos;
    angleDelta = Mathf.DeltaAngle(angleOld, transform.localEulerAngles.z);
    angleOld = transform.localEulerAngles.z;
  }
  else
  {
    transform.RotateAround(transform.position, transform.forward, angleDelta);
    angleDelta = Mathf.SmoothDampAngle(angleDelta, 0, ref angleRef, smoothAngle);
  }
}

this is the effect :

sentences:
Can't rotate object after using transform.forward I'm using above code to rotate object pointing where it moves:

transform.forward = m_Rigidbody.velocity;

It works fine, however the problem is that I can't rotate this object anymore after set direction.

transform.forward = m_Rigidbody.velocity;
transform.Rotate(0, 0, m_RotateSpeed * Time.deltaTime * 500); // Not Working

Code is simple, first rotate the object to point where it goes and then rotate z axis. But when I ran the game, it just shaking little bit and didn't rotate at all.

Why it doesn't work even rotating code after the transform.forward? Any advice will very appreciate it.

sentences:
How to distort 2d perlin noise? I am using Unity's 2D Mathf.PerlinNoise(x, y) function and I would like to make it distorted. What I mean is described with this picture I made:

How can I do that? What transformations should I apply to Mathf.PerlinNoise(x, y) to achieve this effect?

sentences:
XNA GUI: Creating a 'scroll pane' widget I'm trying to create a simple GUI system and am currently stuck on how to implement a textarea with a scrollbar. In other words, the text is too large to fit into the view area. I want to learn how to do this, so I'd rather not use an already rolled API.

I believe this could be done if the text were part of a texture, but if the game had a lot of unique dialog, this seems expensive.

I researched creating a texture on the fly and writing to it, but came up with nothing.

Any suggested strategies would be appreciated. I believe it boils down to: text in a texture and how? Or something I have not thought of...

sentences: (love2d)How would I go about drawing the same image multiple times? Obviously I could just copy and paste a love.image.draw() function multiple times for how many times I want the item to be drawn, but lets say I wanted to draw an image wherever the mouse is clicked at. How would I go about making it so it draw said item every time I clicked. If I only clicked twice it would draw two objects, and if I clicked it 500 times it would draw 500 items, without having to have 500 different draw functions?

sentences:
detect collision between two circles and sliding them on each other I'm trying to detect collision between two circles like this:

var circle1 = {radius: 20, x: 5, y: 5}; //moving
var circle2 = {radius: 12, x: 10, y: 5}; //not moving

var dx = circle1.x - circle2.x;
var dy = circle1.y - circle2.y;
var distance = Math.sqrt(dx * dx + dy * dy);

if (distance < circle1.radius + circle2.radius) {
    // collision detected

}else{
    circle1.x += 1 * Math.cos(circle1.angle);
    circle1.y += 1 * Math.sin(circle1.angle);
}

Now when collision is detected I want to slide the circle1 from on the circle2 (circle1 is moving) like this:

--circle1---------------------------------circle2-------------------------

I could do this by updating the angle of circle1 and Moving it toward the new angle when collision is detected.

Now My question is that how can I detect whether to update/increase the angle or update/decrease the angle based on which part of circle2 circle1 is colliding with ??

I would appreciate any help

sentences:
D3D11_SAMPLER_DESC::MipLODBias vs ID3D11DeviceContext::SetResourceMinLOD When implementing a max-texture-detail functionality for a game, which approach is better to use, out of:

Setting the D3D11_SAMPLER_DESC::MipLODBias value of a sampler state object, or,
Setting the min resource LOD of each texture resource with ID3D11DeviceContext::SetResourceMinLOD()?

I'm thinking it's probably the second option, because using SetResourceMinLOD() means that only the relevant subresource will be uploaded to the video memory, correct?

If that is the case, I assume that setting SetResourceMinLOD() will cause Direct3D to remove unused detail levels from video memory (if necessary) if they're already on there?

Thank you

sentences:
how to generate road in racing game I'm making a racing game in python and I kind of wrote myself into a corner.  This for loop:

 for i in objects:
     if i.name == "road":
         if i.y == 0:
             road = Road(road_x,-20,road_width,20)
             objects.append(road)

is how I generate new road tiles as the old ones move down the screen.  When a block spawns 20 pixels offscreen, it falls down until its top left corner hits 0 and then a new block spawns above it.  if you run this code: https://github.com/hailfire006/economy_game/blob/master/racing%20game
you can see that it works great, right up until the player accelerates by pressing up or "w", at which point the road stops spawning.

What I think is happening is that the road is skipping the 0 mark and that's why no new road is spawning, but increasing the acceleration in the code doesn't seem to mess it up, it's only when it's changed dynamically in game.  Can soneone explain what's happening here because nothing I try is working and I've been stuck on this for days...

sentences:
Is there an engine-agnostic tool for editing curve animations? I am looking for a tool that allows to edit 3D animation curves. What I want is something similar to how the animation system works in Unity or others. Being able to create a timeline of transformations to some object, with properties like scaling, rotation, position etc.

I am looking for an engine agnostic tool that can export this in a format that can be parsed and used in my own engine, like some level editors do.

sentences:
Unity getting Input from UI So I'm trying to get a script of mine to pass information to another static class being used for saving files as I've been told I wouldn't want that script to be instantiated. So I used a separate script to get input field text. However, I seem to be encountering a problem whenever I want to save the file.

I keep getting the error "Object reference not set to an instance of the object", I have made done this though. (See code below)

The class to get the name of the file

public class SaveInputField : MonoBehaviour
{
    public static string saveName;
    public GameObject inputField;

    public void getFileName(string saveName)
    {

        saveName = inputField.GetComponent<Text>().text;
        Debug.Log("Save file name: " + saveName);
        SaveFile.saveName = saveName;
    }
}

^called whenever its been edited

The static class

public static class SaveFile
{

    public static string saveName;

    public static void SaveData(Deck deck)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string path = Application.persistentDataPath + "/" + saveName + ".dd";

        FileStream stream = new FileStream(path, FileMode.Create);
        Debug.Log("Stream Opened");
        DeckData data = new DeckData(deck);

        formatter.Serialize(stream, data);
        stream.Close();
        Debug.Log("Stream Closed");

    }
```

sentences:
Find all tiles by ID in layer In phaser 2.6.2, is there a way to retrieve all tiles given their ID from a TilemapLayer? The method searchTileIndex on Tilemap works well to retrieve a tile. It has a skip parameter that allows to loop through the tiles, so I've come with the following code:

var walls = [];
var skip = 0;
do {
    var tile = map.searchTileIndex(Tiles.ID_WALL, skip, false, wallLayer);
    if (tile !== null) {
        walls.push(tile);
        skip++;
    }
} while (tile !== null);

but it looks very cumbersome to say the least. Am I missing a simpler method, kind of getAllTiles(id) or something?

sentences:
How do I create a Shadow of the Colossus - like climbing system? I'm developing a game in Unreal Engine 4, and I want to implement a climbing system just like in Shadow of the Colossus, where you can grab and climb onto specific parts of the monster (fur, in this case).

It probably doesn't use the same logic as a building a climbing system/edge grabbing, where it uses a sphere trace by channel to detect edges and then disable the player movement, as the player must be attached to the colossus since it moves.

How would I go about creating something like this?

sentences:
How to get `Label::createWithTTF` to support RTL languages such as Arabic Firstly, I'm using Cocos2d-x v3.6, Visual Studio 2013 uses(UTF-8 without signature option) and C++.

When using Label::createWithTTF method to write Arabic text, It appear like the following.

The previous arabic text has not been written correctly, It was supposed to look like this السلام عليكم, and it also supposed the Arabic language belong to Unicode encoding.

My code:

auto label = Label::createWithTTF("السلام عليكم", "fonts/arial.ttf", 34);

Is there any way to solve that problem ?

Edit:

I have applied what in this link [ Right-to-left mark  ] and the result was disappearance the Arabic text as in the following picture.

The code:

auto label = Label::createWithTTF("\u200fالسلام عليكم", "fonts/arial.ttf", 34);
label->setAlignment(TextHAlignment::RIGHT);

The problem still exists.

sentences:
HTML5 canvas screen to isometric coordinate conversion I am trying to create an isometric game using HTML5 canvas, but don't know how to convert HTML5 canvas screen coordinates to isometric coordinates.
My code now is:

var mouseX = 0;
var mouseY = 0;
function mouseCheck(event) {
    mouseX = event.pageX;
    mouseY = event.pageY;
}

which gives me canvas coordinates. But how do I convert these coordinates to isometric coordinates? I am using 16x16 tiles.

sentences:
Designing an entity system for a tile-based puzzle game I'm developing a tile-based game creation library in C# and along with it I'm creating a game to test all of its functions.

This is a screenshot of the game:

You've probably never heard of the original, but my game is a clone of Deadly Rooms of Death (DROD), which you can find at http://caravelgames.com

Anyway, as you can see from the screenshot, my game (and my library) is all about 2D puzzle games on a grid, rigorously turn based.

My library has this structure:

Entity: class that gets updated every turn and every game elements inherits from
Tile: class that holds entities (any amount of entities)
TileManager: class that contains a 2D array of all the tiles
Field: class that contains a TileManager and all the methods for querying it and finding entities

For fast queries and flexibility, I'm using interfaces and inheritance to group entities.
Let me explain with code for the roach entity:

public class TDLMonster : TDEntity, IHasTarget, IDrawn, IHasDirection, ISolid,
IHitByWeapon, IHitByMonster
{
...
}

The TDLMonster class inherits from TDEntity (which inherits from Entity). It also uses interfaces as a way to mark certain properties of elements.

public interface IHitByWeapon : IEntity
{
    void HitBySword(IWeapon mWeapon);
}

This is the IHitByWeapon interface. After every turn, weapons check if there is any instance of IHitByWeapon on their tile. If there is, call HitBySword. Here's the code that does this:

 public virtual void CheckHits()
    {
        List<Entity> hitEntities = Field.GetEntities(X, Y, typeof (IHitByWeapon));
        for (int i = 0; i < hitEntities.Count; i++)
        {
            IHitByWeapon hitEntity = (IHitByWeapon) hitEntities[i];
            hitEntity.HitByWeapon(this);
        }
    }

Field.GetEntities(x, y, type) returns a list of entities of that type in a specific tile. When an entity is initialized, my library gets all the types and interfaces using the following code snippet, then puts the entity in dictionaries having types and interfaces as keys:

public static List<Type> GetAllTypes(Entity mEntity)
    {
        List<Type> types = new List<Type> {mEntity.GetType()};
        Type[] nestedTypes = mEntity.GetType().GetNestedTypes();
        types.AddRange(nestedTypes);
        Type[] interfaces = mEntity.GetType().GetInterfaces();
        types.AddRange(interfaces);

        foreach (Type type in nestedTypes) types.AddRange(type.GetInterfaces());

        return types;
    }
...
foreach (Type type in GetAllTypes(this))
            {
                if (!Tile.TileManager.GroupedEntities.ContainsKey(type))              Tile.TileManager.GroupedEntities.Add(type, new List<Entity>());
                Tile.TileManager.GroupedEntities[type].Add(this);
            }

My library/game is relies completely on types and interfaces.

This is a good thing because I know what methods and properties entities have, and because different entities can share the same interface. I can have 20 different types of monsters, but as long as they implement IHitByWeapon they will all get killed by the player's sword.

This is a bad thing because it relies on hardcoding elements, and I cannot manipulate interfaces at runtime. Let's say I have a door element. I need it to be solid when the door is closed and to be non-solid when the door is open. If the element implements ISolid I cannot remove it. The same problem applies if I suddenly want a flying roach. I would have to code another element that implements ICanFly, because I cannot add an interface to an entity at runtime.

I've thought about using a List of stuff like "solid", "enemy", "player" - but it's not flexible enough, since I cannot have interface-like methods or properties, and I need to guess if the entity has a method or use the dynamic keyword.

How can I solve this problem? Is there something that lets me have the ease of use as interfaces but also the flexibility as List?

Let me know if you need more information or parts of the source code.

sentences:
How to draw a 2D cross-section of a 3D object? I am creating a game where I only want the user to see the 2D intersection of a plane with a 3D object. The goal of the game is to move this plane to a certain position and rotation, which gives a certain 2D shape. Here is a link to a website which illustrates the 2D slices of a 3D object.
How do I approach this if I only want the player to see the slice.

Just to be clear, the solution does not necessarily have to be in 3D, since the ui for the player is going to be 2D anyway

sentences:
How to make texture for text displaying using SDL ttf with good performance? In my game, there are many units and for each units there's an information widget attached next to them. I use SDL as the game rendering engine.

I currently want to display their ID for debugging purposes.

However, for each unit, I create a texture with their ID, I render it, then I destroy it.

Needless to say that when there are about 40 units on my screen, the game gets pretty laggy (if its any indication, my game currenly weights 25 MB)

How can I get over this?

sentences:
Unwanted continuous rotation with Quaternion I am probably missing something simple but ... this is how I'm calculating the world matrix of my object:

glm::translate(glm::mat4(1.f), mPosition) * glm::mat4_cast(mOrientation) * glm::scale(glm::mat4(1.f), mScale);

where mOrientation is a glm::quat type and it is set to identity via:

mOrientation(glm::vec3(0.0f, 0.0f, 0.0f))

What's strange is that my object keeps rotating over the Y-axis (world space) and to prove that it isn't my loop, I changed my world matrix calculation to:

glm::translate(glm::mat4(1.f), mPosition) * glm::rotate(glm::mat4(), 45.0f, glm::vec3(0.0f, 1.0f, 0.0f)) * glm::scale(glm::mat4(1.f), mScale);

And my object is static and is indeed rotated 45 degrees on the Y-axis. The key difference is that with Quaternion, it KEEPS rotating. What am I missing?

sentences:
2D Drawing architecture I want to create something like a game but I am going to use Direct2D and GDI for drawing API.My problem is that I want to separate drawing code from objects. For example lets say I have conduit objects and pumps.Each one might have different color and vector shape. I mean problem here is that drawing a pipe wont be a texure but a series of commands like drawline , drawrectangle etc.The only way I can think of having a Renderer class that would have drawing logic for each one.But in case I want it to be extendable from another developer then in order to add a new object they should extend renderer.
My question is  since I am not going to use classic game things like sprites,textures etc how can drawing complex vector objects be abstracted? And how can I make it extendable ?

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:
Multiplayer game communication framework for mac/ios (Cross post from stackoverflow)

I am creating a multiplayer 2D game for Mac and iOS devices. I'll be using cocso2d for graphics/game engine, however I am largely blank on what to use for multiplayer communication. Please note that I cannot use central severs e.g. SmartFox, RedDwarf, etc since I want the players to "host" games for others and be able to play it on their LAN, VPN or my own servers.

Any pointers? I checked lidgren but it's for .NET only and hence not an option for me.

EDIT: just in case it wasn't clear, the messaging has to be real time hence it's probably going to be over UDP

sentences:
HTML5 mobile game storing data I am developing an mobile application (in HTML5) that will run on multiple platforms and will eventually have both single and multiplayer options. The current issue I have is the best method for storing many rows of data so that the user can access it either in single (no internet) or multiplayer.

I have a relational database for the multiplayer users to access the data, however I'm concerned about performance (keep trying to access to the server). I was wondering if there is any reasonable method (apart from localstorage and websql - as I understand, localstorage can't hold a lot of data and websql is only available on certain platforms) to store a lot of data locally on a mobile device so that any non-internet users can still access their data and do so quickly?

sentences:
Linux: blit image on screen without stuttering at a stable frame rate I'm working on a very simple game, and one of the project goals is to minimise the use of libraries.

I'm drawing every frame into a buffer, which is then displayed using XPutImage (see the code of the main loop). This simple code is used to limit FPS:

// Limit FPS
{
  u64 current_timestamp = LinuxGetWallClock();
  u64 ns_elapsed = LinuxGetWallClock() - last_timestamp;

  if (ns_elapsed < target_nspf) {
    struct timespec ts;
    ts.tv_sec = 0;
    ts.tv_nsec = target_nspf - ns_elapsed;  // time to sleep
    clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);

    while (ns_elapsed < target_nspf) {
      ns_elapsed = LinuxGetWallClock() - last_timestamp;
    }
  } else {
    // printf("Frame missed\n");
  }

  last_timestamp = LinuxGetWallClock();
}

Everything works fine and as expected, but every now and then the image stutters, as if the X server has buffered up a few frames' worth of images and then flushed them all in a single go. This happens irrespective of frame misses.

Note: I'm not talking about image tearing here.

I realise that the code above is not supposed to provide a stable frame rate, and occasionally one frame might be displayed for too long, and another frame might get lost and never displayed, but I don't see how that thing alone can cause the terrible occasional stuttering.

My only guess would be that clock_nanosleep may sleep for longer than I asked for.

Questions:

Is my guess above correct?
If not, what might be the reason?
Are there any ways to address this problem without having to use OpenGL to wait on vblank?

Thanks.

sentences:
Collision detection of convex shapes on voxel terrain I have some standard convex shapes (cubes, capsules) on a voxel terrain.  It is very easy to detect single vertex collisions.  However, it becomes computationally expensive when many vertices are involved.

To clarify, currently my algorithm represents a cube as multiple vertices covering every face of the cube, not just the corners.  This is because the cubes can be much bigger than the voxels, so multiple sample points (vertices) are required (the distance between sample points must be at least the width of a voxel).  This very rapidly becomes intractable.

It would be great if there were some standard algorithm(s) for collision detection between convex shapes and arbitrary voxel based terrain (like there is with OBB's and seperating axis theorem etc).

Any help much appreciated.

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:
What is the most efficient container to store dynamic game objects in? I am making a first person shooter and I know about about a lot of different container types but I would like to find the container that is the most efficient for storing dynamic objects that will be added and deleted from the game quite frequently. EX-Bullets.

I think in that case it would be a list so that the memory is not contiguous and there is never any re sizing that is going on.  But then I am also contemplating using a map or set.  If anyone has any helpful information I would appreciate it.

I am writing this in c++ by the way.

Also I came up with a solution that I think will work.

To start off I am going to allocate a vector of a big size.. say 1000 objects.  I am going to keep track of the last added index in this vector so that I know where the end of the objects are.  Then I will also create a queue that will hold the indices of all objects that are "deleted" from the vector. (No actual deleting will be done, I will just know that that slot it free). So if the queue is empty I will add to the last added index in the vector + 1, else I add to the index of the vector that was at the front of the queue.

sentences:
Automatically create C# from manually created game objects I have created 2 gameobjects along with its properties in the Unity Inspector.
I have attached a screenshot below.

For prototyping, I like the Inspector very much, but for runtime I prefer doing everything by scripts. This way nothing can go wrong: I don't have to carry so many files around, and I find it easier to understand everything.

I would now like to change this so that these 2 components are created at runtime by script.

Is there perhaps a way to automatically create the script that would create these game objects?

I would appreciate it very much if I could save some time with such an automatic script creation.

Thank you for any input.

sentences:
How are the packet boundaries in the Source engine DEM format determined? I'm trying to write a program that reads Source DEM files, and about all I can at this point is the header which is a magic string, few ints and floats and 280-long strings.

The last field in the header is an int which specifies the length of the "sign on" data in bytes, but after reading that much forward into the file then attempting to read a new int for another packet of data, I get garbage values (0's or negative values) after 2-3 packets (I expect a few thousand).

Basically I'm interpreting the documentation as so:

Header Data (less sign-on length)
Sign-on length (int, "Length of the signon data (Init for first frame)")
Sign-on packet (of above specified length)
Next packet length (int)
Next packet data (length above)
...repeat to EOF.

If I consume another 4-bytes between the "sign-on length" and packet itself (it's a bit unclear if the last field in the header is actually part of the header or just the start of the first packet), I also get garbage.

All this is before even trying to parse the contents of the packet data, I'm currently just trying to jump through the recording and chop it up in to the frame packets.

sentences:
How to draw only visible tiles? I have a big map with isometric tiles(3d camera), how can i draw only visible tiles ?

Whats the best way to do that ? space partitionning (octrees etc...)?

sentences:
Joint constraints in PhysX I'm trying to use PhysX for my physics engine.  I'd like to use spherical joints, but I'm having trouble with the constraints.  All of the examples that I've found refer to SDK v2.8.  I'd like to stick with v3.0.  Even the PhysX support center uses deprecated APIs.  There's a tutorial at the support center (Ch 4 - Grass) that I'm trying to imitate.  Converting that code to the current API has been problematic.  NxSphericalJointDesc is deprecated.  How do you specify equivalent constraints to those found in the tutorial?

There's another post that talks about a similar problem.

sentences:
Player ranking using Elo with more than two players I would like to use Elo to track player rankings between matches of a certain game, however the game can be played with up to four players in a match. I have seen games like Carcassonne use Elo with more than two players playing, but I am not familiar with Elo beyond a 1-1 matchup.
From the wikipedia article the two-player equations I would like to extend are:

Ea = 1/(1 + 10(Rb - Ra) / 400)
Eb = 1/(1 + 10(Ra - Rb) / 400)
Rxnew = Rxold + 32 * (W – Ex), where W=1 if X wins and W=0 if X loses.

How would the computation for Ex and W change given more than two players?

sentences:
Path tables or real time searching for AI? What is the more common practice in commercial games; path lookup tables or real time searches?

I've read that in many games path lookup tables are pre-calculated and baked into each map, so to speak, then steering behaviour is used to handle dynamic obstacles.

or is it better practice to use optimised hierarchical A* searches? I understand the pro's and cons of each, I'm just curious as to what is most often used in the industry.

sentences:
Can sampling an input texture in shader return values updated in same pass? In my hlsl, (I am using Direct2D helpers which I guess just call tex2D), can D2DSampleInputAtOffset() return a pixel value that was only updated in that same pass of the shader? Or will it always return the value the sample had before the shader has processed any pixel? e.g.:

#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_COMPLEX
#include "d2d1effecthelpers.hlsli"

D2D_PS_ENTRY(main)
{
    float4 color = D2DGetInput(0);

    float4 above = D2DSampleInputAtOffset(0, float2(0, -1));
    // will above be the value in the sample before drawing with this shader?
}

Further is there a specific sequence in which pixels are processed by my shader, e.g. left to right, top to bottom?

sentences:
Button onClick in a menu prefab doesn't work I don't seem to be able to make a reference to a Button inside a menu prefab.
My menu prefab consists of a panel and the panel has 4 buttons.
I added
public GameObject prefabMenu;

in my code and drag and dropped the prefab in the Unity Editor to it.
When my scene is starting (Start() method) I instantiate this prefab into a GameObject like this:
panelMenu = Instantiate(prefabMenu, canvas.transform);

after that I try to refer one of the buttons with this line and set an onClick listener:
btnResume = panelMenu.transform.Find("BtnResume").GetComponent<Button>();
btnResume.onClick.AddListener(() => Log.I("Working"));

The log method however doesn't not get called when I click on the button (I checked and the btnResume is not null).
I appreciate any help on this. Thank you.

sentences:
3D Distortion Effect I'm trying to make a distortion effect similar to this:

However I'm not making a 2d screen space effect.  I'm applying it to a 3d scene and I want it to be placed IN the world, so it can be blocked by other 3D objects.  I know the general method for doing this is as a post-process effect applied to a 3D sphere, however I can't find any code/equations that work for that case.  All the ones I've found assume you're given a 2d point and a radius.

The 2d point is easy to calculate from a 3d point but getting the radius of a 3d sphere projected into 2d space... seems extremely complicated.  How can I achieve this kind of outwards-push effect in a 3d space?

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:
NavMeshAgent fails to find paths in certain areas in NavMesh I've been using Unity for about 2 days, and I have a scene with a navmesh. I can click on the NavMesh and get the NavMeshAgents to move to that position most of the time. However, there is a region of the NavMesh where it fails to generate a path to. I technically have two NavMeshes, because I have two different sized NavMeshAgents, but both fail in the same region. Since I'm very new to Unity, I don't know how to diagnose this, much less fix it. How should I go about learning more about this problem?
I can path through the affected area, as long as the destination point is on the other side of it. Also, when I put a cube in the middle of the affected area and rebake the NavMesh, the problem area moves to a new location, so it must have something to do with the geometry.

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 Would You Animate a 3d Characters Face (With Textures) So I'd like to do a low poly style of modeling, and one of the corners I'd like to cut is on head geometry. Specifically, making the details of the face a texture (like a Mii or a character in Animal Crossing for example).

How would you go about accomplishing animating the face? Getting it onto the model in the first place?

I'm using Unreal Engine to learn and working on my 3d modeling skills at the same time, so knowing a general workflow would give me some structure to work with.

sentences:
synchronise two coordinate planes So i have two coordinate planes. One is player and mouse click position relative to player. Other is the world map.

I need to find the point on the world map, where the mouse clicks.

The map is generated from a 64*64 heightmap, so for now i want to find the mouse click inside the 64*64 bounds.

Im having trouble determining the coordinates at the world map, where the mouse clicked.

The map has a multiplier of 10. Im not really sure how it is applied, but when it is 10, the world map is in bounds -10,-10 to 10, 10. When it is 20, it is in -20,-20 to 20, 20, when 50 then in -50,-50 to 50,50. Those are click coordinates in relation to player.

To get the world vertex i need to supply a coordinate (0-63, 0-63).

How do i transform the mouse click coordinates so that they are aproppriate to the world map?

sentences:
Box2d too much for Circle/Circle collision detection? I'm using cocos2d to program a game and am using box2d for collision detection. Everything in my game is a circle and for some reason I'm having a problem with some times things are not being detected as a collision when they should be.

I'm thinking of rolling up my own collision detection since I don't think it would be too hard.

Questions are:

Would this approach work for collision detection between circles?
      a. get radius of circle A and circle B.
      b. get distance of the center of circle A and circle B
      c. if the distance is greater than or equal to the sum of circle A radius and circle B radius then we have a hit
Should box2d be used for such simple collision detection? There are no physics in this game.

sentences:
Calculate the extreme points of a quadrilateral Given four points (a,b,c and d) how do I find the extreme points (b,d) from the perspective of the player (p).

I was trying to do it by finding the angle to the centre of the quadrilateral then checking for the furthest point either side but that obviously wouldn't work when the player is parallel to a point.

Any nudges in the right direction would be welcome.

sentences:
FPS Camera Look Direction I'm using XNA to create an FPS camera that uses a Direction vector instead of a Target vector control the camera's orientation.

I'm having trouble with the math for looking up and down when the camera is rotated about the Y axis. No problems looking left and right.

Here's my code:

Vector3 LookDirection {get;set;}

public void LookLeft(float scale)
{
    LookDirection = Vector3.Transform(LookDirection, Matrix.CreateRotationY(MathHelper.ToRadians(scale)));
}

public void LookRight(float scale)
{
    LookDirection = Vector3.Transform(LookDirection, Matrix.CreateRotationY(MathHelper.ToRadians(-scale)));
}

public void LookUp(float scale)
{
    //doesn't work when camera is rotated into the X axis
    LookDirection = Vector3.Transform(LookDirection, Matrix.CreateRotationZ(MathHelper.ToRadians(scale)));
}

public void LookDown(float scale)
{
    //doesn't work when camera is rotated into the X axis
    LookDirection = Vector3.Transform(LookDirection, Matrix.CreateRotationZ(MathHelper.ToRadians(-scale)));
}

I know I need to manipulate both the X and Z components when looking up and down, I just can't figure out exactly what to do. Thanks

sentences: Unity Google VR reticle pointer weird behaviour I'm using Unity 2017.3.1f1 and Google VR SDK 1.150.0. I added GvrEditorEmulator and GvrEventSystem to the hierarchy, created an empty object and put main camera inside. I also added GvrRecticlePointer as a child of the camera. Then I added a spinning cube and added EventTrigger script onto it. When I point reticle at the cube in the game mode the reticle pointer start shaking. I'm wondering why is that?

sentences: Where do components get added in Unity? In unity's GameObject class, there are a few default data members. When we add a component to the game object, light for example, where exactly does it get added? Does it become a part of the GameObject class?

sentences:
How to decrease the size of a distance? I made a code for the character to be teleported to the place where the mouse cursor is, if the distance is less than or equal to 350.

Blueprint:

I happen to wish that if the distance were greater, the character teleported to the equivalent point of the line (distance between character and mouse cursor) of 350.

What I would like to know how to do:

I've thought about using the Line Trace by Channel, but I can not think of how to decrease the value of a distance and find the equivalent point in a line (vector value).

EDIT 1 (attempt based in Ocelot comment)

Blueprint:

Result in game:

Now the character teleports to a point that seems to have reference to the center of the level. I tried to add this vector to the character's position, but I did not get the desired result.

PS - The print of the word "Hello" on the screen indicates how many times I clicked on the teleportation key in the last 2 seconds.

sentences:
How do I read input from multiple keyboards/mice on one computer? I want to be able to read inputs from multiple keyboards and still differentiate them. It's for split-screen. I know it's possible, because Serious Sam 3 allows it.

Edit : Well a whole lot of my description has been removed, anyway, one of the maine details was that it had to be cross-platform! However, I found just today a POSSIBLE solution, which is using libusb 1.0 (it's Windows-compatible since 1.0), I'm using 1.0.15 (which is actually libusbx, they've created a branch and have come back to the main branch for 1.0.16 =/ )! So my actual answer now is (because I have no PS/2 port :S), is libusb recognizing PS/2 devices (I know nothing about PS/2 standard, so I don't know, but I have some reasons to think it can be recognized). Does anyone know it? If noone knows, I wrote a program that enumerates USB devices and displays their Product and Manufacturer name, is anybody willing to test it? (you can run it in Avast! Sandbox if you prefer, it still works ^^)

Thanks in advance, and thanks for all the responses yet!

Oh by the way, using RawInput is out of question because of its Windows exclusive API, I thought about it once, but I want my game to be Windows/Linux/Mac compatible ;)

Edit2 : As marked in the tags, I'm coding in C++ (was also part of the original post)! I really don't understand what happened, since the original post title even changed =/ That was not my original question, the question was about the PS/2 / USB thing!

sentences:
Superclassing RPG Game Entities I am in the design process of an RPG game and I have no experience at all in game dev.
This question is about how I should approach entity management using OOP classes.

My train of thought is as followed:

Have Entity interface with basic update() function
"Mortal" class and "NPC" class implement Entity
"Hero" and "Monster" class inherit from "Mortal" class

In this case, Mortal class are all those entities that have statuses such as HP and MP.
NPC are self explanatory.

I am sure my approach is naive so I would like to know the pros and cons and what would be a better way to approach this.

sentences:
How can i remove the margins in Window_Base? So i am remaking Window_Status for my game where i have the character battler displayed in the background. bellow is the portion of the script which adds the battler image taken from def refresh (the first part, i omitted the at-the-time experimental code for Status Icons and Stats)

bitmap = RPG::Cache.battler(@actor.battler_name+"_menu", @actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw,ch)
self.contents.blt(0,0, bitmap, src_rect, 75)
draw_actor_name(@actor, 0, 0)
draw_actor_level(@actor, 80,0)
draw_actor_class(@actor, 0, 32)

and this is the result

now the battler image used is about 5x larger than the regular one (because stretching it using code made it look pixely, this way it's a bit more smoother) and also i've chopped off the left side because some of the battlers i use don't have their head perfectly centered (this way they can all can get set at 0,0)

however as you can see the bottom, which isn't cropped in the original image, is still being chopped off at the bottom. also despite the bitmap being at 0,0 it's not flesh against the sides.

i'd like to know how i can remove these margins? ideally at the Window_Base level since i can see myself running into the same problem with Window_Command

NOTE: this is in RPG Maker XP so i'm using RGSS

sentences:
How can I track how "well-lit" a player is so that I can determine if my AI can see him or her? I want to see how well-lit the player character is in an environment so that my AI can react (or not) to the player when he or she is visible.

Currently I am doing this by reading back the color data of the final render target and computing the brightness of the player's region. It seems expensive and taxing, so I was wondering if there is a better way to approach this?

sentences:
Wrong contineous rotation to car In my 2d game, I want to rotate car face based on collision detected. But at present after 3 to 4 collision its doing continuous rotation only rather than moving straight after collision.

Here is my straight movement related code:

myRigidbody.MovePosition (transform.position + transform.up * Time.deltaTime * GameManager.Instance.VehicleFreeMovingSpeed);

For better collision purpose, I have used Rigidbody position change approach.

Here is my collision time code:

public void OnCollisionEnter2D (Collision2D other)
{
 if (other.gameObject.CompareTag (GameConstants.TAG_BOUNDARY)) {
     ContactPoint2D contact;
     contact = other.contacts [0];
     Vector3 reflectedVelocity = Vector3.Reflect (transform.up, contact.normal);
     direction = reflectedVelocity;
 }
}

if (direction != Vector3.zero && pathGenerator.positionList.Count <= 0) {
        float angle = Mathf.Atan2 (direction.y, direction.x) * Mathf.Rad2Deg;
        Quaternion targetRot = Quaternion.AngleAxis (angle - 90f, Vector3.forward);
        transform.rotation = Quaternion.Slerp (transform.rotation, targetRot, 0.1f);

        if (Quaternion.Angle (transform.rotation, targetRot) < 5f) {
            transform.rotation = targetRot;
            direction = Vector3.zero;
        }

    }

Rotation get applied within other code so that car was changing its face correctly and that method not affecting here that I have checked by placing debug statement.

Share you side thought for this.

sentences:
Is there a way to organize colliders? I am using a tilemap to design levels for my game in Unity.
So, naturally, I need some circle/box colliders to interact with the objects in the game.

I know that if I use a prefab for every tile, I can also attach a collider, and never have to worry to add or modift colliders. But this seems too impractical, and also if I want to modify a block of colliders, I have to do this for every single tile.

I also tried using Tilemap Colldier 2D, but it generates colliders for the places I don't want colliders, such as grasses that stick out from the ground tiles.

My question is, is there any neat way to organize colliders so that I can identify them by looking at their names, IDs, etc.?

Currently, I am designing only one level and anxiety builds up on me as I take a look at the colliders in a single tilemap. How can I automate or organize the colliders for my tilemap?

sentences:
How to sync a LineRenderer in a multiplayer game? After a lot of searching online, I have come here as a last resort for my problem.

The question says it all. How to sync a LineRenderer?

One answer I found was to use a ClientRpc. I tried it with no effect.

Below is the snippet of my code,

    IEnumerator laserBeam()// This is called through another method on the click of a button
        {
            Beam = GetComponent<LineRenderer> ();
            Beam.SetVertexCount (2);
            Beam.material = BeamMaterial;
            Beam.SetWidth (0.07f, 0.07f);
            Beam.enabled = true;
            Beam.SetPosition (0, gameObject.transform.position);
            Beam.SetPosition (1, target.position);
            RpcDrawLines (gameObject, target.position, true);
            yield return new WaitForSeconds (1.0f);
            Beam.enabled = false;
            RpcDrawLines (gameObject, target.position, false);
        }

    [ClientRpc]
    public void RpcDrawLines(GameObject start, Vector3 end, bool isOn)
    {
        LineRenderer beam = start.GetComponent<LineRenderer> ();
        if (isOn) {
            beam.SetVertexCount (2);
            beam.material = BeamMaterial;
            beam.SetWidth (0.07f, 0.07f);
            beam.enabled = true;
            beam.SetPosition (0, start.transform.position);
            beam.SetPosition (1, end);
        }
        else
            {
                beam.enabled = false;
            }
        }

So, this is the code. Works fine on the Server but no effect in the client. I know I am doing something wrong in the client rpc. But I have no idea what it is. Any way of help would be appreciated. Thanks

Note: I am using UNET

sentences:
How do I convince my team to use less VO? I am a firm believer in using voice over (VO) only for necessary elements such as game narrative, and here and there to drive game play (e.g. instructions coming in over intercom, that sort of stuff). I think that game design should speak for itself, and generally, when lots of VO instructions are needed to drive game play, good design is lacking.

Unfortunately, my team doesn't really consider this, and feels that everything needs to be commented on by the main character's companion. As a result, I (sound designer) got a huge script in which I had virtually no say, with in my opinion lots of useless lines. Some examples:

  When there's only one tree in the scene with a very obvious squirrel in it.

  "Look at that squirrel in the tree!"

-

  In a room with one door.

  "I wonder what's behind that door."

-

  When facing a lot of bad guys.

  "Those are a lot of bad guys."

I feel we're dumbing down the player, and taking away lots of attention from the actual environment and player's initiative. However, whenever I mention this to the script writer or lead director (who is partially responsible for the script to), they're quite protective about it. I feel I have to ask line-by-line if this is really necessary, and this is not good for the atmosphere or productivity.

How can I convince my team that something more fundamental is wrong with the script?

Edit: Does someone have some good examples of games that use the above in a bad way, that I can use to demonstrate my point?

sentences:
OnCollisionEnter2D not working I am fairly new to Unity2D and am making a 2D platformer to get used to the engine. I am trying to create a platform that moves when the player jumps on it, however, on the script for the platform the OnCollisionEnter2D method is just not being called. This is the script:
public class ThrustPlatform : MonoBehaviour

[SerializeField] float thrustSpeed;
[SerializeField] float thrustDistance;

Animator thrustAnim;
Rigidbody2D rb;

private bool thrust = false;
private Vector2 startPos;
private Vector2 targetPos;

void Start()
{
    thrustAnim = GetComponent<Animator>();
    rb = GetComponent<Rigidbody2D>();

    startPos = transform.position;
    float targetX = startPos.x + thrustDistance;
    targetPos = new Vector2(targetX, startPos.y);
}

private void OnCollisionEnter2D(Collider2D coll)
{
    Debug.Log("COLLISION");
    thrust = true;
}

private void FixedUpdate()
{
    if(thrust)
    {
        rb.velocity = new Vector2(thrustSpeed, 0);
    }
}

The player and platform are on layers that can collide with each other in the collision matrix, the player still lands on the platform, and the player has a dynamic rigid body and the platform a kinematic rigid body. As far as I am aware kinematic rigid bodies detect collisions from dynamic rigid body, I have watched tutorials where this works. Even if I change the platform rigid body to dynamic there is no detection. I have also tried using continuous collision detection on both rigid bodies but still it is not calling. If I change it to a trigger and use OnTriggerEnter2D however, the Debug line appears.
This is the rigidbody for the platform.

This is the rigidbody details for the player.

I am very confused as to why this isn't working and I can't find a solution anywhere else (unless I am missing something very obvious).

sentences:
Regulating how much to draw based on how much was drawn last frame [Edit: I found an answer - see below]

I have a 3D game world on an iPhone (limited graphics speed), and I'm already regulating whether I draw each shape on the screen based on it's size and distance from the camera. Something like...

if (how_big_it_looks_from_the_camera > constant) then draw

What I want to do now is also take into account how many shapes are being drawn, so that in busier areas of the game world I can draw less than I otherwise would.

I tried to do this by dividing how_big_it_looks by the number of shapes that were drawn last frame (well, the square root of this but I'm simplifying - the problem is the same).

if (how_big_it_looks / shapes_drawn > constant2) then draw

But the check happens at the level of objects which represent many drawn shapes, and if an object containing many shapes is switched on, it increases shapes_drawn lots and switches itself back off the next frame. It flickers on and off.

I tried keeping a kind of weighted average of previous values, by each frame doing something like shapes_drawn_recently = 0.9 * shapes_drawn_recently + 0.1 * shapes_just_drawn, but of course it only slows the flickering down because of the nature of the feedback loop.

Is there a good way of solving this?

My project is in Objective-C, but a general algorithm or pseudo-code is good too.

Thanks.

Edit: Please, I'm not asking for general advice on rendering performance. I need an answer to the specific question of how to take the shapes drawn in previous frames into account without getting flickering.

sentences:
How do I detect collision with isometric walls? I will use game called "Project Zomboid" as an example. Here is a pic how does it look >

How should I handle player's collision with walls constructed like that? It's easy to handle walkable and not walkable tiles for player, but this is different and I have no ideas how to solve this problem. Any tips?

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:
Material usage, one per model or per object? Is it better (memory, time (of developer), space) to use single model that is unwrapped and uses a single material or to break a model down into appropriate bits, each with their own smaller texture/material?

Or does it depend on the target platform as to what is acceptable - ie PC vs tablet?

An example:
Say you have a typical house with a tiled roof.

Model it, make sure everything is attached, unwrap the walls/roof so in your UV template the walls and roof would be in one texture file, side-by-side in say a 512x512 file.
Model the roof/walls as separate objects, unwrap them individually and have two UV templates. You could then have a 256x256 file for each one.

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:
OpenGL blending (masking) I need some help with OpenGL textures masking. I have it working but need to find some other blending function parameters to work in other way.
Now I have:

//Background
...code...
    glBlendFunc(GL_ONE, GL_ZERO);
...code

//Mask
...code...
    glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_DST_COLOR, GL_ZERO);
...code...

//Foreground
...code
    glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA);
...code

Now it sets foreground's opacity to 0 (fills with background texture) where mask is transparent. I need it to react to mask's colors. I mean something like setting foregrounds opacity depending on mask's color. For example if mask is black (0.0,0.0,0.0) then the opacity of that place in foreground is 0 (is filled with background), and if mask is white (1.0,1.0,1.0) then the opacity of foreground is 1 (not filled with background). It can be in reverse consequence (white = opacity 0, black = opacity 1). I just need it to work depending on color.

1st column is my current result. Circle in mask is transparent.
 2nd column is example of result I am trying to get. Circle in mask
    is white.
 3rd column is example of why I want to get it working just like as I
    said (white mask color = foreground alpha 0, black mask color =
    foreground alpha 1 or reverse)

1st row is background
 2nd row is mask
 3rd row is foreground
 4th row is result

sentences:
How can a web game store points online without giving the user the possibility to do the same call but with more points? Imagine I have an HTML5 web game where the user can get points by doing certain activities. The game can be played offline, so there's not necessarily a live internet connection (note: this makes this question other than existing questions). Game state will then be synchronized at a later moment.

How can the frontend tell the server that the user has indeed gained those points without giving the user the ability to cheat? E.g. by doing a REST call with a multitude of his points? How can the server tell the difference between a real call and a fake call?

What I can think of is to send not the points, but e.g. all the moves of the game, and then the server recomputes the game and calculates the gained points? But that is quite hard, and the game must be deterministic in order to give the client and server the exact same result from the moves.

Does anybody know how existing games implement this? Or how it could theoretically be done?

sentences:
Unity2D: How to check for overlap using the job system Currently, I have implemented a job in unity for performance reasons. In that job, I am checking if a game object overlaps with the "detection circle". The job looks like this:

[BurstCompile]
public struct CreateGridJob : IJob
{
    public float diameter, radius;
    public NativeArray<int2> positionsArray;
    public NativeArray<bool> isWallArray;
    public float3 bottomLeft;
    public int sizeX, sizeY;
    public float3 right, up;
    public LayerMask layer;

    public void Execute()
    {
        int x = 0, y = 0;
        for (int i = 0; i < positionsArray.Length; i++)
        {
            float3 point = bottomLeft + right * (x * diameter + radius) + up * (y * diameter + radius);
            bool wall = true;
            Vector3 worldPoint = point;
            if (Physics2D.OverlapCircle(worldPoint, radius, layer))
                wall = false;
            positionsArray[i] = new int2(x, y);
            isWallArray[i] = wall;

            if (x % sizeX == 0)
                x++;

            y++;
            if (y >= sizeY)
                y = 0;
        }
    }
}

The problem course when I have to call if (Physics2D.OverlapCircle(worldPoint, radius, layer))as it can only be called in the main thread thus throwing an exception.

The result of this job will be a grid to be used in pathfinding.

Am I going in the right direction or is there a different way of doing this?

Edit-1: Unfortunately no, not all are convex (can be changed if there's no other way).

Here is an example of a concave asteroid:

There are many of these asteroids scattered across the scene. First, they are grouped in sectors, and each sector has its own asteroids. Sectors are independent of each other and are only connected through portals. For the simulation purposes, all (at least for now) sectors are active and generate their grid. But a single sector can have for example 200 asteroids. They are placed at random.

Edit-2: Flow!
A script generates sectors and their children.
In this script on Update, I call the CreateGridJobHandle. which gets the Job handles and then I execute them.

    private void Update()
    {
        if (Helper.IsStatusGraterOrEqual(GameStatus.FirstSectorGridSet))
        {
            NativeArray<JobHandle> jobHandleList = new NativeArray<JobHandle>(Sectors.Count, Allocator.TempJob);
            for (int i = 0; i < Sectors.Count; i++)
            {
                JobHandle handle = Sectors[i].SectorGrid.CreateGridJobHandle();
                jobHandleList[i] = handle;
            }
            JobHandle.CompleteAll(jobHandleList);
            jobHandleList.Dispose();

            for (int i = 0; i < Sectors.Count; i++)
            {
                Sectors[i].SectorGrid.SetGridFromData();
            }
        }
    }

    public JobHandle CreateGridJobHandle()
    {
        CreateGridJob job = new CreateGridJob();
        jobPositionsArray = new NativeArray<int2>(gridSizeX * gridSizeY, Allocator.TempJob);
        jobWallsArray = new NativeArray<bool>(gridSizeX * gridSizeY, Allocator.TempJob);

        job.positionsArray = jobPositionsArray;
        job.isWallArray = jobWallsArray;
        job.diameter = nodeDiameter;
        job.bottomLeft = transform.position - Vector3.right * GridWorldSize.x * 0.5f - Vector3.up * GridWorldSize.y * 0.5f;
        job.sizeX = gridSizeX;
        job.sizeY = gridSizeY;
        job.right = Vector3.right;
        job.up = Vector3.up;
        job.radius = NodeRadius;
        job.layer = WallMask;

        return job.Schedule();
    }

After this, I just set the grid into 2d array and apply the isWall values.

    public void SetGridFromData()
    {
        for (int i = 0; i < jobPositionsArray.Length; i++)
        {
            if (jobWallsArray[i])
            {
                grid[jobPositionsArray[i].x, jobPositionsArray[i].y].IsWall = jobWallsArray[i];
            }

        }
        jobWallsArray.Dispose();
        jobPositionsArray.Dispose();
    }
```

sentences:
Core code obfuscation and scripting I am currently developing a 2D multiplayer game in Java and I would like to use Lua to define clientsided visual animations. Although this sounds like a reasonable idea to keep the core Java code to a minimum, these scripts would be depending on the core code and would therefore break if the core code is obfuscated (think of naming of classes and fields, imports).

What options do I have? Is there a way around this? If I was the head of a million dollar game development company I could just leave the source wide open without any obfuscation whatsoever but unfortunately I am not. Anyone could just reverse engineer the compiled code, modify it, alter resources and claim it as their own. I am aware that obfuscation does not completely stop that, but it does require someone to put a whole lot more effort into it.

I am currently still in an experimental design phase so I do not have any code examples of what I'd like to protect.

sentences:
How to transfer an object from one state / form to another I want to do a similar cooking meal like in the game "Overcooked". Where do you cook a variety of dishes.

I can not grasp the idea of how it is implemented or where to start. You take an object (vegetable), interact with the necessary "changers" (cutting, cooking). At the end of the process - you replace the model and go further?

What do I need to know? What to use? What to google?

I will be glad to any help.

sentences: Does Overlap2d have frustum culling? Does Overlap2d have its own frustum culling or do I have to implement my own?

sentences:
vuforia how do I force objects into a 2D plane I'm working on a game in which cards are placed on a table and then rendered in augmented reality. These objects have 3D physics attached to them which doesn't work as well if they are either rotated or if the system mistakes them for being higher or lower then they really are.

Is there a good method to force Vuforia/Unity to place all items in the same 2D plane and keep all of them upright compared to that plane?

I currently have the following code:

using UnityEngine;
using System.Collections;

public class projectioncode : MonoBehaviour {
    Vector3 p1;
    Vector3 p2;
    Vector3 p3;
    Vector3 v1;
    Vector3 v2;
    Vector3 normal;

    /*
     *use a plane with the following 3 coordinates
     */
    public void setPlaneByPoints(Vector3 point1,Vector3 point2, Vector3 point3){
        p1 = point1;
        p2 = point2;
        p3 = point3;

        v1=p2-p1;
        v2=p3-p1;
        normal=getNormal(v1,v2);
    }

    public Transform projectTransform(Transform input){
        input.position = projectPoint (input.position);
        return input;
    }
    /*
     *  projects a 3d point into space;
     */
    Vector3 projectPoint(Vector3 point){
        Vector3 vOToPoint = point - p1;//vector between origin and point
        float dist = Vector3.Dot (vOToPoint, normal); //distance plane to point
        return point - dist * normal;
    }

    /*
     * caclulates the normal of 2 vectors
     */
    Vector3 getNormal(Vector3 v1,Vector3 v2){
        Vector3 res= (Vector3.Cross (v1, v2));
        res.Normalize();
        return res;
    }
}

This seems to project objects onto a plane but the results tend to be inaccurate and result in weird movements, particularly when moving the camera around.

This is what it looks like:

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: 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:
ScriptableObjects lose references/stored objects upon build/restarting the Unity Editor? I'm working on implementing room prefabs for my 2D procedural map generation algorithm.

Basically I made a tool which parses a scene's

monsters, items, etc into an ObjectContainer prefab,
and into a ScriptableObject containing the tilemap's TileDatas, EntryTiles, and the ObjectContainerPrefab.

It works well, but my problem occurs when I try to build the game, or just restart the editor.

The TileData array will be empty.

And thus for example the EntryTiles' TileData reference will be null.

Here 's how I use them:

[MenuItem("Custom Tools/Parse room prefab from scene")]
private static void ParseRoomPrefabFromScene()
{
    var tilemap = GameObject.Find("Tilemap").GetComponent<Tilemap>();
    RoomPrefab roomPrefab = ScriptableObject.CreateInstance<RoomPrefab>();
    ParseTilemap(roomPrefab, tilemap);
    ParseObjects(roomPrefab, tilemap);
    ParseEntryTiles(roomPrefab, tilemap);
    AssetDatabase.CreateAsset(roomPrefab, "xyz.asset");
    AssetDatabase.SaveAssets();
}

// How I setup my scriptable object, i.e. in ParseTilemap:
var tileDatas = new List<TileData>();
...
    var tileData = new TileData(coordinates, unityTile, isWall);
    tileDatas.Add(tileData);
...
roomPrefab.tileDatas = tileDatas.ToArray();

Here are the classes:

public class RoomPrefab : ScriptableObject
{
    public TileData[] tileDatas;
    public EntryTile[] entryTiles;
    public ObjectContainerPrefab ObjectContainerPrefab;
}

[Serializable]
public class TileData
{
    public TileBase UnityTile
    {
        get;
        private set;
    }

    public Vector2Int Coordinates
    {
        get;
        set;
    }

    public bool IsWall
    {
        get;
        private set;
    }

    public TileData(Vector2Int coordinates, TileBase unityTile, bool isWall)
    {
        Coordinates = coordinates;
        UnityTile = unityTile;
        IsWall = isWall;
    }
...

[Serializable]
public class EntryTile
{
    public TileData TileData
    {
        get;
        private set;
    }

    public Vector2Int LeaveDirection
    {
        get;
        private set;
    }

    public EntryTile(TileData tileData, Vector2Int leaveDirection)
    {
        TileData = tileData;
        LeaveDirection = leaveDirection;
    }
...

[Serializable]
public class ObjectContainerPrefab
{
    public Vector2Int Coordinates
    {
        get;
        private set;
    }

    public float Rotation
    {
        get;
        private set;
    }

    public GameObject Prefab
    {
        get;
        private set;
    }

    public ObjectContainerPrefab(Vector2Int coordinates, float rotation, GameObject prefab)
    {
        Coordinates = coordinates;
        Rotation = rotation;
        Prefab = prefab;
    }
}

UPDATE: here is a freshly parsed scriptable object. In the Editor everything is fine, while in its file its tileDatas array is already empty. Why?

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 0}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 11500000, guid: 30263215ad3a45a479bb2dd6409fb0a9, type: 3}
  m_Name: TestRoom
  m_EditorClassIdentifier:
  tileDatas: []
  entryTiles:
  - DebugCube: {fileID: 0}
  - DebugCube: {fileID: 0}

sentences: Irregular Shaped Colliders For Unity Is it possible to create an irregular-shaped collider?  If so, how?  Would I need to create a couple objects and group them up into one Game Object?

sentences: Problem using ccTouchesEnded/ccTouchesBegan to move sprite in cocos2d-x? I'm using ccTouchesBegan/ccTouchesEnded to move sprite from one point to another but I'm having problem, if i give two or more consecutive inputs one by one while sprite is moving(runAction is being performed). It first moves to last point i touched and then teleports itself to previous touched points one by one.

sentences:
Photon2 billboards take a long time to face the camera I'm using PUN2 and trying to use nametag billboards for my players, but they are not facing forward correctly and I have to wait more than 20 seconds to make the name tag of player return to facing forward.
here's my code for my BillBoard Script:
public class BillBoard : MonoBehaviour
{
    protected Transform ThisCameraPlayerBillBoard ;

    private void Start()
    {
        ThisCameraPlayerBillBoard = GameSetup.GS.ThisCameraToBillBoard.GetComponent<Camera>().transform;

    }

    private void FixedUpdate()
    {
        transform.LookAt(transform.position + ThisCameraPlayerBillBoard .rotation * Vector3.forward,
            ThisCameraPlayerBillBoard .rotation * Vector3.up);

    }
}

sentences:
What will happen if the argument of mix() or clamp() is above 1 or below 0? There's two magnificent intrisincs: mix() in GLSL and clamp() in HLSL, which are used to implement linear interpolation. Let's say we have a variable:

float v = ?; // where ? can be [-FLOAT_MAX, +FLOAT_MAX]

and then we do:

gl_FragColor = mix(value1, value2, v);

So, the question is: does it works the correct way under GL or DirectX? Should I EXPLICITLY normalize the value of v like this:

gl_FragColor = mix(value1, value2, clamp(v, 0.0, 1.0));

sentences:
Perspective Matrix doesn't work OpenGL 4 I tried to implement my own perspective matrix and it doesn't work. I don't understand why. With just with my view matrix (without Perspective Matrix) I can see my mesh.

Here my view matrix :

Vec3f position(0.0,0.0,-5.0);
Vec3f target(0.0,0.0,0.0);

Mat4f Camera::LookAt(Vec3f target, Vec3f position)
{
 //ce dont j'ai besoin pour calculer les parametre de ma camera...
 Vec3f up_world = Vec3f(0.0,1.0,0.0);
 Vec3f forward = (position - target).normalize();
 Vec3f right = up_world.cross(forward).normalize();
 Vec3f up = forward.cross(right).normalize();

 Mat3f R;
 R.setCol(2,forward);
 R.setCol(0,right);
 R.setCol(1,up);

 R.transpose();

 Mat4f R4(R);

 Vec3f mp = position * -1.0f;
 Mat4f P4;
 P4.setCol(3,mp);

 _LookAt = R4 *P4;
 return  _LookAt;
}

And my Perspective Matrix :

Mat4f Camera::perspective(float fovy, float aspect, float zNear, float zFar)
{

  float theta = fovy * 0.5f * (180.f / M_PI);
  float range = zFar - zNear;
  float invtan = 1.f/tanf(theta);

  Mat4f projMat(invtan / aspect,  0.0f,    0.0f,                       0.0f,
                           0.0f,  invtan,  0.0f,                       0.0f,
                           0.0f,  0.0f,    -(zFar + zNear) / range,  -2 * zNear * zFar / range,
                           0.0f,  0.0f,    -1.0f,                      0.0f);

    _perspectiveCam = projMat;
    std::cout << _perspectiveCam << std::endl;
    return _perspectiveCam;
}

  Mat4f perspective(float fovy = M_PI/2, float aspect = (1280.f/720.f)*1.f, float zNear = 0.1f, float zFar = 100.f);

My shader is very simple so it can't be the problem..

#version 410 core

layout(location = 0) in vec3 V_position;
layout(location = 1) in vec3 V_color;
layout(location = 2) in vec3 V_normal;

uniform mat4 view_matrix;
uniform mat4 proj_matrix;

out vec3 color;
void main()
{
    color = V_color;
    gl_Position = proj_matrix * view_matrix * vec4(V_position, 1.);
}

when I initialise _perspectiveCam with the unit matrix 4x4 it displays my triangle..
but when I implement _perspectiveCam like in the function it does not display my triangle

Here my Set col function :

template <typename TYPE>
void Mat4<TYPE>::setCol(int i, Vec4<TYPE>& vec4)
{
  for (size_t k = 0; k < 4; k++)
  {
    setElement(k,i, vec4.getElement(k));
  }

}

void setElement(int i,int j, TYPE var){element[i*4 + j] = var;}
TYPE getElement(int i, int j) const {return element[i*4 + j];}

sentences:
Detect when item has been dragged & dropped onto an inventory slot In my inventory system I want to be able to drag and drop items into inventory slots.
I managed to make it work, but only in a weird way:

When the player starts dragging, it picks up the item and it follows the mouse's position.

When they release the button outside the inventory, the item's position is restored to the slot from which it was picked up.
I use GameObject mouseReleasedObject = eventData.pointerCurrentRaycast.gameObject; to detect whether the drag was released over an inventory slot.

The problem is that when the player drops it on a possible inventory slot, the same "restore to previous slot" behaviour happens.
That's because the mouse is top of the dragged item and the slot as well but the item is rendered above everything else.

How can I make the dragging ignore the item itself, and detect the slot underneath?
Start dragging:
    public void OnBeginDrag(PointerEventData eventData)
    {
        GameObject draggedObject = eventData.rawPointerPress;
        if(draggedObject.GetComponent<RectTransform>() is null) return;

        if(draggedObject.tag == "InventoryItem")
        {
            Debug.Log("InventoryItem drag has started!");
            dragStartSlot = draggedObject.transform.parent.gameObject;
            draggedItem = draggedObject;
            draggedItem.transform.SetParent(canvas.transform);
            draggedItem.transform.SetAsLastSibling();

        }
    }

End dragging:
    public void OnEndDrag(PointerEventData eventData)
    {

        GameObject mouseReleasedObject = eventData.pointerCurrentRaycast.gameObject;
        if(draggedItem is null) return;
        Debug.Log("Released at: "+mouseReleasedObject.gameObject.name);
        if(mouseReleasedObject.transform.tag == "InventorySlot")
        {
            if(mouseReleasedObject.transform.childCount < 1)
            {
                //  the inventory slot is empty, we place here the item!
                draggedItem.transform.SetParent(mouseReleasedObject.transform);
                draggedItem.GetComponent<RectTransform>().localPosition = Vector3.zero;
            }
            else
            {
                //  the inventory slot is taken, we swap the items!
            }
        }
        else
        {
            //  the item is not released on a proper slot, we restore it's position!
            draggedItem.transform.SetParent(dragStartSlot.transform);
            draggedItem.GetComponent<RectTransform>().localPosition = Vector3.zero;
        }
    }

sentences:
Monogame - Problem with lighting 3d mesh I am having an issue with lighting my 3d icosphere. For some reason,the lighting appears to be coming from the correct direction  (+X, -Y, -Z) but it also appears to be coming from (-X,+Y,+Z) and I have no idea why. I am not very well versed in 3D in Monogame yet, can anyone point me in the right direction of what is going on here?

EDIT:

The code for the shader

VertexToPixel ColoredVS(float4 inPos : POSITION, float3 inNormal : NORMAL, float4 inColor : COLOR)
{
    VertexToPixel Output = (VertexToPixel)0;
    float4x4 preViewProjection = mul(View, Projection);
    float4x4 preWorldViewProjection = mul(World, preViewProjection);

    Output.Position = mul(inPos, preWorldViewProjection);
    Output.Color = inColor;

    float3 Normal = normalize(mul(normalize(inNormal), World));
    Output.LightingFactor = 1;
    if (xEnableLighting)
        Output.LightingFactor = dot(Normal, -xLightDirection);

    return Output;
}

PixelToFrame ColoredPS(VertexToPixel PSIn)
{
    PixelToFrame Output = (PixelToFrame)0;

    Output.Color = PSIn.Color;
    Output.Color.rgb *= saturate(PSIn.LightingFactor) + xAmbient;

    return Output;
}

And this is for calculating normals

            for (int i = 0; i < Vertices.Length; i++)
                Vertices[i].Normal = new Vector3(0, 0, 0);

            for (int i = 0; i < Indices.Length; i += 3)
            {
                Vector3 p1 = Vertices[Indices[i]].Position;
                Vector3 p2 = Vertices[Indices[i + 1]].Position;
                Vector3 p3 = Vertices[Indices[i + 2]].Position;

                Vector3 v1 = p2 - p1;
                Vector3 v2 = p3 - p1;
                Vector3 normal = Vector3.Cross(v1, v2);

                normal.Normalize();

                Vertices[Indices[i]].Normal += normal;
                Vertices[Indices[i + 1]].Normal += normal;
                Vertices[Indices[i + 2]].Normal += normal;
            }

            for (int i = 0; i < Vertices.Length; i++)
                Vertices[i].Normal.Normalize();

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:
Calculate smooth transition between local space angles I'm trying to calculate direction of moving character (to rotate it's animation).
I have something like this:

Character can have 4 cardinal directions. The rotation is calculated from the current cardinal direction.
So for example For north we have -90 degrees from N to W and 90 degrees from N to E.
From E to N we have -90 degrees and from E to S we have 90 degrees.

The problem occurs when character is switching directions.It happens at about half the distance between cardinal directions. At this point current rotation is switching from negative to positive number (or other way around), and there is noticeable hitch. When for example going from E to N, it switches to N direction but it was at about -45 degrees which in N space it places for a frame or two between N and W directions.

Why do I calculate angles in cardinal direction space ? Animations are prepared for strafing or moving backward (or any other angle) and I need to assume that the direction of animation is 0 degrees and calculate from here.

Is there way to smoothly change angle between cardinal directions ?

For now I tried to lerping between them when switching (which improved overall look but is far from smooth transition), tried to  track from which direction the switch is coming, but it didn't really improved anything.

FVector Right = Character->GetActorRightVector();
FVector Forward = Character->GetActorForwardVector();
FTransform Transform = Character->GetTransform();
FVector CurrentAcceleration = CMC->GetCurrentAcceleration();
FVector CurrentVelocity = CMC->Velocity;

FVector AccelerationDirection = CurrentAcceleration.GetSafeNormal2D();
FVector VelocityDirection = CurrentVelocity.GetSafeNormal2D();

FVector LocalAcceleration = Transform.InverseTransformVectorNoScale(AccelerationDirection);
FVector LocalVelocity = Transform.InverseTransformVectorNoScale(VelocityDirection);

float DeltaTime = Output.AnimInstanceProxy->GetDeltaSeconds();

float Atan2Angle = FMath::Atan2(LocalVelocity.Y, LocalVelocity.X);
const int32 ChildIndex = FMath::RoundToInt((Atan2Angle * 2 / PI) + 4) % 4;

float VelAngle = FMath::RadiansToDegrees(VelQuat.GetAngle());
float OldOrient = CurrentOrient;

EFCardinalDirection Dir = static_cast<EFCardinalDirection>(ChildIndex);
EFCardinalDirection OldDir = static_cast<EFCardinalDirection>(OldDirection);

float DirDot = 0;
//main switch wihin which I determine from where calculate angle.
switch (Dir)
{
case EFCardinalDirection::N:
{
    FQuat ForwardQuat = FQuat::FindBetween(Forward, CurrentVelocity);
    float OrientN = FRotator(ForwardQuat).Yaw;
    CurrentOrient = OrientN;// FMath::FInterpConstantTo(OldOrient, OrientN, DeltaTime, 300.0f);
    break;
}
case EFCardinalDirection::E:
{
    FQuat LeftQuat = FQuat::FindBetween(Right, CurrentVelocity);
    float OrientE = FRotator(LeftQuat).Yaw;
    CurrentOrient = OrientE;// FMath::FInterpConstantTo(OldOrient, OrientE, DeltaTime, 300.0f);
    break;
}
case EFCardinalDirection::S:
{
    FQuat BackQuat = FQuat::FindBetween(Forward*(-1), CurrentVelocity);
    float OrientS = FRotator(BackQuat).Yaw;
    CurrentOrient = OrientS;
    break;
}
case EFCardinalDirection::W:
{
    FQuat RightQuat = FQuat::FindBetween(Right*(-1), CurrentVelocity);
    float OrientW = FRotator(RightQuat).Yaw;
    CurrentOrient = OrientW;// FMath::FInterpConstantTo(OldOrient, OrientW, DeltaTime, 300.0f);
    break;
}
default:
    break;
}

sentences:
How are scripted camera usually managed? I noticed that many open games (think platformers, adventure, action...) have very complex cameras that appear to mix both automatic placement most of the time, and sort of pre-placed camera locations.

How are these usually implemented? Is it just some sort of zone trigger that then launches an interpolation between the last camera state and the scripted camera for the zone, or are there more special details?

sentences:
What strategies are best for managing Game Center and offline saves in the same app? I have an iOS app for which I want to use the Game Center API for saving games. At the same time, I want to have the option to save multiple games on the local file system, using the familiar save-slots mechanism. I anticipate that a user may not wish to use the Game Center, or may wish to support a guest user on their device.

I initiate authentication and loading asynchronously, as recommended by Apple, which in itself causes issues as the callbacks may arrive before or after the ViewControllers which are interested in them are loaded.

Typically, the app starts before the authentication is complete, which means the offline games are available first and the game center games become available at a later point. However, if the user is using the Game Center, it is likely that these later arriving games are the ones that would be interesting.

I am wondering how to handle these two sets of save-games. My first thought was to allow the user to explicitly switch between Game Center mode and local mode, but Apple explicitly says that you should not do this. I also want to avoid blocking waiting for the authentication to complete. I have to admit that, since I am still in development, I lack the ability to try out various strategies easily.

Are there any good patterns for managing both online and offline saves in an iOS app?

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: Unity ceiling light issues I'm trying to get back into Unity and I've been playing around with lighting. I modelled a simple lightbulb in Maya and have been trying to create a hanging ceiling light but I'm struggling to get it to work. No matter where I place the point light, it appears to originate from the ceiling and the bulb remains dark. Ideally, I would like the light to originate from inside the bulb and spread across most of the room, while also making the bulb glow. I'm sure this is a simple task but I would really appreciate any tips in the right direction. Thanks

sentences:
How do you change movement to strafe Right now my player can move forward and backward using

case 'a':case 'A':
    speed.x = lx * 0.1;
    speed.z = lz * 0.1;
    break;
case 'b':case 'B':
    speed.x = -(lx * 0.1);
    speed.z = -(lz * 0.1);
    break;

Ly is equal sin(vertAngle);

Lz is equal -cos(horAngle);

What should i do for sideways movement?

sentences:
How do I account for the velocity difference between a ship and it's fired projectile? In my project, I have a ship that moves and increases it's movement speed with respect to time and how long the acceleration button is being pushed(just like the way a real life car works), now as expected, the ship fires projectiles when I press the fire button.

The problem here, is that at a point in the game, the ship reaches it's highest speed/terminal velocity, and now it's faster than the projectile it fired which is not what I want, so, how do I create a realistic projectile movement based on the ship's velocity?
This is so that if the projectile is fired when the ship is moving slowly through the game scene, it doesn't move so fast that we can't see it travelling in the forward direction, and at the same time if it is fired when the ship is moving at top speeds, the ship is not seen to be faster than or as fast as the projectile's speed.

I want to keep the code as optimized as possible, so I am using this line for the projectile's movement:

public float velocity = 100f;
void Update() {
transform.position += transform.forward * Time.deltaTime * velocity;

}

sentences: Best format for model with double UV sets I'd like to use first UV set as wrapping (or when some faces cover another on UV) diffuse color map and second UV set as baked ambient occlusion (packed to islands) map. It is possibly to use FBX or Collada .dae or other (what?) in this case? I read scene by Assimp library.

sentences:
Unity, rb.MovePosition and transform.Rotate at the same time I can't figure out why my object can't move and turn at the same time.

    public float moveSpeed;
private Vector3 rotationSpeed;
public Camera cam;

public Vector3 straightForward;

public Quaternion spreadAngleRight;
public Quaternion spreadAngleLeft;

public Vector3 localRightVector;
public Vector3 localLeftVector;

public Vector3 newVectorRight;
public Vector3 newVectorLeft;

private Rigidbody rb;

Vector3 movement;
void Start () {
    rb = gameObject.GetComponent<Rigidbody> ();
    rotationSpeed = new Vector3(0, 100, 0);

    straightForward = transform.TransformDirection (Vector3.forward);

    spreadAngleRight = Quaternion.AngleAxis (45, new Vector3 (0, 1, 0));
    spreadAngleLeft = Quaternion.AngleAxis (315, new Vector3 (0, 1, 0));

    localRightVector = spreadAngleRight * straightForward;
    localLeftVector = spreadAngleLeft * straightForward;

    newVectorRight = transform.TransformDirection (localRightVector);
    newVectorLeft = transform.TransformDirection (localLeftVector);
}

// Update is called once per frame
void Update () {

    #region Control
    if(Input.GetKey(KeyCode.W)){
        rb.MovePosition(transform.position + transform.TransformDirection(Vector3.forward * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey (KeyCode.A)) {
        rb.MovePosition(transform.position + transform.TransformDirection(-Vector3.right * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey (KeyCode.S)) {
        rb.MovePosition(transform.position + transform.TransformDirection(-Vector3.forward * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey (KeyCode.D)) {
        rb.MovePosition(transform.position + transform.TransformDirection(Vector3.right * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.D)){
        rb.MovePosition(transform.position + transform.TransformDirection(newVectorRight * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.A)){
        rb.MovePosition(transform.position + transform.TransformDirection(newVectorLeft * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey(KeyCode.S) && Input.GetKey(KeyCode.D)){
        rb.MovePosition(transform.position - transform.TransformDirection(newVectorLeft * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey(KeyCode.S) && Input.GetKey(KeyCode.A)){
        rb.MovePosition(transform.position - transform.TransformDirection(newVectorRight * moveSpeed) * Time.deltaTime);
    }
    Vector3 mouseInputX = Input.GetAxis ("Mouse X") * rotationSpeed;
    Vector3 mouseInputY = Input.GetAxis ("Mouse Y") * rotationSpeed;

    gameObject.transform.Rotate (mouseInputX * Time.deltaTime, Space.Self);
    cam.transform.LookAt(gameObject.transform.position + Vector3.up * 2f);

    #endregion
}

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:
Realistic angular velocity for rolling sphere in Unity 5.1 I'm trying to make a small 2D game with a rolling ball/sphere using Unity 5.1, but if find the angular velocity of the ball weird.

On this first image (http://imgur.com/8wBoGms), you can see the sphere in 2D and in its initial position. On this second image (http://imgur.com/ArCRSZn), the sphere was moved by rolling until it made a 90° turn.

But the distance traveled by the sphere is greater than it should, if you wanted to be to be realistic :
you can see that the radius of the circle is equal to the size of the squares' sides, so the circle circumference should be equal to ~6.28 (in square side size). If the sphere was traveling realistically, it should travel ~1.57 (in square side size) to turn 90°.
But in the second image, we can see that it take 3 and not 1.57 .

The controller of the sphere is simply adding a force when a left or right button is pressed :

public class PlayerController : MonoBehaviour
{
    public float speed;
    private Rigidbody2D rg2d;

    void Start()
    {
        rg2d = GetComponent<Rigidbody2D>();
    }

    void FixedUpdate()
    {
        float moveHorizontal = Input.GetAxisRaw("Horizontal");

        Vector2 movement = new Vector2(moveHorizontal, 0.0f);
        rg2d.AddForce(movement * speed * Time.deltaTime);
    }
}

So my question is : how can I make the angular velocity realistic in this situation? Or am I doing something wrong?

Thanks for taking the time, I really appreciate !

sentences:
How can I use ParallaxBackground in AndEngine? I'm new to game development with  AndEngine. I want to add ParallaxBackground but I don't know how to change the background when the player moves. I'm using arrows for moving a player.

Now my question is where I write the code parallaxBackground.setParallaxValue(5);?

I have written this line in onAreaTouched method of arrow but it does not work.

Code

private Camera mCamera;
private static  int CAMERA_WIDTH = 800;
private static  int CAMERA_HEIGHT = 480;

private BitmapTextureAtlas bgTexture;
private ITextureRegion bgTextureRegion;

@Override
protected void onCreateResources() {

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
    bgTexture = new BitmapTextureAtlas(getTextureManager(),2160,480,TextureOptions.REPEATING_BILINEAR);
    bgTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(bgTexture, this, "background.png", 0, 0);
    bgTexture.load();
}
@Override
protected Scene onCreateScene() {

    this.getEngine().registerUpdateHandler(new FPSLogger());

    Scene scene = new Scene();
    scene.setBackground(new Background(Color.BLACK));

    final ParallaxBackground parallaxBackground = new ParallaxBackground(0, 0, 0);
    final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();

    parallaxBackground.attachParallaxEntity(new ParallaxEntity(0.0f, new Sprite(0, CAMERA_HEIGHT - this.bgTextureRegion.getHeight(), this.bgTextureRegion, vertexBufferObjectManager)));
    scene.setBackground(parallaxBackground);

Robot robot = new Robot();

    // add Player
    final AnimatedSprite animatedRobotSprite = new AnimatedSprite(robot.centerX, robot.centerY, 122, 126, (ITiledTextureRegion) robotTextureRegion, getVertexBufferObjectManager());
    scene.attachChild(animatedRobotSprite);
    animatedRobotSprite.animate(new long[]{1250,50,50});

    // add right arrow button
    Sprite rightArrowSprite = new Sprite(0, CAMERA_HEIGHT-70, rightArrowTextureRegion, getVertexBufferObjectManager()){

        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent,float pTouchAreaLocalX, float pTouchAreaLocalY) {

            switch (pSceneTouchEvent.getAction()) {

            case TouchEvent.ACTION_DOWN:
                moveRight = true;
                parallaxBackground.setParallaxValue(5);
                break;

            case TouchEvent.ACTION_MOVE:
                moveRight = true;
                break;

            case TouchEvent.ACTION_UP:
                moveRight = false;
                break;

            default:
                break;
            }
            return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
        }
    };
    scene.attachChild(rightArrowSprite);

    scene.registerTouchArea(rightArrowSprite);

    scene.setTouchAreaBindingOnActionDownEnabled(true);

    scene.setTouchAreaBindingOnActionMoveEnabled(true);

    scene.registerUpdateHandler(new IUpdateHandler() {

        @Override
        public void reset() {

        }

        @Override
        public void onUpdate(float pSecondsElapsed) {

            if ( moveRight ){
                animatedRobotSprite.setPosition(animatedRobotSprite.getX()+speedX, animatedRobotSprite.getY());

            }
        }
    });

    return scene;
}

sentences:
What happened with server code on deployment to Heroku I'm starting to learn about making games on the web and am using this agario clone on GitHub to help.

I've succeeded in setting up a version on Heroku using the instructions from here. I've never used Heroku before, so I'm a little lost on a few more things. The link from the instructions allowed the files to be directly transferred from GitHub. However, I can't seem to view them at all from Heroku - I can only run the client with 'Open app' (which works).

What exactly happened when I deployed the app? Did Heroku immediately start running the server code and will it continue to indefinitely do so even if no clients are connected?

sentences: UE4 opens C++ project the second time When I create new C++ Project (Base Code), UE4 opens only code editor (MS VSCode). Then when I close code editor and I open this project, UE4 opens its editor. Why?

sentences:
FPS drop when detecting collision (sfml, c++) So, I have this small class with a collision detection function in it, it's called every frame.

When I run the game I get around 8000 FPS, but when the collision function gets called it drops to 2000.

This is what the function looks like (only called 1 time per frame)
The second one is just for overriding.

bool DetectCollision(sf::RectangleShape other)
{
    if (entityRect.getGlobalBounds().intersects(other.getGlobalBounds()))
    {
        // Handle collision here
        return true;
    }
    else
    {
        return false;
    }
}

bool DetectCollision(sf::Sprite other)
{
    if (entityRect.getGlobalBounds().intersects(other.getGlobalBounds()))
    {
        // Handle collision here
        return true;
    }
    else
    {
        return false;
    }
}

Not sure why the FPS drops that much, is this way of detecting collisions heavy for the pc? I'm running a pretty high-end pc.

sentences:
Problem converting FBX file into XNB I create a Monogame Content Project to convert assets into XNB. For FBX file without texture there is no problem: the file is correctly converted and when I load XNB into my project everything is ok.
The problem occours when i have associated to fbx file a texture map: in this case both FBX and PNG files are converted to XNB but when i try to load these XNB files into my project the following problem occours:

"ContentLoadException: Could not load Models/maze1 asset as a non-content file!"
Note: maze1 is the XNB file that was converted from FBX.

How can I solve this problem?
Thank you in advance

sentences:
How do I set up a dedicated server for my multiplayer Unity game? I've made a multiplayer game with Unity and Mirror networking, and it all works perfectly when just running it on my own computer. However, I am trying to host on a dedicated server so that I can put the project on my portfolio and not have to worry about whether players can log in and test/play the game or not.
I tried a AWS Free server and I see that the Tanks example from Mirror is working just fine (although laggy), but my own project doesn't. I think this has something to do with the RAM limit of the free server but I'm not sure. I can see the task manager going up to 95% memory usage. When I remove some particle effects and geometry and enemies, it works.
I'm not sure if this is my code that is so cloggy or the server or both. In any case I would need a solution for this but I don't know what my options are.
Would be great if anyone can point me in the right direction. Thanks!

sentences:
How to draw a Bezier line with shaders? I found a shader code to draw a filled Quadratic Bezier in

https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch25.html

How can I use something similar to draw a Bezier line that follows the same path?

sentences: What are the advantages of tangent space normals over object space normals? What are the advantages of normals in tangent space to normals in object space for calculation of bump mapping?

sentences:
Is there a value in unifying animation lengths in turn based game? It might be a small detail, but I'm wondering if there is a significant impact on the game feel between scenario where for example all characters in a game have the same attack animation length and scenario where each character may have different attack animation length.

Has there ever been anyone exploring such topic?

sentences:
What do you need to know in C++ before starting to program with DirectX I was wondering what do you need to know in C++ before starting to program with DirectX?

I have only been programming in C++ (more for 2D games using SDL and learning the basics) for just over a year, I was wondering what kind of concepts and methods should someone be knowledgeable with or at least have seen before, before attempting to learn how to use Direct X?

sentences:
Issue with Monogame resizing I've converted my XNA project into a MonoGame one.

Whenever I start the application and resize the game manually (ie - dragging the window)...

this.Window.AllowUserResizing = true;

...the game scales in a weird manner.

Namely instead of scaling as it should do, it scales to the point where it looks fuzzy and the mouse clicks aren't working correctly.

The main game map has a hard coded "component size" which means that when the screen gets larger, its supposed to show more of the game - but instead I'm getting poorly scaled components.

Part of my code looks as follows:

const int TILEWIDTH = 50;
const int TILEHEIGHT = 50;
//......
Rectangle rec = new Rectangle(0, 0, TILEWIDTH, TILEHEIGHT);
spriteBatch.Draw(this.game.Content.Load<Texture2D>(tileGraphic.path), rec, Color.White);

So theoretically the pixels are becoming larger. This was working correctly in XNA.

I am in no way handling or overriding the resize command, it was 'just working'.

I found some threads with similar problems, but no solution. Anything I could do ?

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:
Show the tooltip when mouse over at the object unity3d i wanted to show the tooltip like this when the mouse over at the object, here is the example image:

and

i already tried this below code, but the message on the debug.log didn't showed up when i am hovering my mouse to the object, the object i give the name same like this:

void Update()
{

    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    RaycastHit hit;

    if (Physics.Raycast(ray,out hit) && hit.collider.gameObject.name == "Yify")
    {

        Debug.Log("Yify");

    }

}

And here is my object (i use List to multiple the objects and each object i gave the name), (The object's name "Yify" is on the right side, dark green color):

Please help. Thank you!

Update:

i already got the script that hold movement and attack logic like the image that shown below sir @Korchkidu:

sentences:
Why is my Tiled map distorted when rendered with LibGDX? I have a Tiled map that looks like this in the editor:

But when I load it using an AssetManager (full static source available on GitHub) it appears completely askew.

I believe the relevant portion of the code is below.
This is the entire method; the others are either empty or might as well be.

private OrthographicCamera camera;
private AssetManager assetManager;
private BitmapFont font;
private SpriteBatch batch;
private TiledMap map;
private TiledMapRenderer renderer;

@Override
public void create() {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    assetManager = new AssetManager();
    batch = new SpriteBatch();
    font = new BitmapFont();

    camera.setToOrtho(false, (w / h) * 10, 10);
    camera.update();

    assetManager.setLoader(TiledMap.class,
            new TmxMapLoader(
                    new InternalFileHandleResolver()));
    assetManager.load(AssetInfo.ICE_CAVE.assetPath, TiledMap.class);
    assetManager.finishLoading();

    map = assetManager.get(AssetInfo.ICE_CAVE.assetPath);

    renderer = new IsometricTiledMapRenderer(map, 1f/64f);
}

sentences:
Rotate Rigidbody2d slowly for 360 degrees I would like to perform a 360 degree rotation on a GameObject with rigidbody2d component. You should be able to see the rotation, so I thought of rotating the object 8 times with 45 degrees each around the z axis. So far, one might think that this should be an easy task. But, after several hours, I'm really stuck here.

I tried several code snippets (although not understanding them completely, I must admit):

void FixedUpdate()
{
    rigidbodyComponent.MoveRotation(45.0f);
}

==> Rotates the object one time for the desired angle.

void FixedUpdate()
{
   rigidbodyComponent.MoveRotation(45.0f);
}

==> Nothing happens.

Could you please give my a hint in what direction (meaning: classes / methods) I should proceed?

Thanks.

sentences:
in box2d how to decrease joint's reaction force? I'm trying to make a game like cut the rope and meet some problems.
when I create a float bubble and connect with a rope(a sets of bodies connected with revoluteJoint), the rope will become longer and when I destroy the bubble,rope gives a a big reaction force to candy, so how to decrease this reaction force?
to simulate bubble's floating, I did this

class Bubble extends PhyObject
{
     override function draw():void{
         if(this.combined){
            this.getBody().SetLinearVelocity(velocity);//velocity=new b2Vec2(0,-3.5);
         }
     }
     //other code
}
class Main{
    public function loop(){
        getAllPhyObject().forEach(function(phyObj){
              phyobj.draw();
        });
    }

}

so if bubble was combined with candy ,It "float".
I think maybe I can do this
pseudo code:

if(bubble is connected with rope)
{
    //dynamic adjust bubble's linear velocity with rope's reaction force
}

but I just cannot figure out how to dynamic adjust bubble's linear velocity.and is there a simpler way to solve this problem?
thanks!
update
finally I solved my problem,so I write it down and hope it help to you.
below code is grab from b2BuoyancyController and it works in my case.

    //buoyancy
    private function float():void {
        if (bodies.length < 1)
            return;
        var body:b2Body = bodies[0];
        if(body.IsAwake() == false){
            //Buoyancy force is just a function of position,
            //so unlike most forces, it is safe to ignore sleeping bodes
            return;
        }
        var normal:b2Vec2 = new b2Vec2(0, -1);
        var offset:Number = 20;
        var density:Number = 2;
        var velocity:b2Vec2 = new b2Vec2(0, 0);
        var linearDrag:Number = 2;
        var angularDrag:Number = 1;
        var gravity:b2Vec2 = toolkit.world.GetGravity().Copy();
        var areac:b2Vec2 = new b2Vec2();
        var massc:b2Vec2 = new b2Vec2();
        var area:Number = 0.0;
        var mass:Number = 0.0;
        for(var fixture:b2Fixture=body.GetFixtureList();fixture;fixture=fixture.GetNext()){
            var sc:b2Vec2 = new b2Vec2();
            var sarea:Number = fixture.GetShape().ComputeSubmergedArea(normal, offset, body.GetTransform(), sc);
            area += sarea;
            areac.x += sarea * sc.x;
            areac.y += sarea * sc.y;
            var shapeDensity:Number = 1;
            mass += sarea*shapeDensity;
            massc.x += sarea * sc.x * shapeDensity;
            massc.y += sarea * sc.y * shapeDensity;
        }
        areac.x/=area;
        areac.y/=area;
        massc.x/=mass;
        massc.y/=mass;
        if(area<Number.MIN_VALUE)
            return;
        //Buoyancy
        var buoyancyForce:b2Vec2 = gravity.GetNegative();
        buoyancyForce.Multiply(density*area)
        body.ApplyForce(buoyancyForce,massc);
        //Linear drag
        var dragForce:b2Vec2 = body.GetLinearVelocityFromWorldPoint(areac);
        dragForce.Subtract(velocity);
        dragForce.Multiply(-linearDrag*area);
        body.ApplyForce(dragForce, areac);

        //tmpForce
        if(candy.bodies.length>0){ //TODO 你妹!!!!!
            var tmpForce:b2Vec2 = candy.bodies[0].GetLinearVelocity();
            body.SetLinearVelocity(tmpForce);
            //tmpForce.x = 0;
            //tmpForce.Subtract(velocity);
            //tmpForce.Multiply(-linearDrag*area);
            body.ApplyForce(tmpForce, areac);
        }
        //Angular drag
        //TODO: Something that makes more physical sense?
        body.ApplyTorque(-body.GetInertia()/body.GetMass()*area*body.GetAngularVelocity()*angularDrag)
    }

tips:use force instated of impulse and changing linear velocity.

sentences:
Custom inventory items based on inheritance So, here's the scenario:
I'm building an RPG. Like most of the other RPGs on the market, my game will feature an inventory and of course, inventory items. So far I've worked well with using a single class for all items, because I did not need anything else than character stat alteration on item usage (consumption). However, I'd like some items to have a more exotic effect. Think of something like when the user consumes a transformation potion, he automatically turns into a beast.

In order to achieve this I've thought about declaring a new class that inherits from BaseItem for each item. Each descendant would override some methods (like void OnConsume()), to change the base behavior.

This works fine, but when it comes to inventory management, I have some issues. The actual inventory will have to work with BaseItem components only (for obvious reasons, as it's an enumerable collection of objects of the same type); casting any descendant to the base class is possible, so no problems in adding items to the inventory. But how can I keep track of the descendant's type (class) for each item in the inventory? And how to perform the descendant's OnConsume from withint he inventory, for each item?

Let me know if you can think of a better solution than mine, or if you can think of a solution to my problem only.

Development is done in C#, inside Unity 3.5.

Thanks!

sentences:
In XNA, how do I dynamically load parts of a large 2D world map? I want to develop a huge world map; at least 8000×6000 pixels in size. I have broken it into a 10×10 grid of 800×600-pixel PNG images. To avoid loading everything into memory, the images should be loaded and unloaded depending on the player's position in the grid.

For example, here is the player at position (3,3):

As he moves to the right to (4,3), the three images at the far left are deallocated while the three images at the right are allocated:

There should probably be a threshold inside each cell of the grid triggering the loading and unloading. The loading should probably happen in a separate thread.

How do I design such a system?

sentences: Field of view settings for first person shooter Are there any industry standards for setting the field of view (FOV) for FPS games or is it solely based on trial and error? Are there any guidelines for choosing the correct value?

sentences:
How can I extend the FindObjectsByTag to filter multiple parents of the found objects? private List<GameObject> FindDoors(string[] parents)
    {
        GameObject[] doorsLeft = GameObject.FindGameObjectsWithTag(c_doorLeft);
        GameObject[] doorsRight = GameObject.FindGameObjectsWithTag(c_doorRight);

        List<GameObject> allDoors = doorsLeft.Union(doorsRight).ToList();

        List<GameObject> toRemove = new List<GameObject>();
        for (int i = 0; i < allDoors.Count; i++)
        {
            for (int x = 0; x < parents.Length; x++)
            {
                if (allDoors[i].transform.parent.name != parents[x])
                {
                    toRemove.Add(allDoors[i]);
                }
            }
        }
        foreach (var it in toRemove)
        {
            allDoors.Remove(it);
        }

        foreach (GameObject door in allDoors)
        {
            Debug.Log("Door Parent : " + door.transform.parent);
        }

        return allDoors;
    }

Usage :

var allDoors = FindDoors(new string[]{ "Wall_Door_Long_01", "Wall_Door_Long_02" });

But in the function FindDoors the return allDoors is empty.
I think the problem is at this IF :

if (allDoors[i].transform.parent.name != parents[x])

Once it's Wall_Door_Long_01 so if it's Wall_Door_Long_01 it will not remove the item but next it's Wall_Door_Long_02 so now the it's true and will remove the even if the parent name is Wall_Door_Long_01 and same if it's Wall_Door_Long_02

And then in the end it will remove all the items.
But I want it to remove only doors that the parents of them is not Wall_Door_Long_01 and not Wall_Door_Long_02

sentences:
How to develop and optimize the illusion of meaningful character development between the player and NPCs? How to develop and optimize the illusion of meaningful character development between the player and NPCs?

It's very hard for a game developer to create unlimited dialogue options for just one NPC for the player to interact with, and develop some type of meaningful relationship with. Instead most developers create the illusion of choice in order to minimize the amount of dialogue an NPC has, yet maximize the player's illusion of meaningful development with that NPC.

I am pondering the idea of creating a Skyrim Mod that implements a clever way of reusing pre-spoken dialogue of all NPCs and to create the opportunity for the player to interact with the NPCs and create an illusion that the player makes meaningful dialogue choices to develop some type of relationship with NPCs later imposing consequences on the either player, the NPC, or both later in the game.

I am not asking of a way to create new dialogue, but rather how to cleverly reuse dialogue to achieve the same effect for different and new events. This is not just specific to Skyrim. The same ideas can still be useful for games under current development.

The illusion of choice is a very difficult concept to think about. A web series titled Extra Credits provides an excellent definition for this. For convenience I have copied very important terminology from Extra Credit that will help fortify answers to this game development question.

What is agency?

to have some control of an outcome

What is choice?

any moment during play that the player could perform 2 or more distinct actions but has to pick some number of actions less than the total number available to execute

What is consequence?

making you realize the impact of something you did

What is the difference between choice and consequence?

choice makes you think about what actions you will take, yet consequence makes you think about actions you have already taken

What is meaningful choice?

when the decision making process isn't arbitrary, when the player understands the choice their making and has some system to weigh their options, this does not by any means mean they have to fully understand what the consequences of each option will be only that they believe they have what the need to weigh the choices presented to them
meaningful choice is not a logical calculation with a definitive answer

What is illusion of choice?

any moment in a game where you as a player feel as though you're making a choice when in reality theres either no alternative option actually being presented or the consequences of that choice are negligible
players hate it when they notice the illusion of choice

sentences:
Calculating the correct roll from a bone transform matrix Read this forum topic for more info: http://blenderartists.org/forum/showthread.php?260602-transform-matrix-to-bone-%28head-tail-roll%29-bug

I'm trying to get my Blender3d modeller importer to create correct bones from my file's transform matrices.

The Blender Python API doesn't have a way to do this (anymore!), so people had to dig the Blender C source to find out how Blender does it and port that. Here's a Python port of the needed functions, not by me (I don't know C):

def vec_roll_to_mat3(vec, roll):
    target = mathutils.Vector((0,1,0))
    nor = vec.normalized()
    axis = target.cross(nor)
    if axis.dot(axis) > 0.0000000001: # this seems to be the problem for some bones, no idea how to fix
        axis.normalize()
        theta = target.angle(nor)
        bMatrix = mathutils.Matrix.Rotation(theta, 3, axis)
    else:
        updown = 1 if target.dot(nor) > 0 else -1
        bMatrix = mathutils.Matrix.Scale(updown, 3)
    rMatrix = mathutils.Matrix.Rotation(roll, 3, nor)
    mat = rMatrix * bMatrix
    return mat

def mat3_to_vec_roll(mat):
    vec = mat.col[1]
    vecmat = vec_roll_to_mat3(mat.col[1], 0)
    vecmatinv = vecmat.inverted()
    rollmat = vecmatinv * mat
    roll = math.atan2(rollmat[0][2], rollmat[2][2])
    return vec, roll

How to use them:

pos = mymatrix.to_translation()
axis, roll = mat3_to_vec_roll(mymatrix.to_3x3())

bone = armature.edit_bones.new('name')
bone.head = pos
bone.tail = pos + axis
bone.roll = roll

Sadly, it seems even the Blender C code is buggy and doesn't take into account cases when the bone is parallel to (0,1,0). So such bones can get assigned wrong (by 180 degrees) rolls and mess up animations.

Does anyone have better code for generating roll which takes into account such cases?

The old Blender 2.4 API generated correct ones. Its C code can be found here: http://svn.blender.org/svnroot/bf-blender/branches/blender-2.47/source/blender/blenkernel/intern/armature.c
I'm no C coder myself, again.

sentences:
OpenGL textures make very low fps I loaded some textures just one time before I go to my mainloop(glutMainLoop).
I am using SDL for the texture loading.
However, when I compile, my game is running at 6-10 fps.
When I don't load the textures(so the game is running without the textures), I have 30-50 fps.
Please help me, I don't know what can cause this low fps.

Texture loading using SDL and OpenGL:

#include "LoadTextures.h"
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
LoadTextures::LoadTextures(){}
GLuint LoadTextures::texture[10];

void LoadTextures::loadStuff(const char * imgPath, int amount){
        SDL_Surface * surface = IMG_Load(imgPath);

        glGenTextures(1, &texture[amount]);
        glBindTexture(GL_TEXTURE_2D, texture[amount]);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexImage2D(GL_TEXTURE_2D, 0, surface->format->BytesPerPixel, surface->w,surface->h, 0, GL_RGBA,GL_UNSIGNED_BYTE,surface->pixels);

        SDL_FreeSurface(surface);
}

It would be a mess to post my whole code, but this is where all my textures are loaded, in the beginning of my code(so just one time, no more).

Sorry for bad English, please help...

EDIT:

This is where I render the sky texture(that causes the lag).
Information: LT.texture is an array where all the (just one time) loaded textures are stored in so I can use them. I use double buffering.

void Drawing::drawSky(){
    ///THE SUN
    glPushMatrix();
    glBindTexture(GL_TEXTURE_2D, LT.texture[6]);
    glEnable(GL_TEXTURE_2D);

    glColor4f(1.0f, 1.0f, 1.0f,1.0f);

    glBegin(GL_QUADS);
        glTexCoord2f(0, 0); glVertex2f(-10.0f,-5.0f);
        glTexCoord2f(0, 1); glVertex2f(-10.0f,4.0f);
        glTexCoord2f(1, 1); glVertex2f(100.0f,4.0f);
        glTexCoord2f(1, 0); glVertex2f(100.0f,-5.0f);
    glEnd();

    glDisable(GL_TEXTURE_2D);
}

EDIT:
This is where I swapped buffers:

void Main::display(){
    ///BACKGROUND COLOR(AKA THE SKY)
    glClearColor(0.0f,0.0f,1.0f,1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    ///LOAD THE IDENTITY MATRIX TO RESET THE DRAWING LOCATIONS(AKA CLEARING THE SCREEN)
    glLoadIdentity();

    ///SO EVERYTHING HAS THE CORRECT SIZE
    glTranslatef(0.0f, 0.0f, -5.0f);

    //draw.drawSky();
    draw.drawSun();

    ///CAMERA MOVEMENT
    glTranslatef(cameraX, 0.0f, 0.0f);

    ///DRAWING AND RENDERING TEXTURES AND ANIMATIONS
    draw.drawTerrain();
    draw.drawGrass();
    draw.drawClouds();
    draw.drawPlayer();
    draw.walkAnimation();

    ///SO THE PLAYER CAN JUMP
    if(inputClass.flying){
        inputClass.returnFly(0.007f);
    }

    ///FPS COUNTING AND CALCULATING THE DELTA TIME
    float recentTime = (float)clock();
    deltaTime = recentTime - startTime;
    startTime =  recentTime;

    ///FPS SHOWING TO CONSOLE WINDOW
    //std::cout << "Delta: " << deltaTime << std::endl;
    std::cout <<  "FPS: " << (1 / deltaTime) * 1000 << std::endl;

    ///MOVEMENT OF THE CAMERA
    cameraX += cameraSpeed * deltaTime;

    ///SWAP THE BUFFERS FOR SMOOTH RENDERING
    glutSwapBuffers();
  }

sentences:
How to use 3D models in video games? (Copyright related) There are many gray areas in using 3D models online that may be free, creative commons with specific terms, or public domain. I notice many 3D models being sold by artists that are exact replicas of known vehicles (eg. BMW,Honda,etc.(with emblem)). I would think in this situation there will be some sort of infringement  especially if someone bought that model and used it in their video game, no matter if it was marked as royalty free. I would appreciate if someone with experience could assist in clarifying some of the following areas. Please note, this is the information I have inferred based of personal research, may not be factual, please correct me if I am wrong.

Commercial Use: Of course never sell someone's 3D model, but what part of that is considered theirs; if they made a model of an RC car, are the wheels legal to use, the chassis, engine especially if the creative textures(or meshes) are removed and all that is the mere form of the object. (Eg. if I 3D model a nail/screw; that is not considered copyright protected because it is a 'common'/'useful' object)

Free Usage: If your product is free, my assumption is that game devs could use a 3D model as long as they change textures, colors, etc. But form of the object is all for grabs.

Commercial Use & Free Use: If the product/game you are using is free, but you have advertisements bringing you revenue that may be on the side of a website or phone app and pop up every now and again; does this make it acceptable?

Thank you ahead of time!

sentences:
How to spawn objects and control the content in each spawn I'm using unreal engine and would like to spawn multiple actors and control the text in each spawned actor.

How can this be achieved in unreal engine?

sentences: How to mouse click an object in scene view to select it from editor I have several game objects with colliders in my game. I have enabled Always Show Colliders to keep all of them visible in my scene view. Because the objects are a lot, selecting them from the hierarchy window is a bit cumbersome and really slowing down my workflow. How can I select an object by left mouse clicking on it  in the scene view of an editor?

sentences:
Lighting doesn't work properly in WebGL build only at one place So I have a 2d game where a player walks around the level (top view) with a flashlight in front of him. Everything works fine in the editor, however whenever I build it for WebGL and test it in my browser, one room only one, has a problem with lighting, and as I walk in different parts of the room lighting changes in a weird way, and the floor is blinking in the first half of the room, as well as the flashlight is barely visible (if at all).

Here's how it looks in the editor and is supposed to look like:

And here's a few screenshots from the web build:

P.S. Everything works fine in a standalone build.

Also there seems to be no problem when I disable the 4 lights (the whole room works fine), these are the lights (the ones that look like from a window):

sentences:
Frame-rate drops when drawing 2D map tiles Update: I figured out it has nothing to do with the camera but instead framerate drops when drawing my map tiles onto the screen.

Here’s a link to a video showcasing the bug in action (For further reference): https://streamable.com/m4zuf3
Any and all guidance is appreciated, thanks.
Here's the draw functions:
    protected override void Draw(GameTime gameTime)
    {
        m_mainLevel.Draw(spriteBatch);
    }

        public void Draw(SpriteBatch sb)
        {
            //Draw Background
            for (var i = 0; i < BackgroundTiles.Length; i++)
            {
                int id = BackgroundTiles[i].m_id;

                int column = id % TilesetTilesWide;
                int row = (int)Math.Floor((double)id / (double)TilesetTilesWide);

                int width = Map.TileWidth * 2;
                int height = Map.TileWidth * 2;

                float x = (i % Map.Width) * width;
                float y = (float)Math.Floor(i / (double)Map.Width) * height;

                Rectangle tilesetRec = new Rectangle(TileWidth * column, TileHeight * row, TileWidth, TileHeight);
                Rectangle dest = new Rectangle((int)x, (int)y, width, height);
                sb.Draw(Tileset, dest, tilesetRec, Color.White);
            }
        }

Is the problem that I'm drawing too many tiles per frame? the map size is 250 x 250 tiles, with each tile being 16x16px.

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:
Java: Basic Movement AI not working I am working on a basic AI system to get an entity to follow a player. I created both the player and the ghost entity, but it seems as if the ghost only wants to increment both x and y, it never wants to do the opposite, or choose only x or y to use. Here is where I implemented the ghost and player in my constructor:

public MansionAzazel() {
    ...
    TileCoordinate ghostSpawn = new TileCoordinate(52, 50);
    TileCoordinate playerSpawn = new TileCoordinate(54, 52);
    player = new Player(playerSpawn.x(), playerSpawn.y(), key);
    player.init(level);
    ghost = new Ghost(ghostSpawn.x(), ghostSpawn.y(), player);
    ghost.init(level);
    ...
}

Here is the update() function for the ghost:

public void update() {
    int xa = 0, ya = 0;
    if (anim < 1000000)
        anim++;
    else
        anim = 0;

    if (player.getX() > xa)
        xa++;
    if (player.getX() < xa)
        xa--;
    if (player.getY() > ya)
        ya++;
    if (player.getY() < ya)
        ya--;

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

In which to sum it all up, the ghost entity will only and always move in one direction because the coordinates are 0 and I don't know why.

sentences:
What is the Unity 2019.3.5 version of `UnityEngine.UI.Text`? I was following a tutorial on how to create a dialogue Box in Unity, and in one part of the tutorial the tutor imports UnityEngine.UI and creates an object of type Text, but my version of Unity is 2019.3.5f1 and I learned through searching a bit online that this UnityEngine.UI doesn't exist anymore in this version, and that it was replaced with
UnityEngine.UIElements, and this Text type doesn't exist anymore as well.
I couldn't find a replacement for Text or what is the new nomenclature, nothing from trying stuff that popped in the auto complete or searching for answers in the Internet gave me answers. Maybe I just searched poorly, but if anyone happens to know, could you kindly answer?

sentences:
Matrix multiplication order for multiple model transformations I have a problem in terms of what frame of reference, I should construct, scaling (S), rotation (R) and translation (T) for a model matrix (in that order). Let us assume the use of glm (or glsl), i.e. to mean column major representation.

I believe, it should be a matrix multiplication of:

M = T * R * S // S * R * T is what we want to apply, but due to being column major, the order gets reversed, due to (AB)^T =B^T*A^T

Now, if I have a previous transformation already applied (say M_prev), and I want to apply a transformation M on top of that, then is the correct form:

M_new = M_prev * M // M_new and M_prev are both column major. I'm post multiplying due to being column major, but this is incorrect, I guess?

I believe this is incorrect (at least in some experiments I carried out, please correct me if I'm wrong), and it should be the reverse. What is the flaw in my calculation of M_new?

sentences:
Defining collision response in an Entity system I'm building a really simple top-down 2d shooter which uses an Entity Component pattern.

I've added several different entities to a level and given them different collision groups. I have an entity to represent a teleporter (assigned to collision group A), a player entity (group B), and a bunch of enemies (Group C).

I understand that the actual collision response should be decided in the collision System based on the groups that the colliding entities belong to. What I can't figure out is how to define the specifics of a collision.

For example, if a player collides with a teleporter I need to move the player across the level. Where do I store the target location? I'd assume in a component on the teleporter. Should I create a whole new component just for that data? I feel it should be stored in the teleporters collision component but no all entities that use the collision component will require this data.

Could someone please try to enlighten me?

Thanks

sentences:
First Person Camera strafing at angle I have a simple camera class working in directx 11 allowing moving forward and rotating left and right. I'm trying to implement strafing into it but having some problems.

The strafing works when there's no camera rotation, so when the camera starts at 0, 0, 0. But after rotating the camera in either direction it seems to strafe at an angle or inverted or just some odd stuff.

Here is a video uploaded to Dropbox showing this behavior.
https://dl.dropboxusercontent.com/u/2873587/IncorrectStrafing.mp4

And here is my camera class. I have a hunch that it's related to the calculation for camera position. I tried various different calculations in strafe and they all seem to follow the same pattern and same behavior. Also the m_camera_rotation represents the Y rotation, as pitching isn't implemented yet.

#include "camera.h"

camera::camera(float x, float y, float z, float initial_rotation) {
m_x = x;
m_y = y;
m_z = z;
m_camera_rotation = initial_rotation;

updateDXZ();
}

camera::~camera(void)
{
}

void camera::updateDXZ() {
m_dx = sin(m_camera_rotation * (XM_PI/180.0));
m_dz = cos(m_camera_rotation * (XM_PI/180.0));
}

void camera::Rotate(float amount) {
m_camera_rotation += amount;

updateDXZ();
}

void camera::Forward(float step) {
m_x += step * m_dx;
m_z += step * m_dz;
}

void camera::strafe(float amount) {
float yaw = (XM_PI/180.0) * m_camera_rotation;

m_x += cosf( yaw ) * amount;
m_z += sinf( yaw ) * amount;
}

XMMATRIX camera::getViewMatrix() {
updatePosition();

return XMMatrixLookAtLH(m_position, m_lookat, m_up);
}

void camera::updatePosition() {
m_position = XMVectorSet(m_x, m_y, m_z, 0.0);
m_lookat = XMVectorSet(m_x + m_dx, m_y, m_z + m_dz, 0.0);
m_up = XMVectorSet(0.0, 1.0, 0.0, 0.0);
}

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:
What language or platform is used to develop apps for Google+? Does anyone know what language or platform is used to develop apps for Google+?

I'm hoping Python, but I know google has a lot of other mediums they could use for this. I'm fine with hearsay as I know the game portion of google+ is pretty new.

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.

sentences:
Manage massive items game data in an Android Idle Game I'm working on an Android Idle game, with many items that user can buy in each level, that each of them has more than 50 levels who can be updated by the user. Each item in each specific level can produce some value of a specific unit every second in the game.
Currently, I manage this massive game data (Not user's data) in the Dictionary data structure in code, that each item has an instance of Item class for the value. Item class has many properties like for example multidimensional arrays of levels data.
I initialize this dictionary each time user opens the game.

The problem is we want to balance the game, and it needs to change this massive data many times for test. with the current structure, it takes hours to edit data each time.

My question is, is that a better way to manage massive items game data to can be simply replaced for example by data from an excel's sheets in Unity?
Thanks.

sentences:
Create apk from libgdx project What is the basic procedure to create the signed apk for my libGDX project? I am new to libGDX so provide some guidance.

I am talking about deploying apk to the Android market. I have to ask this question because my Galaxy SX2 display only blank screen.

sentences:
How to implement a pixelated screen transition shader? I am interested in creating a screen transition seen in a lot of retro games. The transition is just a kind of pixelated distortion that increases or decreases in granularity over time.

The effect is present in Super Mario World, and can be seen recreated in this clip.

Also, here is an image depicting the transition (ignore the gradual lightening of the screen):

I want to achieve this by animating the uniforms of a GLSL shader.

Unfortunately, I don't know how to design the shader.

I know how to sample gradient textures to create various screen wipes, as well as how to sample noise textures to create simple distortion effects. But I can't figure out exactly how to create this effect.

Any advice on how to set up a shader to achieve this effect?

sentences:
How to make a script on a prefab act on a particular scene instance? I am building Actionables (Windmill, Coal) on a Planet by hovering the mouse over the Planet and clicking on it.

Actionables are prefabs, which have an Actionable component, with the same setup (at the moment).

Once the player is happy with the location of their Actionable, they click LMB, which activates onClick callback, which is supposed to call Planet.Build(), which adds the Actionable on the Planet permanently (saves it into an internal array).
I also have a "Turn Off" Button, which calls stopBuilding() when clicked, disabling the preview placement.
When stopBuilding() is invoked by the button click, everything works as expected.
I also want to be able to call Planet.stopBuilding() (which, by removing the actionableModel, disables hover preview on the Planet) from Planet.Build(), such that the player does not need to click the Turn Off button described above after building an Actionable.
Inside Actionable prefabs I can only assign other prefabs, but I need them to interact with the scene object. I cannot override the Planet object in Actionable instances, as they are generated on the fly.
How do I access the scene object Planet from Actionable prefab?
Here is my Planet and its stopBuilding method so far:
   public class Planet : MonoBehaviour
   {
       private GameObject actionableModel;

       // ...

       public void stopBuilding()
       {
           // For debugging only
           Planet planet = GameObject.Find("Planet").GetComponent<Planet>();
           Debug.Log(planet.actionableModel);
           Debug.Log(this.actionableModel);

       }
   }

And here is the Actionable component which has a UnityEvent property onClick, which calls stopBuilding() on a click event.
   public class Actionable : MonoBehaviour
   {
       public class OnClick : UnityEvent<GameObject> { }
       public OnClick onClick = new OnClick();

       // ...

       void OnMouseDown()
       {
           onClick.Invoke(gameObject);
       }
   }

sentences:
How do I scale a rectangle image while retaining its border thickness? I want to create a programmatically scalable image like this:  scales to .

Both have a one pixel border. If I scaled from the first to the second in Paint.NET, there would be a two pixel horizontal border, but I want it to keep it single-pixel.

sentences:
Software Design or Advanced Computer Graphics for Game Dev Wannabe So, I've been a programmer for 3 years and am finishing up my first graduate semester. I want to get into independent software( mostly mobile ) development with a interest in game development.

The university I go to does research in software development but not computer graphics, but they do offer  courses in computer graphics and advanced computer graphics. I took the first computer graphics class this semester.

We used very little OpenGL. We have had 4 main projects where we have implemented the algorithms behind anti-aliasing, clipping, polygon filling, implementing our own transformations( replacing glRotate/Scale/Translate ), and phong lighting equation. From talking to a friend, he says it sounds like a good course.

I have a choice to make next semester, take software design or advanced computer graphics. I've talked to the professor teaching the advanced computer graphics class and he says we are going to be implementing the algorithms our selfs again, but it is focused on more ray-tracing type algorithms. I'm not sure how this class could help me in the realm of game development.

Now, the software design class I feel I could really use. I only took one class on software engineering in my undergrad and I have the possibility to do research in software engineering if choose to. I have found my self when working on my own iPhone apps in the past of hating some of the code I wrote. I did some design but just to get things going. I know that I need to do better at software design if I'm going to be a successful software developer.

So, I know I need both but I guess what would be more useful taking at a university? Which ever one I don't take I probably will try to teach myself in my own time. I'm kind of leaning towards Software Design just so I can see how it's really suppose to be done. Where as the advanced computer graphics algorithms aren't subjective in any way and just need to be implemented.

FYI: I won't be able to take the other class in the future as both of these classes are only offered once every 2-3 years.

Description on each class

Advanced Graphics:
Realistic, three-dimensional image generation;modeling techniques for complex three-dimensional scences; advanced illumination techniques;fractual surface modeling; modeling and rendering of natural phenomena.

Software Design:
Software design principles, attributes, models, and methodologies; object-oriented designs; real-time system design;user interface design;design verification; reusability issues;tools;current issues.

sentences:
Game freezes, cannot see why My game freezes randomly, mostly when changing from one level to the next. I cannot tell why this is the case. There are no errors or warnings. This happens when i build the game and when I am testing the game in the Unity editor. It will say unfreeze itself after a few seconds.  I have attached one of the level codes and the timer code. I have also attached a picture of how it looks when it freezes.
This is one of the level codes :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;
public class Arduino5 : MonoBehaviour
{
    SerialPort sp = new SerialPort("\\\\.\\COM5", 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 erial 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 > 50f) )
                {
                    m_Material.color = Color.grey;
                    Renderer _rend = Sphere.GetComponent<Renderer>();
                    Sphere.GetComponent<Renderer>().material = _rend.material;
                    _rend.material.mainTexture = Resources.Load("face4") as Texture;

                }
                else
                {
                    m_Material.color = Color.white;
                }
            }
            catch (System.Exception)
            {

            }
        }
    }
}

and this is the 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", 1.0f);
        }
    }

    IEnumerator LoseTime()
    {
        while (true)
        {
            yield return new WaitForSeconds(1);
            timeLeft--;
        }
    }
    void ChangeLevel()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
}

In terms of trying to close the serial port, would something like this work:

void Start()

{
    if (!sp.IsOpen)
    { // If the erial port is not open
        sp.Open(); // Open
        sp.ReadTimeout = 250;
    }

// Timeout for reading
else if (sp != null)
{

    {
        sp.Close();
    }
}

}

sentences:
Initial direction of intersection between two moving vehicles? Possible Duplicate:
  Predicting enemy position in order to have an object lead its target

I'm working with a bit of projectile prediction for my AI and I'm looking for some ideas, any input?

If a blue vehicle is moving in a direction at a constant speed of X m/s and a stationary orange vehicle has a rocket that travels Y m/s, which initial direction would the orange vehicle have to fire the rocket for it to hit the blue vehicle at the earliest time in the future?

Thanks for reading!

sentences:
In Unity, How to format Old RPCs into new "PunRPCs" In older unity versions you could simply used RPC. With newer verisons of Unity my code now doesn't work and it says that it needs to be transformed into "PunRPC" , Pun being "Photon Unity Networking." I am not sure how to reformat it to work with current unity versions. Can anyone shed light on this?

My Code

FXManager.cs

1 using UnityEngine;
2 using System.Collections;
3
4 public class FXManager : MonoBehaviour {
5
6   [RPC]
7   void SniperBulletFX( Vector3 startPos, Vector3 endPos ) {
8       Debug.Log ("SniperBulletFX");
9
10  }
11}

PlayerShooting.cs

1 using UnityEngine;
2    using System.Collections;
3
4    public class PlayerShooting : MonoBehaviour {
5
6   public float fireRate = 0.5f;
7   float cooldown = 0;
8   public float damage = 25f;
9   FXManager fxManager;
10
11  void Start() {
12      fxManager = GameObject.FindObjectOfType<FXManager>();
13
14      if(fxManager == null) {
15          Debug.LogError("Couldn't find a FXManger.");
16      }
17  }
18
19
20  // Update is called once per frame
21  void Update () {
22      cooldown -= Time.deltaTime;
23
24      if (Input.GetButton ("Fire1")) {
25          //Player wants to shoot...so. Shoot.
26          Fire ();
27      }
28  }
29
30  void Fire() {
31
32      if (cooldown > 0) {
33          return;
34      }
35
36      Debug.Log ("Firing our gun");
37
38      Ray ray = new Ray (Camera.main.transform.position, Camera.main.transform.forward);
39      Transform hitTransform;
40      Vector3 hitPoint;
41
42      hitTransform = FindClosestHitObject (ray, out hitPoint);
43
44      if (hitTransform != null) {
45          Debug.Log ("We hit:" + hitTransform.name);
46
47          // We could do a special effect at the hit location
48          // DoRicochetEffectAt (hitPoint);
49
50          Health h = hitTransform.GetComponent<Health> ();
51
52          while (h == null && hitTransform.parent) {
53              hitTransform = hitTransform.parent;
54              h = hitTransform.GetComponent<Health> ();
55          }
56
57          // Once we reach here, hitTransform may not be the hitTransform we started with!
58
59          if (h != null) {
60              // This next line is the equivalent of calling;
61              //                  h.takeDamage( damage);
62              //Except more "networky"
63              PhotonView pv = h.GetComponent<PhotonView> ();
64              if (pv == null) {
65                  Debug.LogError ("Freak out!");
66              } else {
67                  h.GetComponent<PhotonView> ().RPC ("TakeDamage", PhotonTargets.AllBuffered, damage);
68              }
69          }
70
71          if (fxManager != null) {
72              fxManager.GetComponent<PhotonView>().RPC ("SniperBulletFx", PhotonTargets.All, Camera.main.transform.position, hitPoint);
73          }
74      }
75      else {
76          // We didn't hit anything (except empty space), but let's do a visual FX anyway
77          if (fxManager != null) {
78              hitPoint = Camera.main.transform.position + (Camera.main.transform.forward*100f);
79              fxManager.GetComponent<PhotonView>().RPC ("SniperBulletFx", PhotonTargets.All, Camera.main.transform.position, hitPoint);
80          }
81      }
82
83      cooldown = fireRate;
84  }

If anymore information is needed, please let me know, I would love to figure out how the new "PunRPC(Photon Unity Neworking)" works so I can use it in future projects.

Edit: This is the error I get "PhotonView with ID 2 has no method "SniperBulletFx" marked with the PunRPC or @PunRPC(JS) property! Args: Vector3, Vector3
UnityEngine.Debug:LogError(Object)"

sentences:
How do I make game objects move towards the player, when the player is within a set range? I am trying to make game objects, like a coin or ammo clip, gravitate towards the player when they are within a set radius. I have seen this implemented in quite a few old school 90's games; when the player walks near anything, I want it to move to the player for collection. I can already handle the collection.

This is what I have, so far:

using UnityEngine;
using System.Collections;

public class MoveCoinsTowardsPlayer : MonoBehaviour
{
    public Transform target;
    public float speed;

    void Update()
    {
        float step = speed * Time.deltaTime;
        transform.position = Vector3.MoveTowards(transform.position, target.position, step);
    }
}

How do I make game objects move towards the player, when the player is within a set range?

sentences:
How to change player objects when switching scenes? I have a scene for lobby. When player connects to server he gets a lobbyCharacter, which is an empty gameobject with a script on it that create UI element with the players name. In lobby players can select character they want to use.
Now when starting game, i would like to switch scene to the game scene when all players are ready. I have been reading the API, documentation, and different stack questions, but i cant seem to find any info on how this should work. On NetworkManager i can do scene schange which will be changed on all clients. But how do i persist data over multiple scenes? And if the lobby characters are destroyied how are the game characters instansiated according to the choises made in lobby? How does the client connection persist between multiple scenes?
Do i just manage the character locally and use syncHooks to synchronize over the server? Do i need to create somesort of container gameobject that holds the player connection information and some extra stuff?
EDIT
Reading the soruce code of mirror i fouind that NetworkManager holds the connection of the client, sort of. So now the issue has come down to replacing the prefab for the connection.
I have the following code:
 public void switchScene()
    {
        GameObject obj = NetworkClient.connection.identity.gameObject;

        NetworkServer.ReplacePlayerForConnection(NetworkClient.connection, Instantiate(shipPrefab));

        NetworkServer.Destroy(obj);
        ServerChangeScene(gameScene);
    }

This should switch the prefab for connection and then switch scene, but i keep getting 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.switchScene () (at Assets/LobbyManager.cs:51)

And i dont understand why this is happening. New prefab has networkIdentity and networkTransform. Old prefab only has network transform. Up until this point everything wors, but once i want to switch scenes, it breaks.

sentences:
How to implement efficient Fog of War? I've asked a question how to implement Fog Of War(FOW) with shaders. Well I've got this working. I use the vertex color to identify the alpha of a single vertex.

I guess the most of you know what the FOW of Age of Empires was like, anyway I'll shortly explain it:

You have a map. Everything is unexplored(solid black / 100% transparency) at the beginning. When your NPC's / other game units explore the world (by moving around mostly) they unshadow the map. That means. Everything in a specific radius (viewrange) around a NPC is visible (0%transparency). Anything that is out of viewrange but already explored is visible but shadowed (50% transparency).

So yeah, AoE had relatively huge maps. Requirements was something around 100mhz etc. So it should be relatively easy to implement something to solve this problem - actually.

Okay. I'm currently adding planes above my world and set the color per vertex. Why do I use many planes ? Unity has a vertex limit of 65.000 per mesh. According to the size of my tiles and the size of my map I need more than one plane. So I actually need a lot of planes. This is obviously pita for my FPS.

Well so my question is, what are simple (in sense of performance) techniques to implement a FOW shader?

Okay some simplified code what I'm doin so far:

// Setup
for (int x = 0; x < (Map.Dimension/planeSize); x++) {
    for (int z = 0; z < (Map.Dimension/planeSize); z++) {
         CreateMeshAt(x*planeSize, 3, z*planeSize)
    }
}

// Explore (is called from NPCs when walking for example)
for (int x = ((int) from.x - radius); x < from.x + radius; x ++) {
    for (int z = ((int) from.z - radius); z < from.z + radius; z ++) {
        if (from.Distance(x, 1, z) > radius) continue;
        _transparency[x/tileSize, z/tileSize] = 0.5f;
    }
}

// Update
foreach(GameObject plane in planes){
    foreach(Vector3 vertex in vertices){
       Vector3 worldPos = GetWorldPos(vertex);
       vertex.Color = new Color(0,0,0, _transparency[worldPos.x/tileSize, worldPos.z/tileSize]);
    }
}

My shader just sets the transparency of the vertex now, which comes from the vertex color channel

sentences:
Continuous Physics Engine's Collision Detection Techniques I'm working on a purely continuous physics engine, and I need to choose algorithms for broad and narrow phase collision detection. "Purely continuous" means I never do intersection tests, but instead want to find ways to catch every collision before it happens, and put each into "planned collisions" stack that is ordered by TOI.

Broad Phase
The only continuous broad-phase method I can think of is encasing each body in a circle and testing if each circle will ever overlap another. This seems horribly inefficient however, and lacks any culling.

I have no idea what continuous analogs might exist for today's discrete collision culling methods such as quad-trees either. How might I go about preventing inappropriate and pointless broad test's such as a discrete engine does? I also would like to be able to see collisions more than 1 frame ahead to.

Narrow Phase
I've managed to adapt the narrow SAT to a continuous check rather than discrete, but I'm sure there's other better algorithms out there in papers or sites you guys might have come across.
What various fast or accurate algorithm's do you suggest I use and what are the advantages / disatvantages of each?

Final Note:
I say techniques and not algorithms because I have not yet decided on how I will store different polygons which might be concave, convex, round, or even have holes. I plan to make a decision on this based on what the algorithm requires (for instance if I choose an algorithm that breaks down a polygon into triangles or convex shapes I will simply store the polygon data in this form).

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:
Why does XMVector4Dot return a vector with the dot product copied to it's components? The documentation for XMVector4Dot lists the return value as a vector. It also states that the dot product is replicated into each component. Given that the dot product is going to be a single value, how does this offer an advantage over just returning float?

The only way I can see to get the value is to do something such as:

        XMVECTOR w = { -XMVectorGetX(XMVector4Dot(x, eye)), -XMVectorGetX(XMVector4Dot(y, eye)), -XMVectorGetX(XMVector4Dot(z, eye)), 1 };

Which seems unnecessary. Is there another reason I'm overlooking?

sentences:
Why is is so hard to develop a game console emulator? I have always found emulators rather fascinating. I would seriously like to create an emulator for an older ganeration console or handheld. It would help me gain a greater appreciation of the hardware and the games which were created for that hardware. However, people are always saying how hard it is and that I should not even try. I would like to know why that is.

Also, I would like some suggestions on a good place to start and where can I find the information I need?

sentences:
Best practice for implementing overall / weekly / daily highscores? So I'm setting up social leaderboards and I want there to be daily weekly overall high scores. The way the scoring works is each score is tied to a user after the user logs in so the scores need to always be linked to a user. I'm using the Parse BaaS with Unity C# and I've gotten overall highscores working by adding a highScore field to the ParseUser model. From the research that I've done so far based on google play services and game center has led me to the following solution.

Have 3 fields for the ParseUser model: overallScore, dailyScore, weeklyScore. Reset dailyScore and weeklyScore when appropriate

Is this an appropriate solution for what I'm trying to implement? Is there a more efficient or scalable way to do it?

sentences:
What are milestones for a game developer to gauge their progress? I know actually completing a game is a massive milestone, a complete polished, holistic experience. Something that I've not yet been able to commit to.

There are of course classes and degrees to earn in several fields that will help gain experience, but how would one judge their own progress and strive to progress further?

The yellow brick road to "Rock Star Game Programmer" is very cloudy. At this point I think it may be closer to an ocean, drifting along until you wake up one day at your destination.

sentences:
How do I write a shader that lights up when objects are near a surface? In this Overwatch gameplay video, the character's shield lights up white in areas that are near other objects' geometry.

Note the white edges on the blue shield, near the floor, walls and pillar.

I believe the shield has its own model and the effect is done with a shader, but I'm lost trying to figure how to translate the concept of "nearness" to shader programming.

sentences:
Best way to test if some point on a line if in front of another point on the same line in 3D I have a line in 3D defined by point P0 and direction vector D.
For given input point P on a line defined as above, I want to test if P is in front of point P0. The code will be used in GLSL fragment shader.

So far, my best solution is following GLSL function:

bool IsInFront(vec3 P, vec3 P0, vec3 D)
{
  float d = length(P - P0);
  vec3 Pp = P0 + d * D;
  return (length(Pp - P) < 1.0E-4);
}

Explanation is simple. d is distance between P and P0, and there are only two possible positions on a line where a point with distance d from point P0 can be on a line: in front, or behind point P0. Then I just check if positive point is same as input P.

However, this code uses precision 1.0E-4, and recalculation of input point P. Is there a faster and numerically more stable way to do this?

Regards

sentences:
Use Stage's draw() method to invoke Actor's draw method in Libgdx Question :
In the following snippet, I wish to draw different shapes such as rectangles, circles, triangles etc. I will be creating different class files for each of such objects, as I did for Rectangle class here.

I've been trying to invoke the draw method of Rectangle object from Stage object, but I am unable to do so. If I make a plain call to the draw method of the Rectangle object, I can draw the object.

Can some one suggest me how is this possible ?
Also, I had many other queries which I'd tried to put in comments. Please have a look at them and kindly help me in figuring out the concept beneath it.

Disclaimer : I am new to game programming, started with Libgdx.

Following is the Scan class :

package com.mygdx.scan.game;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.scenes.scene2d.Stage;

public class Scan extends ApplicationAdapter {
private Stage stage;
public static ShapeRenderer shapeRenderer;

@Override
public void create () {
    stage = new Stage();
    shapeRenderer = new ShapeRenderer();
    Rectangle rect1 = new Rectangle(50, 50, 100, 100);
    stage.addActor(rect1);

}

@Override
public void render () {
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    shapeRenderer.setProjectionMatrix(stage.getCamera().combined);
    shapeRenderer.begin(ShapeType.Filled);
    shapeRenderer.setColor(Color.BLACK);
    //new Rectangle(50, 50, 100, 100).draw();
    shapeRenderer.end();
    // This should call Rectangles draw method. I want a Shapetype.Filled Rectangle.
    // But I'm unable to invoke this method if I add the actor in stage object and invoke it's draw method.
    stage.draw();
}

public void dispose() {
    stage.dispose();
}
}

Following is the Rectangle Actor class :

package com.mygdx.scan.game;

import com.badlogic.gdx.scenes.scene2d.Actor;

public class Rectangle extends Actor {

float xcord, ycord, width, height;
public Rectangle(float x , float y , float width, float height) {
    this.xcord = x;
    this.ycord = y;
    this.width = width;
    this.height = height;
}

// This needs to be called in the Scan class. I just want the draw       method to be invoked.
// Also I wish to draw many such rectangles. What is the best practice to get hold of ShapeRenderer object from Scan class ?
// Should I use one instance of  ShapeRenderer object in Scan class or should I create ShapeRenderer object for each of the Rectangle object ??
// I also plan to repeat the activity for another object such as circles. So I would like to know the best practice here.
public void draw() {
    Scan.shapeRenderer.rect(this.xcord, this.ycord, this.width, this.height);
}

}

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:
Unity console error with only a timestamp I am getting console errors that only have a timestamp. I am running Unity 2019.1.9f1 on Ubuntu 19.04. I have installed dotnet core 2.2.5 on my machine.

Here is the full error log: https://pastebin.com/7vfAK9fZ

Here is a particularly suspect part of the log:

-----CompilerOutput:-stdout--exitcode: 134--compilationhadfailure: True--outfile: Temp/Unity.TextMeshPro.dll
-----CompilerOutput:-stderr----------
No usable version of the libssl was found
/home/username/Unity/Hub/Editor/2019.1.9f1/Editor/Data/Tools/RoslynScripts/unity_csc.sh: line 64:  3902 Aborted
"/home/username/Unity/Hub/Editor/2019.1.9f1/Editor/Data/Tools/RoslynScripts/../../Tools/Roslyn/csc" /shared /noconfig @Temp/UnityTempFile-2773a2345220fccdfb0171165a73fa25
-----EndCompilerOutput---------------
- Finished compile Library/ScriptAssemblies/Unity.TextMeshPro.dll

How do I fix it?

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: Stop music in crafty.js How do I stop a looping music file from playing in crafty.js? I want the music to stop playing once a gameover condition has been reached.

sentences:
Resource management with Lua integration I have a questions about how to better implement resource management when integrating with Lua. I have an entity system that has gameplay logic done in Lua. One of the design points was that I wanted to simplify the script code as much as possible. To that end, things like sprites and sounds are generic "resource" handles (currently just integers) that are referenced, e.g.

self.image = resource("/foo/baz.png")
self.hurtSound = resource("/foo/bar.mp3")
...
play(self.hurtSound)

This works well, but I don't know when (from the native code side) it is safe to delete a resource because a Lua object could be holding on to it. I don't have "levels" where there are convenient "load/unload" points, so I'm wondering how I might safely achieve this without making the Lua code have to do anything complicated with resources. Essentially, I want garbage collection for unused resources. I'm not a Lua expert, so I'm sure there is some feature of the language that could implement such a behavior.

My requirement is that I should be able to copy handles around safely, e.g. do not need to call resource() twice to do some kind of "obvious" reference counting. Similarly, if resource() is called n times, but at least 1 reference is valid, then the resource should not be unloaded; i.e. simply because one value was __gc'd, doesn't mean that all of them should be invalidated.

The native code implements the resource cache and simply needs to be informed when it would be safe to unload something (even if it doesn't unload it immediately).

Any Lua experts ran into similar sort of situations? What did you do to solve this problem?

sentences:
How to efficiently filter by a component with a specific value in an entity component system (all entities in grid position [x,y,z], for example)? I'm working on a 3d grid based game, and I am trying to implement it using an ECS.

I have a position component which indicates the entity's position on the grid. It is comprised of 3 integers (for example [1,3,2]). Now lets imagine the user clicked on position [1,3,2]. I now want to efficiently retrieve all entities in position [1,3,2].

I can see only one way to achieve that using an ECS. I need to filter for all components that have a position component (this can be done in O(1)), then filter through all the position components to find only those positions that equal [1,3,2]. This is extremely inefficient, since I have a hundred thousand entities with a position component to loop through, but I only need a minuscule fraction of them.

It's important to note that I never need to loop through all the hundred thousand position components in a single frame in any other case. For all other systems, I filter entities that have both a position component as well as other components, so I end up only looping through a small fraction of positions in each frame. This means I cant just retrieve all the relevant entities as part of the loop that goes through all the positions, since I dont have such a loop.

Traditionally using OOP, I would have a dictionary from a position to a container that contains all the objects in that position, which would allow me to accomplish the above in O(1). This isn't correct design for an ECS though, from what I understand.

Am I misunderstanding something about Entity Systems? If anyone has any advice I would be glad to hear it.

Thank you.

sentences:
Unity Animation Controller: Is the "atomic" attribute in 4.6.3 the same as the "has exit time" attribute in 5.0? I'm viewing a tutorial based on Unity 5.0. In this version, I see an option whose name is: Has Exit Time:

But on my Unity, version 4.6.3, I don't have this option. Instead I have an option called Atomic.

My guess is that these options mean the same thing. That is, if this box is checked, then the controller should finish playing this state before moving to a new state. But I'm not sure here. If my guess is wrong, which option is equivalent to Has Exit Time in Unity 4.6.3 ?

Thanks :)

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:
Guidance for building a proper in game economy I'm seriously thinking of building a space opera game which would share some of Machiavelli The Prince aspects regarding commerce: each player will be able to extract/build/buy/sell/donate a wide range of products (from ore to spaceships roughly).

However, I'm struggling with the economy aspect of it. Should the game define the prices once and for all? Should each player be able to determine his own buy/sell prices, and if so, how? How can I avoid over engineering this game economy mechanism, while still making it attractive for users?

Edit: thanks to your very nice input, some more information about the setup:

it's a "player only game," with no "computer managed player."
players start with a planet and some resources/units and then (try to) expand
players can be of multiple "species" with no proper relationship apart from the one they might make up => no possible notion of "central bank" or similar in the first place
consequently, I would prefer "not magic" on the economy, by that I mean a standard currency whose value would be determined by the system. However then I don't see how trading would be appealing, since bartering would be the only way, which feels a bit clumsy for the players. I was thinking of having some rare metal as the standard exchange medium, but then I wonder how would to include other basic economic attributes, such as the population's wealth...

Hopefully it doesn't look too daunting...

sentences:
Error while reading TGA file and doing Texture Cube map In my program, i read a TGA file with a function like this:

char* LoadTGA(char* filename, int* width, int* height, int* bpp);

As you can see, this function: return a char array of image data (without TGA file header, from the first pixel row of image to the last pixel row of image), width of TGA image, height of TGA image, and bits per pixel of image data. The part of code that read image data is this:

    int w = pHeader->width; //width of image
    int h = pHeader->height;  // height of image
    int rowSize = w * pHeader->bits / 8;   //The bit is bits per pixel
    bool bInverted = ( (pHeader->descriptor & (1 << 5)) != 0 );  //My TGA image is not inverted so bInverted is false.
    for ( int i = 0; i < h; i ++ )
    {
        char * pSrcRow = pSrc +
            ( bInverted ? ( h - i - 1 ) * rowSize : i * rowSize );
        if ( pHeader->bits == 24 )
        {
           for ( int j = 0; j < w; j ++ )
           {
               *pDest ++ = pSrcRow[2];
               *pDest ++ = pSrcRow[1];
               *pDest ++ = pSrcRow[0];
               pSrcRow += 3;
        }
    }
}

As this code show, for my TGA image, which have bits per pixel (bpp) equals to 24, not inverted, the return char array will be from the first pixel row of image to the last pixel row of image.

I read a image of 512 x 384 pixels like this image below:

I use this image for texture cube so i read 6 parts of this image in following function:

bool Texture::SplitTextureCube(int i, char* des)
{
int l, m, size = width/4;
int aTopLeft[][2] = {{size*2, size}, {0, size}, {size, 0}, {size, size*2}, {size, size}, {size*3, size}};
int rowSize = height * bpp / 8;
for (int j = 0; j < size; j++ ) //height
{
    char * pSrcRow = imageData + (aTopLeft[i][2] + j) * rowSize + aTopLeft[i][0];
    if ( bpp == 24 )
    {
        for ( int k = 0; k < size; k ++ )   //width
        {
            *des ++ = pSrcRow[0];
            *des ++ = pSrcRow[1];
            *des ++ = pSrcRow[2];
            pSrcRow += 3;
        }
    }
    else
    {
        for ( int k = 0; k < size; k ++ )
        {
            *des ++ = pSrcRow[m + 0];
            *des ++ = pSrcRow[m + 1];
            *des ++ = pSrcRow[m + 2];
            *des ++ = pSrcRow[m + 3];
            pSrcRow += 4;
        }
    }
}
return true;
}

This function is called as below:

 char *face = new char[width/4 * height/3 * bpp/8];
    glGenTextures(1, &textureId);
    glBindTexture(GL_TEXTURE_CUBE_MAP, textureId);
    for (int i=0; i<6; i++)
    {
        SplitTextureCube(i, face);
        glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, 0, GL_RGB, width/4, height/3, 0, GL_RGB, GL_UNSIGNED_BYTE, face);
        //glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, imageData);
    }
    delete [] face;

I guess you need no more explain. The problem is when my program running, my cube texture is disordered like this:

I sure that problems are inside my "SplitTextureCube" function, i sure that i read pixels in the wrong order, please help me fix that function.

sentences:
How to make touch events work in a match three type game In "match three" types of games like Crazy Kitchen, when the user touches an image, he can drag his finger over multiple images and create a change in each image he touches in a single gesture. You might drag your finger across 5 images and each image highlights as you drag across it.

I want to create a similar affect in my game but I can only get the first image to change in a single drag or touch event. I have a GridLayout with each cell containing a custom LinearLayout with an OnTouchListener attached. I want to have the user drag across multiple cells and have each view the user drags across change its image to a "highlighted" image.

How do I get more than the first LinearLayout to be affected by the touch event?

Here's my onTouch code:

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        int action = motionEvent.getAction();
        FloorTile singleTile = (FloorTile) view;
        singleTile.getParent().requestDisallowInterceptTouchEvent(true);
        switch(action) {
            case MotionEvent.ACTION_DOWN:
                Log.i(TE, "MotionEvent = DOWN");
                //assign the new Arrow type to the FloorTile
               swapImage(singleTile);
                break;
            case MotionEvent.ACTION_MOVE:
                Log.i(TE, "MotionEvent = MOVE");
                singleTile.swapImage();
                break;
        }
        return true;
    }

public void swapImage(FloorTile mTile) {
        mTile.setBackground(this.getResources().getDrawable(R.drawable.highlight));
//the actual game will pull a Drawable ID from an enum that matches up the original image with an //appropriate highlighted version.
    }

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:
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:
is there any different solution for different buildings different behaviours I'm trying to make different behaviours for workers of different buildings, let's say an agricultural worker would need to sow wheat seed and collect the wheat grain when it's grown. let's call that Behaviour0
For carpentry a worker would get wood and make arrows.
I have 2 different behaviours and I would like to implement them all in the simplest way possible.
 class agricultural{
     Workr Work
     void Working(Work W){
         Behaviour1();
     }
 }
 class Carpentry{
     Workr Work
     void Working(Work W){
         Behaviour2();
     }
 }
 template <tipename T> class BuildWork{
     T BW
     Work(){
         BW.Working();
     }
 }

I tried doing it with template so the behaviour would be inside agricultural and carpentry but problem occurred when I tried to declare template as only 1 can be inside it and getting it with ifs would make it the same as a non-templated version.
 class Workr{
     // here I would need to make it only for 1 is possible
     BuildWork <agricultural> BW
 }

So is this how I should use it?
The next thing occurred to me is this
 class Building{
     bool beh[2];
     void Work(Workr W){
         if beh[0]{
             if (beh[1]){
                 behaviour0(Workr W);
             }
             else{
                 behaviour1(Workr W);
             }
         }
         else{
             if (beh[1]){
                 behaviour2(Workr W);
             }
             else{
                  behaviour3(Workr W);
             }
         }
     }
 }

The last code is workable but I wonder if there is a better solution for this? here I can just change the bits in the beh[ ] and it's working
Each building has different behaviours and each worker in that specific building has same behaviour. Specific behaviour is always in the same building type.

sentences:
Unity - Issue applying Render Texture to object imported from Blender I'm new to Unity and am trying to create a sort of CRT computer monitor/terminal with text. To draw the text, I set up a Text Mesh Pro with its own camera, which renders to a Render Texture.

I then designed a simple computer monitor model in Blender split into two objects: one for the glass part of the screen, and another for the 'rest' of the monitor exterior case.
I saved a copy of the .blend file into the Assets folder and imported this into Unity.

My blender model: (two separate objects, with the separate "screen" piece moved out of the screen)

When I try to apply the Render Texture onto the screen object, the texture is rotated 90 degrees anti-clockwise and is too zoomed in:

I can't seem to rotate the texture so that it is the right way up to read the text, and only some of the text is visible.
I have tried rotating the object 90 deg. clockwise in Blender and "applying" the transform so unity then thinks the object is oriented correctly. this still caused the texture to be rotated.

I also tried exporting as an .obj file, with "Up" set to "Y-Up", but this didn't work.
I then tried applying the Render Texture to a material, which I then applied to the screen object which didn't work either.
If I apply the texture to a standard cube in Unity, it works fine and is rotated and scaled correctly to fit the cube.

How can I get the blender object oriented correctly so that the Render Texture applies in the correct orientation and scales so the whole of the Render Texture fits and is not zoomed in?

I'm using Unity 2019.3 and Blender 2.82.

sentences: Is using isTouched or justTouched multiple times bad? Suppose you have justTouched or isTouched method multiple times in your game screen, is that bad? Is it better to create booleans and as few input listeners as possible? or it doesn't matter?

sentences: Clearing a libGDX pixmap Is there a way to clear a libGDX Pixmap? Or is the only way to dispose it and create a brand new Pixmap?

sentences:
How to manage shaders? I've done some shader programming some time ago but only simple stuff. I'm especially interested in how do you manage shaders? Do you just write one of each kind, or do you need more of them? If so, how exactly do you split and managed them?

Also I've recently read that all the transformation matrix operations I used in OpenGL(glPushMatrix, etc) are now deprecated and you need to manage your own matrices.Is that something you do in a vertex shader and how would I go about doing it correctly?

Suggestions for books about this topic will be highly appreciated.

Thank you.

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:
How do I determine color resolution of an output in DXGI/D3D? i'm was revising some code i wrote some time ago when working on the window wrapper for my rendering framework. The framework is based off DirectX, but it wasn't really using any D3D-related facility. Instead it was wrapping the EnumDisplaySettings call :

DEVMODE dm;
dm.dmSize = sizeof(dm);
int_32 count{ 0 };
while (EnumDisplaySettings(NULL, count, &dm))
{
    if (dm.dmPelsWidth == _width && dm.dmPelsHeight == _height)
    {
        m_width = dm.dmPelsWidth;
        m_height = dm.dmPelsHeight;
        m_color_resolution = dm.dmBitsPerPel;
        m_display_frequency = dm.dmDisplayFrequency;
        return true;
    }
    ++count;
}

Simple as that, this doesn't take into account the format. It does take the refresh rate in count (DisplayFrequency) that I've supposed being the same thing. I'm using this Win32 call because later whenever someone needs to set the window to fullscreen I apply the DEVMODE through ChangeDisplaySettings().

I could have used the IDXGIAdapter::EnumOutputs call, but this doesn't give me the bits per pixel (or color resolution). I've done some tests and its value is 32 most of the times but I don't want to take it for granted. My question(s) is(are):

Is there any way to get the color resolution through Direct3D ? is it strictly related to the format ?
Is my approach correct at all ? because i'm having some doubts, should i keep using the Win32 calls or use the D3D ones ?

I apologize if this question has already been answered or if it has an obvious answer that I can't get, I bet I'm missing something.

sentences:
OnTriggerEnter / OnTriggerStay triggers multiple times and is not been call a second time I am working on a feature that when the Player pass thru a door, a message will popup on the screen.
I'm having few problems: Debug.Log gives me from 2 to 6 logs when I pass thru the collider plane and when I come back to the same collider plane the script it is not been call a second time.
What I'm trying to achive is that Debug.Log gives me only one log and every time I pass thru the collider the script runs again.
so here is my code:

function OnTriggerEnter (other : Collider) { //OnTriggerStay gives the same result
    if (other.tag == "Player") {
    isColliding = true;
  } else {
    isColliding = false;
  }
}
function OnGUI() {
  if (isColliding) {
      Debug.Log(isColliding);
    //Application.ExternalCall('hive.OpenHiveAlert', 'test');
  }
}
function OnTriggerExit() {
    Destroy(this);
}

Any help would be appreciated, thanks.

sentences:
Weird shader compiler error I am trying to draw a full screen quad without a vertex buffer.
SV_VertexID should do the trick, although I get a weird error in my shader on the following line:

PS_IN VS(uint VertexID : SV_VertexID)// << this is the line that causes trouble
{
    PS_IN output = (PS_IN)0;

    float4 pos = float4( (VertexID << 1) & 2, VertexID & 2 ,0,1);
    output.pos = mul(pos, wvp );

    float4 t = mul(pos, texTransform);
    output.tex = float2(t.x,t.y);

    return output;
}

The error message:

invalid type used for 'SV_VertexID' input semantics, must be integral

This is how I compile the shader:

fxc.exe /Tvs_4_0_level_9_3 /EVS /Fo Texture_VS.fxo Texture.fx

I dont understand why, as the type is integral. Why do I get this compiler error?

sentences:
XNA Distortion Shader problem So I came up with a distortion pixel shader in hlsl, but it has some issues. First of all, here is how it works:

The shader uses another texture generated by the program as a distortion "map" (if that's the correct term) I called this map a "mask".

The shader uses the red values in the mask for horizontal distortion and the blue values as vertical distortion. The green values are not used.

It subtracts 0.5 from the red and green values so that they have a range from -0.5 to 0.5 instead of 0 to 1. This lets the distortion go in any direction using only two color values.

I let the shader "push" pixels up to 128 pixels.

sampler s0;
texture textu;
sampler tex_sampler = sampler_state{Texture = textu;};
float2 screenSize;

float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
    float4 tex_color = tex2D(tex_sampler, coords);

    if (tex_color.a)
    {
        float distX = (tex_color.r - 0.5f) * (256.0f / screenSize.x) * tex_color.a;
        float distY = (tex_color.b - 0.5f) * (256.0f / screenSize.y) * tex_color.a;

        return tex2D(s0, float2(coords.x + distX, coords.y + distY));
    }
    return tex2D(s0, coords);
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

"textu" being the mask, "tex_color" is the color value from the mask.
It also multiplies the distortion by the alpha value in the mask.

This seemed to work perfectly at first, but I started noticing some issues.
I was using a completely white texture (as the mask) that was blurred around the edges. I set the color of this texture based on its rotation.
Here is the method I used for that:

private Color GetDirectionColor(float rad)
{
    Vector2 v = new Vector2(
        (float)Math.Cos(rad + Math.PI),
        (float)Math.Sin(rad + Math.PI)
        );

    float r = (v.X * 0.5f) + 0.5f;
    float b = (v.Y * 0.5f) + 0.5f;

    return new Color(new Vector3(r, 0, b));
}

This allows the texture to "push" pixels in whatever direction it is facing.
This method seems to work fine.

The problem is, when the texture is rotated more than 135 degrees and less than 315 degrees (as in, the texture is pointing into the upper left half of a circle if you cut it in half at a 45 degree angle) it does something strange. Where the texture is blurred (the alpha values become less than 1) it starts to "push" the pixels in the opposite direction that it should be.

I suspect this has to do with my shader and not something else in the program. Possibly the -0.5f part???

I'm terribly sorry if this is confusing... I could not find a better way to word it.

Thanks a lot for your help!

sentences:
Exporting the frames in a Flash CS5.5 animation and possibly creating the spritesheet Some time ago, I asked a question here to know what would be the best way to create animations when making an Android game and I got great answers.

I did what people told me there by exporting each frame from a Flash animation manually and creating the spritesheet also manually and it was very tedious.

Now, I changed project and this one is going to contain a lot more animations and I feel like there has to be a better way to to export each frame individually and possibly create my spritesheets in an automated manner.

My designer is using Flash CS5.5 and I was wondering if all of this was possible, as I can't find an option or code examples on how to save each frame individually.

If this is not possible using Flash, please recommend me another program that can be used to create animations without having to create each frame on its own. I'd rather keep Flash as my designer knows how to use it and it's giving great results.

sentences: LWJGL Rendering a 2D Object at a Certain Position On-Screen Okay, so in LWJGL, how can I render a 2D object (maybe for like a menu, or meter that shows up on screen during the game), and have control over size and position on screen? So I can tell it what position relative to the screen. It is a 3d game using gluPerspective (as opposed to glOrtho).

sentences: Does Unity own my game? I made my first game in unity, and I was wondering if I can sell it without owing anything to unity?

sentences:
Wall collision and sweep and prune algorithm I am documenting myself on collision detection algorithms.

If I understand well, "sweep and prune" algorithm using frame coherence is powerful to detect object vs object collisions (almost as 0(n)).

I am wondering if this algo is good for object vs wall collision ?

Suppose you have a big plane wall that is tilted regarding the axes of the "sweep and prune" algorithm (in a 3D game), because it is tilted the bounding box is quite big, and the wall bounding box will be detected as colliding a lot of objects. Similarly if a room is tilted regarding the axes of the algo (and the room is not a cube, but a complex geometry), then all walls collides almost all objects in the room, and the "sweep and prune" algo is useless for this problem.

A turnaround could be to split the wall in many little faces before the algo ?
Or are there other fast specific algos to detect object vs (big)wall collisions ?

sentences:
Pathing for pipe style layout I've been trying to think of ways to approach doing a pipe style game like the one pictured below, but am coming up short.
The pic is from Star Trek Elite Force 2, the hacking minigame part. I've never played the game, but found this particular part via a search.

The player must click on to turn each pipe section and get a path between the blue nodes, while not connecting to any red nodes.
I assumed the way to create the pipe route is to begin from the end node and generate a path towards the starting node, then obscure the path with branches. But on trying this, the path is very obvious (pic added below), so I'm looking for other ideas.
Does anyone have any pointers to set me in the right direction?

sentences:
2D AABB vs AABB Sweep : How to calculate hit normal? I've implemented a 2D AABBvsAABB sweep cast into my game, however, I'm having difficulty calculating the hit normal of the sweep cast.

I have the sweep direction, both a and b AABB positions and xy min-maxs, first and last hit times to work with, but not the colliding edge(s) or normal direction. I just can't conceptualise an efficient solution to this specific problem. Any Ideas? :)

*edit

This is what I have so far - just a general implementation of Gomez's and Christer Ericson's AABB sweep. There's no hit normal, so while the normal calculation is a mystery to me I'm unable to produce any collision response for my character controller.

bool SweepVelAABBvsAABB(AABB a, AABB b, Vector2 v, out Vector2 outVel, out Vector2 norm )
    {
        outVel = v; //Initialise out velocity
        norm = Vector2.zero;

        if( AABBvsAABB(a,b) ) return true; //return early if a,b overlap

        v = -v;
        float hitTime = 0.0f;
        float outTime = 1.0f;

        if(v.x < 0.0f) //sweep is going right
        {
            if(b.max.x < a.min.x) return false;
            if(a.max.x < b.min.x) hitTime = Mathf.Max( (a.max.x - b.min.x) / v.x, hitTime );
            if(b.max.x > a.min.x) outTime = Mathf.Min( (a.min.x - b.max.x) / v.x, outTime );
        }
        else if(v.x > 0.0f) //sweep is going left
        {
            if(b.min.x > a.max.x) return false;
            if(b.max.x < a.min.x) hitTime = Mathf.Max( (a.min.x - b.max.x) / v.x, hitTime );
            if(a.max.x > b.min.x) outTime = Mathf.Min( (a.max.x - b.min.x) / v.x, outTime );
        }

        if(hitTime > outTime) return false;

        //=================================

        if(v.y < 0.0f) //sweep is going up
        {
            if(b.max.y < a.min.y) return false;
            if(a.max.y < b.min.y) hitTime = Mathf.Max( (a.max.y - b.min.y) / v.y, hitTime );
            if(b.max.y > a.min.y) outTime = Mathf.Min( (a.min.y - b.max.y) / v.y, outTime );
        }
        else if(v.y > 0.0f) //sweep is going down
        {
            if(b.min.y > a.max.y) return false;
            if(b.max.y < a.min.y) hitTime = Mathf.Max( (a.min.y - b.max.y) / v.y, hitTime );
            if(a.max.y > b.min.y) outTime = Mathf.Min( (a.max.y - b.min.y) / v.y, outTime );
        }

        if(hitTime > outTime) return false;

        outVel = -v * hitTime;

        return true;
    }

sentences:
How can I refactor an enum so that it is still available in the inspector? I am trying to use an enum so that it is available in the inspector. This code works:

public ArmorTypeEnum ArmorType;
public enum ArmorTypeEnum { Light, Medium, Heavy };

How can refactor it into a single line?

How can I make ArmorTypeEnum private while keeping ArmorType public?

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:
Determining if a character is within the field of view in XNA I'm trying to creating a field of view for the camera I'm making for a game. It rotates around a circle for 180 degrees while the head moves accordingly. I'm going to bound the field of view within an isosceles triangle using the method described on this website.

The problem I'm having is that I don't know how I'm going to detect if the field of view has intersected with the character as seen in this link.

Any help with this would be greatly appreciated.

[EDIT]

sorry I meant an asset in game representing a camera much like the enemy in the second link, not an actual camera class in XNA(really sorry)

sentences:
How to stop switching between paths to a moving target? I've noticed after implementing A* pathfinding into my game, that there is exploitable/unrealistic behavior that goes on when the player moves between two nodes that alter the path of the AI trying to reach them. I have made a few images to demonstrate this problem.

This image above shows how the pathfinding in my game would behave if the player stood on the opposite side of a wall than my AI. If the player doesn't move it will take this single path to reach them. Assume that the red icon is the AI (enemy) and the blue icon is the target (player).

Now, if the player in this image above moves along the white arrows up and down, and the AI is constantly finding the optimal path to the player (ignore the performance costs of doing that), then the AI will also get stuck moving up and down because the optimal path will constantly shift between going above the wall and going under the wall. Is there a way to modify a standard A* implementation to remedy this? I will include my pathfinding code for clarity, but it's pretty much a standard top down implementation. The "Node" object is a node on my grid, and the grid is an object that holds a list of nodes, with a few functions to find a node from a world point.

public class Pathfinding : MonoBehaviour
{

public Transform seeker, target;
AstarGrid grid;

void Awake()
{
    grid = GetComponent<AstarGrid>();
}

public List<Node> FindPath(Vector3 startPos, Vector3 targetPos)
{
    Node startNode = grid.NodeFromWorldPoint(startPos);
    Node targetNode = grid.NodeFromWorldPoint(targetPos);

    List<Node> openSet = new List<Node>();
    HashSet<Node> closedSet = new HashSet<Node>();
    openSet.Add(startNode);

    while (openSet.Count > 0)
    {
        Node node = openSet[0];
        for (int i = 1; i < openSet.Count; i++)
        {
            if (openSet[i].fCost < node.fCost || openSet[i].fCost == node.fCost)
            {
                if (openSet[i].hCost < node.hCost)
                    node = openSet[i];
            }
        }

        openSet.Remove(node);
        closedSet.Add(node);

        if (node == targetNode)
        {

            return RetracePath(startNode, targetNode);
        }

        foreach (Node neighbour in grid.GetNeighbours(node))
        {
            if (!neighbour.walkable || closedSet.Contains(neighbour))
            {
                continue;
            }

            int newCostToNeighbour = node.gCost + GetDistance(node, neighbour);
            if (newCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour))
            {
                neighbour.gCost = newCostToNeighbour;
                neighbour.hCost = GetDistance(neighbour, targetNode);
                neighbour.parent = node;

                if (!openSet.Contains(neighbour))
                    openSet.Add(neighbour);
            }
        }
    }
    return null;
}

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:
Rotate view matrix based on touch coordinates I'm working on an Android game where I need to rotate the camera around the origin based on the user dragging their finger. My view matrix has initial position of sitting on the negative z and facing origin. I have succeeded in moving the camera through rotation left or right, up or down based on the user dragging the finger, but my problem is obviously that after I drag my finger up/down and rotate say 90 degrees so my intial position of -z is now +y and still facing origin, if I drag my finger left/right I want to rotate from +y to +x, but what happens is it rotates around the pole +y. This is to be expected as I am mapping 2D touch drag coords to 3D space, but I dont know where to start trying to do what I want. Perhaps someone can point me in the right direction, I've been googling for a while now but I don't know what I want to do is called!

Edit __
What I was looking for is called an ArcBall, google it for lots of info on it.

sentences:
DirectX -- Best version to develop for? Possible Duplicate:
  learning Direct3D 9, 10 or 11?

I'm just starting to learn DirectX, and I was wondering what the best version would be best to develop for. I'm trying DirectX 9 right now, but was wondering if I should use 10 or 11... Which version is the most commonly used version for games nowadays? I want to be able to play my game on most versions of windows... Is DirectX 9 still used a lot now?

sentences:
Applications programmer - Where to start? So far I've done web design/development and applications programming and of course video games has always been one of those things that I've wanted to take a stab at but never tried outside of a few minor and failed incursions. The only notable game programming I can say I have done was a little puzzle-ish game for the NES written in 6502 assembly so that doesn't exactly count for much.

Basically, what would be a good jumping off point for me? I do know C++ and Java if that gets me anywhere.

sentences:
Different Sprite sizes for animation I have a character which has a size of 32x64 when walking or standing. Using the libgdx animation class I can easily animate him with a texture atlas.
When I want to make him attack however, the Sprite appears squished because the frames for the attack animation are 64x64 to accommodate the sword.
My question is as the artist and programmer, would it make more sense to have each Sprite frame for every animation be 64x64? Or in code, resize the Sprite origin and bounds before the attack animation and set them back to 32x64 when the attack is done?

sentences:
How to get a Read-Write Reference to Parent GameObject from a script component attached to it? I have a game object(object) with a script component(myscript) attached.

I have a reference to myscript component through getComponent, and I want to change the transform of the gameObject the script is attached to.

myscript.gameObject.transform = (new value);

The above code gives me error,

  Property 'UnityEngine.GameObject.transform' is read only.

Is there a way to get a read-write version?

sentences:
UI button not working Every time I try to click on the button, nothing happens. I am linking some picks to help everyone answer my question.

I have added a event system. I have a canvas. The button is set to interactable.

sentences:
How do .HLSL files work together compared to .FX? So I have been slowly reading and working through Frank Luna's D3D11 book which uses the .FX file format which uses effects, techniques and passes which I understand now. However I have read online that the FX framework is no longer supported so I shouldn't use it. How do .HLSL files work? Do techniques, passes and effects still work the same way? Can I still use functions like:

CreateEffectFromMemory();

sentences:
In Android, neat way to send input info from `GLSurfaceView` to `onDrawFrame` in `GLSurfaceView.Renderer`? The input is pinch/drag for camera movement, which modifies a matrix to scale/translate, and sent to a vertex shader. It's working, but ugly.

What's the proper way to do it?

I've noticed:

GLSurfaceView gets onTouch callbacks; but Renderer has access to GL.
Shaders and textures can only be loaded after the onSurfaceCreated() callback, so should be loaded there?
Touch and graphics are on different threads, so should  use queueEvent() or similar.

Is there a game/app on github that's a good example to follow?
Thanks for any help!

sentences:
What are the pros and cons of Lua vs. Python as a scripting language for XNA/C# platform? I am thinking about giving a go to one of my ancient ideas for a game. The core point of this game would be the possible level of functional customization of the game environment and objects (such as modifying the behavior of a space ship weaponry). For this the game would need to be scriptable. Also I don't aim to commercialize it, it is merely an interesting programming challenge for me.

As I am mostly a .NET guy I will use XNA/C# for the game itself. For the scripting I think about going with Python or Lua. I have previous experience with Python and have nothing against it as a language. Lua on the other hand is almost completely new to me, besides some minor World of Warcraft addons modifications I did here and there, and it looks promising. So here is my question:

What are the pros and cons of Lua vs. Python as a scripting language for XNA/C# platform?

Is one of them considerably easier to use with XNA/C#? Has one of them some specific advantages or disadvantages when used with XNA/C#? Why would you recommend one over the other for XNA/C#?

sentences:
How to reduce lag when rendering 40,000 sprites in Unity? I am attempting to render 40,000 sprites: a grid of 200x200 with each grid node having a sprite renderer. All the way zoomed out I get about ~20 frames per second.

What would be the best way to optimize this? Eventually I want to have an even larger grid. The grid has to be changeable — I need to be able to change the ground/floor for that specific grid node.

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:
Node.js Lockstep Multiplayer Architecture Background

I'm using the lockstep model for a multiplayer Node.js/Socket.IO game in a client-server architecture. User input (mouse or keypress) is parsed into commands like 'attack' and 'move' on the client, which are sent to the server and scheduled to be executed on a certain tick. This is in contrast to sending state data to clients, which I don't wish to use due to bandwidth issues.

Each tick, the server will send the list of commands on that tick (possibly empty) to each client. The server and all clients will then process the commands and simulate that tick in exactly the same way. With Node.js this is actually quite simple due to possibility of code sharing between server and client. I'll just put the deterministic simulator in the /shared folder which can be run by both server and client. The server simulation is required so that there is an authoritative version of the simulation which clients cannot alter.

Problem

Now, the game has many entity classes, like Unit, Item, Tree etc. Entities are created in the simulator. However, for each class, it has some methods that are shared and some that are client-specific. For instance, the Unit class has addHp method which is shared. It also has methods like getSprite (gets the image of the entity), isVisible (checks if unit can be seen by the client), onDeathInClient (does a bunch of stuff when it dies only on the client like adding announcements) and isMyUnit (quick function to check if the client owns the unit). Up till now, I have been piling all the client functions into the shared Unit class, and adding a this.game.isServer() check when necessary. For instance, when the unit dies, it will call if (!this.game.isServer()) { this.onDeathInClient(); }.

This approach has worked pretty fine so far, in terms of functionality. But as the codebase grew bigger, this style of coding seems a little strange. Firstly, the client code is clearly not shared, and yet is placed under the /shared folder. Secondly, client-specific variables for each entity are also instantiated on the server entity (like unit.sprite) and can run into problems when the server cannot instantiate the variable (it doesn't have Image class like on browsers).

So my question is, is there a better way to organize the client code, or is this a common way of doing things for lockstep multiplayer games? I can think of a possible workaround, but it does have its own problems.

Possible workaround (with problems)

I could use Javascript mixins that are only added when in a browser. Thus, in the /shared/unit.js file in the /shared folder, I would have this code at the end:

if (typeof exports !== 'undefined') module.exports = Unit;
else mixin(Unit, LocalUnit);

Then I would have /client/localunit.js store an object LocalUnit of client-side methods for Unit.

Now, I already have a publish-subscribe system in place for events in the simulator. To remove the this.game.isServer() checks, I could publish entity-specific events whenever I want the client to do something. For instance, I would do this.publish('Death') in /shared/unit.js and do this.subscribe('Death', this.onDeathInClient) in /client/localunit.js. But this would make the simulator's event listeners list on the server and the client different. Now if I want to clear all subscribed events only from the shared simulator, I can't. Of course, it is possible to create two event subscription systems - one client-specific and one shared - but now the publish() method would have to do if (!this.game.isServer()) { this.publishOnClient(event); }.

All in all, the workaround off the top of my head seems pretty complicated for something as simple as separating the client and shared code. Thus, I wonder if there is an established and simpler method for better code organization, hopefully specific to Node.js games.

sentences: How to get smooth transition within slick? When a player clicks start, my app immediately switches to the first level. My question is how do I incorporate a smooth transition within Slick?

sentences:
shadow mapping with directional light and octree i am about to add shadow mapping to my simple game, i have a map level structured in an octree the camera culls out the octree nodes out of the vieweing frusutm and everything runs smooth. Now i want shadows and i have a doubt , the directional light runs is set at an infinite distance so basically it encompasses all the octree destroying the purpose of node culling. How can i add a directional shadow map and cull nodes outside the light frusutm if it is at an infinite distance ?
thanks in advance

sentences: Finite state machine in C++ So, I've read a lot about using FSMs to do game state management, things like what an FSM is, and using a stack or set of states for building one. I've gone through all that. But I'm stuck at writing an actual, well-designed implementation of an FSM for that purpose. Specifically, how does one cleanly resolve the problem of transitioning between states, (how) should a state be able to use data from other states, and so on. Does anyone have any tips on designing and writing a implementation in C++, or better yet, code examples?

sentences:
How do I render a 2D sprite in 3D space? I am currently working on a game in XNA 4.0, where I want to implement 2.5D, like in "Paper Mario". I feel like it has something to do with z-buffering a Texture2D, and drawing that, but I really have no idea where to start.

How do I render a 2D sprite in 3D space?

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:
Retrieving model position after applying modeltransforms in XNA For this method that the goingBeyond XNA tutorial provides, it would be really convenient if I could retrieve the new position of the model after I apply all the transforms to the mesh. I have edited the method a little for what I need. Does anyone know a way I can do this?

    public void DrawModel( Camera camera )
    {
        Matrix scaleY = Matrix.CreateScale(new Vector3(1, 2, 1));
        Matrix temp = Matrix.CreateScale(100f) * scaleY * rotationMatrix * translationMatrix * Matrix.CreateRotationY(MathHelper.Pi / 6) * translationMatrix2;
        Matrix[] modelTransforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(modelTransforms);
        if (camera.getDistanceFromPlayer(position+position1) > 3000) return;
        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.World = modelTransforms[mesh.ParentBone.Index] * temp *  worldMatrix;
                effect.View = camera.viewMatrix;
                effect.Projection = camera.projectionMatrix;
            }
            mesh.Draw();
        }
    }

sentences:
OpenGL - can't use glew 3.0 I've been trying to follow a tutorial of glew, but i can't run this glGenVertexArrays, it always leads to a memmory access violation!...

I tried glExperimental = GL_TRUE too, also updated my video card driver 2 times, but it doesn't run.

Btw, there's my code (to TRY to generate a simple triangle):

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;

#include <glew.h>
#include <glfw.h>
#include <glm/glm.hpp>
using namespace glm;

#define GLFW_DLL
//#pragma comment(linker,  "/SUBSYSTEM:WINDOWS")
//#pragma comment(linker, "/ENTRY:mainCRTStartup")

int main()
{

    //glewExperimental = GL_TRUE;

    if(!glfwInit())
    {
        cout << "Failed to load graphics... " << endl;
        return -1;
    }

    GLuint VertexArrayID;
    glGenVertexArrays(1, &VertexArrayID);
    glBindVertexArray(VertexArrayID);

    static const GLfloat g_vertex_buffer_data[] =
    {
        -1.0f, -1.0f,  0.0f,
         1.0f, -1.0f,  0.0f,
         0.0f,  1.0f,  0.0f,
    };

    GLuint vertexbuffer;
    glGenBuffers(1, &vertexbuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);

    glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
    glfwOpenWindowHint(GLFW_VERSION_MAJOR, 3);
    glfwOpenWindowHint(GLFW_VERSION_MINOR, 1);
    //glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwOpenWindowHint(GLFW_OPENGL_PROFILE, 0);

    if(!glfwOpenWindow(1024, 768, 0, 0, 0, 0, 32, 0, GLFW_WINDOW))
    {
        cout << "Failed to open window";
        glfwTerminate();
        return -2;
    }

    glfwSetWindowTitle("IfUSeeingThisMsgTheShitWorked");

    glfwEnable(GLFW_STICKY_KEYS);

    //Main loop
    do
    {
        cout << "happaned";
        glEnableVertexAttribArray(0);
        glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
        glVertexAttribPointer(0,3, GL_FLOAT, GL_FALSE, 0, (void*) 0);

        glDrawArrays(GL_TRIANGLES, 0, 3);
        glDisableVertexAttribArray(0);

        glfwSwapBuffers();

    }while(glfwGetKey(GLFW_KEY_ESC) != GLFW_PRESS && glfwGetWindowParam(GLFW_OPENED));

    return 0;
}

Also, I want to point out that this function doesn't work:

glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

so I had to change it to:

glfwOpenWindowHint(GLFW_OPENGL_PROFILE, 0);

Does it have anything to do with my error? hm.

I'm posting it here, just to make sure that there's no other thing I can do, other than buy a new video card.
I really want to use the modern OpenGL, it is pointless to learn the old one.

sentences: Can you export lighting models directly from 3D application to a real time renderer? is it possible for example to insert lighting in a 3D Model software like 3DSMAX and export an animated model like md5,..etc. and export the lighting too ?

sentences:
(Pacman) Loading 151 dots (picturebox) in form. What's the easy way? I'm making pacman clone for school project and I'm having a bit of a struggle with loading dots into the map. I want to put 151 dots (picturebox) onto a map to a specific location, so that later on I could check if there is collision between Pacman and dots using function intersectWith.

I feel like this isn't really the most friendly way of doing it, but currently I don't have any other idea.

So, how does one put many picturebox on a form (if there is a way), and put them in array where I could check for intersection.

This is just some brief, probably wrong code, how I'm imagining this to work:

for(int i = 0; i < 151; ++i)
{
    dot[i] = Resources.dot;
    drawingArea.Load(dot[i]);
}

Thank you all!

sentences:
Unity 5 Client RPC call: Failed to Invoke ClientRpc I have a Unity 5 client and server running. On the server a path is generated and I want the client to receive the position of each target node on this path. Following the Client RPC calls section here http://docs.unity3d.com/Manual/UNetActions.html I have created the following script:
public class AccessingTargetPos : NetworkBehaviour {

[ClientRpc]
void RpcPosFromServerToGoTo(Vector3 pos)
{
    UnityEngine.Debug.Log ("Going to ... " + pos);
}

public void PrintPath(Vector3 pos)
{
    if (isServer)
    {
        UnityEngine.Debug.Log (pos);
        UnityEngine.Debug.Log("Send Pos ...");
        RpcPosFromServerToGoTo (pos);
        UnityEngine.Debug.Log("Sent!!");

    }
}

}

Both the client and the server have this script, assigned to a game object. However with the above I receive the following in my console:

At the moment all I want is for the client to output the positions received. When I get this I'll move on. I have followed the link, where have I went wrong here?

sentences:
Unused constant buffers in shaders If you define a constant buffer in a shader, for example

cbuffer test : register(c2)
{
    float4x4 data;
}

But never actually use the data in the shader, does that incur any runtime cost at all?
It's convenient for me to do this but not at the cost of slowing runtime performance at all. When I time it I don't see any difference...

sentences:
Unity - DontDestroyOnLoad - FindObjectsOfType(GetType()).Length is always returning 1 I'm trying to have an object with the DontDestroyOnLoad property. I want an object with NetworkIdentity to persist across scenes, so I can have a holder script for RPCs.

This answer suggests the following code:

public void Awake()
{
    DontDestroyOnLoad(this);

    if (FindObjectsOfType(GetType()).Length > 1)
    {
        Destroy(gameObject);
    }
}

Despite this, I still end up with duplicate objects. FindObjectsOfType(GetType()).Length is always returning 1, and I don't know why, or how to fix it. It makes no difference whether this object is a prefab instance or a simple object in the hierarchy.

I have also tried to clone this object in my NetworkManager script, which is automatically persistent, but GameObject.Find("ObjectNameHere(Clone)") is always returning false. However, the above solution seems simpler so I'd prefer to figure out  FindObjectsOfType(GetType()).Length.

sentences:
Anyone have a source for pictures/screenshots/demos of Mud OLC systems? I really want to get access to some images of MUD (multi user domain/multi user dungeon) OLC (mud OnLine Creation), to use the structure of npcs/mobs/characters/areas/rooms that muds use on my own webgame project (http://www.ninjawars.net), which features a near predominant use of text itself.

I've played a mud for years, and experienced the OLC system of that mud first hand, but the mud went under, so I'm looking for

I tried compiling the type of Mud it was from source (ROM 2.4) but haven't been able to accomplish that.

I'm expecting that there are some images of the OLC of items/mobs/etc out there already, but I haven't been able to find any to base my implementation of the same concepts in my game off of.  If there's some live way to get access to a demo of OLC, that would be even better.

sentences: When to use AI prediction in a Fighting Game I am making a fighting game AI that can predict the player's next move using a N gram predictor. Once I have the prediction, when do I use it ? Do I wait till player makes a move and then use the prediction ? What about distance from the player ? How do I make the use of my prediction look realistic ?

sentences:
How to smooth rotations? I have a semi-regularly (15fps to 60fps) sampled source of position and orientation to which I am using dead reckoning to fill in gaps.

However, I would like to smooth it further to eliminate any steps due to dead reckoning error.

The x,y,z can easily be smoothed with a small (3pts?, 5pts?) moving average filter. However, I am unsure of how to approach smoothing the orientation.

I have access to Axis angle representations and a decent Quaternion class that I could possibly build a moving average filter with. It has multiply (operator *) and power (operator ^) which in theory would allow me to effectively average a set of rotations.

Would filtering an axis angle representation work if I simply filtered the 'x','y','z' and 'a' channels and then normalized it?

sentences:
2D Tower Targeting (Tower Defense) so just to be more specific this question isn't in regards to how to target enemies or anything like that rather its purposed towards a specific targeting issue i have with me enemies in its current state.

So the issue im having is that if i fire a bullet towards an enemy and then before that bullet hits the desired enemy it was initially set too, if my tower changes its target then suddenly my bullet does a u-turn and then targets this new enemy. Which isn't what i want.

I'm using C++. I know this is a pointer issue, that my pointer's memory address changes to point at the new enemy which the tower would be facing, the problem is i just don't know how to solve this, personally for me i don't use pointers that much and unfortunately im just not very good at using them it seems :/.
Any help on this issue is greatly appreciated, its been annoying me now for the better part of a few hours, and if anyone could explain what I'm doing wrong here as-well that would be great!
So here's my targeting code

for (int numOfEnemies = 0; numOfEnemies < lib.numberOfEnemies; numOfEnemies++)
{
    float y =  pow(enemies[numOfEnemies].position.y - position.y, 2);
    float x = pow(enemies[numOfEnemies].position.x - position.x, 2);

    if (sqrt(y + x) < range && enemies[numOfEnemies].alive)
    {
        cEnemy =  &enemies[numOfEnemies];
        acquiredTarget = true;
        break;
    }
}

Simple enough, then this is how i'm passing it in my Projectile class;

bullets.push_back(Projectile(bulletPosX, bulletPosY, 8, 8, damage, 1, speed, *cEnemy, currentUpgradeLevel));

Which specifically then uses this constructor;

Projectile::Projectile(float x, float y, int w, int h, int dmg, int type, float mxSpeed, Enemies& bulletTarget, int towerLevel)
{
     position.x = x;
     position.y = y;
     width = w;
     height = h;
     bulletAngle = 0;
     renderingAngle = 0;
     damage = dmg;
     active = true;
     ySpeed = 0;
     xSpeed = 0;
     maxSpeed = mxSpeed;
     typeOfProjectile = type;
     target = &bulletTarget;
}

There you see target is then a pointer to an enemy address, the cEnemy (currentEnemy). What my desired effect would be to have my Projectile store the enemy that I pass into it which then until it hits that enemy, the targeted enemy will forever stay focused on the enemy passed in when the projectile was first created.

Again any help greatly appreciated!

For reference

Enemies = Class Name.
enemies = vector array of active Enemies.

cEnemy = (Pointer to Enemies Object)/Enemies* cEnemy.

sentences:
displaying leaderboard Basically what i wish to ask:
*A game is developed for android platform, is on google store and its leader board (scores etc.) are on Google server.

Can we display the top scores from there on a webpage/website which is on a different server? Yes or No!

sentences:
Momentum-wise accurate player controls in Unity regarding collisions First post here. So I am a newbie to Unity and am willing to create a general character controller script to base my future characters. I understand a character's mechanics are pretty design (UX) dependent and I will need a few varients.

What I want
Momentum-wise accurate physical simulation (as much as game performance allows). Some examples:

If a flying canon-ball hits the player, it shall be crashed or flown away (some parameters would let us kill him in code hopefully) in accord with ball's momentum and player's mass.
If the player hits a stationary canon-ball the ball most-probably wouldn't move (due to friction), yet if they push enough it gains some torque and rolls-over. Rotational and kinetic energy would need equal energy provided.
Multiple player's could act upon a bunch of pieces just for fun.
Regular character capabilities such as stair/ladder climbing, walking, etc.

What I have read so far:

CharacterController needs to write code for desired physics, and apt when not so interactive characters (e.g. first person shooter) are at hand.
Rigidbody is good for non-agent dynamic items (e.g. falling boxes), and is hard to implement for agents (muscle powered humanoids, etc.), though possible.

What I ask
How can I implement such momentum-wise accurate physics (regarding collisions) in Unity engine?

sentences:
Is it feasible to create a blockchain to use as a market place game mechanic without extreme inflation? After watching a fascinating video about block chains, the narrator brought up the idea of using block chains in video games. The example he used was in an MMO type of situation where the player used a sword to defeat a dragon and then the sword became known as Dragon Slayer and its stats would go up and the value of it would increase as well. The player would then sell it to another player who used it to defeat some other powerful monster and it gained more stats and its name changed again. Obviously, it needs to be fine tuned a lot more before it is a feasible idea considering if a sword is owned by say 1000 players then, its description couldn't hold that much information and would need to be limited.

I am thinking of using the block chains similar to the above example except bring it to more of a market place type of mechanic. The player maybe goes through dungeons to defeat monsters. The deeper you go the higher the value of your weapon goes up (stats and gold value) and the higher dungeon you get to the more powerful weapon you will need.

As I think about this concept more I find myself wondering how I could avoid extreme inflation of the in game currency. I'd like to get away from micro-transactions but, I know that is a big tool in helping keep inflation down. (i.e. a second currency). What are some other key ways to keep inflation down in a fast growing in-game economy?

I guess the main thing I see happening is that the balance between the skills earned vs. value earned on a weapon need to be extremely similar so that combat farming doesn't occur in the lower levels but also so that players don't just hold onto the same weapon the whole time they play the game either.

I guess that could be part of the solution but, maybe there are more concrete answers out there that may prevent extreme inflation of in game currencies.

sentences:
add physics to a group or container body in phaser I'm developing a HTML5 Phaser game. In this game I do have a Group which I would like to behavior as a physics body (arcade-physics).

It is a character with a lot of moving parts (sprites) inside this group. In this case the group acts like a container for the sprites.

However I only able do add physics behavior to a sprite.

game.physics.arcade.enable(mySprite); // works good!

Doing the same to a group does not works. it only add physics to children sprites

game.physics.arcade.enable(myroup) // does no works
myGroup.body.(...)  // body is undefined

I would like to create a "virtual" body to this group, mannually set dimensions for it (body.setSize) and add all my sprites inside it. Is that possible in any another way?

sentences:
Need some general direction for turn-based planning AI I'm planning to make a turn-based fleet battle game. While I think I can figure out most of the things I need, I have no idea about the AI handling this sort of game. I need some general direction about how should I deal with it.

None of the things I described below is currently done - except maybe unit movement stuffs.

The combat resembles Frozen Synapse or Steambirds, in which you and your opponent plan their unit's actions and then execute it to see how it resolves. Since the units are naval warships, their movement is restricted by current direction and speed, etc etc. They attack when you order them to do so(not automatic).

I think I can give scores to each move(like Chess AI), depending on its location, direction, possible movement area, known enemy positions and things like that. Then I can use Minimax algorithm to let the AI select the best move.

Now, I'm asking because I can't figure out

which situation should the score be based on. Should the AI make a plan assuming the enemies are all moving straight, predict the best enemy plan based on it, and then write the actual plan based on the prediction? Is it going to demand a lot of processing power? Or is there simpler way using Minimax?
Unlike grid-based tactical games, the area which a unit can move is a (semi-)continual area. If I try to give score to all possible positions, that might take too much processing power. Is there a way to handle this issue neatly?
There might be more efficient/effective alternatives to the Minimax on this particular game which I do not know.

So... i'm asking for general direction about how should I handle the AI. Details will be in when I actually make it.

sentences:
How to integrate Tiled maps and collision detection with pygame? I have been using pygame to make a simple rpg pokemon style game. To create maps I have used the Tiled map editor and then loading them into pygame using pytmx.

I have heard that you can add object layers in Tiled to your map, and then use this information for collision detection within your game engine (in this case pygame). Unfortunately, while I know how to load the tmx file into my pygame game, I have no idea how to use the object layers for collision detection.

Can anyone provide a minimal example on how to do this? The documentation that I have come across for Tiled appears to be quite minimal and still an active work in progress. As a result I have not been able to find information on using Tiled and object layers for collision detection in pygame.

sentences:
Why does my MonoGame mesh throw an unhandled exception when trying to draw? I am using the '3D Models' chapter of Learning XNA 4.0 to further understand 3D implementation in XNA, but I am running into an unhandled exception, when I try to draw each mesh.
Here is my basic Draw() function. It determines the amount of mesh transforms inside my model, and proceeds to draw each one, using a default BasicEffect.
public virtual void Draw(Camera camera)
{
    Matrix[] transforms = new Matrix[model.Bones.Count];
    model.CopyAbsoluteBoneTransformsTo(transforms);

    foreach (ModelMesh mesh in model.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.Projection = camera.projectionMatrix;
            effect.View = camera.viewMatrix;
            effect.World = GetWorld() * mesh.ParentBone.Transform;
        }

        mesh.Draw();
    }
}

When I attempt to run, I get stopped at mesh.Draw();, with the error

An unhandled exception of type 'System.InvalidOperationException' occurred in MonoGame.Framework.dll
Additional information: An error occurred while preparing to draw. This is probably because the current vertex declaration does not include all the elements required by the current vertex shader. The current vertex declaration includes these elements: SV_Position0, TEXCOORD0, COLOR0.

The model was provided by our lecturer. I have confirmed that the model shouldn't have any problems drawing. I have also found a similar issue to the one I am having, on the MonoGame forums, however the user reported having a current vertex declaration that includes "SVPOSITION0, TEXCOORD0, COLOR0", and the solution appeared to be changing "SVPOSITION0" to "SV_Position0".
While I am unsure how to directly change the vertex declaration, it appears I should already have the correct vertex declaration.
Why won't my mesh draw?
If I remove the effect.EnableDefaultLighting() line, it works, no problem. However, I then do not have light, and everything comes up as black. If I replace my ground.x model with the spaceship.x model supplied by Microsoft, it works with lighting. I presume my issue is with my model, however, I can not access spaceship.x to read in plain english, as I can with my ground.x.
Ground.x
xof 0303txt 0032
template Vector
{
    <3d82ab5e-62da-11cf-ab39-0020af71e433>
    FLOAT x;
    FLOAT y;
    FLOAT z;
}

template MeshFace
{
    <3d82ab5f-62da-11cf-ab39-0020af71e433>
    DWORD nFaceVertexIndices;
    array DWORD faceVertexIndices[nFaceVertexIndices];
}

template Mesh
{
    <3d82ab44-62da-11cf-ab39-0020af71e433>
    DWORD nVertices;
    array Vector vertices[nVertices];
    DWORD nFaces;
    array MeshFace faces[nFaces];
    [...]
}

template Coords2d
{
    <f6f23f44-7686-11cf-8f52-0040333594a3>
    FLOAT u;
    FLOAT v;
}

template MeshTextureCoords
{
    <f6f23f40-7686-11cf-8f52-0040333594a3>
    DWORD nTextureCoords;
    array Coords2d;
    textureCoords[nTextureCoords];
}

Mesh
{
     4;
     65536.00000;0.000000;-65536.00000;,
     -65536.00000;0.000000;-65536.00000;,
     -65536.00000;0.000000;65536.00000;,
     65536.00000;0.000000;65536.00000;;
     2;
     3;0,1,2;,
     3;0,2,3;;

    MeshTextureCoords
    {
         4;
         0.000000;0.000000;,
         0.000000;1024.000000;,
         1024.000000;1024.000000;,
         1024.000000;0.000000;;
    }

    MeshMaterialList
    {
        1;
        2;
        0,
        0;

        Material
        {
            0.800000;0.800000;0.800000;1.000000;;
            0.000000;
            0.000000;0.000000;0.000000;;
            0.000000;0.000000;0.000000;;

            TextureFilename{"sanddf.png";}
        }
    }
}

sentences:
Make a light only affect one object I'm wondering if it's possible to make a light source only affect one object? I know that it's possible to use layers and culling mask, but then I would need one layer for every single object which is not possible.

Is there a way for example that I could make only children or siblings be affected by a light source? Or other solution?

Have a nice day!

Update #1:

sentences:
What causes aliasing? I always hear about aliasing and anti-aliasing and I know what it looks like but what I don't understand is what causes it. Is it a physical phenomenon? Or a numerical one?

If it helps to explain, I have some programming knowledge, but not in video games or graphics.

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:
Octree subdivision problem Im creating octree manually and want function for effectively divide all nodes and their subnodes - For example - I press button and subnodes divided - press again - all subnodes divided again.
Must be like - 1 - 8 - 64. The problem is - i dont understand how organize recursive loops for that.

OctreeNode in my unoptimized implementation contain pointers to subnodes(childs),parent,extra vector(contains dublicates of child),generation info and lots of information for drawing.

class gOctreeNode
            {
   //necessary fields
    gOctreeNode* FrontBottomLeftNode;
    gOctreeNode* FrontBottomRightNode;
    gOctreeNode* FrontTopLeftNode;
    gOctreeNode* FrontTopRightNode;
    gOctreeNode* BackBottomLeftNode;
    gOctreeNode* BackBottomRightNode;
    gOctreeNode* BackTopLeftNode;
    gOctreeNode* BackTopRightNode;
    gOctreeNode* mParentNode;
    std::vector<gOctreeNode*> m_ChildsVector;
    UINT mGeneration;
    bool mSplitted;
    bool isSplitted(){return m_Splitted;}

    .... //unnecessary fields
    };

DivideNode of Octree class fill these fields, set mSplitted to true, and prepare for correctly drawing. Octree contains basic nodes(m_nodes). Basic node can be divided, but now I want recursivly divide already divided basic node with 8 subnodes. So I write this function.

    void DivideAllChildCells(int ix,int ih,int id)
    {
        std::vector<gOctreeNode*> nlist;
        std::vector<gOctreeNode*> dlist;

        int index = (ix * m_Height * m_Depth) + (ih * m_Depth) + (id * 1);//get index of specified node
        gOctreeNode* baseNode = m_nodes[index].get();

        nlist.push_back(baseNode->FrontTopLeftNode);
        nlist.push_back(baseNode->FrontTopRightNode);
        nlist.push_back(baseNode->FrontBottomLeftNode);
        nlist.push_back(baseNode->FrontBottomRightNode);
        nlist.push_back(baseNode->BackBottomLeftNode);
        nlist.push_back(baseNode->BackBottomRightNode);
        nlist.push_back(baseNode->BackTopLeftNode);
        nlist.push_back(baseNode->BackTopRightNode);

        bool cont = true;
        UINT d = 0;//additional recursive loop param (?)
        UINT g = 0;//additional recursive loop param (?)

        LoopNodes(d,g,nlist,dlist);

        //Divide resulting nodes
        for(UINT i = 0; i < dlist.size(); i++)
        {
            DivideNode(dlist[i]);
        }
    }

And now, back to the main question,I present LoopNodes, which must do all work for giving dlist nodes for splitting.

    void LoopNodes(UINT& od,UINT& og,std::vector<gOctreeNode*>& nlist,std::vector<gOctreeNode*>& dnodes)
    {
        //od++;//recursion depth
        bool f = false;

        //pass through childs
        for(UINT i = 0; i < 8; i++)
        {
            if(nlist[i]->isSplitted())//if node splitted and have childs
            {
                //pass forward through tree
                for(UINT j = 0; j < 8; j++)
                {
                    nlist[j] = nlist[j]->m_ChildsVector[j];//set pointers to these childs
                }
                LoopNodes(od,og,nlist,dnodes);
            }
            else //if no childs
            {
                //add to split vector
                dnodes.push_back(nlist[i]);
            }
        }
    }

This version of loop nodes works correctly for 2(or 1?) generations after - this will not divide neightbours nodes, only some corners. I need correct algorithm.
Screenshot

All I need - is correct version of LoopNodes, which can add all nodes for DivideNode.

sentences: Do editor errors affect device performance? Do errors that come up in the Unity editor affect a game's performance on a device (on Android in particular)?  I'm talking about errors that keep coming continuously during Update() such as NullReferenceException  and "Debug.Log".

sentences:
What causes this z position change? This is a follow-up on the following thread.

I'm applying a code that will move an object just outside the camera's frustum.
I have used the same code in other projects, and it worked fine.

However, I'm using it with URP now, and I'm experiencing a z-position change while I expected only a x position change.

And I just don't see why it does that.

I have recorded a video here.

If I press the button, the cube should be moved to the left only. But it also moves to the back (z position).

And this is the script that I have applied to the cube in the video:

using System;
using UnityEngine;

public class PlaceOutsideCamera : MonoBehaviour
{
     public void PlaceOutsideFrustum(Transform uTransform, bool uLeft)
    {
        uTransform.position = pPlaceOutsideFrustum(uTransform, uLeft);
    }
    public static Vector3 pPlaceOutsideFrustum(Transform uTransform, bool uLeft)
    {
        var frustumPlanes = GeometryUtility.CalculateFrustumPlanes(Camera.main);
        Ray ray;
        Plane plane;

        if (uLeft)
        {
            // 1.
            ray = Camera.main.ScreenPointToRay(new Vector3(0, Camera.main.pixelHeight / 2f, 0));
            plane = frustumPlanes[0];
        }
        else
        {
            ray = Camera.main.ScreenPointToRay(new Vector3(Camera.main.pixelWidth - 1, Camera.main.pixelHeight / 2f, 0));
            plane = frustumPlanes[1];
        }

        float fDistance = Mathf.Abs(Camera.main.transform.position.z - uTransform.position.z);

        // 2.
        var borderPoint = ray.GetPoint(fDistance);

        // 3.
        var frustumOutside = -plane.normal;

        Bounds b = BoundsFromTransform(uTransform);
        // 4.
        var halfDiameter = b.size.magnitude / 2f;

        return borderPoint + frustumOutside * halfDiameter;
    }
    public static Bounds BoundsFromTransform(Transform uTransform)
    {
        try
        {
            Bounds bounds = new Bounds(uTransform.position, Vector3.zero);//wir hätten auch einfach new Bounds() nehmen können, meint Manfredas

            foreach (Renderer renderer in uTransform.GetComponentsInChildren<Renderer>())
            {
                bounds.Encapsulate(renderer.bounds);
            }

            Vector3 nOff = bounds.center - uTransform.position;

            return new Bounds(nOff, bounds.size);
        }
        catch (Exception ex)
        {
            UnityEngine.Debug.Break();
            return new Bounds();
        }
    }
    public void OnGUI()
    {
        if (GUI.Button(new Rect(0, 350, 100, 50), "DoThis!"))
        {
            pDoThis();
        }
    }
    private void pDoThis()
    {
        this.PlaceOutsideFrustum(this.transform, true);
    }

}

Can anybody tell me why my code does this? I just don't see it.
Thank you very much for the help!

Edit: Here is another video that shows the camera position in the Inspector.

sentences: Can you recommend a 2D game engine compatible with Windows Phone? I'm curious what people are using to develop games for the Windows Phone (or XNA in general). I have come across a few engines but for the most part they don't seem to be actively maintained. If you are using an engine which you think does the job well please recommend it below.

sentences: How to select a sprite with the mouse in c# XNA? I'm attempting to create a chess game, for the movement I need to be able to click on a piece with the mouse, and then the square I'd like to move it to. Each piece on the board is a sprite, and I'm struggling to find a way to select a sprite in order to then move it, what would be the best way to do this? I'm programming in c# with XNA framework btw. Thanks in advance :)

sentences:
How to calculate the stopping distance of a wheel collider? I have an 'AI' bus in my game that needs to pull over occasionally at a bus stop. What I want to do is change the acceleration and brake force based on the stopping distance of the bus. I don't want to simply use the distance between the bus stop and the bus because each time the bus pulls over, it could be traveling at a different speed.

Right now it uses the distance between the bus stop and the bus. It doesn't really work well though because if a bus is traveling faster, it will take a longer distance to stop and will likely go past the bus stop. Same thing if it were going slower.

How do I calculate the stopping distance my bus will take to come to a complete stop?

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:
Separating part of mesh facing upwards I really hope you can help me fix this code:
List<Vector3> verticesToExport = new List<Vector3>();//vertices of the triangles facing upwards.
        List<int> trianglesToExport = new List<int>();//new triangle facing upwards.
        //meshToCut is the original mesh, then I just try to replace it with the new data.
        int[] triangles = meshToCut.triangles;
        Vector3[] vertices = meshToCut.vertices;

        for (int i = 0; i < triangles.Length; i += 3)
        {
            Vector3 corner = vertices[triangles[i]];
            Vector3 a = vertices[triangles[i + 1]] - corner;
            Vector3 b = vertices[triangles[i + 2]] - corner;

            float projection = Vector3.Dot(Vector3.Cross(b, a), Vector3.down);
            if (projection > 0f)
            {
                verticesToExport.Add(vertices[triangles[i]]);
                verticesToExport.Add(vertices[triangles[i + 1]]);
                verticesToExport.Add(vertices[triangles[i + 2]]);
                trianglesToExport.Add(triangles[i]);
                trianglesToExport.Add(triangles[i + 1]);
                trianglesToExport.Add(triangles[i + 2]);
            }
        }
        meshToCut.SetVertices(verticesToExport);
        meshToCut.SetTriangles(trianglesToExport, 0);//probably I'm doing wrong here!

It works great by retrieving the vertices facing up, and I guess the triangles too but when I put it into a mesh filter I believe the triangles are not in order...
1.The model I'm trying to separate; the triangles facing upwards.

2. This is what happens if I just take the vertices and triangulate them again. It proves that vertices are alright!

3. The result I get from the code above:

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:
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:
How can I reflect a point about a line in Unity? I am drawing a line using the line renderer in the following way:

public class MyLineRenderer : MonoBehaviour {
LineRenderer lineRenderer;

public Vector3 p0, p1;

// Use this for initialization
void Start () {
  lineRenderer = gameObject.GetComponent<LineRenderer>();
  lineRenderer.positionCount = 2;

  lineRenderer.SetPosition(0, p0);
  lineRenderer.SetPosition(1, p1);

}

}

From the image below, the line P0P1 is known and so is point A. How can a point B, which is the reflection of A about the line P0P1 be found?

sentences:
What is the role of tessellation in terrain? I'm relatively new to graphically programming and I've been looking into ways to render larger heightened terrain. I keep seeing comments directing me to disregard things such as geometry clipmaps, in favor of tessellation.

From what I've read however, tessellation adds inner and outer triangles between a set of vertices. So from what I understand, you would lose the 1 to 1 relationship between height points and vertices. Additionally, the new vertices would be interpolated and therefore somewhat similar looking between points of similar height.

Is this the case or is there something I'm missing.  Is tessellation exclusively the way to go or can it (/should it) be combined with other techniques?

sentences:
How do I model / diagram turn-based combat? I'm developing a turn-based combat system for an RPG, and I'd like to know if there is any kind of best practice around diagrammatically modelling something like this.

The ideal modelling paradigm would capture quite a few things, including:

entities (and their stats/status)
entity actions / interactions
positioning
terrain effects
temporal effects

Do I use something from UML? BPMN? A combination? Do I home-bake something?

To clarify: I'm not looking for any advice on designing the system. I'm already quite far along with that. I'm looking for a good way to diagram the model.

sentences: XNA project won't target .NET 4.0 I am trying to reference the System.Threading.Task assembly. If I am not mistaken, it should be part of mscorlib. But no matter what I do, my project always defaults to the .net 2.0 runtime. Even if I create a brand new XNA 4.0 Windows Phone project, it wants to use the .net 2.0 runtime. Any ideas what I could be missing?

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:
Rectangles clear each other when moving on canvas I am having this problem after moving rectangles, they seem to delete one another.
Most probably it is a problem with clearRect(...) method.
This is the clean function I am using:

clean: function(element){
        // All default values clean all the screen
        if(typeof element.x === 'undefined'){
            element.x = 0;
        }

        if(typeof element.y === 'undefined'){
            element.y = 0;
        }

        if(typeof element.width === 'undefined'){
            element.width = canvas.width;
        }

        if(typeof element.height === 'undefined'){
            element.height = canvas.height;
        }

        // In case values are entered
        if(element.type === 'rectangle'){
            ctx.clearRect(element.x,element.y,element.width,element.height);
        }
    }

This is the rendering

rect: function(element){
    // Check if color is defined
    if(typeof element.color === 'undefined'){
        element.color = 'black';
    }
    else{
        ctx.fillStyle = element.color;
    }

    // Draw the rectangle
    ctx.fillRect(element.x,element.y,element.width,element.height);
}

sentences:
Slick2d Particles loading xml returning null I've made a particle class that creates a particle of Slick2d library, but the XML file doesn't want to load , it keeps giving me null error. I gave it the path as I do for everything but it refuses to work and its been like this for days I just cant get it to open that XML file. If anyone can help me it would be much appreciated.

try {
        particleImage = new Image("res/particles/particle.png", false);
        system = new ParticleSystem(particleImage,1500);

        //load the xml file and add the emitter to the system
        File xmlFile = new File("res/particles/bloodDown.xml");
        ConfigurableEmitter emitter = ParticleIO.loadEmitter(xmlFile);
        emitter.setPosition(315, 358);
        system.addEmitter(emitter);
    } catch (Exception e) {
        System.out.println("Exception: " +e.getMessage());
        e.printStackTrace();
        System.exit(0);
    }

Entire particle class : http://pastebin.com/rBR0xpE7

Particle manager class : http://pastebin.com/N8gNFk6W

Slick 2d documentation : http://www.slick2d.org/javadoc/

My structure of workspace:

sentences:
How should I handle "real time" events in an online strategy game? Some online strategy games have real time events. For example when you send troops to attack somewhere, the attack happens at the right time in the future. Checking the database again and again to get the list of attacks happening each second would cause heavy load. Is there any technique to achieve this goal?

Another example: You want to attack a village 3 hours away, you send troops and the attack occurs 3 hours later. Should there be an script to check the database at each second to run the query at the specified time?

sentences:
Realistic Camera/Screen Shake from Explosion I'd like to shake the camera around a bit during an explosion, and I've tried a few different functions for rocking it around, and nothing seems to really give that 'wow, what a bang!' type feeling that I'm looking for. I've tried some arbitrary relatively high frequency sine wave patterns with a bit of linear attenuation, as well as a square wave-type pattern. I've tried moving just one axis, two, and all three (although the dolly effect was barely noticeable in that case).

Does anyone know of a good camera shaking pattern?

sentences:
Diamond Isometric Tile Picking C# Xna I recently converted the display style of a isometric map from staggered to diamond and I can't figure out the tile picking process.
I'm well aware of the other existing threads regarding this subject and I read all of them but I haven't figured out a solution (my concentration these days is a mess)
I'm using a very basic system which consists of passing through all tiles and pick the one where the mouse points at (something like this Map.Tile.Intersects(mouse.Rect) ) and then with the help of a color map I pick the correct tile.
But I don't like this system because is pretty inefficient compared to some mathematic solutions I saw and didn't understand.
So here is the code I use to create the map :

                int x = 128 * j;
                int y = 64 * i;
                int isoX = (6 * 64) + (x - y);
                int isoY = (x + y) / 2;

128 is the tileWidth , 64 tileHeight and 6 * 64 is the xOffset

And the coordinates are like this :

Can somebody give me some hints or explain what I should do ?
Thank you.

sentences: Multiplayer game with Cocos2d-Javascript and Node.js It is possible to make a multiplayer browser based game using cocos2d-javascript + node.js? If so, is there any tutorial about that?

sentences:
Trees swaying in the wind using Tilemap I am working on a top-down, tile-based game (think 2D RPG). However, I would like to have trees that sway in the wind and shake a little if the player bumps into them!
How should I approach this? Is it achievable with trees that are composed of tiles and part of a tilemap?
Or should I exclude my trees from the tilemap and turn them into game objects instead?
If I were to turn them into separate game objects, would I then manually tweak their rotation/position to achieve the sway and shake, or is there some form of shader I can use?

sentences:
Missing shadow: why? In these scene, i can't figure why, my player, and object it place, can't cast shadow on floor.

All other static objects in scene cast shodow correctly.

There is a floor with it's material, then there is also a Reflection probe.

Is Reflection Probe something that influence shadow cast correctly ?

Follow, floor proprieties

Floor material proprieties:

My Lights:

My scene:

sentences:
How to position a Weapons model in a first person shooter with XNA I am building a first person shooter and positioning the weapons is hard. I am trying to get the bat to look like you are holding it but I keep trying things and they don't appear in the positions I want them to be in. Here is what I did with one version of the function.

void DrawModelModel(Model model, Matrix world)
    {
        Vector3 modelPosition = Vector3.Zero;
        float modelRotation = 0.0f;
        Viewport viewport = graphics.GraphicsDevice.Viewport;
        float aspectRatio = (float)viewport.Width / (float)viewport.Height;
        // Set the position of the camera in world space, for our view matrix.
        Vector3 cameraPosition = new Vector3(0.0f, 0.0f, 200.0f);
        // Copy any parent transforms.
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(transforms);

        // Draw the model. A model can have multiple meshes, so loop.
        foreach (ModelMesh mesh in model.Meshes)
        {
            // This is where the mesh orientation is set, as well
            // as our camera and projection.
            foreach (BasicEffect effect in mesh.Effects)
            {

                effect.World = transforms[mesh.ParentBone.Index] *
                    Matrix.CreateRotationY(modelRotation)
                    * Matrix.CreateFromYawPitchRoll(0.0f, 1.0f, 1.0f);
                effect.View =  Matrix.CreateLookAt(cameraPosition,
                    Vector3.Zero, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.ToRadians(35.0f), aspectRatio,
                    1.0f, 10000.0f) ;
            }
            // Draw the mesh, using the effects set above.
            mesh.Draw();
        }
    }

Here is what I did with a different version of the function.

void DrawModelModel(Model model, Matrix world)
    {
        Vector3 modelPosition = Vector3.Zero;
        float modelRotation = 0.0f;
        Viewport viewport = graphics.GraphicsDevice.Viewport;
        float aspectRatio = (float)viewport.Width / (float)viewport.Height;
        // Set the position of the camera in world space, for our view matrix.
        Vector3 cameraPosition = new Vector3(0.0f, 0.0f, 200.0f);
        // Copy any parent transforms.
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(transforms);

        // Draw the model. A model can have multiple meshes, so loop.
        foreach (ModelMesh mesh in model.Meshes)
        {
            // This is where the mesh orientation is set, as well
            // as our camera and projection.
            foreach (BasicEffect effect in mesh.Effects)
            {

                effect.World = transforms[mesh.ParentBone.Index] *
                    Matrix.CreateRotationY(modelRotation)
                    * Matrix.CreateFromYawPitchRoll(0.0f, 1.0f, 1.0f);
                effect.View =  Matrix.CreateLookAt(cameraPosition,
                    Vector3.Zero, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveOffCenter(-2.0f,1.0f, 0.0f, 1.0f, 1.0f, 10000.0f) ;
            }
            // Draw the mesh, using the effects set above.
            mesh.Draw();
        }
    }

What matrix can I use to get the bat model to appear realistically as if you are really holding it in a first person view. I am new to matrices so my knowledge of them is basic. What matrix should I use or what parameters with my current matrix should I be editing? I am thinking the projection matrix is what I need to be editing, but I am very confused at this point. Any help would be great.

sentences:
Get MouseUp event outside of Sceneview scene window? So I have an editor script that uses a dragging operation which works quite nicely.  Except, if you release the button while OUTSIDE the Scene Window, the event doesn't register.
How do I detect mouseup outside of the scene window?
private static void OnScene(SceneView sceneview)
{
    Event e = Event.current;
    if (e.type == EventType.MouseDrag)
    {
        //do some drag stuff
        e.Use();
    }

    if (e.type == EventType.MouseUp && e.button == 1)
    {
        //is the Right Mouse button released?
    }
}

I suspect somehow it's due to my Event e being inside the OnScene making the mouse actions only existing in the context of the Scene Window perhaps?  I have no idea, very new to Editor scripting...

sentences:
Execute a function for ten seconds and disable it for two seconds I have a particular function which I am calling in Update function.
For the first ten seconds, the function should get called in Update function, then it should get disabled for next two seconds, then again enable it for next ten seconds. This cycle should keep repeating? How can I execute it?

sentences:
DX11 CreateTexture2D When i want to load texture i can either call
CreateTexture2D without passing pointer to texture content passing Default usage and call UpdateSubResource

or

CreateTexture2D with pointer to texture content passing Immutable or Default as usage.

In first case texture is uploaded to GPU, in seconds case it is also backed to RAM. IIRC it is a so called Managed Pool that help with device loss, but i have hand-made mechanism to handle device loss, i don't want DX to consume pretty big amount of RAM for nothing.

I would be easy to stick with 1st option, but if i call UpdateSubResource from BG thread it sometimes crashes (because it uses ImmediateContext that is used on render thread).

Is there any way to tell DX11 not to copy textures to RAM on CreateTexture2D?

sentences: Model mesh overlapping while animating in Unity but not in Blender I made an FPS model in blender and created reload animation when I imported that model in Unity I saw that while the magazine ejecting from the rifle it overlapped some of the gun parts. Then I went back to the blender and changed some keyframes and positions in the blender but in Unity, it showed me the same problem. I tried many times it looks fine in the blender but in the Unity, it has the same problem.

sentences:
What is Vulkan and how does it differ from OpenGL? Khronos Group (the standards body behind OpenGL) has just announced Vulkan:

  Vulkan is the new generation, open standard API for high-efficiency access to graphics and compute on modern GPUs. This ground-up design, previously referred to as the Next Generation OpenGL Initiative, provides applications direct control over GPU acceleration for maximized performance and predictability.

Their page is quite marketese/jargon-heavy, as is the press release… In simple terms, what does Vulkan mean to game developers? (Gabe Newell is quoted as being strongly in favour, without further explanation.)

What exactly is Vulkan's relationship to OpenGL? Its previous name "glNext" (short for "Next Generation OpenGL Initiative") makes it sound like a replacement.

Update: The Vulkan 1.0 spec was released on 16-02-2016.

sentences:
How can I get a 2D texture to rotate like a compass in XNA? I'm working on a small maze puzzle game and I'm trying to add a compass to make it somewhat easier for the player to find their way around the maze. The problem is: I'm using XNA's draw method to rotate the arrow and I don't really know how to get it to rotate properly. What I need it to do is point towards the exit from the player's position, but I'm not sure how I can do that.

So does anyone know how I can do this? Is there a better way to do it?

sentences:
List has no value after adding values in I am creating a a ghost sprite that will mimic the main sprite after 10 seconds of the game. I am storing the users movements in a List<string> and i am using a foreach loop to run the movements. The problem is when i run through the game by adding breakpoints the movements are being added to the List<string> but when the foreach runs it shows that the list has nothing in it. Why does it do that? How can i fix it?

this is what i have:

public List<string> ghostMovements = new List<string>();

    public void UpdateGhost(float scalingFactor, int[,] map)
    {

        // At this foreach, ghostMovements has nothing in it
        foreach (string s in ghostMovements)
        {
            // current position of the ghost on the tiles
            int mapX = (int)(ghostPostition.X / scalingFactor);
            int mapY = (int)(ghostPostition.Y / scalingFactor);

            if (s == "left")
            {
                switch (ghostDirection)
                {
                    case ghostFacingUp:
                        angle = 1.6f;
                        ghostDirection = ghostFacingRight;
                        Program.form.direction = "";
                        break;

                    case ghostFacingRight:
                        angle = 3.15f;
                        ghostDirection = ghostFacingDown;
                        Program.form.direction = "";
                        break;

                    case ghostFacingDown:
                        angle = -1.6f;
                        ghostDirection = ghostFacingLeft;
                        Program.form.direction = "";
                        break;

                    case ghostFacingLeft:
                        angle = 0.0f;
                        ghostDirection = ghostFacingUp;
                        Program.form.direction = "";
                        break;

                }
            }
        }
    }

    // The movement is captured here and added to the list
    public void captureMovement()
    {
        ghostMovements.Add(Program.form.direction);
    }

EDIT:

    // Ghost is the name of the class that creates the ghost sprite
    // as well as where captureMovement() is in.
    Ghost ghost = new Ghost();

    // This update is in a class named turtle
    public void Update(float scalingFactor, int[,] map)
    {
        // current position of the turtle on the tiles
        int mapX = (int)(turtlePosition.X / scalingFactor);
        int mapY = (int)(turtlePosition.Y / scalingFactor);

        //The rest of the code that contains the captureMovement method being called
        //looks the same as the if statement with just different directions.
        if (Program.form.direction == "left")
        {
            ghost.captureMovement();
            switch (turtleDirection)
            {
                case turtleFacingUp:
                    angle = 1.6f;
                    turtleDirection = turtleFacingRight;
                    Program.form.direction = "";
                    break;

                case turtleFacingRight:
                    angle = 3.15f;
                    turtleDirection = turtleFacingDown;
                    Program.form.direction = "";
                    break;

                case turtleFacingDown:
                    angle = -1.6f;
                    turtleDirection = turtleFacingLeft;
                    Program.form.direction = "";
                    break;

                case turtleFacingLeft:
                    angle = 0.0f;
                    turtleDirection = turtleFacingUp;
                    Program.form.direction = "";
                    break;

            }
        }
    }

    // This update is in the game1 class (main class)
    protected override void Update(GameTime gameTime)
    {
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        turtle.Update(scalingFactor, map);
        ghost.UpdateGhost(scalingFactor, map);

        base.Update(gameTime);
    }

sentences:
Javascript Canvas Drawing Efficiency I have just recently started some experiments with game development in Javascript/HTML5, and so far it has been going pretty well.  I have a simple test scene running with some basic input handling, and a hundred-ish drawImage() calls with a few transforms.  This all runs great on Chrome, but unfortunately, it already chugs on Firefox.  I am using a very large canvas ( 1920 x 1080 ), but it doesn't seem like I should be hitting my limit already.  So on that note, I was hoping to ask a few questions:

1) What exactly is done on the CPU vs. the GPU in terms of canvas and drawImage()?  I'm afraid the answer is probably "it depends on the browser", but can anybody give me some rules of thumb?  I naively imagined that each drawImage call results in a textured quad on the GPU with the canvas effectively being a render target, but I'm wondering if I'm pretty far off base there...

2) I have seen posts here and there with people saying not to use the translate(), rotate(), scale() functions when drawing on the canvas.  Am I adding a lot of overhead just by adding a translate() call, as opposed to passing in the x,y to drawImage()?  Some people suggest using "transate3d", etc., which are CSS properties, but I'm not sure how to use them within a scene.  Can they be used for animated sprites within a single canvas?

3) I have also seen a lot of posts with people mentioning that pre-building canvases and then re-using them is a lot faster than issuing all the individual draw calls again.  I am guessing that my background should definitely be pre-built into a canvas, but how far should I take this?  Should I maintain an individual canvas for each sprite, to cache all static image data when not animating?

Thank you much for your advice!

sentences:
How to calculate delta-time on Android? How do I calculate the time between frames on Android? I'm using this for the thread:

public class GameThread extends Thread
{
  private int FPS = 30;
  private double averageFPS;
  private SurfaceHolder surfaceHolder;
  private Game gamePanel;
  public boolean running;
  public static Canvas canvas;
  public static double deltaTime;

  public GameThread(SurfaceHolder surfaceHolder, Game gamePanel) {
    super();
    this.surfaceHolder = surfaceHolder;
    this.gamePanel = gamePanel;
  }

  @Override
  public void run() {
    long startTime;
    long timeMillis;
    long waitTime;
    long totalTime = 0;
    int frameCount =0;
    long targetTime = 1000/FPS;

    while(running) {
      startTime = System.nanoTime();
      canvas = null;

      //try locking the canvas for pixel editing
      try {
        canvas = this.surfaceHolder.lockCanvas();
        synchronized (surfaceHolder) {
          this.gamePanel.tick();
          this.gamePanel.render(canvas);
        }
      } catch (Exception e) {
      } finally {
        if(canvas!=null)
        {
          try {
            surfaceHolder.unlockCanvasAndPost(canvas);
          } catch(Exception e){
            e.printStackTrace();
          }
        }
      }

      timeMillis = (System.nanoTime() - startTime) / 1000000;
      waitTime = targetTime-timeMillis;

      try{
        sleep(waitTime);
      } catch (Exception e) {
      }

      deltaTime = waitTime;
      totalTime += System.nanoTime() - startTime;
      frameCount++;
      if(frameCount == FPS)
      {
        averageFPS = 1000/((totalTime/frameCount)/1000000);
        frameCount =0;
        totalTime = 0;
        System.out.println(averageFPS);
      }
    }
  }

  public void setRunning(boolean b)
  {
    running=b;
  }
}

I tried doing it like in normal Java, but it didn't work (it only lead to a crash).

sentences:
Random Disconnects on UNET Using UNET, I can't host a game for more than a few minutes unless both server and client are on the same computer. It appears that I am not alone in this.

Essentially, any latency problems or packet loss triggers an immediate disconnect. Rather than just getting lag, the client gets booted.

Does anyone know how this could be dealt with?

sentences:
Time loop/ticking architecture Say I build a snooker game, where balls need to jitter around.

Balls belong to a class (ball class), where all the ball functions are defined.

In the animation, time evolves by a clock ticking within a time loop.

I wonder if the clock function/time loop should be optimally defined in the main program or the class file?

If defined in the class, the advantage is that all functions regarding ball movements, collisions etc, which take time to happen, can be put in the class, without worrying about the time loop; the disadvantage is that time will tick for every ball separately, which obviously looks bad.

sentences:
Question regarding irradiance I know that the formula for irradiance at surface point p with normal n given a point light source at position l is:

H = I(cos x) / ||l - p||^2

Where:

x = angle between n and l-p
I() = Intensity of light

But if I have an area light source defined by a polygon P, what is the formula for irradiance?

sentences: Load character animation on button press - Unity3D I am new to Unity3D and I am going to develop a  simple animation application. There is a human character and there are three button Eg:- "jump", "down" , "roll", I want to bind the animation files with the human character once the player presses the corresponding button. I need your help to know that what are the steps that I need to follow...let me know if anyone has good reference, thank you very much...

sentences:
Composing Neo Geo music I was listening to some of Neo Geo game music on Youtube the other day and it made me think about creating new music in this style.

If I wanted to make a retro-style game today, how would I compose/sequence new music to make it sound like a Neo Geo game?

sentences: How to build Arena-ish level using grid tiles? I had an idea of procedurally generating arena-type levels in which the player would either fight hordes of enemies, or another skilled opponent. The level would be built at the very start of the layout, and will have a layout similar to those in Quake Live; Pickups, enemy spawners, etc. What would be the best way to achieve this?

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:
Creating a hexagonal wraparound map I'm trying to create a wraparound map for a hexagonal map, so when you exit a tile on one side of the big hexagon-shaped map, you enter a tile on the other side.

Example image from Red Blob Games article on Hexagonal Grids.

In the image, the pale tan hexagonal chunk in the center is our map. The greenish/reddish chunks around it are shifted copies of the same map. If we stand on the blue tile under the cursor and walk off the main map into the green copy to the right, that's the same as wrapping around our map to the corresponding point on the other side: here, walking from the blue tile in the lower-right-hand red copy into the bottom-right corner of the center map.

I used an approach with a lookup table first. But as soon as those maps get too big, the lookup tables get even bigger. I'm searching for a solution which works without a lookup table.

sentences:
Game Input for Single Actions So I'm not 100% sure what you would call this type of keypress, but it is essentially a keyTyped event but in reverse order. Instead of being triggered when the button is released, it is triggered when the button is first pressed, but can't be triggered again until the button is released and pressed again.

Right now I have events for buttonDown and buttonUp and I also have two HashMaps to keep track of the currentInput and previousInput of each action in the game (jumping, moving, crouching, etc...) How can I provide a function that when called returns true for this type of button push?

sentences:
How can I make that also the yradius values will change when the flag is true? In this part when I'm changing the xradius slider it's also changing the yradius slider at the same time and same value. But I can't change the yradius when trying to change it's slider. I want to be able either change the xradius or yradius when the flag is true. Both will change to the same values but I want to be able to change also the yradius so it will change the xradius.

if (changeBothRadius)
        {
            yradius = xradius;
            xradius = yradius;
        }

I tried to add the xradius = yradius; but it's not working only when changing the xraiuds it's working.

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

[RequireComponent(typeof(LineRenderer))]
public class DrawCircle : MonoBehaviour
{
    [Range(0, 50)]
    public int segments = 50;
    [Range(1, 50)]
    public float xradius = 5;
    [Range(1, 50)]
    public float yradius = 5;
    public bool changeBothRadius = false;
    [Range(0.1f, 2)]
    public float lineThickness = 0.1f;
    public bool minimumRadius = false;

    private LineRenderer line;
    private List<float> radiusList = new List<float>();

    void Start()
    {
        line = gameObject.GetComponent<LineRenderer>();
        line.positionCount = segments + 1;
        line.useWorldSpace = false;
        CreatePoints();
    }

    void Update()
    {
        line.startWidth = lineThickness;
        line.endWidth = lineThickness;
        CreatePoints();
    }

    void CreatePoints()
    {
        if (changeBothRadius)
        {
            yradius = xradius;
            xradius = yradius;
        }

        float x;
        float z;

        float angle = 20;

        for (int i = 0; i < (segments + 1); i++)
        {
            x = Mathf.Sin(Mathf.Deg2Rad * angle) * xradius;
            z = Mathf.Cos(Mathf.Deg2Rad * angle) * yradius;

            line.SetPosition(i, new Vector3(x, 0, z));

            angle += (360f / segments + 1);
        }
    }
}

sentences:
Detect collision from a particular side I'm making a platform sidescrolling game. All I want to do is to detect if my character is on the floor:

function OnCollisionStay (col : Collision){
    if(col.gameObject.tag == "Floor"){
        onFloor = true;
    } else {onFloor = false;}
}
function OnCollisionExit (col : Collision){
    onFloor = false;
}

But I know this isn't the accurate way. If I hit a cube with a "floor" tag, in the air (no matter if with the character's feet or head) I would be able to jump.

Is there a way to use the same box collision to detect if I'm touching something from a specific side?

sentences: New to creating AI - where to start? I am new to game programming and am trying to make a basic 2d top-down space game with 2 space ships that fight each other.  I am doing well with the user controlled space ship, but have no idea how to even start programming an AI.  Are certain methods/patterns better for this situation?  Where would I even begin?

sentences:
How do I load graphical resources asynchronously? Let's think platform-agnostic: I want to load some graphical resources while the rest of the game is running.

In principle, I can load the actual files on a separate thread, or using async I/O. But with graphical objects, I will have to upload them to the GPU, and that can (usually) only be done on the main thread.

I can change my game loop to look something like this:

while true do
    update()
    for each pending resource do
        load resource to gpu
    end
    draw()
end

while having a separate thread load resources from disk to RAM.

However, if there are many big resources to load, this could cause me to miss a frame deadline and eventually get dropped frames. So I can change the loop to this:

while true do
    update()
    if there are pending resources then
        load one resource to gpu
        remove that resource from the pending list
    end
    draw()
end

Effectively loading only one resource per frame. However, if there are many small resources to load, loading all of them will take many frames, and there will be a lot of wasted time.

Optimally, I would like to time my loading in the following manner:

while true do
    time_start = get_time()
    update()
    while there are pending resources then
        current_time = get_time()
        if (current_time - time_start) + time_to_load(resource) >= 1/60 then
            break
        load one resource to gpu
        remove that resource from the pending list
    end
    draw()
end

This way, I would only load a resource if I can do it within the time I have for that frame. Unfortunately, this requires a way to estimate the amount of time it takes to load a given resource, and as far as I know, there are usually no ways to do this.

What am I missing here? How do many games get to load all their stuff completely asynchronous and without dropped frames or extremely long loading times?

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:
What is the most efficient way to load all the textures? I am developing a game (in Java) that is going to have a lot of textures and images in it.

What is the most efficient way to load all the textures? I was thinking on pre-loading all the images instead of loading them during runtime (because during runtime they will be loaded over and over again).

I'll be happy to hear your opinion on those strategies, and also, if you have a better strategy I would like to hear that.

sentences:
How to only allow letters to be pressed on in pygame? I want the user to press on any letter of the alphabet; it should block the input from the rest of the keys. How can I do this using pygame?

Keys=pygame.key.get_pressed()

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:
How to manage merging/splitting viewports to create a dynamic splitscreen I'm making a multiplayer 2D game where each player has an entity that they can move in any direction. This will be local only, so split screen.

Typically the player controlled entities will be in close proximity to each other. What I would like to do is have the screen get split only when players are far away - i.e. when it needs to.

See around mid way through this YouTube clip of Mari0 for an example of what I mean.
See this clip of Super Mario Bros X (sorry, it's a bit of a low FPS) for an example of horizontal & vertical splitting.

There starts off being a single viewport (or maybe 2 rendered to look like one). Then, as the players separate, either vertically or horizontally it splits the screen giving each player is own viewport.

How would I go about creating this effect? (managing the viewport merging/splitting etc)
How about extending it to work for up to 4 players? (is that even possible?)

sentences:
Image drawing tools (that aren't Photoshop) that work in the sRGB colorspace I'm looking for a way to create sRGB raster images. Now, I could use Inkscape and just have it render to a raster format, but are there any image drawing tools other than Photoshop that work in sRGB?

Here's what I want to be able to do more specifically. Let's say the image is all one color. I want to be able to pick color 0x808080, which is in the sRGB colorspace. I want the file to write an image where every pixel is 0x808080. And then, when I read it, I can tell OpenGL that it's sRGB color data, so it will treat the 0x808080 color has being from the sRGB colorspace.

The important part is that, when I'm selecting colors in the tool, the colors I'm selecting are from the sRGB colorspace.

sentences:
Parallax background in with depth in Phaser 3 I'm working on a 2D space shooter type of game in typescript using Phaser 3 and am trying to get a parallax background with different depths going. But I'm having trouble getting the math right.

You can see my work in progress here: https://www.youtube.com/watch?v=Pea9yVbTD64

As stated in the video everything works if the players x and y are positive, but breaks when they are negative, and I can't figure out what I am doing wrong. Any help would be greatly appreciated. Or perhaps there is a better way to accomplish this?

What I'm doing is randomly generating out a bunch of the Sprites, storing them in an Array, and then updating their position with this code.

_Nebulas: is an Array<NebulaParticle>.
p.distance: is a number between 1 and 5 to signify how far away the sprite is and is used to make them move slower when they are
furher away.
_Width and _Height are both arbitrary numbers to signify how big the area is that the parallax should cover, in the video they are
both set to 80.
OriginalOffsetX/Y is the original random position the Sprite was given.

(this line is here because the below code formatting wont work otherwise.)

public update(delta: number, playerx: number, playery: number) {
    console.log(playerx + ", " + playery );
    for (let i = 0; i < this._Nebulas.length; i++) {
        let p = this._Nebulas[i];
        p._Sprite.x = (playerx + (this._Width / 2)) - (((playerx / p.distance) + p.OriginalOffsetX) % this._Width);
        p._Sprite.y = (playery + (this._Width / 2)) - (((playery / p.distance) + p.OriginalOffsetY) % this._Height);
    }
}

class NebulaParticle {
    public _Sprite: Phaser.GameObjects.Sprite;
    public OriginalOffsetX: number;
    public OriginalOffsetY: number;
    public distance: number;
}

sentences:
Add a random number to an existing number to produce output in Unity I am trying to add a random number to an existing number. I am able to get the output in Unity console, but in the inspector, I can see that the public variable is on a non stop loop.

I intend to produce the result when I press the enter key. Is this an efficient way, or can I improve on the code? I am a beginner, and passionate to learn.

Here's the code:

using UnityEngine;
using System.Collections;

public class LearningScript : MonoBehaviour
{
    public int number1 = 5;
    public int number2 = 10;
    public int number3=20;
    public int finalResult;
    public string statement = "NO KEY PRESSED";

    void Update()
    {
        input ();
        if (Input.GetKeyDown (KeyCode.Return))
            Debug.Log (finalResult);
    }

    void Start(){}

    int addnumbers(int num1,int num2)
    {
        int additionResult = num1 + num2;
        return additionResult;
    }

    void input()
    {
        int randomNumber = Random.Range (1, 10);
        finalResult=    addnumbers (number1, randomNumber);
    }
}

sentences:
Artillery Simulation I need some help on a simulation of an Artillery like this one

https://www.youtube.com/watch?v=YktWSKo_UbA.

I cant figure out how to make the "tomato" to get to the selected spot.

Where can I get solutions for this kind of questions in the future? Physics programming books? I am using LibGDX (Java).

sentences:
Snake AI - Is a Hamiltonian approach valid for all grid sizes? So, as has been done many times before, I am designing an AI that can play Snake as effectively as possible. It didn't take me long to find this extremely useful thread here: How to find a safe path for an AI snake?
 where the top answer first and foremost recommends forming a Hamiltonian circuit for the grid and begin by just having the Snake follow this route.

However, after attempting this, I realised it didn't work with my initial grid size (23x23), at least I don't think it does. My understanding may be incorrect, but from what I gather, with m rows and n columns, if mn is odd, then there is no Hamiltonian circuit possible. If this is the case, then should I abandon this method? Or is there any way of implementing it in some case?

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:
convert clock input into 24 hour format I have stuck in a logical problem I have a third party package of DayNight. It takes hours input(24-hour-format) to show dayNight effects in scene

My code is to transform 12 hours clock cycle into 24 hours is

if (todsky.Cycle.Hour >= 0 && todsky.Cycle.Hour < 11.97)
            {
                Debug.LogError("1st");
                var degree = 360 - hourniddle.transform.eulerAngles.z;
                var degreeToMintues = degree * 2;       //multiply each degree with 2 to get correct minutes
                ConvertMinutesToHours(degreeToMintues); //
            }
            else if (todsky.Cycle.Hour > 11.97 && todsky.Cycle.Hour < 23.97)
            {
                Debug.LogError("2ndt");

                var degree = 360 - hourniddle.transform.eulerAngles.z; // as rotation is anti-clock getting rever degree
                var degreeToMintues = degree * 2; //multiply each degree with 2 to get correct minutes
                var MintuestTo24HoursMintueCoverstion = 720 + degreeToMintues; //add 720 mintues into current minute in order to get 24-hour-format
                ConvertMinutesToHours(MintuestTo24HoursMintueCoverstion);

            }
 void ConvertMinutesToHours(float mintues) {
        result = TimeSpan.FromMinutes(mintues);
        Debug.LogWarning(result.Hours + ":" + result.TotalHours + ":" + result.Minutes + ":" + result.TotalMinutes);
        todsky.Cycle.Hour = (float) result.TotalHours;
        Debug.LogWarning("setted hours : " + todsky.Cycle.Hour);
    }

But it is not working correctly .
 have made a clock GUI(360-degree) and as you know it only show 12 digits-format not 24. I am getting clock needle movement which can be change through mouse drag. Needle z position up to 320 degree which means one degree is equal to 2 minutes and i am taking it as input from GUI. I write below code to integrate my clock needle with my DayNight package in order to integrate GUI with package and passing hour parameter into the package but it not working correctly. Problem is that else condition is skipping.

sentences:
Simultaneous Animation for a GameObject - Unity3D Its my second week with Unity. I am doing a 2D game and I have a small GameObject which should change its sprite along with following a definite path defined in Animation Curves.

I did both of them in separate .anim files since the transform animation had many keyframes, i thought it wont be good to put the '2' sprite keyframe repeatedly along side the transform keyframe.

But the problem is, I cant get it both working together at the same time. I dont want any blending because the animation is timed well already.

Also, I tried deleting the sprite change animation and tried it under script changing the SpriteRenderer.Sprite property under Update(); but it works only when the Animator component is disabled in the GameObject.

Any Solutions ? :)

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:
Map a normal image to a cubemap How can I map a normal non T form image to a cube map?

and if there is no manner with which to do this, is it possible to, via DX11, split the image, as the image may be generated on the fly?

Cheers.

sentences:
Lightmapper artifacts I really don't understand why this is creating these kinds of artifacts. I'm starting to think something is wrong with Unity.

There are clearly no overlapping faces on the Model. There is enough of a margin to remove all chances of bleed. Yes the lid is a seperate object but any UV's of the lid and it's box are not overlapping. Thix odd pixelation occurs no matter the quality. It happened all the time sofar here and there and it forced me to replace a few objects in older projects. No idea what causes it. Really sick and tired of this.

Edit:

when I rotate the crate by 90 degrees the artifacts appear on the adjacent side of the cube. From the perspective of the camera it would be the same side. So clearly it's not the UV's or anything.

Lightmap settings

Object Import settings

sentences:
Developing addons for xbox one controller I want to develop an addon that plugs to the bottom of the controller for the xbox one. Can I legally make addons to the xbox one controllers without Microsoft's blessing?

If so, has anyone done anything like this? Cursory search looks like it has not been done.

sentences:
Trade shows and competitions in the UK So I'v been hobby programming games for a few years now but never released anything.

This year I was thinking about deepening my knowledge of the industry and doing some networking buy going to some trade shows and maybe taking part in a contest.

My first instinct was try E3 but that is not open to the public and is in america :(

So what I want to know is what shows and contest are held in the UK for game development.

I have found this difficult to Google when you as I am not sure what I am even looking for so if anyone has any recommendations. Ideally the show would have elements dedicated to design and development of games instead of just previewing the new releases.

Any information on any game competition would be great no matter the level.

sentences:
OpenGL HUD is flickering when rotating the camera I draw game HUD after drawing 3D scene. When I move the camera quickly, HUD starts flickering.
I noticed that it happens only if the distance between the camera and an object its looking at changes after camera's position transformation.It does not happen if there is no mesh in front of the camera. I use separate shader program for HUD rendering. Have tried to enable/disable depth test, blending already. Using VBOs to draw stuff.

Render code:

 def render()
{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

    glEnable(GL_DEPTH_TEST)
    glDepthFunc(GL_LESS)
    glEnable(GL_CULL_FACE)

    Shader.setCurrentShader(Shader.SHADER_VOXEL)
    Shader.currentShader().enable()
    set3DMatrices()
    updateShaderVOXEL()
    val world = WorldRegistry.getWorldByID(0)
    world.renderWorld()
    Shader.currentShader().disable()

    Shader.setCurrentShader(Shader.SHADER_SIMPLE)
    Shader.currentShader().enable()
    set3DMatrices()
    ManagerRegistry.renderManagerSceneBoundingBox.render()
    ManagerRegistry.renderManagerSceneRectangle.render()
    ManagerRegistry.renderManagerSceneLine.render()
    Shader.currentShader().disable()

    glDepthMask(false)
    glDisable(GL_DEPTH_TEST)
    glDisable(GL_CULL_FACE)

    Shader.setCurrentShader(Shader.SHADER_HUD)
    Shader.currentShader().enable()
    set2DMatrices()
    GL13.glActiveTexture(GL13.GL_TEXTURE0) // Texture unit 0
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, Texture.getTexture("screen/cursor/default.png"))
    HUDRenderRegistry.HUDRender.render()
    Shader.currentShader().disable()

    glDepthMask(true)

    glfwSwapBuffers(window)
}

EDIT

I made a video(captured on the phone, so the quality is bad, sorry) and the rectangle in it is actually fully red, not yellow.
https://youtu.be/HhHEfrgsfiU

sentences:
(Tiled) Background stops being rendered in libGDX I'm using Tiled and I created my background as an image in a Tile Layer.
When I load the map in LibGDX, it shows fine. However when the camera moves, the whole background dissapears.

The problem is solved if I add the background as an Image Layer.

Any idea what's causing the problem in the Tile Layer?

sentences:
Raycast only specific layer and ignore other collider I am willing to raycast specific layer and ignore other layers no matters its colider is above to my navPoint layer object?

 int specificLayerMask = LayerMask.GetMask("NavPoint");//raycast only this layer ignore others

        if (Physics.Raycast(raycastObject.transform.position, fwd, out objectHit, specificLayerMask))//50
        {}

the above code raycasting to navpoint layer but unable to bypass other layers colliders. is there any way available to ignore all other collider and raycast to desired layer only no matter colliders are behind any other collider

sentences:
2D physics performance on iPhone/Android using Unity 3D? I've been looking into making 2D games with Unity. One thing which concerns me is the performance of the physics engine. Since Unity is a 3D game engine I'm going to have to assume it uses a 3D physics engine. Obviously I can turn this 3D engine into a 2D one by locking off various axis such that objects only move physically in 2D space.

However this worries me, for example Box2D being a specialized 2D physics engine is optimized for 2D. Would the physics in Unity3D be fast enough to say, duplicate the sorts of physics we see in games like Angry Birds on a handheld device?

sentences:
What pattern is this, and should I do it? I'm making a game in as3 using flash develop and flash cs5. Everything is object oriented. I was wondering, should I have one "gateway" class that has a property-reference to all instantiations of other classes, and I just pass this gateway class to new objects, so they have access to every class. Like so:

 var block:Block = new Block(gateway);

 //In the block class:
 this.gateway.player.setHealth(100);
 //Or:
 this.gateway.input.lock();

Is this like a singleton pattern or something? Should I do this?

sentences:
Games where the story continues via progeny In Phantasy Star III: Generations of Doom for the Sega Genesis you periodically marry and then the story carries on through your sons/daughters. In Rogue Legacy when you die you again play on through your decendents (IIRC).

I am working on an RPG and am thinking about a similar concept for a death mechanic. I want dying to cause some of your loot/skills to pass on to your progeny, who can then pick up where you left off (more or less). What are some potential design pitfalls in implementing such a mechanic? One that I already see is that if I make it too punishing, players will revert to last save, not punishing enough and they'll die on purpose.

Bonus points for referencing existing games (other than the two I mentioned).

sentences:
How to gradually decrease opacity of model? I have been searching for this matter for a long time and slowly I begin to think that this option is not available in XNA for Windows Phone.

I am trying to get a 3D-Model to be drawn at 50% opactity/transparency.

The most promising piece I found is following:

//1. Set the alpha blend mode for the graphics device with:

graphics.GraphicsDevice.RenderState.AlphaBlendEnable = true;
graphics.GraphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha; // source rgb * source alpha
graphics.GraphicsDevice.RenderState.AlphaSourceBlend = Blend.One; // don't modify source alpha
graphics.GraphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha; // dest rgb * (255 - source alpha)
graphics.GraphicsDevice.RenderState.AlphaDestinationBlend = Blend.InverseSourceAlpha; // dest alpha * (255 - source alpha)
graphics.GraphicsDevice.RenderState.BlendFunction = BlendFunction.Add; // add source and dest results

//2. Set the alpha value in the BasicEffect for the model:
effect.Alpha = 0.5f; // Creates a 50% translucent object.

But GraphicsDevice.RenderState.AlphaBlendEnable isn't even available in XNA for Windows Phone.

So is there any way to achieve that effect?

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: Is it possible to skin Qt 4.5 such that it has a 'game-like' interface? Is it possible to skin Qt 4.5 such that it looks less like an application framework but more of a game? I guess this probably means replacing the canvas, the title-bar and the artwork of the various widgets. Will such an approach be platform independent too?

sentences:
How do I check if the same item exist in plist and SpriteKit? I am trying to make a RPG game in IOS, with a similar dialogue system in Baldurs Gate. I have created two arrays in a plist file. Like this:

As you can see I have two arrays: PlayerMessage; a list (it will be) of multiple choices that the player can touch and NPCMessages; the text that is displayed when the PlayerMessage is touched
I am at the stage where I can touch on the NPC and see a black box with text from array (PlayerMessage). However I do not know how to tell Swift, if a player touches the string of the Item in PlayerMessage and if same item exist in NPC Message display the string of that item.
Here is the code that I have used:
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)
{

    for touch in (touches) {

        NPC.name = "NPC"

        let Location = touch.location(in: self)

                    var CorrectedLocation = CGPoint()
                    CorrectedLocation.x = Location.x - LocalCamera.position.x
                    CorrectedLocation.y = Location.y - LocalCamera.position.y

        let node = self.atPoint(CorrectedLocation)
        var Message: SKLabelNode!
        Message = SKLabelNode(fontNamed: "Trebuchet MS")

        if (node.name == "NPC") {
            let NPCMessageer = SKSpriteNode (color: UIColor.black, size: CGSize(width:1000, height:1000))
            NPCMessageer.zPosition = 99
            NPCMessageer.position = CGPoint(x:-500, y:-200)
          Message.fontSize = 50
            Message.color = UIColor.white;            Message.position = CGPoint(x:-500, y:-100)
            Message.zPosition = 100

            addChild(NPCMessageer)
            self.addChild(Message)
            for PlayerMessage in NPC.PlayerMessage {
             Message.text = PlayerMessage as?String}
            let label = self.atPoint(CorrectedLocation)
            if label.name == "Message"
            {

             if NPC.PlayerMessage == NPC.NPCMessage
             {
                Message.text = NPC.NPCMessage as?String
             }

sentences:
How can I retrieve the outer most points on a 2d graph? I have a 2d graph which has some points plotted on it.

What I need to do is get only the outer most points so that I can connect them up (isn't really relevant).

What I can't seem to wrap my head around is the algorithm that I need to use in order to do this?

I think this might help you understand what I want to achieve:

o o o
o x o
o o o

All the o's I want to get and the x I want to ignore. Also, the points can be in any position and any shape but I still want to only grab the outer most points.

Any ideas? Thanks.

sentences:
How to prevent unbalanced population in MMO game factions? In games such as World of Warcraft, the imbalance between factions is often a matter of controversy.

To compensate, WoW applied the Tenacity buff to the outnumbered faction to balance PvP.

However, this only applies to PvP and I wonder if this kind of bonus can be used to encourage character creation in the least populated faction.

Something like an XP bonus for the least populated faction?
For example, 5% XP bonus if the faction represents 45% of the server.
The bonus would be highlighted when creating a character and it would be 0 when the two factions have the same size.

Or a bonus on the economy by lowering auction fees proportionately to the imbalance?

sentences:
Could this MMORPG project-model work? This is an extension of my previous question.

Recently I had an idea of making an, as I could describe it, agile open-source player-financial-profitable MMORPG, which has an interesting (from my POV) project and development model.

Agile means that development should be iterative, with world extending every fixed period of time. And maybe even game universe\plot may be based on iterative development.

Open-source means that everybody can participate, but, obviously, I wish to establish some kind of core team. I estimate that about 0,01% of players will contribute. And this is where I want to make the number grow to about 0,1%.

That's third part: player-financial-profitable means that every player that has outgrown some reputation ceiling (level or another kind) could contribute some kind of *thing to the game. I think about things as special items for now, but they could be transformed into anything on later architecture stage. Special items can be obtained without any financial donations, of course, but if one player wish to buy it from another, it should be sold for real money, presented as some special "platinum coins" in the game. Money should be parted between solder and creator of the item.

But there is one rule — the item, that one creates, must be unique. Under unique I mean unique. It should have unique look, unique animation, and, most importantly, unique ability, that was not presented by any other item so far, not just exterminator sword with +10000 damage. And unique ability should be coded and designed uniquely. That means, that if creator player is not a one-person collaboration between designer and programmer, he should appeal to off-site labour, or to the core team itself. Working places are created and everybody is happy.

So, that is the model as I see it now (and I invented it yesterday night). The main question is:

1) Should I even bother?
The idea is so ambitious, that could be interpreted as flying in the sky with the help of no wings. And I don't want to spend next ten years of my life (that's the minimum period in which I expect the project to become successful) working on unfortunate from the beginning project.

I have many other questions, but this text already gone too big, so I'll ask only most important:

2) Isn't there some similar game project-model already? I've seen PlaneShift, but they definitely aren't what I'm talking about.

3) Are open-source practices suitable for game development? There are so few good professionals in the field, will they bother to contribute?

4) On how many people should I count on early development stage? Later?

5) How to do all this thing without any reasonable budget?

6) Where do I begin without XP in game development, but with XP in programming per se?

Note to moderators: Please make this community wiki, I don't see my checkbox.

sentences:
Smooth loading screen between scenes I created a loading screen to display a loading animation as the next scene is loading. I load the next scene asynchronously with:

yield return SceneManager.LoadSceneAsync(scene,LoadSceneMode.Additive);

And also set Application.backgroundLoadingPriority = ThreadPriority.Low;, but the behaviour is still the same as a regular level load.

Am I missing something?

Expected behaviour:

Exit level, and fade out.
Loading screen appears.
Once load is done, fade loading screen out.
Fade in next scene.

What is happening:

Exit level, and fade out.
Loading screen appears, frozen
Suddenly new scene fades in.

Once the load starts, the game just frezees, like with a regular Scene load.

I read that you have to set allowSceneActivation = false, so you can fade the loading screen out, and then set it to true to let unity finish loading, but this completelly freezes my game, like the async operation never finishes loading.

sentences:
How can I load an image into the back buffer? How can I load and display an Image?...
I have tried something but it didnt.. worked.. this is what I've tried..

File : StrikeOps_main.cpp .. void : render_frame :

Intro::DisplayIntro(d3ddev, introPath.c_str(), Surface, BackBuffer);

File : Intro.h

class Intro
{
public:
    static void Intro::DisplayIntro(LPDIRECT3DDEVICE9 d3ddevice, LPCSTR path, IDirect3DSurface9 *Surface, IDirect3DSurface9 *BackBuffer);
};

File : Intro.cpp

void Intro::DisplayIntro(LPDIRECT3DDEVICE9 d3ddevice, LPCSTR path, IDirect3DSurface9 *Surface, IDirect3DSurface9 *BackBuffer)
{
    D3DXIMAGE_INFO Info;

    D3DXGetImageInfoFromFile(path, &Info);
    d3ddevice->CreateOffscreenPlainSurface(Info.Width, Info.Height, Info.Format, D3DPOOL_SYSTEMMEM, &Surface, NULL);

    D3DXLoadSurfaceFromFile(Surface, NULL, NULL, path, NULL, D3DX_FILTER_NONE, 0, NULL);

    d3ddevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &BackBuffer);
    d3ddevice->UpdateSurface(Surface, NULL, BackBuffer, NULL);
}

then on StrikeOps_main.cpp , void : CloseD3D :

Surface->Release; and BackBuffer->Release; (yes they are declared as globals on StrikeOps_main.cpp

sentences:
vertex/pixel shaders and "materials" What relationship is there, if any, of "materials" and vertex/pixel shaders (or the "effects" that combine the latter two)?

I have the impression that before the advent of HLSL, materials were explicitly handled by Direct3D or OpenGL.  I also have the impression that with HLSL, many prior effects are now handled directly (and generically) via the rendering pipeline in vertex/pixel shaders.  In other words, I hae the impression that materials are often little more than what DirectX would call an "Effect."  If so, this means that many models that specify materials would be transformed by a content pipeline into an "Effect".

Is this correct?  Where can I get a little more history/info that either corroborates or corrects the impression I have?

sentences:
Custom 2D physics on unity I have seen a lot of people think that for a 2D platformer game, Unity2D physics is not really the best approach, and recommend implementing your own physics.

I found the idea interesting, but I don't know how to approach the issue.

Using 2D Rigidbodies, and setting them as kinematic, allows you to ignore unity's physics. But how would collisions be handled without relying on Unity collision system?

sentences:
Choosing a data structure for a group of static (almost) thousands of objects on HTML5 canvas I have this requirement to implement a data structure for a group of thousands of displayable objects, on HTML5 canvas. Something like a particle system. The objects are randomly spread on the map. They have different colors and sizes. Each of them can be removed and I can also add more objects onto the map. These objects may move around a little bit but just one or two pixels. But on any specific (x,y) position there can be only one object.

So we can say that these are static objects. To render this group of objects and make changes to them I have used a particle system and put all the objects in an array. It works but the performance isn't good especially if I perform some operations on the objects. I find that each time I need to find or remove a particular object at a specific location I have to loop through the entire array, which is not very efficient.

Now my question is, can I put the objects into an object and use their position on the map as the key, and the object itself as the value? This way it works more like a hashmap or dictionary. So each time I want to get an object based on its location I can complete that operation in O(1) time. Removing any of the objects is also very easy too. When adding new object I just need to check if the location is occupied otherwise I put the new object in a new position. This way looks so good I want to implement it right away. In ES6 javascript maybe I will put them into Map or WeakMap. But before I do that I want to know if there is any drawback for this method or is it even a good option for this situation? I am also gonna implement this on the game server and transmit the data through network. I wonder if this method has any negative effect on networking?

sentences:
How do I connect the seams between my terrain? I'm using c++ and D3D11 and I'm trying to create a (pretty) large terrain, lets say 4096x4096, maybe larger.
I've got the basics of terrain creation and already split it up into chunks.

But, when I'm rendering them (every chunk has its own vertex and index buffer, as well as its own heightmap), there are still little pieces missing between them. I read a lot about LOD(Level Of Detail) and GMM(Geometry Mipmap), but I can't really implement the theory I read.
At the moment, it looks like this:

I could really use some help, everything is welcome.
If you have some good tutorials on any of this, please share them.

sentences:
Displaying Images Correctly So, I've been working on several smaller game project in past few months, and I've got the hang of game dev in java. Now I'm trying to optimize game performance. Is it ok to simply use g.drawImage();to display sprites and other images?

Note that I'm trying not to use any external libraries.

sentences:
How to calculate size of object depending of its height on the screen? I am programming a mostly 2D game on Android (with Andengine), but the player is a bouncing ball (kinda in 3D).

I wanted to make the bouncing of the ball the most realistic possible, using quadrilic equations (http://www.mathopenref.com/quadraticexplorer.html).
So I know how to calculate the vertical height (z) of the ball, but I do not know, what size should the ball be, depending on its vertical height (z).

When the ball touches the ground, it should be 64px (width and height of the sprite), but if for example it is at 100px above ground, what should be the width and height of the displayed ball ? Is there an easy way to calculate it ?

Thanks

Game Dev noob.

sentences:
shader coding: calculate screen coordinates of fragment Good morning,
I'm new to shader coding and trying to implement some visual effects code in shaders using billboards. (Yes, I couldn't have picked anything harder to start with, but I'm lucky that way)

Setup:
I have rendered the full screen z depth to an array of floats in a previous pass.
In the fragment shader I need the scene depth where the rendered fragment is displayed (to see if it's occluded). I can use tex2d() to get the depth value if I have the screen coordinates of the point being rendered in the fragment shader.

Question:
In the fragment shader how do you calculate the screen coordinates of the pixel (in the range 0-1.0)?

Is the position passed to the fragment shader a pixel offset? If so, I guess it would be:
    float2( position.x / screen-width, position.y / screen-height )

Thanks for any help/

sentences:
Transform.LookAt rotates the sprite and collision not triggering I've applied the below script to a gun object to instantiate bullets to the direction of the mouse position.

The bullet collision is not getting triggered since the bullet has been rotated.

How to solve this.

void FixedUpdate()
    {

        mousePosition = Input.mousePosition;
        mousePosition.z = 0.0f;

        //Gun Rotation

        objectPosition = Camera.main.WorldToScreenPoint(transform.position);

        mousePosition.x = mousePosition.x - objectPosition.x;
        mousePosition.y = mousePosition.y - objectPosition.y;

        angle = Mathf.Atan2(mousePosition.y, mousePosition.x) * Mathf.Rad2Deg - 90;

        Vector3 rotationVector = new Vector3(0, 0, angle);
        transform.rotation = Quaternion.Euler(rotationVector);

        //Gun Rotation

        if (Input.GetMouseButtonDown(0))
        {
            GameObject bullet = (GameObject)Instantiate(bulletObject, transform.position, transform.rotation);
            bullet.transform.LookAt(mousePosition);
            bullet.GetComponent<Rigidbody2D>().AddForce(bullet.transform.forward * bulletSpeed);
        }

    }

sentences:
I can't set the Source image for a UI image; how to fix it? I am new to Unity. As a learning project, I started to make a very basic car racing game. In order to add an on-screen speedometer for my car, I imported an image UI.

The problem is that I can't set a source image for my speedometer UI. I tried using .jpg .png or .psd image files as well. In any case, I'm not able to drag and drop the image.

Under the list Source Image, I already have selected UISprite from the drop-down list, but still, I'm not able to set source image.

Can anyone provide me any solution? I also have attached a screenshot of what I have.

sentences:
How do I simulate a swinging pendulum? I want to simulate a rope with a weight attached, swinging back and forth like a pendulum. Any actual physics is overkill; it's just endlessly repeating the same motion.

JQuery has a the "swing" ease similar to what I'm looking for. How does it work?

I was thinking of rotating from one angle to another with Math.easeOutExpo, but real pendulums ease differently...

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:
C++ text based football -- lookup table and AI logic help I am trying to develop a one-player text based football game in C++ strictly in the console without graphics. I am developing the game logic here below vs the CPU and I also need to do the vice versa (CPU vs User). How could I do this without a ton of if statements. I am not sure how to accomplish this same code below as a lookup table and I know I need some randomness so it is not predictable.

For this example below, the scenario would be which down are we in (4th in this example), how many yards to go (2 yards), the offensive's team running attribute (choice = Bears), the defense run attribute (o_choice = Bengals) and the play called (playbook_choice = 1 which is QB Sneak). Any help would be much appreciated, I have been banging my head against on the wall on this. I have not incorporated the attributes ratings below into the code below because I am not sure how. The Bears would have offensive running and pass ratings, and defensive running and pass ratings (so 4 ratings in total), same goes for the Bengals.

    //test logic
if (playbook_choice == 1 && choice == 1 && o_choice == 2) { //if qb sneak is called by the user controlled bears vs the cpu bengals

    int current_down_yards = 0,down = 4 ,yards = 2; // current down is 4th and 2  --- setting the down and distance
    cout << "It is 4th down and 2 yards to go" << endl; // print it out to the user --- setting the down and distance

    if (down == 2 || down == 3 || down == 4 && yards < 3) { //if its 2nd , 3rd of 4th down  and less than 3 yards to go
        current_down_yards = rand() % 16; // give a rate of completion of randomness from 1-15 yards for a QB sneak --- need to take account for the strength
        // of the defense's attribute rating and offense's running rating -- to include for a loss as well as a gain in yardage
        cout << "The QB ran for " << current_down_yards << " " << "yards" << endl;
    }
}

sentences: Should all stats only exist on MySQL database for my Flash browser RPG? I'm creating a browser RPG in Flash which will have some multiplayer elements and in-app purchases so security is a high concern. Would it be better to have all game stats like health and such exist only in the MySQL database and retrieve them every time I need them? The game is turn based, but that would still require very frequent connections to the database. I could use local copies to cut down on the number of connections, but I imagine that would make it much easier for people to cheat.

sentences: Monster Spawner Reference Issue I have a monster spawner that spawns the "enemy" kid which is red, and it has a line in the script where it references the "player" gameobject's transform. Before I made the spawner, I had the enemies put by hand and I could reference the player object without issue. Now they're not handplaced, they are spawned from the prefab folder by the spawner. When they spawn the game gives the null reference exception error and stops. I look up to the enemies that are spawned and none of them have the player gameobject referenced. Also when I click on to the enemy prefab to reference the player object, it just doesnt allow me to. How can I resolve this issue?

sentences:
How are the graphical effects in the Android game Orbital created? I would be very grateful if someone could tell me how the graphics (and in particular, the lighting effects) for this game, Orbital, are created. Would it be OpenGL?

For some background: I'm new to this, and I really like these style of graphics, but I've no idea where to begin -- I'm just trying to figure out which direction I should be headed in. I have a very basic knowledge of Java, and I'm just starting to work with Android now. I have made simple games in Java in the past.

sentences:
Missing references in built bundles The following is a copy of our post in Unity Forum (https://forum.unity.com/threads/missing-references-in-built-bundles.1103689/)
Hello,
We have a bundle for our scenes and another one to store our prefabs (actually we have around 10 bundles but let's keep it simple). In every scene we have unpacked prefab instances. We have no problem in playmode using the AssetDatabase but once we use built addressables some unpacked prefab instances in our scenes are broken. Sprites and / or scripts are missing in a inconsistent way; in some scenes those objects are fine and sometime they are not. This comes along multiple warning messages "The referenced script (Unknown) on this Behaviour is missing! ".
Note that the issue also happens when we fully deploy our player.
Unity version : 20193.3.13
Addressables version : 1.16.1

Solution 1 : We tried to remove addressable prefabs (A,B,C in the diagram) from their bundle since we don't really have to instantiate them at runtime for now and it worked.
Solution 2 : We also tried to put scenes and prefabs into the same bundle and it worked too.
Solution 3 : Switch to 1.18.2 and 1.15.1 version of addressable package and it didn't work.
Solution 4 : Finally we tried to use the Duplicate Bundles Dependencies analyzer multiple times in order to have no more issues of this type and it didn't work.
Questions 1: As far as we understand, when addressable groups are built, Unity computes all dependencies and build them inside the bundle along the orignal assets (in my diagram "Scenes" bundles is packed with D'). What we don't understand is why having our prefabs in a separated bundle break references link in the scenes. Our guess is that Unity doesn't know which version of those dependencies to use (the one in the scene bundle or the one in the prefab bundle) and somehow fails to load them properly.
Question 2 : Is splitting our content is a good approach, we did it mostly for visibility but it appears to be more a problem in the long term, what are your guidelines regarding this matter ?
Question 3 : Why Duplicate Bundle Dependency rule has to be processed multiple times to properly fix every issue ? We think that running this rule creates duplication issues itself but we can't really tell..
Thanks.

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:
Values or Struct-Like Location Class? I'm currently working on a 2D RPG, where the player character moves on a tilemap but is not constrained to the individual tiles. Every tile in a room is referred to by x and y coordinates to an Array. I'm considering using a Location class to store a float x and float y for the player character, as well as, perhaps, a Room. What are the advantages and disadvantages of this approach versus keeping the float x and float y values of the Player class (thus not creating a Location class)?

Collision detection with walls, objects, and other players will need to be calculated.

sentences:
Calculating the winding and normal when programatically adding triangles to a mesh I'm writing a program that takes a 2D planar polygon and extrudes it to a 3D mesh with a given height. I identify triangle edges that are borders of the polygon and now I'm trying to automatically compute the two triangles required for the extrusion of the border. However, I'm stuck at how to compute the correct winding and normals

My start situation is this: I have the two coordinates of the edge (marked in white) and the normal of the original triangle (marked in orange)

Using this information I'm trying to compute two triangles which should result in:

The 4 vertices are easy to compute (just the two vertices of the edge and two more at a different height). The normal should be perpendicular to the original normal but to do that I need a second reference point. It doesn't seem to be as simple as using the centroid of the triangle.

The triangle winding confuses me. I need a counter-clockwise winding and I guess I could determine which vertices to use based on the normal but how is not immediately apparent to me.

sentences:
Check if body is on the ground In my game I have an quite irregular terrain at the bottom and a round ball which can be controlled by the keyboard. Is there any way to check, if the ball is currently on the terrain? This is very important to know because the ball should only be able to be controlled when it is on the ground.

I tried to use the OnCollision event of the ball body, but it only gets fired on the first occurrence.... For my problem a continuous type of collision-detection is needed.

sentences:
Should fields in components in an ECS use polymorphism? I've just started to try and learn how to use ECS (Entity component systems), but I'm having trouble understanding the concepts behind components.

Should adding more types of components, or trying to make a component reusable through its fields be favored? For example, if I'm trying to give all entities a shape for collision detection, should I have a different component for every shape (RectangleComponent, CircleComponent, PolygonComponent), or should I have one ShapeComponent, and in there have a field which is of type Shape, with class Shape having subclasses Rectangle, Circle, and Polygon.

I'm unsure because using a Shape seems to be much more flexible and easier to implement systems, but it also feels like I'm violating the ECS rule of not having any functionality in components.

sentences:
How can I convert an orthographic camera to a perspective camera? How can calculate perspective camera parameters from orthographic camera parameters (left, right, top, bottom, near, far)?

Specifically I don't know how calculate the FOV for a perspective camera from orthographic camera.

sentences:
How can I organize render and transformation data in a scalable fashion? I am writing for OpenGL 2.0 and in the future porting to OpenGL ES 2.0. I only use VBOs and shaders (no immediate mode, no vertex arrays).

I already have working solutions, they just... feel wrong. All my calls related to OpenGL are tucked away in a separate class called RenderManager (this includes creation of VBOs and IBOs, texture IDs and shader programs) and rendering. I called the creation of OpenGL objects logging in and out, so majority of this action is invoked from the ResourceManager object upon loading of data. However, a lot of geometry (level) is generated dynamically and therefore some RenderManager calls to create the VBOs/IBOs is scattered throughout the level class.

Now, I have a Renderable interface which returns the (single) transformation matrix and a RenderOp object when it is time for rendering. RenderOps is an object that has Vertex/Index Buffer pointers (has actual geom. data which in turn has VBO/IBO indices) and some parameters such as whether to use the index buffer and if the RenderOp needs blending and stuff.

There is also the RenderView object; it has the viewport parameters, projection matrix and view matrix (camera).

The game objects reside in the World class (single-dimension arrays). These game objects are added upon their creation, and are derived from Entity interface. Entity is able to  return the number of Renderable-type objects within as well as the actual pointer to a Renderable at a given index.

The magic happens when the main loop traverses the World. First it collects all Light objects visible from within Frustum. Then it collects Entity object that's within Frustum (it gets added to std::vector inside RenderView if it is), and then it checks that same object to see if it is inside any of the visible Light's bounding volumes (and gets added into Light's std::vector).

Then the RenderView is passed onto the RenderManager class, which  extracts appropriate Renderables from each Entity, applies Renderable's shader, then applies Renderable's textures, then stores the transforms inside itself and promptly shoves them down the programmable pipeline's throat along with attributes stored inside the RenderOperation (that gets extracted from Renderable as well).

Last note - I have NO way to render debug data, which is extremely annoying.

A lot of what I am doing feels wrong. My question is, how do you organize all your Renderable and Transformation data to facilitate your rendering needs? I am burning out thinking of semi-flexible ways of managing this data and I want to hear your ways. I am not a big fan of scene graphs, and consequently don't really want to implement one as I feel there are no real hierarchies inside the game, but I feel like I'm running myself into a corner.

Please throw me a bone here, how do you manage all this data? And if you suggest an event based rendering system, how would you design it?

sentences:
Create sprite sheet (texture atlas) from video with alpha What's the best way to make a sprite sheet (texture atlas) from a video?

In my case, I have videos of animated character expressions (e.g., smiling, frowning, sad, excited), which I intend to use as frames on quads in my app. I have video sized for retina 2x of a small character, so it's approx 150px square for a 75px character, with alpha/transparency. My animator can output any common format. I'll have 50-100 frames. I do not need a power-of-two size output, any rectangle is ok. I'm working on MacOS.

Is the best workflow still: video -> folder with PNGs -> TexturePacker

Or is there any smarter way to do this? I'll be having a lot of iterations, so I'd like to make it as easy and fast as possible.

There are two older questions from 2010 and 2012 about making sprite sheets.

sentences:
How should I generate the board for a match-3-style game? I am trying to create a "match 3" game. I'm stuck figuring out a good algorithm to fill up the game board.

My game's board is 8x8.

EDIT:

A few things:

The board should always be solvable. for example, the user has a score to reach by making matches. All boards must be able to produce enough available matches for the user to win each level or solve it.

sentences:
How to create a fog effect in XNA with PixelShaderFunction? I developped a small XNA games in 3D.
I would like to add a "fog of war" on my models instantiated with an effect in my (.fx) file.
The problem is, I do not know how to change the function
"PixelShaderFunction".

File [.fx]

Here is the declaration of my variables in my effect file (.fx):

// InstancedModel.fx
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------

// Camera settings.
float4x4 World;
float4x4 View;
float4x4 Projection;

//Fog settings
float FogNear;
float FogFar;
float4 FogColor;

And my function "PixelShaderFunction" in my effect file (.fx):

// Both techniques share this same pixel shader.
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return tex2D(Sampler, input.TextureCoordinate) * input.Color;
}

sentences:
Having the same camera in all scenes I have 100 scenes, each scene has a camera, but I want only the camera from scene 1 to exist in each scene that I appear in.

I use the function DontDestroyOnLoad() to make the camera exist in each scene but I always find my self with another camera that I don't want.

Any ideas? thank you in advance.

sentences:
Multiplayer game servers architecture I'm trying to create MMORPG with huge world divided by chunks. I was thinking a lot about servers architecture. I don't want my main game server to have direct access from clients and I do want to have some abilities for load balancing and for expanding whole system.

Finally I came up with this architecture:

The Game Server - which store game state and trigger events and so on. This server does not communicate with clients. It will be connected to database to store game state from time to time.
Streaming Servers - servers that handle client connections and stream game state to them as far as players actions to server. I suppose them to work through UDP. With this  approach I will have some benefits:

I can put then in different countries to lower pings.
I can have as many then as my budget allows me to. Adding more streaming servers would allow to handle more client online.
if something happens with one of streaming servers (due to hacker attacks or server hardware/software failure) this will not effect whole systems and other players experience. Players from this server can be routed to another.

Physics Servers - they would handle chunk physics and maybe some other heavy stuff. With adding new physics servers I can extend my system so that it would able to proceed more and more data, if needed.

What are the pitfalls of such an architecture? How good is it?

How would clients know to which streaming server they should connect? I suspect that here I should have one more - routing server that would do something like load balancing stuff and route user to one of the working streaming servers.

Would I have some problems with data synchronization?

sentences:
Memory-leak around SDL_FreeSurface When I call my tile engine function, the amount of memory my program uses begins to spike at about 80 - 90 megabytes per second. The memory use continues to go up until the program crashes. The function is below.

After tinkering with it, I figured out that I could reduce this bricking to about 15 megabytes per second if I called SDL_FreeSurface every time I ran the function. But this confused me, because I thought that you are only supposed to use SDL_FreeSurface when the program exits so that the images don't continue to occupy the memory.

if I don't call SDL_FreeSurface before I blit the tiles, do the previously blitted tiles continue to exist?
If I don't how do I fix the aforementioned bug?

The edit I made to bring the memory bricking down to 15 megabytes per second is commented out.

SDL_Surface* loadedTile = NULL;
SDL_Surface* modelIMAGE = NULL;

void enviroment::blitTiles(SDL_Surface* windowENVIRO, int tileAmount, int tileType[], int tileXenviro, int tileYenviro, bool quitTiles)
{
    HDcounter = -1;

//if(loadedTile != NULL)
//{
//    SDL_FreeSurface(loadedTile);
//}

loadedTile = IBFobjectENVIRO.loadIMG("tileClipSheet.png");

        for(int tiles = 0; tiles < tileAmount; tiles++)
        {

            switch(tileType[tiles])
            {
                //Black square (unpassable)
                case 1: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 0, 0, 75, 75);

                        HDcounter += 1;

                        forbiddenX[HDcounter] = tileXenviro - 75;
                        forbiddenY[HDcounter] = tileYenviro;
                        forbiddenSpriteWidth[HDcounter] = 75;
                        forbiddenSpriteHeight[HDcounter] = 75;
                        forbiddenSpriteDepth[HDcounter] = 75;
                break;

                //Grey square
                case 2: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 75, 0, 75, 75);
                break;

                //Brown square
                case 3: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 150, 0, 75, 75);
                break;

                //Invisible square (unpassable)
                case 4: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 225, 0, 75, 75);

                        HDcounter += 1;

                        forbiddenX[HDcounter] = tileXenviro - 75;
                        forbiddenY[HDcounter] = tileYenviro;
                        forbiddenSpriteWidth[HDcounter] = 75;
                        forbiddenSpriteHeight[HDcounter] = 75;
                        forbiddenSpriteDepth[HDcounter] = 75;
                break;
            }

            tileXenviro += 75;

            if(tileXenviro >= level1ObjectENVIRO.level1Width)
            {
                tileYenviro += 75;
                tileXenviro = tileXenviro - level1ObjectENVIRO.level1Width;
            }
        }

    if(quitTiles == true)
    {
        SDL_FreeSurface(loadedTile);
    }
}

sentences:
Designing score system: Combos, chains, multipliers and bonuses I am making a breakout-clone, I not want only want it to feel "arcade" for home users, but it will have a arcade version (although probably noone will buy, and I will only use the machine to amuse other people...), this make scoring, and high-scores a important part of it, it has no multiplayer, with the community existing around how to score higher and higher scores.

Being a breakout game, if the score is just linear, everyone that "finish" the game, will attain the same maximum score... Obviously this is undesirable, specially because the game DOES have a end, you cannot play it forever until you lose...

So, how to design some decent score system? Currently I added a multiplier, and it increases when you kill several blocks fast, but this has the unintended side effect of creating absurdly high scores near the end of the game when you are highly powerful (yes, my game is not only about batting the ball :P) and can clear a whole bunch of blocks at once...

To make it more clear, you have 5 frames to kill another block and increase the multiplier, on the start of the game, only batting the ball, this only happen when you manage to get the ball stuck behind the wall (something that is desirable to reward... several players plainly have a CRAVING to attempt that), and if you are a MASTER breakout player, you can score on the first five levels something like 100k points... Yet, on one of the late levels, if you use in a mediocre way (not even good way) the powers, you can easily rack-up 2 million points in a single level (and no, my game does not have points padded with 0! Some stuff DO reward you with 1 point, or 10... It is just the multiplier increase of 5 frame kill that skyrocket...)

I want to add more mechanics, fix this one, and make lots of stuff rewardable, stuff that make the screen shine, blink, show pretty stuff and make the player go "WOW, DID YOU SEE THAT?" and tap his friend in the shoulder, and then when he make it on purpose he screams: "HAHAAAA, I AM AWESOME AND YOU SUCK!!! DO IT TOO!! I DARE YOU!!!"

Note: Although the theme here is breakout, no problem in crossing genres, shmups are particularly good in this area, Radiant Silvergun for example was plainly great... But of course, it need to still be applicable on a breakout :)

Meta question: How I create tags? If I really can't, can a moderator put some decent tags for me? Like scoring, or chain-system, or stuff like that? Otherwise we will end with thousands of stuff with the same tags: design, writing and C++... or generic stuff like that.

sentences: How do I make a sprite fire a bullet in a direction using SFML and C++? I'm learning game programming for the first time using sfml and c++. I have sucessfully animated my sprite in all four directions watching some video tutorials. But now i want my sprite to fire in a facing direction. I just want to do it a very basic way. It would be great if i could get some idea of it. I am using xcode 7.

sentences:
Unity / Passing an array in a shader I want to pass my array (which is inside my c# code) to my shader.

Shader "custom/shader4"
{
    Properties
    {
        _myArray("Array", Float[256]) = []
    }

    SubShader
    {
        Pass
        {
            CGPROGRAM
            public float _myArray[256];

//code...

^this is obviously not working. Is anyone here who knows how to solve this?

(also in c#:)

myMaterial.MyArray = anotherArray;

It has to be something like this- right?
Or do I need a workaround?

sentences:
What am I suppose to use instead of Unity Resources if I have to load and unload sprites at runtime? I recently read this guide posted in the Unity website about Resources. It is clear from the get-go that it is discouraged to use Resources unless you are prototyping something.

My game is like a 2D RPG, and it has over five thousand monster sprites (yes, a lot). As far as I'm concerned, it makes perfect sense to put all the sprites in the Resources folder, and just load the ones that I need (using their name) when a battle starts and then unload them.

The Unity article makes one point that might support my approach:

  Generally required throughout a project's lifetime

Well, I'm not so sure about it - in a single game session it's entirely possible that thousands of those sprites will not be used at all as the player simply doesn't encounter those monsters.

The article goes on to talk about why is it discouraged to use Resources:

  This operation is unskippable and occurs at application startup time
  while the initial non-interactive splash screen is displayed.
  Initializing a Resources system containing 10,000 assets has been
  observed to consume multiple seconds on low-end mobile devices, even
  though most of the Objects contained in Resources folders are rarely
  actually needed to load into an application's first scene.

And it is indeed true - my game does in fact take several seconds to load on some low-end devices, especially Android ones. It is also true that none of those sprites of mine need to be loaded at startup.

So I am willing to stop using Resources - but I am at a loss now: the article doesn't mention a reasonable alternative to this.

Here are the (unreasonable) approaches that I have thought of:

  Create a component with a collection of all the sprites, that way they are all loaded without using Resources.

Yeah but I have five thousand sprites. This sounds extremely tedious.

  Same as the previous suggestion, but use Texture Packer or something similar to pack lots of sprites into different sheets - this way I have to do less work.

My sprites are large and packing them won't be a huge help - I'd still end up with a thousand or so sheets.

My point is, I just can't have 5000+ sprites preloaded. I need to load them at runtime via  Resources, but Unity clearly discourages it. Is there a solution to this?

sentences:
Proper names and wordings for Real/Fake fullscreen video modes I have an option in my game which allows Player to choose between video modes:

Fullscreen Fake
Fullscreen Real
Windowed

First and second corresponds to SDL_WINDOW_FULLSCREEN_DESKTOP and SDL_WINDOW_FULLSCREEN in the SDL library.

While their meanings whould be clear for GameDev people, for average Player, I think, it will be not so obvious. I never saw any examples of that kind of Video Settings. Other games often provide just a choice between the two: Fullscreen / Windowed.

What names and explanations I should provide, so it will not be confusing for a common user ?
Are there any examples of games which have similar options ?

sentences:
WebSockets and Python/PyGame I am looking to start development on a game that will have the server be written in Python/PyGame and the front end be in HTML5.  What I would like to do is, with as minimal impact as possible, open up a WebSocket or two to allow the server to push events to my browser.

Is this possible with Socket.IO, or do I need an extra layer to handle WebSockets?  I'd like to avoid importing and installing extra packages if possible.

sentences:
Strategy Games Online Resources I am looking for some good online (ebooks) resources about strategy games discussing the gameplay and the interactive aspects of strategy games, and how to design interesting and challenging strategy game.

I found this book (http://www.amazon.co.uk/Game-Guru-Strategy-Dave-Morris/dp/1904705456) and seems interesting by reading table of contents. Unfortunately, I did not find any way to buy an ebook version of it and I am in Middle East and ordering this book would take lots of time.

Any idea?

sentences:
How do I use an external FBX object in Unity? Is it possible to use an external .fbx object in Unity 3D the same way we can insert a picture?

Something like myPath = "http://www.myserver.com/object/myobject.fbx";?

sentences:
Random environment runtime generation in Unity I need a tip for a project: basically I need to randomly generate an environment (a map) for a game.
As generating a full map completely procedural is impossible for me, I thought to create a static map (I made one ice based, one rock based, one desert based etc) with some static elements in it like a "spawn area", a map border.

Next, I made some "piece of map" smaller that the actual size of the border (like the border is 1000x1000 and this piece are max 200x200). Each piece has the same style of the border (e.g. I made few icy pieces with a spawn of polar bear and few desert pieces with a spawn of scorpions).

Now I'm stuck; I can't randomly spawn all the little squares inside a border & I can't randomly spawn them inside and make them match one with an other. Incidentally, this is a 3D project.

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: High Frequency Polling And Handling Fuzzy Inputs I'm developing a FPS game and I'm considering polling at a high frequency on a separate thread. This decouples the game loop and reading input. I get sub-frame samples and can process those samples from a queue. My question is about determinism. I want to drive input handling with a variation of a state machine or DPDA. These things are not known for "fuzzy-friendliness" so I need to filter dequeued inputs (in the signal processing sense). How do real games implement high frequency input handling?

sentences:
Performance of separate Animators vs single multilayer Animator I am making a 2D game with Unity 5.4 and I want to animate my 2D human character.

He has different sprites for its body parts - leg(s), hand(s), head, eye(s), nose, mouth. Its eyes, hands, legs move independently from each other - meaning their animations and transitions are not related in any way.

My question is, which alternative is the better choice performance-wise when animating?

For legs, hands, eyes, etc. create separate Animator and animate them separately.
For all animations use single Animator (attached on body's "container" GameObject) and create for legs | hands | eyes different Layers in the Animator.

sentences:
How can I handle the difficulty level between co-op and single player? I'm working on an action-adventure game, and I was considering adding a co-op option. What I'm trying to decide is if when another player joins the game, if the game should get harder. On the one hand, I don't want the game to just get easier. On the other hand, I don't want to break continuity by making enemies suddenly stronger, eg I was able to take this down it two hits before, why does it take four all of the sudden.

I do not want there to be an "AI co-op" that comes with you in single player, I think that would make the game worse since it would detract from player agency.

How can I handle this? How can I keep the game challenging when a second player joins in?

sentences:
Rotating A 2D Cannon Based On Mouse Position I'm creating a game like bubble shooter, I have a cannon which is in the image bellow:

I want to rotate the cannon based on mouse position.

So far I tried various solutions I found over the web but non of them are working, I know that I only need to rotate the cannon on the Z axis because this is a 2D game, so I don't touch X and Y axis.

Does anybody know how can I rotate the cannon based on mouse position?

Or at least provide me a sample script on where to start.

Thank You.

sentences:
SDL Audio/Mixer cannot initialize with 2 channels only From the documentation using SDL2 Mixer to init the soundcard with 2 channels.
It will return 8 channels (7.1) and seems there is no way have just 2 channels.
here the snippet that i used simple as that:
Mix_Init(0);
    if (Mix_OpenAudio(44100, AUDIO_S16, 2, 1024) < 0) {
        cerr << Mix_GetError();
        return -1;
    }

int freq;
uint16_t fmt;
int channels;
if (Mix_QuerySpec(&freq, &fmt, &channels) == 0) {
    cerr << "query return 0" << endl;
}
cout << "freq: " << freq << endl
    << "format: " << fmt << endl
    << "channels: " << channels << endl;

and channels are equal to 8.
MY soundcard is a 7.1 so make sense, but shouldn't be init as stereo (2 ch) if required so?
Any help how to "force" to have just 2 channels?
It seems like is my driver doesn't support normal stereo, that is quite weird to me.
Any help would be appreciated

sentences:
Tile map using in game development I am a new Android game developer and I have only a limited knowledge about game development and all. I'd like to create a game just like Farmville
and I heard that tile map is the method used to code this game but I dont have support from others so I request you all to help me if you can. Please tell me how I could create such a game using eclipse and android SDK and let me know if there is any game engine that can be a support to my game and how to use it too. I looked at cocos2d android but its very complicated for a starter point of view.

sentences:
How to create projection/view matrix for hole in the monitor effect Lets say I have my XNA app window that is sized at 640 x 480 pixels. Now lets say I have a cube model with its poly's facing in to make a room. This cube is sized 640 units wide by 480 units high by 480 units deep. Lets say the camera is somewhere in front of the box looking at it.

How can I set up the view and projection matrices such that the front edge of the box lines up exactly with the edges of the application window?

It seems like this should probably involve the Matrix.CreatePerspectiveOffCenter method, but I don't fully understand how the parameters translate on to the screen.

For reference, the end result will be something like Johhny Lee's wii head tracking demo:
http://www.youtube.com/watch?v=Jd3-eiid-Uw&feature=player_embedded

P.S. I realize that his source code is available, but I am afraid I haven't been able to make heads or tails out of it.

sentences:
Font Changes in WebGL Build I'm attempting to make a game for WebGL. However, everytime I export a build, the font always changes on everything, just like below.

Original

WebGL

My default font is Arial and I have made a separate Arial font file with which I've replaced all instances of Arial font in my game, but it's still turning out like this. Why?

sentences:
How are 3D models created in video games? How are 3D models in games designed and displayed? Is it all code? Drawn on paper, then on a 3D graphics software, then... what?

Of course, game programmers won't define every vertex of every shape(/object,) they want to be drawn, all in code (whether in Direct3D or OpenGL.) So, do the game designers have tools to use, like Maya or something like it of proprietary 3D graphics softwares out there; they "draw" the model in that software, export it in whatever format, then programmers parse it via code and automatically enter the decoded/parsed raw vertices of the object/model?

I have Googled much but I couldn't find something solid to explain how this aspect of professional video games is worked on.

sentences:
How to find the source of a memory leak in a Blockchain + Node.js game We have been working in a Node.js game, part of a game network, which seems to be working slower and slower as you keep it open, as well as it seems to increase the RAM and CPU usage over time.

We are assuming it's a memory leak issue/improper use of the data structures within the application.

The question is, how could I detect the source of this type of issue?

sentences:
The steps in implementing Bézier triangle patches What are the steps in creating a Bézier triangle patches. What steps would you do in order to create this in directx 11?

Say I just input 3 vertices and create a simple triangle. Is this enough? Or should I create a triangle with 9 vertices, all of them in different heights so it would make a bumpy triangle, then I apply berstein's formulas and make them smooth. so I get like a smooth triangle, not all bumpy.

A triangle like

My book says
Research and implement Bézier triangle patches.

Luna, Frank D. (2012-05-21). Introduction to 3D Game Programming with DirectX 11 (Kindle Location 11901). Mercury Learning and Information. Kindle Edition.

So what are the steps you would do in order to accomplish it? Please no "coulds"

sentences: Does Unity store temporary autosaves for scripts? If not, how do I avoid data corruption My PC lost power in the midst of a save(twice in a row) and I've lost my scene setup as well as a script(its contents actually). I would like to know if there are any fail-safes for saving files. If not, how would I prevent future data loss/corruption.

sentences:
Is this the typical approach to modern OpenGL UI & Text rendering, for mobile? I'm implementing GUI in OpenGL ES 2.0 to fit with my application framework's existing structure. I'd like to have the UI rendering eat as little mobile processing capacity as possible. So to confirm...

Is the following general approach standard these days, for mobile games?

Use the following for each of controls and text:

One VBO - one glDrawElements() call for all elements
One texture atlas (certainly just one for text, preferably just one for control backgrounds)
Many quads batched in VBO, each quad corner having appropriate UVs to access the character or detail texture in question
For overlapping UI "panels", turn on depth buffer & use different float depths per panel
Modifiable textfields have their own small, separate VBO modified using glBufferSubData() or glBufferData() (to shorten on backspace/delete) as noted here.

Please confirm / deny / correct existing points or add missing details where necessary.

sentences:
What type of server should I use? I am planning on making a game in c#. It will be a turn based, space exploration game. I want the turns of the different players to be able to happen at the same time though. I have been researching for what type of server to use for hours and I cannot find one that works the way I want it to.

I have heard of listening servers, dedicated servers, and peer to peer.
-the peer to peer I have heard are almost gone, and obsolete for the most part
-dedicated servers are expensive, in terms of resources (lots of data)
-and there are listening servers which seem to be the best option.

Also is there a way for the server to run under the same exe as the client? like how minecraft does it? where each game is internally run in a server though 2 windows do not appear?

EDIT:

I know that I need to create my own server, and I am pretty sure I can do it in c# ( i made a small client and server that doesn't do much but it works) but I want to know what structure of server I should create

sentences:
Process for converting unity asset to scenekit scene/resource Has anyone successfully figured out a method for converting a unity3d asset to a 3d SceneKit model/scene? I imagine it would require exporting the asset into some third party file type, and then importing into scene kit. If you have any knowledge that can help me, would you kindly explain the process?

Unity3d has a fantastic asset store, and I want to import some of these things to a project that requires scenekit (unfortunately, "just use unity" is not really an answer to my problem-set).

sentences:
Unity - adding camera constraint to prevent the player from seeing beyond the scene Like the title says, I'm after some kind of constraint for the camera to prevent the player from seeing beyond the scene and seeing the Skybox. I came across the code to add a Mathf.Clamp, but I can't get it to work.
I'm currently trying to make a 2.5D platformer in which the camera follows the player (ahead), which leads to seeing beyond the scene to the far left and right. I already have an invisible wall in place to prevent the player from falling off, but I would love to also clamp the camera from going any further.

This is the script I have at the moment:

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

public class CameraController : MonoBehaviour
{
    [SerializeField] GameObject player = null;
    [SerializeField] [Range(0.1f, 2f)] float followAhead = 2f;
    [SerializeField] [Range(0.1f, 2f)] float smoothing = 1f;

    //public PlayerController playerController;

    private float minPosition = -9.37f;
    private float maxPosition = 4.68f;
    private Vector3 cameraClamp;

    const float m_minY = 2f;
    Vector3 targetPosition;
    Vector3 cameraOffset;

    void Start()
    {
        cameraOffset = transform.position - player.transform.position;
    }

    void Update()
    {
        targetPosition = (player.transform.position + (player.transform.forward * followAhead)) + cameraOffset;
        //smoothedForward = Vector3.MoveTowards(smoothedForward, playerController.GetTravelDirection(), 0.5f * Time.deltaTime);
        //targetPosition = (player.transform.position + (smoothedForward * followAhead));
        //transform.position = player.transform.position + cameraOffset;
        targetPosition.y = Mathf.Min(targetPosition.y, m_minY);
        transform.position = Vector3.Lerp(transform.position, targetPosition, smoothing * Time.deltaTime);
        cameraClamp.x = Mathf.Clamp(transform.position.x, -9.37f, 4.68f);
    }
}
```

sentences: Apply Vertex Colors to XNA Spritebatch sprites I know that you can use custom vertex and pixel shaders using SpriteBatch but I can't figure out how to apply colors to individual vertex points on a sprite generated by spritebatch. All I can do is apply a blanket color to the entire sprite rather than being able to blend between the 4 points that should be available in a quad. Can anyone give me a hand with this?

sentences:
How do I calculate where which pixel it's reflecting based on a height map? I saw this How can I Compute steepness for heightmap while looking for a way to reflect pixels.
But now that I have the steepness/slope I don't know how to calculate which angle it's pointing at.
Imagine if I had an image parallel (directly above my heightmap) with my heightmap and 100(units/pixels) away/above from it, if the steepness is 0, then i just grab a pixel at that same [x,y].  Imagine that i am trying reflect what the heightmap would show if i was to be able to see through my image.
But let's say I have a steepness of 1 which i am guessing is 45 degrees since 1/1 is 45 degrees but which pixel should i be grabbing from my image how do I calculate what angle the pixel is coming from [x,y].
How would i calculate which pixel(location) is reflected onto the heightmap (imagining that the heightmap is a chrome surface).
I know if the angle is too steep it'll be way outside of the image but I'll just use min/max hack to grab border pixels (unless you can think of another method to handle that) but for angles that are inside my image still...how do I calculate which pixels to reflect.
Basically trying to render an image reflected by height-map when image is placed directly above heightmap with variable input of distance between image and heightmap (use like 100 units as example, but i want to allow user the ability to change this distand)
Please explain in easy terms as sometimes I don't understand rare mathematics notation/symbols.
Thanks in advance.
EDIT: This got me searching for calculating normal for heightmap I think I found what I was looking for.

sentences: Can a material be created from a gameobject in Unity? I am trying to manually create snowflakes in unity, after I created a snowflake in the unity scene, is it possible to create a material out of it?

sentences:
How to Further My Game Dev Studies Away from Technology? I'm a college student, and I have a really boring class every Tuesday that's 2 hours and 45 minutes long. It's an interesting situation... attendance is required and checked, and electronic devices aren't allowed, but discussion isn't required and the lectures don't really matter to the exams. So I sit there in the back of the room either dozing off, doing Sudoku, doodling on my paper, pen-spinning, or trying to secretly use my phone without getting caught. I find myself wishing I could use the time productively.

Just like when one sits down with paper and crayons and can't think of anything to draw, I find myself wanting to do something to further my game development skills (e.g. work on the design of a game) but as I sit there with a pen and paper and the professor droning on, nothing comes to mind.

Help me get through this tedious class! What are some things I could think through or work on, or how can I figure out things to think/work on? Or even things I could print out in advance and read or solve during class. Remember the constraint is that I have no access to technology...

And I'm not sure a book would be appropriate. Though now that I think of it, I should probably just read game dev books from the library. Why didn't I think of that before? Anyway I still want to hear suggestions! What would you do with this time, if you were in this situation?

sentences:
How to draw point sprites with transparency in OpenGL without depth sorting? I am trying to render point sprites with alpha transparency and because I render millions of points depth sorting would kill performance. My issue as you can probably imagine is that artifacts appear in some of the borders when the draw order is not correct:

My code for drawing:

glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays(GL_POINTS,0,nSamples);

In my shader I just specify a alpha value in the output color depending on how close to the point center we are.

Is there any way to get rid of the artifacts and get a correct transparency render?

sentences:
Emulating 3d trajectory in top-down 2d game? As the title suggests, I am wondering if it's possible to emulate a 3d arrow trajectory to a top-down 2d game? If you would look at this clip of Age of Empires 2 game, especially when archers are firing from bottom to top. Can the parabola/arc of the trajectory (in that certain view angle) be emulated in a 2d orthographic, top-down game? So that the arrows would look like they're in 3d space. I know it's tricky but I wonder if there's some computation available for this.

If you could point me in the right direction or some sample code I would be very grateful. I've only implemented this projectile motion in a side-scroll view.

Thank you in advance.

sentences:
Computing pixel's screen position in a vertex shader: right or wrong? I am building a deferred rendering engine and I have a question. The article I took the sample code from suggested computing screen position of the pixel as follows:

VertexShaderFunction()
{
    ...
    output.Position = mul(worldViewProj, input.Position);
    output.ScreenPosition = output.Position;
}

PixelShaderFunction()
{
    input.ScreenPosition.xy /= input.ScreenPosition.w;
    float2 TexCoord = 0.5f * (float2(input.ScreenPosition.x,-input.ScreenPosition.y) + 1);
    ...
}

The question is what if I compute the position in the vertex shader (which should optimize the performance as VSF is launched significantly less number of times than PSF) would I get the per-vertex lighting insted. Here is how I want to do this:

VertexShaderFunction()
{
    ...
    output.Position = mul(worldViewProj, input.Position);
    output.ScreenPosition.xy = output.Position / output.Position.w;
}

PixelShaderFunction()
{
    float2 TexCoord = 0.5f * (float2(input.ScreenPosition.x,-input.ScreenPosition.y) + 1);
    ...
}

What exactly happens with the data I pass from VS to PS? How exactly is it interpolated? Will it give me the right per-pixel result in this case? I tried launching the game both ways and saw no visual difference. Is my assumption right?

Thanks.

P.S. I am optimizing the point light shader, so I actually pass a sphere geometry into the VS.

Solution:

struct PSInput
{
    float2 vPos : VPOS;
};

PixelShaderFunction(PSInput input)
{
    float2 ScrPos = input.vPos*halfPixel*2;

        //The correct Screen Space Texture Coordinates.
    float2 TexCoord = ScrPos + halfPixel;

    //Bonus: getting the world position.
    ScrPos = ScrPos*2 - 1;
    ScrPos = float2(ScrPos.x, -ScrPos.y);

    float4 position;
    position.xy = ScrPos;
    position.z = depthVal; // Read from the depth map.
    position.w = 1.0f;

    position = mul(position, InvertViewProjection);
    position /= position.w;
}

sentences:
RTS Engine or DotA-like game Is there any good documented and simple Game engine for RTS games, especially for building DotA-like game?

I know I can use Crystal Space, Irrlicht or another Game Engine. But I need most similar game or engine to DotA gameplay.

sentences:
Should I go with Windows Phone 7 or Try Android? I already know C# and am familiar with XNA.

So it would make sense to develop for the Windows Phone 7, but would it be worth while to learn Java, get familiar with Android, and instead develop for Android devices?

Android has been around longer so it would probably have a larger user base. Is it really worth it to try to develop for one of the more popular mobile platforms. (Windows Phone 7 has been out for like a month?)

I haven't tried either one yet though. I'm also going to buy a phone, so this decision would probably influence the phone that I buy. (to develop/test on)

sentences:
How to solve Sweep and prune false positives concerning large floor plane I am developing a 3d sweep and prune module for a project, and it is producing false positives.

The pair generation code is as follows:

    for (unsigned int i = 0; i < mXExtents.size(); i +=2)
    {
        if (mXExtents[i]->mOwner->getID() != mXExtents[i + 1]->mOwner->getID())
        {
                tempXPairs.push_back(new Pair(mXExtents[i]->mOwner, mXExtents[i + 1]->mOwner));
        }
    }
    for (unsigned int i = 0; i < mYExtents.size(); i +=2)
    {
        if (mYExtents[i]->mOwner->getID() != mYExtents[i + 1]->mOwner->getID())
        {
                tempYPairs.push_back(new Pair(mYExtents[i]->mOwner, mYExtents[i + 1]->mOwner));
        }
    }
    for (unsigned int i = 0; i < mZExtents.size(); i +=2)
    {
        if (mZExtents[i]->mOwner->getID() != mZExtents[i + 1]->mOwner->getID())
        {
                tempZPairs.push_back(new Pair(mZExtents[i]->mOwner, mZExtents[i + 1]->mOwner));
        }
    }

Where each object has a unique ID in the world. This works fine with small objects, but I have encountered a problem, where, If the ground is represented by a finite (albiet large) axis aligned plane, false positives and negatives are generated, preventing the Narrow-phase from doing it's job.

As you can see, each axis list is traversed in sets of 2 elements, and the unique ID's are compared. If they do not match, then a pair is generated for that axis.

Without the ground plane, The order of each list would be Amin, Amax, Bmin, Bmax etc. which would not generated false positives. However, with the addition of the ground plane, the order becomes  Pmin, Amin, Amax, Bmin, BMax, PMax.

Even if A and B are far away from one another on the axis in question, the pair is still generated. Additionally, If there is a genuine overlap on that axis, eg. Pmin, Amin, Bmin, Bmax, Amax, Pmax, then genuine intersections are missed.

Also, I've just encountered another problem: Even when traversing the lists one element at a time, In the case of objects stacked on an axis, collisions can be missed. The following image illustrates this:

If anyone else has encountered this problem, I'd like to hear how they solved it.

sentences:
Quixel asset to unity I downloaded asset from Quixel, I'm using Unity HDRP, the problem I am facing is how to properly create a mask map cause the asset from Quixel doesn't have metalness map where in HDRP mask map it requires channel R should be metalness map, and the base map requires RGB color and I've got diffuse map from the asset, to put diffuse map to the basemap slot the right way to do? I'm fairly new to the channel, so put it simple
1.How to pack channels for mask map if no metalness map in the asset, what to do with the empty channel
2.Is it right to put diffuse map to basemap slot?
3.What to do with the detail map in the maskmap , the same as to no metalness map provided in the asset.
4.Another question is heightmap, Unity provide pixsel mode and vertex mode, what is the consideration before choose the displacement mode, When I choose pixsel mode, the whole texture seems to be lowered down not the pixsel on the texture surface bumped or lowered down, it is the whole texture moved.
Thanks for answering these!

sentences: How can I set a MonoGame window's position? How do I set the position of my window in MonoGame?

sentences:
How to make a 2D semicircle sprite in Unity? I followed this answer: https://answers.unity.com/questions/1008644/semi-circle-2d-collider.html and was able to create a semicircle collider:

But is there any way I can just crop the circle sprite to make it a semicircle?

I tried looking for other documentation, but couldn't find any..

sentences:
Should I ping for a TCP-based game? I have a head-to-head game where two players communicate through a server based on TCP.

I am planning to implement a ping/pong mechanism in order to detect network disconnection situations. For example,

A pings B every 500ms.
If A receives no response from B, A shall consider B is disconnected.
If A receives no response from the server, A shall consider A is disconnected itself.

Do you think this ping/pong system is needed or other method is recommended?

sentences:
DirectSound only allows to capture and output from/to primary devices I wanted to allow my users to choose the devices that they want to capture from and output to.
For this, I used DirectSound device and capture device enumeration functions, obtained GUIDs of all available devices, and arrived at the following lists (DirectSound's grammar preserved):
Primary Sound Driver
Speakers (Realtek High Definition Audio)

Primary Sound Capture Driver
Mic in at front panel (black) (

However when I proceed to create sound capture and output devices, they only work if I supply the GUID of the primary drivers. If I supply Speakers or Mic, the result is always
No sound driver is available for use, or the given GUID is not a valid DirectSound device ID.

My thinking was that since the list of devices is returned to me by DirectSound system, then each GUID should be valid for capture or output, respectively. What am I missing?

sentences:
Handle Entities & Collision in large numbers I am creating a simple 2D maze game and I am a little confused about entities & collision detection.

At the moment, my entity class is an abstract class containing position, velocity, sprite and a booolean named shouldRender, as well as a tick and render method. Should I go with this or lean towards a component based entity system? If so, how would I implement that in java?

Also, when I update and render my entities I have a class named Level, which holds an arraylist with all entities. When updating and rendering my entities, I iterate through this list and render the entities that are visible in the camera, via the shouldRender boolean. However, all entities are updated, which makes the FPS drop.

Also, when checking for collisions: should I use a Rectangleand loop through all entities in the list and check if the current entity is colliding with any other entity? Or should I lean more towards stuff like quadtrees etc? (And how would I implement those?)

Because when every entity has to check for collisions with all other entities on the map the game runs at 10-20FPS, which is not too good.

So, if anyone could explain this to me, I would be very thankful!

sentences:
Coordinates of the corners of a rectangle bridging two circles I am implementing a game that involves slingshots and circular objects. I have gotten the basic "geometric" construction down for rendering the slingshot, but I am having trouble implementing this in my game (written in js, although any language explanations will be understood). Below is a diagram of the desired construction:

I know (cx, cy), which is the center of the circle I am "launching", the radius of that circle, and the position of the mouse at any given time (mx, my). The second circle around (mx, my) includes the same radius as the circle centered at (cx,cy). Lines ST and QP are parallel.

I must find the coordinates of points P, Q, S, and T. Any efficient approaches to this problem? (Would I use trigonometry, vector math, algebra?) Specific examples are appreciated. Thank you.

sentences:
How to program an enemy to attack when someone gets near it? Like in free-roam RPGs, like Skyrim, I want to make a super-rudimentary screen with just two objects: player and enemy. The enemy will walk around randomly through AI algorithms, and will only fight back gracefully when the player gets near them, and when the player runs away past a certain distance it will continue its AI walking cycle. How do I do this?

Any guidance would be nice.

sentences: Drawing in a static location when using a camara transform I'm using a matrix transform to move a 2d camera in Monogame, and I was wondering: How, if I initiated my spritebatch with a matrix transform, can I draw something in a static (non-moving) position? For example, I want to put debugging variables in the corner of the window.

sentences:
PYGAME - Sprite movement seize to function when entire X and Y span is reviewed I've created an sprite class that has a detection radius checking if the player enters the zone. If yes, the sprite moves towards the player. It works perfectly fine when the sprite checks for three directions (X is greater, X is lower, Y is greater/lower), in other words, the sprite only moves up and down if all four directions are enabled..
Here is my code for the move function:
def move(self):
        target_x, target_y = self.target.pos

        if self.mob_wc + 1 <= 24:

                if self.pos_x < target_x:
                    self.vel += vec(self.speed, 0)
                    self.image = self.game.orc_mob_walkRight[self.mob_wc//6]
                    self.mob_wc += 1

                elif self.pos_x > target_x:
                    self.vel = vec(-self.speed, 0)
                    self.image = self.game.orc_mob_walkLeft[self.mob_wc//6]
                    self.mob_wc += 1

                if self.pos_y > target_y:
                    self.vel = vec(0, -self.speed)
                    self.mob_wc += 1

                elif self.pos_y < target_y:                   <-- if this condition is disabled
                    self.vel = vec(0, self.speed)                 The sprites move perfectly upwards
                    self.mob_wc += 1                              towards the player, shifting between
                                                                  moving On X and moving on Y.
        else:                                                     However, if it is enabled, the
            self.mob_wc = 0                                       sprites ONLY move on the Y field

Here is my code for the update function:
    def update(self):
        self.rect = self.image.get_rect()
        self.rect.center = self.pos
        self.pos += self.vel * self.game.dt

        self.pos_x, self.pos_y = self.pos

        target_dist = self.target.pos - self.pos

        if target_dist.length_squared() < self.detect_radi**2:
            self.move()
        else:
            self.vel = vec(0,0)
            self.image = self.game.orc_mob_img

For the way they move i followed this post.
I am aware my build differs due to the use of vectors, which is something that i'm suspecting may be the cause of the issue. If anyone have any idea or tips to why this issue may occur, please tell me cause i've been sitting trying to fix this for 3+ hours now..

sentences:
How to move on a mesh? I am working on my collision system right now and I wondered how you can actually walk on a mesh. For example I'm thinking about a dynamically created little village and I want to be able to move the player across roofs etc.

I read about two different approaches to that problem.

Simulate the next step and test if the step can be performed. If it's all right, perform that step or abort otherwise
Perform the step and let the collision system handle a collision in the next frame.

Now, with regards to speed and accuracy, which one is better suited for my problem. As a sidenote: the player should also be able to climb stairs and I also want to prevent the player from moving on very steep parts of the model.

sentences:
How to resolve collision of two or more linearly moving non-rotating axis-aligned 2d boxes? Sorry for my bad english.

In my game, to resolve collision of a moving-box (e.g. the player) and fixed-boxes (e.g. tiles) :-

I check in advance whether a moving-box is going to collide with a fixed-box. If yes, then start moving the moving-box in 1 unit displacement in the direction of original displacement but only after checking in advance whether the next movement will result in a horizontal or vertical collision with any fixed-box. If in the next move it is going to collide with a fixed-box horizontally, then the x side of the moving-box is resolved and no more displacement in horizontal direction. Same for the y side.

But my problem is - how to resolve the collision of two (or more) moving axis-aligned non-rotating boxes?

What other people do is update position (resolving collision in the process) of the moving-boxes individually (one box at a time). That is wrong because in a certain time all of the moving-boxes are supposed to move simultaneously. So, this would result in wrong collision resolution. People won't notice it but collision would be resolved in wrong direction.

Other people separate the boxes using a minimum translation vector which they calculate using Separating Axis Theorem. This would also result in wrong resolution since the axis might not be the  one that the boxes were supposed to be in contact with before intersecting with each other.

How can I resolve collision of two moving axis-aligned non-rotating 2d boxes correctly ?

sentences:
States, actions logic am I doing it right? Currently I have the follow states:

Need To Run
Run
Need To Walk
Walk
Need To Fight
Fight

Am I misunderstanding it and mixig possible actions with states ?

I mean, to me Need To Run would either return true of false telling wether I should procced to the Run action or not and same goes for the other needs.

While I am fighitng should I have second FSM to threat what skills it should be using for example if it needs to heal or not ?

For instance inside the fight I would have the another FSM for

Need To Heal
Heal
Back To Fight
Use Skill

sentences: How to eliminate roll rotation? Let's say I have Rotation(0, 0, 180) [pitch, yaw, roll]. How to do it that I would have Rotation(180, 180, 0) which is exactly the same?

sentences:
Do I need a server to connect two players in a mobile game? I would like to make a 2 players app game, where 2 players can compete with each other in real time.

If I want the player to be able to compete with the public (anyone who registered with my game able to compete with one another), do I need a server?

If I want the player to be only able to compete with his facebook friends, do I need a server?

Do I need a server at all in the first place, for 2 players game?

sentences:
Rendering voxel data efficiently With Metal, I need to pass in an array of primitives to the GPU to be rendered. I'm making a terrain-based voxel game like Minecraft, but I have a problem.
foring through all of the visible voxels, and in each processing the list of block IDs and Metadata into a list of primitives for rendering is asinine, because I imagine obtaining primitives from raw block data being an expensive process. Surely there's a better way.
Given that you cannot duplicate or cull vertices and planes on the fly on the GPU, doing this in the vertex shader is out of the question. My problem is when or how translate raw block data into a list of primitives ready for the GPU to apply 3D projections to it.
It would definitely be a good idea to maintain the already-processed primitive lists, and only update them when a block updates. However, maintaining these is tricky. Maintaining them one block at a time is very messy, but one voxel at a time would require stitching them together prior to rendering.
This is the foundation of a block sandbox game like Minecraft. Without it I can't progress to gameplay mechanics. My game manages voxel data with a C++ style map, of 3 dimensional arrays of 16 by 16 by 16 4-byte blocks. I simply need to know where, when, and how the process of obtaining primitives from raw block data should take place. How do most games do it?
It's also worth noting that I'm using Metal, a game framework, rather than a game engine, so if game engines generally abstract away this process and therefore this question seems nonsensical, I'm not using a game engine, I'm using a game framework.

sentences:
What is the proper way to process joystick input? What is the proper way to process joystick input?

Take, for example, the Xbox One controller. XInput returns joystick input along the x and y axis. I'm not sure if the hardware just measures voltage across the two axis, or not; I'm not very knowledgeable, in the hardware domain.

I'm unsure what data processing is done by API's like XInput already - but since the dead zone is still prevalent, I'm assuming XInput does very little input massaging. This leaves me with a few questions:

Should the dead zone be clipped circularly or rectangularly?
What type of low-pass filter should be applied, if any? Perhaps a moving average should be applied?
Should a bias be introduced into the input based on the resting input?

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:
Is SDL2 alone capable of dynamic (or deferred) lighting? I'm talking about JUST SDL2, not OpenGL or DirectX.
Would drawing deferred lighting bulk the CPU up and how would it be done?

sentences:
How to correctly enable anti aliasing in XNA? In my project when I add graphics.PreferMultiSampling = true; this line in the Game1 Constructor (as the msdn website suggests), anti aliasing does not enable. Any idea what I might be missing ? Here is the full code:

public Game1() : base()
{
    graphics = new GraphicsDeviceManager(this);
    graphics.PreferredBackBufferWidth = 720;  // game's width
    graphics.PreferredBackBufferHeight = 720; // game's height
    graphics.PreferMultiSampling = true;
    Content.RootDirectory = "Content";
}

protected override void LoadContent()
{
    spriteBatch = new SpriteBatch(GraphicsDevice);
    LightningSegment = Content.Load<Texture2D>("Lightning Segment");
}

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.DarkCyan);

    Matrix skew = Matrix.Identity;
    skew.M12 = (float)Math.Tan((double)Math.PI / 6);
    spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, skew *
         Matrix.CreateScale(1.5f, 3f, 1));
    spriteBatch.Draw(LightningSegment, new Vector2(200, 200), null, Color.Red, 0,
         new Vector2(0f, 300f / 2f), new Vector2(250f, 1f), SpriteEffects.None, 0f);
    spriteBatch.End();

    base.Draw(gameTime);
}

sentences: Variable height jumping in side scrollers How can I have the player jump higher if the jump key is held down longer? I am currently just reducing gravity as long as the key is held and the player is jumping, but this looks odd.

sentences:
Creating Compute Shaders throws E_INVALIDARG exception in SharpDX I've recently been working on a small helper for creating and using compute shaders in C# along with Monogame/XNA. My end goal is simply to have compute shaders working in C#.
My main issue is as such:
   var result = SharpDX.D3DCompiler.ShaderBytecode.CompileFromFile(filepath, "CSMain", "cs_5_0", ShaderFlags.Debug);
   if (result.ResultCode.Failure)
      throw new Exception($"HLSL Compilation failed with the code: [{result.ResultCode.Code}] and message: [{result.Message}]");
   shader = new SharpDX.Direct3D11.ComputeShader(device, result.Bytecode);

Calling the constructor on the ComputeShader class throws the error: "HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect." (Of type SharpDXException). The device is obtained via Microsoft.Xna.Framework.Graphics.GraphicsDevice.Handle casted to a D3D11 Device.
Call Stack:

Anyone know how to fix this? Or is this just something I'll have to find some new way of doing?
NOTE:
The fact that I went down the Monogame-DirectX + SharpDX route is largely incidental, but I don't seem to have many options - something like Vortice.Windows, which aims to replace the now abandoned SharpDX, doesn't appear to have compute shader support. While I wouldn't mind using OpenGL, and would be happy with being recommended working .Net Core OpenGL binding libraries (Vulkan would probably be way over my head), that type of question isn't accepted here, but I'm aware it may be the better option.

sentences:
One of my variable won't increase I start learning unity recently and I am using Unity 2017.3.0f3. Now I'm creating a Block Breaker game and I tried to create a way to check win condition and to go to next level.
So I write those two variables:

public static int BreakableCount = 0;
public int RemindBricks = 0;

At start I write this code to count the number of blocks in my scene:

 isBreakable = (this.tag == "Breakable");
     if (isBreakable) {
         BreakableCount++;
     }

Which works perfectly and after that I set the win condition:

void OnCollisionEnter2D (Collision2D col)
     {
         Handlehits ();
         print ("bricks count is= " + BreakableCount);
         print ("remind brick is= " + RemindBricks);
         print ("_______________");
         if (RemindBricks == BreakableCount) {
         SimulateWin();
         }
     }
     void Handlehits ()
     {
         int MaxHit = hitsprites.Length + 1;
         TimeHit++;
         if (TimeHit >= MaxHit) {
             RemindBricks++;
             DestroyObject (gameObject);

   } else {
     LoadSprite();
     }
 }

My problem is RemindBricks only increased once and after that it won't increase at all. Here is the result:

And here my entire project to download if you want. So please tell me why my variable won't increase and how to fix it. Thanks.

sentences:
Initializing entities vs having a constructor parameter I'm working on a turn-based tile-based puzzle game, and to create new entities, I use this code:

Field.CreateEntity(10, 5, Factory.Player());

This creates a new Player at [10; 5]. I'm using a factory-like class to create entities via composition.

This is what the CreateEntity method looks like:

public void CreateEntity(int mX, int mY, Entity mEntity)
{
    mEntity.Field = this;
    TileManager.AddEntity(mEntity, true);
    GetTile(mX, mY).AddEntity(mEntity);
    mEntity.Initialize();
    InvokeOnEntityCreated(mEntity);
}

Since many of the components (and also logic) of the entities require to know what the tile they're in is, or what the field they belong to is, I need to have mEntity.Initialize(); to know when the entity knows its own field and tile.

The Initialize(); method contains a call to an event handler, so that I can do stuff like this in the factory class:

 result.OnInitialize += () => result.AddTags(TDLibConstants.GroundWalkableTag, TDLibConstants.TrapdoorTag);
 result.OnInitialize += () => result.AddComponents(new RenderComponent(), new ElementComponent(), new DirectionComponent());

This works so far, but it is not elegant and it's very open to bugs. I'm also using the same idea with components: they have a parameterless constructor, and when you call the AddComponent(mComponent); method in an entity, it is the entity's job to set the component's entity to itself.

The alternative would be having a Field, int, int parameters in the factory class, to do stuff like:

new Entity(Field, 10, 5);

But I also don't like the fact that I have to create new entities like this.
I would prefer creating entities via the Field object itself.

How can I make entity/component creation more elegant and less prone to bugs?

sentences:
Why is Unity UI Image color not being animated? Animation is changing the color of an UI Image but the color only changes only in the inspector but not Game/Scene view.

In this video I demonstrate the problem clearly.

sentences:
Error loading "SpriteFont1". File not found I have an issue while trying to load a font file with the extension ".xnb" and I am receiving following error:

Error loading "SpriteFont1". File not found.

For following code:

public static Dictionary<string, T> LoadListContent<T>(this ContentManager contentManager, string contentFolder)
        {
            DirectoryInfo dir = new DirectoryInfo(contentManager.RootDirectory + "/" + contentFolder);
            if (!dir.Exists)
                throw new DirectoryNotFoundException();
            Dictionary<String, T> result = new Dictionary<String, T>();

            FileInfo[] files = dir.GetFiles("*.*");
            foreach (FileInfo file in files)
            {
                string key = Path.GetFileNameWithoutExtension(file.Name);

                result[key] = contentManager.Load<T>(key);
            }
            return result;
        }

The file is actually there and I am getting here FileInfo[] files = dir.GetFiles("*.*"); one file which is present in the folder.

I am using the function like this:

fontList = ContentLoader.LoadListContent<SpriteFont>(Content, "Fonts");

Is there something which I have overlooked?

sentences:
Rotate camera around offset to player position (third person shooter view) I'm trying to rotate my camera 'next to' the player object so that the player is not in the way of the screen-centered reticle. What I am trying to achieve is something like the targetting system of Fortnite, GTA 5 or Red Dead Redemption (or most third-person shooters), where the camera/player are offset slightly so that you can see directly in front of them.
My code so far allows me to rotate the camera about the player (object here) and it follows the player's position. I cannot figure out how to offset it.
public void update(final GameObject object)
    {
        this.newMouseX = Input.getMouseX();
        this.newMouseY = Input.getMouseY();

        final float dx = (float) (this.newMouseX - this.oldMouseX);
        final float dy = (float) (this.newMouseY - this.oldMouseY);

        // Rotate the camera on mouse move
        this.verticalAngle -= dy * this.mouseSensitivity;
        this.horizontalAngle += dx * this.mouseSensitivity;

        // Distances from side view
        final float horizontalDistance = (float) (this.distance * Math.cos(Math.toRadians(this.verticalAngle)));
        final float verticalDistance = (float) (this.distance * Math.sin(Math.toRadians(this.verticalAngle)));

        // Distances from top view
        final float xOffset = (float) (horizontalDistance * Math.sin(Math.toRadians(-this.horizontalAngle)));
        final float zOffset = (float) (horizontalDistance * Math.cos(Math.toRadians(-this.horizontalAngle)));

        this.position.set(object.getPosition().getX() + xOffset, object.getPosition().getY() - verticalDistance + VERT_OFFSET, object.getPosition().getZ() + zOffset);

        this.rotation.set(-this.verticalAngle, this.horizontalAngle, 0);

        this.oldMouseX = this.newMouseX;
        this.oldMouseY = this.newMouseY;
    }

This is the sort of thing I'm trying to achieve:

sentences:
How to handle Multiple-accounts creation and cheating? I am developing a game that is running as a web application. The fact is that the game lose sense if one player creates several accounts. Imagine that is a turn-based strategy game, and if you play against yourself (with another account) you can earn tons of points easily.

At first, I thought about logging every single user action, and then comparing the users IP to detect if there is any clue of cheating. But then I noticed that different users could be running under the same IP, for example if they are in the school and all them share the same IP using a proxy. Using this way innocent people could result banned.

Is there any better approach that I'm missing?

sentences:
2D HLSL World position I'm trying to get world position from my vertex shader to my pixel shader so that I can disable the shader once a preset X coordinate has been passed (no shading once I'm over X).

Getting the screen position is not a problem so far but despite my best efforts to look after it and implement examples the calculations just don't return the preferred world positions I'm looking for.

Update: So got it to somewhat work, after compiling the shaders the output changes to such:

Could anyone explain why this happens?

I should mention that I'm really new to HLSL, been only scripting so far.

Edit:Added matrices.

world = Matrix.Identity;
view = Matrix.CreateScale(new Vector3(1, 0.75f, 0)) * Matrix.CreateTranslation(-playerpos.X, -playerpos.Y, 1);
projection = Matrix.CreateOrthographicOffCenter(0, view.Width, view.Height, 0, 0, 1);
Matrix halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0);
projection = halfPixelOffset * projection; <\code>

    texture lightMask;
    sampler mainSampler : register(s0);
    sampler lightSampler = sampler_state{Texture = lightMask;};
    float4x4 World;
    float4x4 View;
    float4x4 Projection;

    struct vs2ps
{
    float4 Pos : POSITION0;
    float4 TexCd : TEXCOORD0;
    float3 PosW : TEXCOORD1;
};

vs2ps VS(float4 Pos : POSITION0,float4 TexCd : TEXCOORD0)
{
    vs2ps Out;
    Out.Pos = mul(Pos, World*View*Projection);
    Out.TexCd = TexCd;
    Out.PosW = mul(Pos, World);
    return Out;
    }

float4 PixelShaderFunction(vs2ps input) : COLOR0
{   float2 texCoord = input.TexCd;
    float4 screenPosition = (input.PosW,1.0f);
    float4 lightColor = tex2D(lightSampler, texCoord);
    float4 mainColor = tex2D(mainSampler, texCoord);
    if(screenPosition.x < 3500)
    {
         return (mainColor * lightColor);
    }
         else return mainColor;
}

sentences:
Finding the side of a shape a ray intersects For some simple 3D shapes (cubes, prisms) how can I determine which side a ray intersects, knowing the direction of the ray, and the normals of the shapes' sides.

I thought of using plane intersection for each side, but I'm sure there's a more efficient way.

Also, could this be done for a cylinder?

sentences:
How do I decrease the scale of an instanced node or scene? I'm trying to decrease size of instanced RigidBody2D scene, through code. With scale(), I'm trying to decrease the size of the image/sprite that's attached to the RigidBody2D. The problem is, it's not working.

No matter how much I try to scale down, the size of the blood drop circle remains the same.

const blood_druple_scn = preload("res://Scenes/blood.tscn")

func spawnBlood():
    var newBlood = Blood_druple_scn.instance()

    rotationAdd = rotationAdd + 30

    if(switchBloodSize == 0):
        set_scale(Vector2(2,1)) //This part is my problem
        print("blood size: ", newBlood.get_scale())
        add_child(newBlood)
        switchBloodSize = 1

    elif(switchBloodSize == 1):
        newBlood.scale(Vector2(0.5,0.5)) //This part is my problem
        print("Blood size: ", newBlood.get_scale())
        add_child(newBlood)
        switchBloodSize = 0

    newBlood.set_pos(Vector2(100,100))
    rotate(rotationAdd)

As you can see, I have two different if conditions, each with a different scale() and size. Sadly, both remain the same size. The strange part is that it does display the scale values as been altered, yet the newBlood instance is not visually changing. Why is this?

sentences:
What's a good way to draw multiple circles? Why does the following code not work?

public float ThetaScale = 0.0001f;
private int Size;
private LineRenderer LineDrawer;
private float Theta = 0f;

void Start ()
 {
  LineDrawer = GetComponent<LineRenderer>();
  LineDrawer.SetWidth(0.1f, 0.1f);
  LineDrawer.material = new Material(Shader.Find("Mobile/Particles/Additive"));
  LineDrawer.SetColors(Color.blue, Color.blue);
 }

void DrawingCircle(float radius)
{
Theta = 0f;
Size = (int)((1f / ThetaScale) + 1f);
LineDrawer.SetVertexCount(Size);
for(int i = 0; i < Size; i++){
    Theta += (2.0f * Mathf.PI * ThetaScale);
    float x = radius * Mathf.Cos(Theta);
    float y = radius * Mathf.Sin(Theta);
    LineDrawer.SetPosition(i, new Vector3(x, y, 0));
}}

void Update ()
{
    for(int l = 0; l < 3; l++)
    {
        DrawingCircle(l);
    }
 }

I want to plot a multiple circles like that

What's a good way to draw multiple circles?

sentences:
What is the process to start developing games for the PS Vita? Let's assume a solo/indie developer using Unity and targetting the PS Vita. Let's also assume that the developer's region is Europe.

What does the developer need to start developing (only developing, not publishing) on the PS Vita?
Which Unity version/license?
What needs to be done on the Playstation side? (registration etc)

As an extra point:

What extra steps are needed for the said developer be able to distribute an alpha/beta version of the game? (for a gamejam and feedback)

sentences: How to create a container with thin borders? I want to make a container with a thin border, for this I created a 32x32 pixel image, but by adjusting the Canvas Scaler and also setting the Anchors I noticed that at some screen resolutions the sides of the container disappear or change color, how can I fix this?

sentences: Techniques for bot movement in (first person) shooter games I was wondering what kind of technologies were used in FPS games to move bots around the level. I know the pathfinding is done using waypoints or navigation meshes but how do the bots actually rotate and move over those paths? Is something like opensteer used for that, if so, which particular parts?

sentences:
How to make a smooth projectile in roblox? I am trying to make a projectile (Energy ball) for my game. I am using body velocities, but the issue is is that it seems laggy. I shoot it then half a second through flight it seems to stop in mid air for a quarter of a second then continue. This only happens the first minute of playing.

Here is my code:

local Motion = Instance.new("BodyVelocity", Ball)
Motion.Velocity = ((MouseClickLocation - Player.Character.HumanoidRootPart.Position).Unit*100)

Why is the described behavior happening and how can I make it never happen?

sentences:
Is it appropriate approach to simulate shadowing via occlusion culling of lights? I have own deferred renderer and a scene with both closed and open spaces. I want to prevent light passing though solid objects. For example, there can be a house with a lot of point lights inside. I want to prevent lighting of objects outside the house, but it is not always possible to adjust appropriate falloff distance.
And it seems that creating shadows maps for each of them will require a lot of time and memory. So I could try another approach - create some set of bounding primitives for each light source and perform occlusion culling with all of them to determine whether some space is affected by the source.
Is this method appropriate for the described situation or maybe is there any other methods to simulate shadowing?

sentences:
isometric coordinates issue: (0,0) and (5,5) are flipped? I am having an issue with the isometric coordinates.

When I enter the coordinates (5,5), the character should be at the bottom corner of the tile, but it is at the top corner, (5,5) and (0,0) look like they have been switched :

With (5,5), my character goes at the top instead of being at the bottom corner :

(The convertToScreen method is from :
Isometric rendering and picking? )

//create isometric tiles
public Vector2 convertToScreen(float x, float y, int offsetX, int offsetY)
    {
            Vector2 screen;
            float TILE_WIDTH = 1;
            float TILE_DEPTH = 0.5f;
            //calculate the screen coordinates
            float _x =  offsetX - (y * TILE_WIDTH/2) + (x * TILE_WIDTH/2) - (TILE_WIDTH/2);
            float _y = offsetY + (y * TILE_DEPTH/2) + (x * TILE_DEPTH/2);

            screen = new Vector2(_x, _y);
            return screen;
     }

//in the "create" method
float valueCam = 10;
    camera = new OrthographicCamera(valueCam, valueCam * (Gdx.graphics.getHeight() / (float)Gdx.graphics.getWidth()));
    camera.translate(new Vector2(0,0));

    Vector2 conv = convertToScreen(5,5, 0,0);
    myCharacter.setPosition(conv.x, conv.y);

    public void renderMap(){
        float tileWidth = 1;
        float tileHeight = 0.5f;
        for (int x = 0; x < 5; x++){
            for(int y = 5-1; y >= 0; y--){

                Vector2 v = convertToScreen(x,y, 0,0);
                float x_pos = v.x;
                float y_pos = v.y;

                //float x_pos = (x * tileWidth*0.5f ) + (y * tileWidth*0.5f);
                //float y_pos = - (x * tileHeight*0.5f) + (y * tileHeight*0.5f);

(edit: the previous issue was the offset of x-1, fixed by changing the x_pos and y_pos as shown above)

sentences:
Can Harlowe for Twine 2 handle variable references inside a Datamap? I'm starting to learn Twine and I'm putting together a little framework for making a game.

I'm trying to make a DataMap named 'Door' that has a key/value pair of "openCondition",$doorUnlocked. What currently happens is that "openCondition" is set to what $doorUnlocked is when 'Door' is created (false).  This is fine, but when $doorUnlocked becomes 'true', "openCondition" stays the same, because it's already been set.

Is is possible to set a DataMap value to a reference of a variable?
Are reference variables even built into Harlowe?
If not, are they available in any other Twine format?

sentences:
Component systems: No inheritance hierarchy at all, or a basic one? (I asked a similar question, but it had more questions inside it and I feel it wasn't clear enough, so I'm opening a new one).

Until recently I implemented all my games using an inheritance hierarchy. Those were simple games.

For example:

          Entity
          /    \
      Movable  Static
      /  \        /  \
    Orc  Mage   Tree  Wall

This worked for simple games.

However recently I read about 'entity component systems'. Using this approach, a class doesn't inherit from another class in order to receive functionality. Instead it is composed with it, which allows for more flexible designs.

My question is this:

I know that each component is a class (derived from a common base class).

However, there is one thing I don't understand: In the 'component system' approach, is there one class that all entities are instances of - and the only difference between entities is the components they contain?

For example: There is a class Entity. All entities in the game are instances of this class.

The only differences between them is that they are composed with different Component objects.

For example:

Component aiComponent = new AIComponent();
Component movementComponent = new MovementComponent();
Component physicsComponent = new PhysicsComponent();
Component rangedAttackComponent = new RangedAttackComponent();

Entity orc = new Entity();
orc.addComponent(aiComponent);
orc.addComponent(movementComponent);
orc.addComponent(physicsComponent);

Entity shootingCastle = new Entity();
orc.addComponent(aiComponent);
orc.addComponent(rangedAttackComponent);
orc.addComponent(physicsComponent);

As you can see, both orc and shootingCastle are instances of the Entity class. But they are composed with different components.

Is this how 'entity component systems' are supposed to be? No inheritance hierarchy at all? Or is there still a basic inheritance hierarchy, but most of the logic is inside components?

sentences:
Are there any preexisting maps for a Minecraft-like level I could use in my engine? I am working on a tiny cube-based engine like Minecraft. I was wondering if there is a way for me to get large blocky terrain in a text format that I can use for rendering on my engine?

I don't want to start on procedural generation now, I just want a resource where I can get the coord list for a pretty looking terrain.

Alternatively, is it possible for me to parse the Minecraft world files and use that data to generate terrain/buildings in my code?

sentences:
Help with off-game tasks I love writing video games for fun, and often do that.

I noticed, anyway, that most of the times implementing the gameplay itself doesn't take too much time to me (maybe because I already did that plenty times and know what and how to do for most of the things), but when I try to implement off-game stuff I get lost.

By off-game I mean what is not gameplay: menus, cutscenes between levels, world map to choose levels, saving and loading status, managing replays ... Only tried to write a few of these a few times, but always failed; that's why I never really completed and distributed a game.

Are these common problems? And where should I start to do this? Where could I find some books/guides about such stuff?

sentences:
Procedural Star Generator I want to develop a procedural galaxy / starfield generator.

A rather simple approach would be to use some pseudo-random algorithm to repeatedly create a star and its properties (such as position, mass, luminosity, density, and so on...). But in doing that, I would be quite limited in terms of the total number of stars. They would all be created at startup, and kept in memory, even the ones which are totally out of the player's range.

I do not want to end up with millions of star instances.

What I need is some way to only generate the stars which are near to the player and, therefore, being rendered. On the other side, I want the player to be able to return to stars, once they disappear due to being too far away.
Take Space Engine for example, it also does not generate all its trillion stars at the start of the simulation.

What would be a suitable approach to this kind of problem?

sentences:
How can I analyze which level on which of three difficulty settings causes players to quit my game? I have a puzzle game with N stages where each stage has 3 difficulty levels. Users have to finish current unlocked stage to access next stage, but they can access any difficulty level for unlocked stage.

As example, User A played stage 1 with difficulty level EASY, then he changed the difficulty level to HARD and finished stage 2.

I'm using Flurry Analytics to log as above: "stage1_Completed_Easy" and "stage2_Completed_Hard"

The problem is: there could be more users completed stage N than those who sompleted stage N-1
As example,  there are:

100 players completed stage1 EASY
50 players completed stage1 HARD
50 players completed stage2 EASY
25 players completed stage2 HARD
70 players completed stage2 NORMAL

I'm making assumption that each player only completed each stage once. This means from stage 1 to stage 2, I'm losing 5 players

I want to know which level and what difficulty that makes users stop playing my game

sentences:
How much more do I have to learn? So I started learning java sometime ago and now I am understanding packages.

My main goal is to do minecraft modding. Can someone with modding experience please tell me how hard(or easy) minecraft modding is? And how much time will it take for me to get to a level when I can start modding?

sentences:
Which nodes of the Collada DAE are most relevant for game object/character use? I'm really new to game dev / D3D. And I was looking to choose an intermediary format to work with and convert to my internally used format. Collada DAE seems to be good as it can export animation too and it's XML. Kind of bloated but easy to parse.

My expertise is in reusable code writing, libraries, APIs and such. So my first impulse was to go an implement a FULL parser of the Collada format given the fact that I'm not 100% what I need or will need to extract from it.

As it seems Collada is trying to be everything and the kitchen sink, there's definitely stuff in there I don't think I need to be concerned about. So, sanity prevailed and decided to come here and ask the experienced people what are the important nodes for game characters and objects in the .DAE file? Or is there another format considered friendlier by game devs that can export animations too?

I've figured out the following are important:

geometries (mesh + triangles)
materials + images
animations + controllers
visual scenes + scene

What else am I missing from the top-level node list? I don't think lights are important as I deal with that in code. I just need to import meshes + textures + animations. At least for now, as I'm just starting out in D3D programming.

For a non-animated object I can get away with a .OBJ file but for a player with animations, I really don't think .OBJ supports them.

  So the question is: Which DAE nodes are relevant to game objects and animated characters?... and if someone experienced consuming this format could provide a few words describing them, in a more game-friendly way then that specification... would be great! Or should I use another intermediary format but .DAE?

sentences:
Unity: Shader Outlined/Uniform uses undefined Queue: 'Geometry + 1' my outline shader was working fine but suddenly it started throwing this error. the game still works fine in the editor though but when i try to build it gets stuck on the step:

Packing assets - sharedassets0.assets

this is my shader:

Shader "Outlined/Uniform"
{
    Properties
    {
        _Color("Main Color", Color) = (0.5,0.5,0.5,1)
        _MainTex ("Texture", 2D) = "white" {}
        _OutlineColor ("Outline color", Color) = (0,0,0,1)
        _OutlineWidth ("Outlines width", Range (0.0, 2.0)) = 1.1
    }

    CGINCLUDE
    #include "UnityCG.cginc"

    struct appdata
    {
        float4 vertex : POSITION;
    };

    struct v2f
    {
        float4 pos : POSITION;
    };

    uniform float _OutlineWidth;
    uniform float4 _OutlineColor;
    uniform sampler2D _MainTex;
    uniform float4 _Color;

    ENDCG

    SubShader
    {
        Tags{ "Queue" = "Geometry + 1" "IgnoreProjector" = "True" }

        Pass //Outline
        {
            ZWrite Off
            Cull Front
            CGPROGRAM

            #pragma vertex vert
            #pragma fragment frag

            v2f vert(appdata v)
            {
                appdata original = v;
                v.vertex.xyz += _OutlineWidth * normalize(v.vertex.xyz);

                v2f o;
                o.pos = UnityObjectToClipPos(v.vertex);
                return o;

            }

            half4 frag(v2f i) : COLOR
            {
                return _OutlineColor;
            }

            ENDCG
        }

        Tags{ "Queue" = "Geometry"}

        CGPROGRAM
        #pragma surface surf Lambert

        struct Input {
            float2 uv_MainTex;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
            o.Albedo = c.rgb;
            o.Alpha = c.a;
        }
        ENDCG
    }
    Fallback "Diffuse"
}

i tried looking on the internet but couldn't get any help on this error.

sentences:
Accessing a char array from another class I'm working on a crossword puzzle game. In order to set the letters in my tiles, I have a script attached to text components that accessing a char array that stores my letters. It looks like this:

First class:

  public class GenerateBoard : MonoBehaviour
  {
    public static char[,]gameBoard = new char[15,15];
    void Start()
    {
        gameBoard[0, 0] = 'W';
    }

Second class:

public class SetLetter : MonoBehaviour
{
    Text letter;
    public int x;
    public int y;
    // Start is called before the first frame update
    void Start()
    {
        letter = GetComponent<Text>();
        letter.text = GenerateBoard.gameBoard[x,y] + "";
    }

    // Update is called once per frame
    void Update()
    {
        Debug.Log("glitch: " + GenerateBoard.gameBoard[0, 0]);
    }
}

I would expect Debug.Log to print 'W' but it appears to be empty. Why isn't it accessing the letter 'W' from the first class? When I use Debug.Log in my first class it properly prints 'W'.

sentences:
Creating 3D objects from code and their normals I'm trying to create my own 3D objects from scratch so I can generate my own terrain for a game I'm making.

So I created a cube and realized the lighting was strange, I looked up the cause and found that each face needed multiple vertices so they could hold their own individual normal because face x's normal will be different to face y's normal, even though the vertices are the same.

So I re-made my cube this way and went on with my terrain generating code. Now that I'm getting into creating more sophisticated meshes the number of vertices and indices are getting quite high (atleast compared to my cube) and a big reason for it is because I have to replicate a lot of the vertices just to have a different normal.

I just wanted to ask if this is normal (I know, I'm so funny) and that I'm doing everything right? Or is there a simple way for a single vertice to hold multiple normals?

sentences:
How do I make 2 players from one Class? I am teaching myself XNA and only started a few days ago. I am making a clone of Pong and have made a class for the Paddle:

I am wondering how I can create 2 paddles one for each player from the one class.

Thanks,

TeaBelliedTitch

sentences:
How can I simulate the gravity of a sphere instead of a plane? How can I simulate the gravity of a sphere instead of a plane?

For a naval warfare game, I wish to implement a surface that simulates a curved plane with horizon. The plane is rendered with water physics, which needs, along with all physical objects, avatars and projectiles, to respond to gravity as a focal point rather than a distributed surface.

sentences:
Cocos2d: Adding a CCSequence to a CCArray I have a problem with an action performed by a sprite. I have one CCSequence in a CCArray and I have an scheduled method (is called every 5 seconds) that make the sprite run the action. The action is performed correctly only the first time (the first 5 seconds), after that, it does not.

Here is the code:

In .h ->

@interface PowerUpLayer : CCLayer {
    PowerUp *powerUp;
    CCArray *trajectories;
}

@property (nonatomic, retain) CCArray *trajectories;

In .mm ->

@implementation PowerUpLayer

@synthesize trajectories;

-(id)init
{
    if((self = [super init]))
    {
        [self createTrajectories];
        self.isTouchEnabled = YES;
        [self schedule:@selector(spawn:) interval:5];
    }

    return self;
}

-(void)createTrajectories
{
    self.trajectories = [CCArray arrayWithCapacity:1];

    //Wave trajectory
    ccBezierConfig firstWave, secondWave;

    firstWave.controlPoint_1 = CGPointMake([[CCDirector sharedDirector] winSize].width + 30, [[CCDirector sharedDirector] winSize].height / 2);//powerUp.sprite.position.x, powerUp.sprite.position.y);
    firstWave.controlPoint_2 = CGPointMake([[CCDirector sharedDirector] winSize].width - ([[CCDirector sharedDirector] winSize].width / 4), 0);
    firstWave.endPosition = CGPointMake([[CCDirector sharedDirector] winSize].width / 2, [[CCDirector sharedDirector] winSize].height / 2);

    secondWave.controlPoint_1 = CGPointMake([[CCDirector sharedDirector] winSize].width / 2, [[CCDirector sharedDirector] winSize].height / 2);
    secondWave.controlPoint_2 = CGPointMake([[CCDirector sharedDirector] winSize].width / 4, [[CCDirector sharedDirector] winSize].height);

    secondWave.endPosition = CGPointMake(-30, [[CCDirector sharedDirector] winSize].height / 2);

    id bezierWave1 = [CCBezierTo actionWithDuration:1 bezier:firstWave];
    id bezierWave2 = [CCBezierTo actionWithDuration:1 bezier:secondWave];

    id waveTrajectory = [CCSequence actions:bezierWave1, bezierWave2, [CCCallFuncN actionWithTarget:self selector:@selector(setInvisible:)], nil];

    [self.trajectories addObject:waveTrajectory];
    //[powerUp.sprite runAction:bezierForward];

    //        [CCMoveBy actionWithDuration:3 position:CGPointMake(-[[CCDirector sharedDirector] winSize].width - powerUp.sprite.contentSize.width, 0)]
    //[powerUp.sprite runAction:[CCSequence actions:bezierWave1, bezierWave2, [CCCallFuncN actionWithTarget:self selector:@selector(setInvisible:)], nil]];

}

-(void)setInvisible:(id)sender
{
    if(powerUp != nil)
    {
        [self removeChild:sender cleanup:YES];
        powerUp = nil;
    }
}

This is the scheduled method:

-(void)spawn:(ccTime)dt
{
    if(powerUp == nil)
    {
        powerUp = [[PowerUp alloc] initWithType:0];

        powerUp.sprite.position = CGPointMake([[CCDirector sharedDirector] winSize].width + powerUp.sprite.contentSize.width, [[CCDirector sharedDirector] winSize].height / 2);

        [self addChild:powerUp.sprite z:-1];

        [powerUp.sprite runAction:((CCSequence *)[self.trajectories objectAtIndex:0])];
    }
}

I don't know what is happening; I never modify the content of the CCSequence after the first time.

sentences:
How to cause delay of 1 second of bullets when space pressed I was wondering how to cause the bullets to delay since at the moment, they fire pretty much one after another. So I was wondering how to make each bullet be delayed by one second when the space bar is pressed/held down.

public class TheGun extends GunType{

  private Rectangle bullet;
  private final double speed = 3d;

  public TheGun(double xPos, double yPos, int width,int height){
    this.setxPos(xPos);
    this.setyPos(yPos);
    this.setWidth(width);
    this.setHeight(height);

    this.bullet = new Rectangle((int) getxPos(),(int) getyPos(), getWidth(), getHeight());
  }

  @Override
  public void draw(Graphics2D g) {
    if(bullet == null)
      return;

    g.setColor(Color.YELLOW);
    g.fill(bullet);
  }

  @Override
  public void update(double delta, BlockyBlocks blocks) {
    if(bullet == null)
      return;

    this.setyPos(getyPos() - (delta * speed - 1));
    bullet.y = (int) this.getyPos();
    wallCollide(blocks);
    isOutofBounds();
  }

  @Override
  public boolean collisionRect(Rectangle rect) {
    if(this.bullet == null)
      return false;

    if(bullet.intersects(rect)){
      this.bullet = null;
      return true;
    }

    return false;
  }

  @Override
  public boolean collisionPoly(Polygon poly) {
    // TODO Auto-generated method stub
    return false;
  }

  @Override
  public boolean destroy() {
    if(bullet == null)
      return true;

    return false;
  }

  @Override
  protected void wallCollide(BlockyBlocks blocks) {
    for(int i = 0; i < blocks.wall.size(); i++){
      if(bullet.intersects(blocks.wall.get(i))){
        blocks.wall.remove(i);
        bullet = null;
        return;
      }
    }
  }

  @Override
  protected void isOutofBounds() {
    if(this.bullet == null)
      return;

    if(bullet.y < 0 || bullet.y > Sea_InvadersDisplay.HEIGHT || bullet.x < 0 || bullet.x > Sea_InvadersDisplay.WIDTH){
      bullet = null;
    }
  }
}

sentences:
align local Y to be parallel with global Y during or after slerp I am using the following function to have a globe rotate a point on its surface to face the global Z toward the camera. This works fine, but after each rotation  the Y axis seen as a green line is not vertically aligned.

I believe this is how slerp between two unit vectors works, it takes the shortest path.

I would like to know how can I achieve this rotation whilst getting the globe to rotate itself so that Y is at least parallel to the global Y?

        function rotateToHub(continent){
            var speed = 2000;
            var z = new THREE.Vector3(0, 0, 1);

            point = continent.position.clone().normalize();

            var q = new THREE.Quaternion();
            q.setFromUnitVectors(point, z);

            var duration = {t: 0};
            var tween = new TWEEN.Tween(duration)
                .to({t: 1}, speed)
                .onStart(function(){
                    slerp = true;
                })
                .onUpdate(function(){
                    earthContainer.quaternion.slerp(q, this.t);
                })
                .onComplete(function(){
                    slerp = false;
                    update();
                })
                .start();
        }

sentences:
How to load a png file without alpha premultiplying in ios? I am making a game in which I use the alpha value, in some cases for transparency, in others for occlusion, and for HDR in others.

I'm loading the images like this (this is MonoTouch, but objective-c can be easily converted to c#):

CGImage bitmap = new UIImage(resourcePath).CGImage;
width = bitmap.Width;
height = bitmap.Height;
IntPtr pixels = Marshal.AllocHGlobal(bitmap.Width * bitmap.Height * 4);
using (var context = new CGBitmapContext(pixels, bitmap.Width, bitmap.Height, 8, bitmap.Width * 4, CGColorSpace.CreateDeviceRGB(), CGImageAlphaInfo.PremultipliedLast))
{
    var dest = new RectangleF(0, 0, bitmap.Width, bitmap.Height);
    context.ClearRect(dest);
    context.DrawImage(dest, bitmap);
    GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, width, height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, pixels);
}
Marshal.FreeHGlobal(pixels);
bitmap.Dispose();

However, this butchers all my pixels by premultiplying them by the alpha value.

The reason behind this is that I'm creating CGBitmapContext with CGImageAlphaInfo.PremultipliedLast. I tried with CGImageAlphaInfo.Last, but creating the context fails. Core Graphics only works with premultiplied alpha, as explained here.

I tried using CGDataProviderCopyData, as well as pngcs. However, they both simply decode the bitmap, and don't convert the pixels to RGBA, which is relevant when you're storing 8-bit, 24-bit PNGs, or indexed PNGs (I have lots of these, which are the result of optimizing my PNG files for size).

So I'm lost. I need a way to decode PNG files in a way that they are converted to RGBA without premultiplying my colors by the alpha value. Is that too much to ask? GDI, GDI+, System.Drawing, DirectX, Mono for Android as well as PSM do it just fine...

Also, why does iOS development has to be so picky?

sentences:
Winform + XNA (Microsoft Example) - Issues with Drawing Texture2D Before I get started I would just like to say that I have been using the Microsoft Winform + Xna examples found here:

WinForms Series 1: Graphics Device

I think I somewhat understand how its working however I'm running into one major problem. I'm trying to draw a Texture2D image to the spriteFontControl's spriteBatch parameter, which is an object of the XNA SpriteBatch class, and when I do I get this red "X" on a white box that fills the entire spriteFontControl area. This is a screen shot of what it looks like:

As for the coding that I added to do this is pretty simple. I used the content parameter from the spriteFontControl to load the box.jpg image into the program. Then just called the following code inside the Draw() method for the spriteFontControl:

spriteBatch.Begin();
spriteBatch.Draw(box, new Vector2(0,0),Color.Black);
spriteBatch.End();

If anyone could please offer some help as to how to draw Texture2D images in the Winform + XNA example then that would be most helpful. I heard that it was made so that you could draw it just like you would in XNA but I think I'm still missing something.

Thanks in advance.

P.S. This is the code from the Draw() method of the spriteFontControl:

    const string message = "Hello, World!\n" +
                               "\n" +
                               "I'm an XNA Framework GraphicsDevice,\n" +
                               "running inside a WinForms application.\n" +
                               "\n" +
                               "This text is drawn using SpriteBatch,\n" +
                               "with a SpriteFont that was loaded\n" +
                               "through the ContentManager.\n" +
                               "\n" +
                               "The pane to my right contains a\n" +
                               "spinning 3D triangle.";

    GraphicsDevice.Clear(Color.CornflowerBlue);

    spriteBatch.Begin();
    spriteBatch.Draw(box, new Vector2(15, 15), Color.Black);
    spriteBatch.DrawString(font, message, new Vector2(23, 23), Color.White);
    spriteBatch.End();

sentences: How to use blender files in your own engine? It is not trivial to use your own shader on blender, so I've created a good-looking webgl shader. Now, what do I need to use the things I made in blender on it? An obvious first idea would be to parse the blender format. For that, I need to know it's specification: what does it include? Meshes? Bones? Animations? Vertex colors? What else? But I guess there could be easier paths, though. Maybe an exporter from Blender to an easy-to-understand JSON format exists? So that is my question, what is the fastest path to use blender files with my webgl renderer?

sentences:
Unity / How do I change the color of the "Screen" based on the Object's depth's (as a Screen Effect)? Yesterday I asked and solved my problem:

Unity / How do I change the color of an object based on its depth?

Today I tried to change the script(from yesterday) and apply it to the camera and it did not work.

Every pixel which is printed on the Display has a depth (float), is that right?

Based on that Depth - I want every object to fade grey, relative to the screen distance to that "pixel".

Is this possible?

Or do I have to use that vertex/fragment shader on every single Object and Plane and Sky and everything in the world?

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:
Octree implementation for fustrum culling I'm learning modern (>=3.1) OpenGL by coding a 3D turn based strategy game, using C++.

The maps are composed of 100x90 3D hexagon tiles that range from 50 to 600 tris (20 different types) + any player units on those tiles. My current rendering technique involves sorting meshes by shaders they use (minimizing state changes) and then calling glDrawElementsInstanced() for drawing. Still get solid 16.6 ms/frame on my GTX 560Ti machine but the game struggles (45.45 ms/frame) on an old 8600GT card. I'm certain that using an octree and fustrum culling will help me here, but I have a few questions before I start implementing it:

Is it OK for an octree node to have multiple meshes in it (e.g. can a soldier and the hex tile he's standing on end up in the same octree node)?
How is one supposed to treat changes in object postion (e.g. several units are moving 3 hexes down)? I can't seem to find good a explanation on how to do it.
As I've noticed, soting meshes by shaders is a really good way to save GPU. If I put node contents into, let's say, std::list and sort it before rendering, do you think I would gain any performance, or would it just create overhead on CPU's end? I know that this sounds like early optimization and implementing + testing would be the best way to find out, but perhaps someone knows from experience?

sentences:
Prefab can't accept script-created material I am doing mod support for my game. I want users to be able to change materials of any prefab in the game. In order to achieve that, I create a new material from the imported data and then apply it to an existing prefab.
However, it does not work. It works if I try to assign the newly created material to an object on the scene (not a prefab) and it works if I try to assign an existing material to a prefab. However, assigning a new material to a prefab results in this:

I am fairly certain that is exactly the issue since it can be reproduced as easily as with this snippet of code:
GameObject prefab = Resources.Load("Prefabs/Cubes/IceCube") as GameObject;
prefab.GetComponent<MeshRenderer>().sharedMaterial = new Material(Shader.Find("Standard"));

What am I doing wrong? How can that be worked around?

sentences:
LibGDX FileHandle does not delete file I'm using this line of code to delete a file:

if(Gdx.files.local("/files/ids.json").exists()) {
   Gdx.files.local("/files/ids.json").delete();
}

The same code works for all previous levels except the last one. The file does exist, but the delete() method returns false.

Any help would be greatly appreciated as it has exhausted me. I've seen similar topics in Java but nothing has worked for me. It's really weird that the same code works in some cases.

Edit

Also, in case this provides any information, when I step through the program with the debugger, the delete() returns true.

sentences:
In Unity, how do I make a 3D flight arc preview? I'm stuck on how to make a preview trajectory for a projectile appear when holding a button. The trajectory should start at a certain position on the scene and end wherever the player points their mouse. On mouse click, a projectile should be launched along that trajectory with the clicked position as its target.

How can I do this?

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:
Microsoft XNA code sample wont work with blender model I downloaded this code sample and integrated it into my game
http://xbox.create.msdn.com/en-US/education/catalog/sample/mesh_instancing

It works with the model that they supplied, but throws and exception whenever I use one of my models.

  The current vertex declaration does not include all the elements
  required by the current vertex shader. TextureCoordinate0 is missing.

I tried pluging my model into their original source code and same thing.
My model is an fbx from blender and has a texture.
This is the function that throws the error

GraphicsDevice.DrawInstancedPrimitives(
  PrimitiveType.TriangleList,
  0, 0,
  meshPart.NumVertices,
  meshPart.StartIndex,
  meshPart.PrimitiveCount,
  instances.Length
);

sentences:
Why is my call to SetDisplayMode not supported? I have some legacy DirectX code that always returns DDERR_UNSUPPORTED.

I originally developed the code using DirectX3, and I am porting it to DirectX7 after spending years away from programming.

The following line is returning DDERR_UNSUPPORTED rather than DD_OK:

hrRetVal = pDDraw->SetDisplayMode(dwWidth, dwHeight, dwBPP, 0, 0);

Could someone please take a quick peek and respond if you see why this might be the case? This is not a commercial application... just something to do for fun.

Based on the Microsoft on-line documents, the SetDisplayMode method is not deprecated, and should work. A compiled version of my legacy program written with DirectX3 renders graphics on newer OS's such as Windows 10, without issue. I am interested in making some changes.

This Video compilation unit:

Sets the video mode to 1024 X 768
Create a DirectX instance, set the cooperative level.
Which when destroyed will Restore video to original mode, and flip to GDI

void Video::Initialize(void)
{

  TRACE("Video::Initialize invoked\n");

  hrRetVal = {0};
  DWORD dwDefaultRefreshRate = 0x0;
  DWORD  dwWidth = 1024, dwHeight = 768, dwBPP = 8, dwRefreshRate = dwDefaultRefreshRate, dwFlags = 0x0;

  try
  {
    Check(hrRetVal); // check for DD_OK

    TRACE("Video: using emulation mode, no hardware\n"); // debugging
    TRACE("Video: DirectDrawCreateEx invoked\n");
    hrRetVal = DirectDrawCreateEx((GUID*)DDCREATE_EMULATIONONLY, (LPVOID*)&pDDraw, IID_IDirectDraw7, NULL);

    Check(hrRetVal); // TRACE value of hrRetVal
    if (DD_OK == hrRetVal)
    {
      TRACE("Video SetCooperativeLevel invoked\n");
      hrRetVal = pDDraw->SetCooperativeLevel(hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
      Check(hrRetVal);
      if (DD_OK == hrRetVal)
      {

        // Lets see if the video is supported
        hrRetVal = QueryVideoCapability();
        Check(hrRetVal);

        if (DD_OK == hrRetVal)
        {

          TRACE("Attempting to set video resolution to: %d %d \n", dwWidth, dwHeight);

          hrRetVal = pDDraw->SetDisplayMode(dwWidth, dwHeight, dwBPP, 0, 0); // this line always returns DDERR_UNSUPPORTED

          // hrRetVal == DDERR_UNSUPPORTED after call to SetDisplayMode

          Check(hrRetVal);
          if (DD_OK != hrRetVal)
            throw (VIDEO_EXCEPTION); // with throw an exception since hrRetVal == DDERR_UNSUPPORTED
        }
      }
      else
      {
        Check(hrRetVal);
        throw (VIDEO_EXCEPTION);
      }
    }
    else
    {
      Check(hrRetVal);
      throw (VIDEO_EXCEPTION);
    }
  }

  catch(int exception)
  {
    TRACE("%Xh exception caught by Video::Initialize\n", exception);
    Video::Check(hrRetVal);

    if (exception == VIDEO_EXCEPTION)
    {
      char message[80];
      strcpy_s ( message, "Unable to initialize video. ");
      strcat_s ( message, "\nApplication will now terminate.");
      FatalMessageBox( message );

      TRACE("APP_EXCEPTION thrown by Video::Initialize\n");
      throw (APP_EXCEPTION);
    }
  }
}

I'm using Visual Studio 2017 Pro v15.7.2, on Windows 10 Build 1803.

sentences:
Compute shader: Property at kernel index is not set I am trying to follow this excellent Coding Adventure: https://www.youtube.com/watch?v=lctXaT9pxA0 in order to get a very simple mesh deformation on a mesh using a compute shader.
I'm getting an error that reads:

Compute shader (NewComputeShader): Property (vertices) at kernel index (0) is not set
UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
MoonShader:runShader() (at Assets/MoonShader.cs:27)
MoonShader:Update() (at Assets/MoonShader.cs:15)

I'm calling runShader() in Update (maybe that's a terrible idea, but I don't think it's contributing to this specific problem yet).
Do I need to somehow pass my mesh's vertices into StructuredBuffer<float3> vertices;? If so, how am I supposed to do that?
This is the call to the compute shader in my .cs file.
void runShader() {
    int kernelHandle = computeShader.FindKernel("CSMain");
    computeShader.Dispatch(kernelHandle, 512, 1, 1); //this is the line it appears to be complaining about
}

This is my .compute file.
#pragma kernel CSMain
StructuredBuffer<float3> vertices;
RWStructuredBuffer<float> heights;
uint numVertices;
float testValue = 20;

[numthreads(512,1,1)]
void CSMain (uint id : SV_DispatchThreadID) {
    if(id >= numVertices) {

    } else {
        float3 vertexPosition = vertices[id];
        heights[id] = 1 + sin(vertexPosition.y * testValue) * 0.05;
    }
}

Link to repo if it's helpful: https://github.com/glenpierce/proceduralPlanets

sentences:
Finding Endpoint of line in Unity I have a startpoint, magnitude(length) and direction and want to find endpoint to construct the line
here is the code to make question more clear

private Vector2 GetEndPoint(Vector2 startPoint, Vector2 direction, float magnitude) {
    Vector2 endPoint = //some stfuff with parameters
    return endPoint;
}

And this is the visualization of what I want

Hope I am clear enough, any suggestions is welcomed

sentences:
What does mean the float value in a voxel data? We know that a voxel can be represented by a three dimensional array of boolean or float values. There is an answer that demonstrates this perfectly: the difference between binary/boolean or floating-point voxel.

If we use the binary way, we probably use a byte[,,], so we have 256 slots. They can be used to represent the content. For example, 0 can be air, 1 grass, 2 stone, 3 water.

By this way, we can define what is solid or not and which colour where.

But what about the floating-point way? So my question: What does the float value mean in a floating-point voxel context? Is there a way to use it as the binary way to describe the content and keep the terrain smooth?.

What I've experimented & What I get it?

I've tried to build a mesh with Marching Cube, filled with "random" 3d fractal from Perlin Noise. The result looks very good, but now how I am supposed to define what is what? (Air, Stone, ...)

I am pretty sure the solution was already answered in this answer. Unfortunately, even if I read the answer 5-6 times, I don't get it.

I understand there is a threshold which defines what is solid or not.

Giving me 3 for-loop pseudo code to fill with floating-point the three dimensional array would probably be helpful.

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:
Creating terraced terrain Let's say I have a heightmap, but I want to create flat areas on it. The easiest solution would be to just say that every value between 0.2 and 0.4 should just become 0.3, but to keep the terrain continuous, I need to make sure that the values below 0.2 are mapped between 0 and 0.3 and the values above 0.4 get mapped between 0.3 and 1

So if we make a diagram, where the x axis is the value and the y is the outcome, then we get this:

This is fine when you have only 1 flat area, but if I'm trying to recreate something like a farmland in Peru, I have to create a lot of these:

So how can I create an efficient function, which given a value and an array containing the from and to values of the flattened areas transforms the value in the new system.

For instance, using the same example, a value of 0.25 would return 0.3 and a value of 0.5 would return 0.41666....

sentences:
Interpolate object collision stuck in Unity I am working on a very basic test in 2D. The problem I am having is that, when my sprite collides with the ground, it is checking the event too frequently. The sprite stays in limbo, as it doesn't have a chance to leave the ground. By the time it does, the check tells it to turn around, resulting it quickly going up and down. I uploaded an example clip to YouTube.

When contact is made, the sprite needs to change it's Y axis direction. How do I fix this? Please see my code, below:

void Update ()
{
    hitWall = Physics2D.OverlapCircle(wallCheckUp.position, wallCheckRadius, whatIsWall);

    if (hitWall)
    {
        moveUp = !moveUp;
    }

    if (moveUp)
    {
        transform.localScale = new Vector3(-1f, 1f, 1f);
        GetComponent<Rigidbody2D>().velocity
            = new Vector2(speed, GetComponent<Rigidbody2D>().velocity.x);
    }
    else
    {
        transform.localScale = new Vector3(1f, 1f, 1f);
        GetComponent<Rigidbody2D>().velocity
            = new Vector2(-speed, GetComponent<Rigidbody2D>().velocity.x);
    }
}

Here is my object:

sentences:
How costly is an OpenGL draw call, and how do I optimise them? How costly is a draw call in OpenGL?

What are the ways to reduce the number of draw calls? I have seen people using glMapBufferRange, but I can't figure out how it improves the performance.

How much impact do draw calls have on the overall performance of a program?

sentences:
I want to get back into 2D games programming I used to develop games in the late 80's / early 90's and would like to look at getting back into it these days.

I have seen online there are so many options and libraries etc, so just thought I would try asking on here to see if anyone could offer some advice/a path to take.

I only really want to do 2D games as I did many years. I have seen things like Unity and other javascript libraries and it looks a bit of a minefield.

Ideally I would like to target Android / IPhone games.

I know c#, some c++, javascript/html5

Any info greatly appreciated.

C

sentences:
How to make an enemy spawner that selects from a list of potential enemies? (Unity) I'm just making a practice version of a basic 2D RPG, but I'm trying to build a spawner kind of object that could be scaleable across the entire game. That is, there would be multiple types of enemies, and each instance of such a spawner would have a specific set of enemies that it would spawn.

I'm sure the answer is very simple, but I'm at the beginning stages of all of this. I guess really I just want a simple list that I can attach to my object and add the enemy names to it so that it can draw from that to figure out what they would spawn.

sentences:
How can I instantiate and sync a LineRenderer in multiplayer network? I am trying to make a laser that will be visible to all clients in a multiplayer networked game on Unity.

I've tried using a Command Attribute but that hasn't worked. I also found some ideas to use RpcClient but I am not quite sure how to implement that.

The code I'm using for the laser (I just run the method in Update) is:

public void CmdActivateLaser(bool laserState)
{
    if (laserState == false)
        return;

    pointer.SetPosition(0, transform.position);

    RaycastHit endCommand;
    if (Physics.Raycast(transform.position, transform.forward, out endCommand))
    {

        finalPos = new Vector3(0f, 0f, endCommand.distance);
        pointer.SetPosition(1, finalPos);

    }
    else
    {
        pointer.SetPosition(1, transform.forward * 500f);
    }
}

sentences: What 2D engine can I use to port my flash game to iOS and Android? I would like to port my 2D flash game to Android and iOS. Is there any cross platform engine you could recommend? Corona is the only promising one I have found so far.

sentences:
Getting Early User Feedback on Games Disclaimer: It may be that I'm already doing all the "right" things, but just don't have enough traffic for it to pay off with people giving feedback.

My question is: how do you attract early and quality feedback into games, from end-users? Ideally, I'm looking at a model where the seed of an idea comes from you (or from them, even) and you build it into a game, molding it along the lines that people tell you are best.

Because you're just one opinion. And game developers have a reputation for doing weird and sub-par quality stuff, sometimes.

I'm currently practicing the following:

VIP List: I have a "VIP" mailing list (mostly friends) who agreed to try out game releases and give me feedback. They seem hesitant to say anything negative, and most of them are not really gamers, just doing it because they know me and like my niche.
2-4 Week Releases: I use a form of agile and release iterations every two to four weeks. This means every release is functionally small, but somewhat polished.
Press-Releases: With every release, I also post a small "press release" post identifying the good, the bad, what's next, and screenshots (along with a link to play the latest release version).

I'm not getting that much feedback. What am I missing?

sentences:
How to make non-standard sized zones for a procedurally generated 2d map? I am making a procedurally generated map with different zones (plains, forest, village, etc) and am currently just designing each one as a square zone. However, I think it'd be neat if the zones were more randomly distributed so that they could be irregular sizes. I'm not sure how to do that in a good way. (Any given tile needs to know what zone it belongs to quickly and deterministically based on its x, y, and random seed for the world)
Are there existing algorithms for this?

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:
Bones Animation - Matrices and calculations We are 'on final' when it comes to finishing the project, but just before implementing the animation system.

Our Client decided to choose "Bones Animation" - which is that I should export each  Transformation Matrix ( matrix4x4 rotation+translation ) for every frame and for every bone that this animated object has.

Objects in our game are animated with 3DS Max Physique Modifier, so we will have bones / weighting data per vertex. But I will simplify things here just to get a bit of light on this subject.

I would like to split this post into 2 points, where :

Exporting bones matrices for every frame

treats about the correct method of exporting the bones positions for later animation purposes, where i have to 'move' and 'rotate' every vertex influenced by this bone to bone position at frame X.

Calculating final vertex position

treats about proper matrices operations to calculate new vertex position according to bone transformation in frame X.

1. EXPORTING BONES MATRICES FOR EVERY FRAME

Do I understand correctly that while exporting the animated object I should:

  Grab BONE transformation matrix at frame 0 and Invert this matrix
  Grab BONE transformation matrix at FRAMEx
  Multiply 1 * 2 to get the transformation offset of the BONE at FRAMEx

[pseudocode]
// Animation export

// For each frame, export bone transformation offset
for(int iFrame = 0; iFrame < vFrames.size(); iFrame++)
{
    // For every bone in the object
    for(int iBone = 0; iBone < vBones.size(); iBone++)
    {
        // Grab transformation matrix for this bone at frame 0 and inverse it
        Matrix3 matBoneMatrixAtStart = pNode->GetObjectTMAfterWSM( 0 );
        matBoneMatrixAtStart.Inverse();

        // Grab transformation matrix for this bone at frame iFrame
        Matrix3 matBoneMatrixAtCurrentFrame = pNode->GetObjectTMAfterWSM( iFrame );

        // Multiply Inversed Transformation Matrix of this bone at frame 0 - with
        //  current frame transformation matrix
        Matrix3 matBoneTransformationOffset = matBoneMatrixAtStart
                                              * matBoneMatrixAtCurrentFrame ;

        // Save matBoneTransformationOffset - vertex will be multiplied by this
        //  matrix for animation purposes
        fwrite(.....)
    }

}
[/pseudocode]

Will that be enough ? Or there is something I am missing here?

2. CALCULATING NEW VERTICES POSITIONS ( FINAL VERTEX POSITION AT FRAME X)

Later on, when rendering, object vertices are going to be multiplied by exported bone transformation matrix for actual animation frame, and then multiplied by
 this whole model transformation matrix to place the object in correct position inside the level :

[pseudocode]

Update()
{
    // The model transformation matrix describing the position of
    //  the model in the level
    matModelTransformationMatrix

    // Calculate new vertex position according to it's bone transformation offset
    NewVertexPosition = (OriginalVertexPosition * matBoneTransformationOffset[iFrame])
                           * matModelTransformationMatrix;

    // Increment the frame for testing purposes
    iFrame++;
}

[/pseudocode]

Am I thinking correct here? So, Having bone transformation offset for frame X, multiplying every vertex affected by this bone by this offset should result in a vertex transformed exactly as this bone right?

sentences:
wrongly scaled on cocos2dx 3.2 when render to multiple fbo (more > 1 deep)? i have bug that only happen when retina flag disabled.

i try draw multiple render texture to achive some multi post effect:
so i have 3 render texture,

fbo 1 for final pos effect
fbo 2 for back buffer w/light
fbo 3 for light mask

i apply this using fbo mechanisms of cocos2dx
 push the fbo1 to screen
push the fbo2 to fbo1
fbo 3 just for sampler texture for render in fbo2 shader

gameplay actor will be drawn on fbo2, after that fbo2 will be rendered to fbo1 ( we can apply some effect here) then fbo1 drawn to screen, then do some gui layering.

the thing is all gp actor drawn into fbo2 , "seems" become scaled down 3 times, so its like the small game screen on left bottom corner, but the light from fbo3 or gui that directly drawn to screen normal positioned and not scaled .

i really dontknow who is scale my fbo2, but i check the matrix its all correct. but seems lot setviewport in rendertexture.h, idont know how its work actualy, so if any one know how viewport work on fbo,

no direct open gl acces for my code except attach shader
if i dont use fbo2 one, ( using fbo1 directly ), the bug doesnt happen
** this doesnt happen on retina true ( scaled 2x ) , this happen on win32 or mac when i disabled retina ,
** tracing draw order correcty
** log  below on command:
onbegin fbo1
onbegin fbo2
onbegin fbo3
( i render some sprite to this fbo first ex: alpha gradient mask)
onend fbo3
( i render gp actor here)
onend fbo2
( render attached fbo2 texture with shader carries sampler of attached texture 3)
onend fbo1
( render attached fbo1 texturee)* may caries some shader
( render gui part )

sentences:
Accurate way to calculate swipe direction based on delta vector I am trying to calculate the direction of a swipe on a touch device screen. Lets say the screen size is 1024 wide and 768 high. The bottom left x and y coordinate is 0,0 and the top right coordinate is 1024,768.

For any given swipe, I will receive a delta vector which indicates the movement on the x and y axis. For instance, if I start a touch at 100,100 and the end the touch at 500,150 I will receive a delta vector of 400,50 and I know from this that the swipe was to the right (and a tiny bit up).

From any given delta vector, is there a formula I can use to determine which direction the vector most resembles, allowing for diagonal swiping too (i.e. left, right, up, down, up-left, up-right, down-left, down-right). I do have some code which calculates the closest with an allowed margin for error - but it occurred to me there must be a mathematical way to solve this without having to check each direction and the margin.

Hope that makes sense, Thank you.

P.s.  Already tried to post this in the math overflow site, but got shot down as apparently it's not a math problem.  Which actually it is.  Hope this is a better choice!

EDIT:

Bornander: The solution you gave (which is very clever) provides the detection as shown in this image...

Where what I'm realistically after is a slightly turned version like this...

sentences:
Authenticate player on backend server with google login I would like to create a mobile game which communicates with my own backend server.

For authentication I want to use google Sign-in(https://developers.google.com/identity/sign-in/android/backend-auth), so users don't need to create an account.

My backendserver uses a TCP connection to communicate with the client and I don't want to send the google login auth code unencrypted over the network. I read alot about SSL encryption, but I'm not sure if it is the thing I need and if this is sufficient.

Another question I would like to ask is do I need to encrypt all packets my client is sending to the server. Because when I just do authentication over an encrypted connection, potential hackers could simply perform a man-in-the-middle attack to access the account of a player after they logged in.

So what would be the best way to send this token to the server, is SSL sufficient for this and do I need to encrypt the whole traffic my game creates?

sentences:
3DS Max equivalent to vertex weight painting I'm working in 3ds max on models for an Iphone game project and finding that using the Physique modifier is to general for rigging. When working with so few vertices I want to be able to directly tell how much weight a bone should have on a specific vertex.

Is there a 3ds max equivalent to the Softimage XSI vertex weight painting? As this would be perfect for this job.

Many thanks

sentences:
A* and Space partitioning I'm planning on implementing A* in my game for pathfinding, I understand the basics of how the algorithm works but I was wondering, other than finding the start and end nodes Are there any benefits to placing the navigation graph into a tree? It seems to me that it wouldn't really benefit any as each node has a list of connections to other nodes. But I recall reading an article about pathfinding a while back and it suggested using a space partition tree, I believe it suggested an AABB tree to be exact.

If A* wouldn't benefit would any of the algorithms benefit from such a thing?

And no, sadly I can't find the article again.

sentences:
Replacing keycode by UI Buttons doesn't work I have tried everything but it still doesn't work. I am not talking about implementing functions wich has stuff inside when you click the UI Button. I want literally replace this Input.GetKeyDown(KeyCode.E). That is inside an if statement and replace with the UI Button object. How can i do this? I have tried with GetButton, GetButtonDown, trying to give a name and with Input.touchCount>0

I am developing a game like Resident Evil old style and when you enter a triggerStay and push the button, a text is showing up.

The Script

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

public class readingNote : MonoBehaviour {

    public AudioSource audio;
    public AudioClip collectSound;
    public  bool playerNextToKey = false;
    bool hasCollided = false;
    public GameObject pic;
    public GameObject text;
    public GameObject notePad;

    public Button yourButton;

    void Start()
    {
        pic.SetActive(false);
        text.SetActive (false);
        Button btn = yourButton.GetComponent<Button>();
        btn.onClick.AddListener(TaskOnClick);
    }

    void TaskOnClick()
    {
/*THIS IS SHOWING ALL TEXT IN THE SCENE AND NOT ONE BY ONE WHEN PRESSING*/
//      text.SetActive (true);
//      pic.SetActive(true);
    }

    void OnTriggerStay ( Collider other) {

        if(other.gameObject.tag == "Player") {
            if(Input.GetKeyDown(KeyCode.E)) {
            //if(Input.touchCount>0) {
                text.SetActive (true);
                pic.SetActive(true);

                AudioSource.PlayClipAtPoint(collectSound, transform.position);

            }

        }
    }

    void  OnTriggerExit ( Collider other  )
    {
        if (other.gameObject.tag == "Player")
        {
            //enter = false;
            //print("close");

            playerNextToKey = false;
            hasCollided = false;
            pic.SetActive(false);
            text.SetActive (false);

        }
    }

}

sentences:
How to make game playable in all mobile screen resolution using Unity Cinemachine with perspective mode? I want my 2D game to be playable (auto scale) in all screen resolution. I'm using Cinemachine & under "perspective" mode. I found tutorial to change the screen in "orthographic" mode but there is no answer for "perspective" mode using Cinemachine. Please help on what setting must be done in Cinemachine or if there is any scripting that I can use. Thanks a lot.

NB: I tried to add a script as in  below link. But it doesn't work. Perhaps it's because I'm using Cinemachine instead of normal main camera. Link: Scale camera to fit screen size unity

Edit: Added picture of the "perfect" view I want below.

Image "expanded" to left & right when I change to "free aspect"

sentences:
How to encrypt Save Files without using a key? Say I made a simple program that takes a file .dat that is encrypted in Binary Format, then I decrypt it into a byte array and then everything is rewritten again into the file decrypted.

For Example:

I've made a binary encryption algorithm. => 0100100001100101001000000110100001100101011000...

But this is very very easy to decrypt...

Is there any way, that, if it's possible does not need any sort of key, to encrypt my save progress?

sentences:
Hierarchical state machines I have a rather simple state machine to control my Unity character and as the actions the character can perform increase, so does the complexity of state management, I have been reading about hierarchical state machines, they seem like the answer to my problems but I cannot 'connect' the theory to actual implementation, take for example the below Movement State
public class Player_Movement : BaseState
{
    public Player_Movement(PlayerController playerController, EntityStateMachine_Comp entityStateMachineComponent) : base(playerController, entityStateMachineComponent)
    {

    }

    public override void OnEnter()
    {
        _playerController.GetComponent<Animator>().SetBool("IsMoving", true);
        _playerController.GetComponent<Cast_Component>().OnCastReady.AddListener(() =>
        {
            _stateMachineController.ChangeToState(new Player_Movement_Casting(_playerController, _stateMachineController));
        });
    }

    public override void OnExit()
    {
        _playerController.GetComponent<Animator>().SetBool("IsMoving", false);
    }

    public override void OnFixedUpdate(StateMachineContext _context)
    {
        //If movement input is zero
        if (_playerController.PlayerInput.inputData.Movement.Input == Vector3.zero)
        {
            _stateMachineController.ChangeToState(new Player_Idle_State(_playerController, _stateMachineController));
        }
        else
        {
            _playerController.motor.MoveAndRotateTowards(_playerController.PlayerInput.inputData.Movement.Input_CameraRelative);
        }
    }

    public override void OnUpdate(StateMachineContext _context)
    {
        if (Input.GetKey(KeyCode.LeftShift))
        {
            _playerController.motor.IsSprinting = true;
            _playerController.motor.Speed = _playerController.motor.walkSpeed * _playerController.motor.sprintSpreedModifier;
        }
        else
        {
            _playerController.motor.IsSprinting = false;
            _playerController.motor.Speed = _playerController.motor.walkSpeed;
        }

        if (!_playerController.motor.IsGrounded && _playerController.Rigidbody.velocity.y < 0)
        {
            _stateMachineController.ChangeToState(new Player_Locomotion_Falling_State(_playerController, _stateMachineController));
        }

        if (Input.GetKeyDown(KeyCode.Space) && _playerController.motor.IsGrounded)
        {
            _stateMachineController.ChangeToState(new Player_Locomotion_Jump_State(_playerController, _stateMachineController));
        }
    }
}

My current goal is to have this become my super state for my movement state machine, I would like to add a sub state to this (Cast Movement) that simply calls _playerController.motor.Move instead of _playerController.motor.MoveAndRotateTowards as I would like to have a different style of movement while aiming a spell, but how would I write this substate so that it only handles how the character moves and falls back on the super state for everything else?
I have the feeling I have to re-write how my state machine works but I have no idea where to start except I probably need to seperate transitions out of the states themselves? perhaps? haha

sentences:
When does it make sense to use Index Buffers? The concept of Index buffers is that certain vertices are shared across faces, hence can be reused to save space of duplicated verticies. A vertex is usually more than 12 bytes (depending on the number of attributes, ie. 3* 32-bit floats), while an index could be stored in as little as 1 to 4 bytes (depending on max number of vertices).

  Example: A cube consisting of 6 quad-faces without using an index buffer would
  require 6 * 4 * 12 = 288 bytes But as it only has 8 unique vertices,
  it could be stored using an index buffer with 4 * 6 indices = 8 * 12 + 4 * 6 = 120 bytes

However for non-shared vertices the space used by the Index Buffer is effectively wasted - because these vertices could've been drawn without an index buffer (if correct ordering in the vertex buffer is given). Considering only the vertex position as attribute, this trade-off would make sense for most meshes - but meshes in the real-world tend to have also other attributes like normals, texture-coordinates etc. Even if a vertex position is shared across faces, it is rare that all other attributes are also shared - hence the vertex needs to be duplicated in the vertex buffer.

  Example: A cube with normals has 8 unique vertices, but each of its 6 faces
  having a different normal vector. So 48 unique vertices are required,
  if one vertex is 24 bytes this results in = 8 * 6 * 24 = 1152 bytes
  Using an index buffer the same size is needed plus at least 48 bytes
  to store the indices = 1200 bytes

Not only would a vertex buffer without index buffer need less memory, it would probably be more cache-friendly as well (as the memory accessed is continous memory).

I try to find out in which scenarios I should use an index buffer instead of a plain vertex buffer, but I failed to find any real-world examples where it would make sense to use an index buffer at all.

My question is: Are there any cases in modern graphics-programming where using an index buffer will actually bring a benefit (ie. is there any advantage which I overlooked)?

sentences:
Audio Engines , do they work on CPU, GPU or DSP I have been reading design specifications of the audio engines. What I am trying to achieve requires performance and I want to parallelize.

Only and only while reading openAL specification it was mentioned very very shortly that if hardware supports than openAL will use DSP as well.

But I am curious for other engines as well and couldn't find information for wwise for example.

In general do audio engine takes advantage of DSP or even GPU maybe ?

sentences:
How do I implement a physics gun? I'm currently trying to implement a physics gun for my game. What I want is for the entity to stay in the same position on the screen no matter how I wiggle the camera about, what is the correct way to achieve this?

I threw together a basic physics gun in 5 minutes (just to handle grabbing and moving the object) but it doesn't work as intended. The problem is obviously that I only handle changes in toolDirection (rotation) but largely ignore changes in toolPosition (translation). For reference, here is my current script (wrtten in Lua):

local toolPosition; --This always holds the position of the tool
local toolDirection; --This always holds a normalized vector indicating the direction the tool is pointing
local grabLocation; --This is the position in world space where the ray from the tool intersected the body of the entity

function UpdateTargetPosition()
    local relativeGrabDirection = (grabLocation - toolPosition).Normalize();                 --direction from tool to target grab point

    local axis = relativeGrabDirection.Cross(toolDirection);
    local angle = math.acos(relativeGrabDirection.Dot(toolDirection));
    local rotation = Quaternion.CreateFromAxisAngle(axis, angle);

    local transform = Matrix4x4.CreateTranslation(-toolPosition) * Matrix4x4.CreateFromQuaternion(rotation) * Matrix4x4.CreateTranslation(toolPosition);
    target.SetWorldTransform(target.GetWorldTransform() * transform);
    grabLocation = grabLocation.TransformByMatrix4x4(transform);
end

sentences:
OpenGL Texture Zig-Zag Artifacts Over Time I'm working on a deferred shading renderer in OpenGL, where I write all geometry output to Colour, Normal and Depth textures and then apply lighting effects later.

Everything seems fine except once every few weeks, constant zigzag-like patterns appear past a certain depth (below the player's knees in the screenshot below). These zigzag patterns are at the same screen coordinates regardless of my pitch and yaw in the game:

I'm not sure what information to provide to resolve this issue, as it seems to me like a GPU error. Each zigzag square is 16x16 pixels, which could be the warp size on my NVIDIA GTX 960. Restarting the program resolves the problem and it doesn't happen again for a few weeks.

My guess is that sections of the fragment shader are failing to write to multiple render targets as I see the same pattern on the Colour, Normal and Depth textures.

The blue colour you can see on the left side of the zigzag pattern is the water at the bottom of the map, which is rendered after the post-processing stage and does not have these artifacts.

Any help with this would be greatly appreciated.

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:
Good way to establish an inventory system? Fairly new to Unity as a whole, and while making a prototype game I came across the issue of setting up an inventory system. So far, I've been stuck on what sort of structure it should have, given:

Each "Mob" (player, enemy, NPC, etc.) has its own inventory
Objects can have children attached, which should be saved (e.g. Gun -> Attachment Manager -> Magazine/Rail/etc.)
Simpler items (ammunition, etc.) are stackable
An inventory has "pouches" which are available only for certain objects (magazines, health items, etc.) and have a certain volume

At first, I simply made a Mob -> Inventory Manager -> Pouch -> Item system where everything was a child of its respective parent, but obviously even with colliders/sprites disabled that's possibly hundreds of transforms per mob being shifted around each update. Right now, I'm just parenting each mob's inventory system to a static "Inventories" object to get past the issue of that many transforms, but is there a better long term solution that takes into account saving/loading and scene transitions?
Right now, I'm considering:

Turning each item with children (guns with attachments) into a prefab and saving it (not ideal)
Using an ID system to instantiate objects on load by loading the root object (gun), then the children (attachments) given certain parameters (but the variables, like the rounds loaded into a magazine, would be tricky to load)
Having different prefabs for items depending on whether or not they're equipped, on the ground, or in an inventory, and switching between them as needed

sentences:
Why is it called "roguelike" and "metroidvania"? As the title says, where did roguelike and metroidvania genre games get their names from? All other genres (that I can think of) have pretty self-explanatory names like:

First Person Shooter: You shoot and it's first-person perspective.
Role-Playing Game: You role-play as another character.
Massive Multiplayer Online: The game is online with multiplayer and supports a lot of players.

But roguelike and metrodvania doesn't seem to relate to any core gameplay element like the other genres do. So why are they called roguelike and metroidvania?

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:
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:
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 does my libgdx app just display the badlogic.jpg instead of my start screen? I have been looking at example libgdx games.  It looks like https://github.com/libgdx/libgdx-demo-cuboc is the closest thing to a game I would like to make.  I am able to download, compile and execute the Cuboc game no problem.  So I follow the instructions for creating a libgdx project (https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle) and I am able to compile and execute the resulting project which just displays the badlogic.jpg file.

So I start aping the code from Cuboc into my game, which I am calling Malfunction. All I want to do is display my "MainMenu" screen which simply display a png file which I copied from the Cuboc game.

Here's what I have in my Malfunction project:

// Malfunction.java
package com.redcricket.malfunction;

import com.redcricket.malfunction.screens.MainMenu;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;

public class Malfunction extends Game {
    private String TAG = "MAL";

    @Override
    public void create () {
        Gdx.app.log(TAG, "MainMenu (Game)");
        setScreen(new MainMenu(this));
    }
}

... and this java file ...

// MainMenu.java
package com.redcricket.malfunction.screens;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class MainMenu extends MalfunctionScreen {
    TextureRegion title;
    SpriteBatch batch;
    float time = 0;
    private String TAG = "MAL";

    public MainMenu(Game game) {
        super(game);
        // TODO Auto-generated constructor stub
        Gdx.app.log(TAG, "MainMenu (Game)");

    }

    @Override
    public void show () {
        Gdx.app.log(TAG, "show()");

        title = new TextureRegion(new Texture(Gdx.files.internal("data/title.png")), 0, 0, 480, 320);
        batch = new SpriteBatch();
        batch.getProjectionMatrix().setToOrtho2D(0, 0, 480, 320);
    }

    @Override
    public void render (float delta) {
        Gdx.app.log(TAG, "render (float)");

        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        batch.begin();
        batch.draw(title, 0, 0);
        batch.end();

        time += delta;
        if (time > 1) {
            if (Gdx.input.isKeyPressed(Keys.ANY_KEY) || Gdx.input.justTouched()) {
//              game.setScreen(new IntroScreen(game));
                Gdx.app.log(TAG, "all done ...");
            }
        }
    }

}

... and this java file ...

// MalfunctionScreen
package com.redcricket.malfunction.screens;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Screen;

public abstract class MalfunctionScreen implements Screen {
    Game game;

    public MalfunctionScreen (Game game) {
        this.game = game;
    }

    @Override
    public void resize (int width, int height) {
    }

    @Override
    public void show () {
    }

    @Override
    public void hide () {
    }

    @Override
    public void pause () {
    }

    @Override
    public void resume () {
    }

    @Override
    public void dispose () {
    }
}

Update: I also have this java code ...

package com.redcricket.malfunction.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.redcricket.malfunction.Malfunction;

public class DesktopLauncher {
    public static void main (String[] arg) {
        LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
        new LwjglApplication(new Malfunction(), config);
    }
}

So why does this screen appear when I run my modified version of Malfunction?

Also none of my calls to Gdx.app.log ever show up in logcat.

Thanks!

sentences:
How can I cast a std::shared_ptr to the correct derived class? I'm trying to implement a component based design for a game I'm making. I decided to write it in C++, but I'm not very good at it. Coming from a Java background I encountered a problem when trying to manage the std::vector for the components. Right now each entity has a vector of components that can be of different derived classes such as "Transform Component" which has an x and y field that I will access later. From what I've read I have to use a std::shared_ptr for each component, and that has worked fine except when I retrieve a component and try to cast it I start getting errors.

The code looks like this:

Component.hpp

class Component
{
public:
    virtual ComponentType getType() = 0;

    virtual ~Component() { }
};

Transfrom.hpp

class Transform : public Component
{
public:
    float x, y;

    virtual ComponentType getType() { return ComponentType::TRANSFORM; }
};

Entity.hpp

class Entity
{
public:
    Entity() : m_components() { }

    Component& getComponent(ComponentType type);
    void addComponent(std::shared_ptr<Component> comp);
    bool hasComponent(ComponentType type);

private:
    std::vector<std::shared_ptr<Component>> m_components;
};

And when I try to use it:

// This gives an error!
Transform comp = std::dynamic_pointer_cast<Transform>(entity.getComponent(ComponentType::TRANSFORM));

How can I fix this?

sentences:
What tools/software are used to make the environments/levels/maps in games? This question has probably been answered before but I've not been able to find the answer, since I'm not able to frame the question with brevity.

So the whole question is :- The worlds/levels that you see in games like Crysis, Assassin's Creed, etc, what do the designers and developers use to create them? Do they use the tools present inside the engine (whether proprietary or in-house) or a separate software that exports these worlds as an importable object for the game engine to use to load models into it, etc?

I know this is a very general question but I have been curious regarding this for some time. I have used Unity in the past and it had a terrain toolkit that could be used to make the terrain, and I'm pretty sure it had completely to do with my lack of skill but I wasn't even close to making an environment that looked like the ones you see these days.

sentences:
SDF - indexing the folding space I had been repetitively watching this part of the video just trying to understand his point:

  you can optionally use the return value as cell index ... as random
  seed to introduce some variation ...

at the near end of the video he stress that:

  don't use for loop ... anything can be achieved by repeating space ...
  I will make an operator to repeat an interval ... give it additional
  values like the first and the last cell index ... start by -2 and end
  at +2 then you get 5 objects ...

How can we achieve like what he say? Do we use clamp() to do that? Something like:

float a = clamp(pMod1(pos.x,2),start_value, end_value);

It is brilliant that everything he present is just like magic to me.

Update01

I dig deeper into SDF research and reading more codes from shadertoy, and discovered this interesting capsule code:

float sdCapsule( float3 p, float3 a, float3 b, float r ) {
    float3 pa = p - a,
    ba = b - a;
    float h = clamp( dot(pa, ba) / dot(ba , ba), 0.0, 1.0 );
    return length( pa - ba * h ) - r;
}

Basically, length(x)-r will get sphere, for x as the origin of the sphere and r is radius of the sphere. so the sdCapsule to some extend, is a variation of sphere, with the clamp(). That means my speculation might be correct. However, I still not sure what that clamp() do and how to adapt it to my use.

sentences:
Raycast in Unity for ground detection returns false while touching ground I'm using a raycast to detect the player's distance to the ground for a hovercraft game.

The raycast works correctly (returns true and also returns the distance to the first impact) until the moment the craft actually touches the ground.  When the player hits the ground, the raycast should theoretically return true and return the distance as near 0f.  Instead, it returns false, meaning the raycast isn't colliding with anything over the length of the ray.  As a result, it can't find the distance.

I'm having a hard time troubleshooting this, and I wonder if anyone can lend a fresh pair of eyes.

Ray ray = new Ray (transform.position, Vector3.down);
RaycastHit ray_result;
bool hit_ground = Physics.Raycast (ray, out ray_result, optimal_vertical_distance * 2);
if (ray_result.distance < optimal_vertical_distance && vertical_force < max_vertical_force)
  {
  vertical_force += vertical_acceleration;
  }
if ((!hit_ground || ray_result.distance > optimal_vertical_distance) && vertical_force > min_vertical_force)
    {
    vertical_force -= vertical_acceleration;
    }
  }
body.AddForce (Vector3.up * vertical_force, ForceMode.Acceleration);

The only time hit_ground worked correctly was when I increased the thickness of the floor from 2 units to 4 units and set the ray to start from 2 units above the craft instead of from the craft itself.  I don't understand why it works, though.  However, in that example, ray_result.distance seems to be locked at -1.10999, regardless of how far away the craft is.

sentences:
CharacterController rotation with mouse I'm trying to rotate my characterController around with the mouse movement.
I've tried to do so with this:

rotLeftRight = Input.GetAxis("Mouse X") * MOUSESENSIVITY * Time.deltaTime;
 rotUpDown = -Input.GetAxis("Mouse Y") * MOUSESENSIVITY * Time.deltaTime;

It works fine when I just move the mouse, but Input.getAxis returns 0 if you don't move the mouse, even if it's already on a corner of the screen. Is this normal?

What I need is something that returns 0 only when the mouse is in the center of the screen. I don't know if that is posible using Input.GetAxis or I should use another function.

Anybody can help me with this?

sentences:
LWJGL/Java - Implementing a writeable text box? I would like to create a writeable text box where a user can input text into it. A nice "send" button that the person could click to send the text to the server would also be nice.

I currently haven no idea how to do this and I do not see any tutorials on how to do this.

I am using LWJGL and Java, and also I am using the Slick2D library.

Thanks!

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:
How to manage data relationships when designing a crafting system? I'm trying to determine all the items, crafting methods and recipes to put in my game, and the relationships between them. I need a tool that allows me to do this both top down (boat needs sails and planks, sails need fabric which needs weaving technology and thread ...) and bottom up (hit rocks together to make sharp rock, tie it to a stick with thread to make an axe ...). I also need to ensure that all items, crafting methods and recipes conform to some template, which will be dynamic, at least in the development phase. I need the tool to be informative about which items conform to the template and which items do not, as well as what they are missing.
Below is an example item:

Item: Oak plank

Item family: Wood plank
Crafting method: Sawing

Item: Oak log

And here is an example item template:

Item

Optional item family
Mandatory crafting method

Choice (Item / Item family)

So this item conforms but I need a some way to ensure this and highlight if it was missing, for example, the crafting method. I also need to be able to check if an Oak log Item entry is also in the list and well formed according to the schema, and be able to change the schema easily. For example, I could later define an optional "Ship" tag in the schema for items that would enforce speed and strength values when used.
I will frequently update the templates and I want this to be a low overhead operation. Therefore I've eliminated databases. Due to the cross-referencing needs, I've eliminated spreadsheets and now I'm working on writing a tool that uses an xml schema to define the templates and list the items, crafting methods and recipes in an xml file, using xml validation to check conformity.
The problem is that the tool is taking too long to write and preventing me to work on the core features of the game. Are there any available tools or workflows for this purpose?

sentences:
Using Box2d to model rotating turret I would like to model a rotating "turret" on top of a tank-like object in 2D from the side view like pictured here:

tank with turret http://uofitorn.net/static/images/tankwithbox2dturret.png

Notice the faint outline of a gun protruding to the upper left courtesy of libgdx's debug renderer (the actual gun sprite is not being rendered).

How do I best implement this using Box2d?  Should I use two bodies?  If so, how?  Or one body with two fixtures?

I tried using two bodies connected by a Revolute Joint, but the turret "gun" does not maintain a constant angle but instead rotates down until it is vertical and then just hangs there.

Or should I not model the turret aspect of the tank in box2d at all?

sentences:
I keep coming across an error "Cannot read property 'innerHTML' of undefined" I'm new to game designing and have to create a game for my project but I keep coming across an error to do with:

index.html:93 Uncaught TypeError: Cannot read property 'innerHTML' of undefined
at drawMissiles (index.html:93)
at gameLoop (index.html:140)

Any idea how to fix this problem?
    drawMissiles()
}

function drawMissiles() {
  document.getElementsByTagName('missile')[0].innerHTML   <--- (index.html:93)
    for(var i = 0 ; i < missiles.length ; i++ ) {
        document.getElementById('missile').innerHTML +=
             `

`;

sentences:
WebGL rendering performance and frustum culling When I render five boxes in WebGL with one texture for all of them, the app runs at 60 FPS, nice. But when I render 70 boxes the performance decreases to ~40fps... but only 5 of the boxes are visible.

I have debugged the app and all 70 boxes are using per fragment shaders when there is no need because 65 of them are out of frustum. I thought that setting the GL viewport clipped out-of-view polygons, but apparently not.

I would like to know if I can use frustum culling techniques to avoid this? How can I activate frustum culling? Is there any WebGL command or I have to do it manually?

Thanks in advance,

sentences:
How can I make a transparent hole with shaperenderer using stencil masking in libgdx? I'm making a 2d game, where I need a resizeable, moveable rectangle outline. I'm trying to use stencil masking to do it by cutting a hole in a solid rectangle, and I thought this would help:

How can I add a transparent overlay to a UI in libGDX?

But all I get is a solid box. Here's my code:

        Gdx.gl.glClear(GL_STENCIL_BUFFER_BIT);
        Gdx.gl.glColorMask(false, false, false, false);
        Gdx.gl.glDepthMask(false);
        Gdx.gl.glEnable(GL20.GL_STENCIL_TEST);
        Gdx.gl.glStencilFunc(GL20.GL_ALWAYS, 0x1, 0xffffffff);
        Gdx.gl.glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);

        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);

        shapeRenderer.box(cubby.xpos + 5 , cubby.ypos + 5, 0, cubby.size - 10, cubby.size - 10, 0);

        shapeRenderer.end();

        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);

        Gdx.gl.glColorMask(true, true, true, true);
        Gdx.gl.glDepthMask(true);

        Gdx.gl.glStencilFunc(GL_NOTEQUAL, 0x1, 0xffffffff);
        Gdx.gl.glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);

        shapeRenderer.box(cubby.xpos, cubby.ypos,0,cubby.size, cubby.size, 0);

        shapeRenderer.end();

        Gdx.gl.glDisable(GL20.GL_STENCIL_TEST);

sentences:
How to only render fragments with Z from 0 to 1 in OpenGL? I have been using OpenGL for a year now, but I just recently found out that OpenGL only clips vertices when the absolute value of the x,y or z coordinate is less than the absolute value of w coordinate. Previously I had assumed that the z coordinate would have to be 0 < z < w to be rendered. Is there any way to clip vertices with z less than 0, without a performance hit?

I am using OpenGL 4.4

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:
Can you trilinear sample a non volume texture? Let's say that i have a regular 2d texture (not a volume texture).  Is it possible to do trilinear texture sampling of that texture even though it isn't a volume texture in opengl or directx?

Specifically, if i had a 2x4 texture laid out like below where A through H are pixels:

A B
C D
E F
G H

What I'd like to get is a trilinear sample being the result of linearly interpolating the bilinear sampling of (A,B,C,D) and (E,F,G,H).

I know i could take two bilinear texture samples and lerp them to get what I want, but is there a hardware supported way to do this?

sentences: How do games with a low tickrate but high framerate work? How do games with a low tickrate make things work? I.e. how do they manage to stay responsive despite the fact that interpolating gamestates for rendering adds input delay? Is there some method besides simple interpolation that allows for fps above the tickrate? E.g. Minecraft seems to work very well with a tickrate of just 20hz.

sentences:
Is it a legal thing to do to sell fabricated accounts of your game? For example, say I create an online mass multiplayer game with in-game purchasing system and with randomness factors as well (the point is that game accounts have actual value and there is a somehow proportional relationship with playing time plus the luck of the player and the account's value) and the game appears to become popular.

Is it legal to, for example, insert cheated accounts into the database (without even spend a second of legitimate playing) and sell those accounts with extremely high price?

sentences:
Unity3D: Storyboard-esq animation - a beginners question As part of an interactive book I'm developing in Unity3D, I'm attempting to make an introductory scene that consists of moving lots of objects at different times - usually when another animation has completed.

For example, some trees (sprites) move down the page, which starts some text moving in and cloud sprites to appear and start to move across the page, then some text begins to scroll from the bottom to the top of the page, while some audio beings to play.

Currently, I've made a script that can move a series of clouds from left to right, or right to left across a background sprite given a speed (note: I'm not using any of the animation tools, simple C# scripting to move the objects on a loop).

Within Unity3D, what is the recommended approach to achieve this?

My thoughts are:

Create a series of scripts that waits for n seconds (where n is the duration a desired 'animation'), and then start another - with somekind of 'master' or 'controller' script to manage the timeline.
Somehow use the animation tooling built into Unity3D, although I don't think that this what they were indented for...
Find a plugin that can help me create the scene and trigger animation/ scripts either on an event (animation finished) or after a specific time.

I've been using Unity3D for about 2 weeks now, so I'm certainly at the (pre?)-beginner level, I do however have over a decade of C# experience, so I'm comfortable with the scripting aspect.

Thanks in-advance,
Kieron

sentences:
Nullpointer exception with Scrollpane in LIBGDX I get a strange Nullpointer exception and I don't understand why. Can someone help me ?

Exception:

Exception in thread "LWJGL Application" java.lang.NullPointerException
    at com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.draw(ScrollPane.java:583)
    at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:123)
    at com.badlogic.gdx.scenes.scene2d.Group.draw(Group.java:57)
    at com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.draw(WidgetGroup.java:163)
    at com.badlogic.gdx.scenes.scene2d.ui.Table.draw(Table.java:119)
    at com.solvapps.tests.NewStoryBook.draw(NewStoryBook.java:40)

My Code ACTOR:

public class NewStoryBook extends Actor {

    Table table;
    ScrollPane pane;
    Table tableScroller;

    public NewStoryBook(Skin skin) {

        int w = Gdx.graphics.getWidth();
        int h = Gdx.graphics.getHeight();
        table = new Table();
        table.setPosition(400, 400);
        table.setSize(w / 3, h * 0.8f);
        tableScroller = new Table();
        tableScroller.add(new Label("bla bla",skin));
        pane = new ScrollPane(tableScroller);

        table.add(pane);

    }

    @Override
    public void draw(Batch batch, float parentAlpha) {
        super.draw(batch, parentAlpha);
        table.draw(batch, parentAlpha);
    }

My Code App:

public class StoryBoxTest4 extends ApplicationAdapter {

    private Stage stage;
    NewStoryBook newstoryBook;

    public void create() {
        stage = new Stage(new ScreenViewport());
        Skin skin = new Skin(Gdx.files.internal(SkinManager.getSkin()));
        newstoryBook = new NewStoryBook(skin);
        stage.addActor(newstoryBook);
        Gdx.input.setInputProcessor(stage);
    }

sentences:
Where is the Aves game engine? The Aves game engine made a splash last spring/summer, with very impressive demo videos. I went back to check on them, and it looks like their site has long since died. Google also doesn't seem to know anything new about them.

Where can I find news about Aves? Is the project dead?

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:
How to read a data from multiple selected text files in unity This question is based off of a previous one.

How to read a data from text file in unity

But I cant get the code to work for my purpose. I want to be able to choose which CSV files needs to be edited instead of just assigning one file.

Here is the code

private void readData()

{
    TextAsset csvFile = Resources.Load("Assets/Resources/Test1.csv") as TextAsset;

    string[] records = csvFile.text.Split(lineSeperater);
    foreach (string record in records)
    {
        string[] fields = record.Split(fieldSeperator);
        foreach (string field in fields)
        {
            contentArea.text += field + "\t";
        }
        contentArea.text += '\n';
    }

I want to access the file using a given link and then write to it. but for some reason it keep saying "Object reference not set to an instance of an object" referring to "string[] records = csvFile.text.Split(lineSeperater);"

I'm new to coding so it might be missing something silly. but as far as i know it should make sense? as csvFile is given the usl, but the url is not being found when its searching for csvFile.text, but then again, i might be completely wrong.

Could someone maybe help me and guide me in the right direction?

sentences:
Queries regarding Geometry Shaders I am dealing with geometry shaders using GL_ARB_geometry_shader4 extension.

My code goes like :

GLfloat vertices[] =
    {
        0.5,0.25,1.0,
        0.5,0.75,1.0,
        -0.5,0.75,1.0,
        -0.5,0.25,1.0,
        0.6,0.35,1.0,
        0.6,0.85,1.0,
        -0.6,0.85,1.0,
        -0.6,0.35,1.0
    };

glProgramParameteriEXT(psId, GL_GEOMETRY_INPUT_TYPE_EXT, GL_TRIANGLES);

glProgramParameteriEXT(psId, GL_GEOMETRY_OUTPUT_TYPE_EXT, GL_TRIANGLE_STRIP);

glLinkProgram(psId);

glBindAttribLocation(psId,0,"Position");

glEnableVertexAttribArray (0);

glVertexAttribPointer(0, 3, GL_FLOAT, 0, 0, vertices);

glDrawArrays(GL_TRIANGLE_STRIP,0,4);

My vertex shader is :

#version 150

in vec3 Position;

void main()
{
    gl_Position = vec4(Position,1.0);

}

Geometry shader is :

#version 150
#extension GL_EXT_geometry_shader4 : enable

in vec4 pos[3];

void main()
{
   int i;
   vec4 vertex;

    gl_Position = pos[0];
    EmitVertex();

    gl_Position = pos[1];
    EmitVertex();

    gl_Position = pos[2];
    EmitVertex();

    gl_Position = pos[0] + vec4(0.3,0.0,0.0,0.0);
    EmitVertex();

    EndPrimitive();
}

Nothing is rendered with this code. What exactly should be the mode in glDrawArrays() ? How does the GL_GEOMETRY_OUTPUT_TYPE_EXT parameter will affect glDrawArrays() ?

What I expect is 3 vertices will be passed on to Geometry Shader and using those we construct a primitive of size 4 (assuming GL_TRIANGLE_STRIP requires 4 vertices). Can somebody please throw some light on this ?

sentences: Is it legal to use the game mechanics of risk if I don't use their name? I'm currently developing an idea for a conquest-style board game similar to Risk. I was wondering if I would be legally entitles to use some game mechanics that appear in that game so long as I don't use Risk's title or logo or anything.

sentences: LibGDX - How to export a texture as a .png onto, say, the desktop I'm making a game in which I need to export a texture which the user has edited as a .png into a specified location. I'd like it if I could have the default saving window thing (like on other apps when you do cmd+s). If this isn't possible, is there any way in GDX to export a texture (as a .png) to the computer (and preferably not the assets folder)

sentences:
Networking player input, UI, and ability use I am currently working on a project to learn more about networking, specifically authoritative network architecture.

In most authoritative systems you capture a player's input queue them up then send them to the server after a certain count or time has passed. The input is "copied" to the local(client) loop and run as prediction while it waits for the server to return the authoritative state back to the local(client) for correction. The states are also sent to all connected players to recreate the observed behavior of remote players.

This system works well for things like player movement and shooting(raycasts). This gets more complicated as we start to integrate UI and player skill/ability bars. In most MOBA or MMO games there is UI that can also create "input". In these cases there isn't a truely 100% right way to accomplish the goal of networking these pieces. You wouldn't need or want the UI to be run on the server in most cases.

I have come up with a few concepts of sending the input for these to the server and would like to know if I am close to conventions that are used in professional system or if I am even thinking about it in the right way.

Case 1: Mapped config agreement
In this model the player can assign abilities to a skill bar that is both clickable and correspond to the number keys on the keyboard. This "mapping" of abilities to bar slots is stored in a player config and is sent to the server.
When the player presses a number key or clicks on an icon an input is generated and added to the input sent to the server that looks something like this:
[BarId:1,BarIndex:1,KeyId:1]
When this is received by the server the server looks up the player UI config that was sent to the server and see what abilityId was stored on that place in the bar, check if it is a valid move then update the server state.

Case 2: Server Command
In this case the player class has a UseAbility(abilityId,target) method that can be called from the client player instance but is executed on the server instance, this bypasses the normal input gathering loop by executing the command on the server immediately so incorporating this into the client/server step systems isn't clean.

Borrowing the use-case from Case 1:
The player presses the button on the keyboard or clicks the UI button. This is "mapped" locally to a specific skill. The button/keypress calls UseAbility(0x00012,self) and is run on the client and server immediately it is checked for validity and then a state is sent to all connected players.

Those are the two cases I have right now. One works well with how input is gathered and sent to the server for processing. The other makes more sense in that the code can be more explicit but it appears to break the server authoritative structure. Would you guys please tell me what you think and maybe we can have a conversation about best practices.

Thanks for reading my post.

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 to draw multiple shapes in one draw call? I have a misunderstanding about vertex buffers in DirectX. I'm trying to draw infinite vertices that they may represent a line or a circle or a rectangle in a single draw call. I can bind them all together and set a flag for each vertex to determine which shape I have to draw now with DrawPrimitive(), but the questions are:

When I first create the vertex buffer, I set a constant length of 1000 for it because I don't know how many vertices I'm going to draw. How can I avoid this?
I don't know the proper way of drawing these vertices at all. I mean I can draw them right now with a dynamic VB, but I have no idea on performance and etc.

BTW, I've read this article which is pretty good, but it doesn't apply to my issue.

Edit

For example, I have 6 vertices which 2 of them are shaping a line and the other 4 are shaping a rectangle. I can bind them all together and copy them into the vertex buffer and then draw. Now, what if next time I wanted to draw a line and two rectangles? In this case I have to add 4 other vertices to my current list and we suppose my VB is not big enough to do that. This is my misunderstanding that I don't know if I should reserve enough space at first place for my VB or there is an alternative to pitch the length during runtime.

I'm trying to draw basic 2d shapes here nothing 3d:

// A class member
std::vector<Vertex2D> mVertices;

// Draw method
{
void* buffer = new char[this->mVertices.size() * sizeof(Vertex2D)];

Device()->VertexBuffer()->Lock(0, sizeof(buffer), &buffer, D3DLOCK_DISCARD);
memcpy(buffer, this->mVertices.data(), sizeof(buffer));
Device()->VertexBuffer()->Unlock();

Device()->SetStreamSource(0, Device()->VertexBuffer(), sizeof(Vertex2D), sizeof(Vertex2D));
Device()->SetFVF(D3DFVF_VERTEX2D);
Device()->DrawPrimitive(D3DPT_LINELIST, 0, this->mVertices.size());

delete[] buffer;
}

It's a simple draw call in a bigger loop. mVertices is a collection of different vertices for different shapes. My second question was, how to draw different shapes from one vertex buffer in a single draw call. My first question was, how can I adjust vertex buffer's length with a relevant length to my vertices and not a default value at compile time.

sentences:
How do I fix this "Accessed None trying to read property Save Game" error? I have create this blueprint, with a Check for an existing Save-Game and load it in case of true. Else, create a new save game object. While Z is pressed, create a new Save Game, getting the Player Position.
The problem is that when I try to start the game, I have two errors:

How can I solve those problems? This is my blueprint:

Thanks.

sentences: How to Change default Mouse pointer on emulator in Android? I want to change default mouse pointer in Android emulator. I want to change it for my game to use different type of cursor.I am using AndEngine for my game development. Is there nay way to change default mouse cursor for my Application. Thanks in Advance

sentences:
How to make healthbar size relative to hp Like in most games with healthbars, the units in my game have a hp_bar object which is a frame, with a slightly smaller rectangle inside which should get smaller (and change color) as a unit loses hp, but I'm unsure how to work the math which will make the rectangle size an integer which represents an percentage rather than the actual hp.

Say the hp bar is 40 pixels in width, and hp is some arbitrary integer amount, what is the python magic to convert the hp to hp bar width?

sentences:
How can I keep a consistent number of players per match in a continuous multiplayer game? Fortnite Battle Royale is an example of a non-continuous multiplayer game. 100 players join a game which has fixed start and end times. When there's only one player remaining, the game ends.

Agar.io is an example of what I like to call a continuous multiplayer game. Players join in and die out, but the game goes on forever.

How would a game developer design a system to split players into different groups when there're too many online to fit in a single game? Let's say a game has a limit of 10 players, and 50 players are trying to join. The server will split them up into 5 separate groups. New players will be sorted evenly into these groups to replace players who died. When the player count increases past the global limit, new games will be created to fit them. The problem arises when the player count decreases. The system needs some way to seamlessly delete extra groups of players that are no longer needed. How can that be done without A) interrupting games to merge players together or B) block new players from joining into the group(s) that require deletion and waiting for everyone in it to die (which will be a bad experience for the last few players).

Agar.io obviously has a player population management system that works, so how do they do it?

sentences: What type should you use for keeping game score Lets say you have a high scoring game like geometry wars, why type would you use for the score and how should you handle overflow?

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 Unity3D, what ways can I improve the batching with a single texture atlas and four-point material? I'm building a randomized city terrain with a set of planes, custom 4 vertice square made in Blender. I've got a texture atlas working so that it draws on a single material and texture, but it's still hitting 97 batch calls when I render the layout. 4 of those are other things, leaving the ground resulting in 93 calls. Are there any other ways I can increase the efficiency? For the moment, the planes are created with a standard instantiate call:

    for (int y = 0; y < NumberOfTilesX; y++) {
        for (int x = 0; x < NumberOfTilesY; x++) {
            CityGround[i] = Instantiate(GroundTile, new Vector3(x, 0, y) * 6, GroundTile.transform.rotation) as GameObject;
            CityGround[i].transform.parent = City.transform;
        }
    }

After being created, they set their own texture within the atlas using a random choice selector.

sentences:
What should I do to get my Blender models into my iOS game? I am working on a 3D OpenGL|ES game for iPad. All the models are created in Blender. How should I go about getting my models into my game?

I have the following requirements of my models:

One texture map
Material
Skeletal animation data
Attachables / Socket Points

sentences:
J2ME character animation with multiple sprite sheets I'm working on a J2ME game and I want to have walking animations.

Each direction of walking has a separate sprite sheet (i.e. one for walking up, one for walking right etc), I also have a static idle image for each direction held together in a single file. I've tried to hold an array of sprites in my player class and then just drawing the sprite corresponding to the current direction, but this doesn't seem to work.

I'm aware that if I combine all the animations into one sprite sheet I could set up different animation sequences, but I want to be able to do it with separate images for each animation.

Is there a way that anyone knows of to achieve this? And ideally without too much extra code (as opposed to combining the sprites into one sheet)

sentences:
Given a point on the surface of an OBB, return normal of the face So I have this class OBB which implements a test function that determines whether a ray hits it. If it does, a passed in struct is assigned a bunch of variables:

struct HitData
{
    float   t;
    Color   color;
    Shape* lastShape = nullptr;
    Vec lastNormal;
}

The last member, Vec lastNormal; is supposed to get its value from the class'

normal(Vec& point) function.

Here's where I'm drawing a complete blank. I.e. I cant seem to find any obvious (or non-obvious) solutions to how to determine the normal.
Essentially what I want to do is identify which of the 6 planes the point lies on. In theory I could brute-force it and just do an intersection test against all the planes but that just seems unnecessarily expensive.
The OBB is defined by a center, three basis vectors and their half-lengths.

Any idea how I could approach this problem?

sentences:
Minimal Inform6 code to support  syntax Without using any of the standard Inform libraries, what is the minimal amount of code / infrastructure needed to support the <action> syntax?

What I tried is

Verb 'foo' * -> Foo;

[ FooSub;
    "Hello from FooSub";
];

[ Main;
  <foo>;
];

I expected this to print Hello from FooSub when run; however, the output I get is

Action <0 0 0>

sentences:
libgdx: input handling issue Not sure how to describe the issue I'm facing here:

Rectangles are grouped and attached to a "layer" extending Stage.
Each layer is added to a multiplexer in a Screen extension.

There are 2 layers:

Top has the 1 big rectangle & group members (smaller colored rectangles)
Bottom has the 2 big rectangles & their members

The 3 big rectangles are all the same size & color (turns yellow if it detects the mouse is over it, for debugging purposes)

When you click on it, it brings its group to the front of its layer.

The problem is that both the top layer and bottom layer are processing the input, grouping and drawing stuff works fine.

In the screenshot, only the top-most big rectangle should be yellow at the cursor's position:

sentences:
When is transform width in code not equal to the transform width in inspector? I've come across a strange case in Unity's UI where the width of a RectTransform isn't the same as what is being reported. I have a transform which is 50 by 50 with no scaling, it is a root object of the canvas yet when I use the information that I get from the transform in code to draw from the bottom left edge of the transform to the top right it doesn't reach all the way!

Gizmos.color = Color.red;
Vector2 pos = new Vector2(transform.position.x, transform.position.y);
Gizmos.DrawLine(pos - transform.sizeDelta, pos + transform.sizeDelta);

Vector3[] corners = new Vector3[4];
transform.GetWorldCorners(corners);

Gizmos.color = Color.magenta;
Gizmos.DrawLine(corners[3], corners[0]);
Gizmos.DrawLine(corners[0], corners[1]);
Gizmos.DrawLine(corners[1], corners[2]);
Gizmos.DrawLine(corners[2], corners[3]);

The first section should draw a line from the bottom left to the top right according to what the transform reports are the width and height however they don't reach across the entire transform. Using GetWorldCorners the actual corners can be found and drawn around, with that data you can extract that the actual width is 60 (150.2 - 30.2 = 120 / 2 = 60)!

Why? Is this a bug or an I missing something obvious here?

sentences:
libgdx+android: White screen after re-create() but not resume() I have this weird issue only on android where if I push the home button, when I get back into the game it passes through resume() and it display by background texture correctly. But if I push the back button it destroy and when I get back it the game it calls create(), but it draws the background as a white texture instead.

I searched a bit on the subject and what I know so far:

Android static variables are not reinitialized on activity recreation, so you must make sure that create() will initialize those variables.
OpenGL will free the textures when the application loses focus, so this is why they must be reloaded when the application resume.

Unfortunately, even having this information in mind while programming did not fix the issue. I'll just show important portion of the code below:

// The asset manager is created statically, but not initialized
private static AssetManager _manager;

//Then during the create() and resume() method, the manager is initialized and all the
//textures will be loaded afterwards.
_manager = new AssetManager();

//When the app is destroyed, dispose() is called and the manager is nullified
_manager.dispose();
_manager = null;

So given the code above, if the application is destroyed or resumed, they will both pass into the same initialization method that creates the assets manager and load textures.

So why it only works on resume() and not on create() when the same code is actually called.

A quick fix that worked was something I found on this forum which consisted in killing the application on disposal with the following code in the android project:

//SOURCE: https://gamedev.stackexchange.com/questions/102079/screen-not-rendering-after-restarting-game
@Override
protected void onDestroy() {
    android.os.Process.killProcess(android.os.Process.myPid()); // this line will kill process
    super.onDestroy();
}

But I am not sure it is the right way to do things.

sentences:
Artifacts in unity shading I created block of 3x3x3 cubes, disabled shadows, set directional lighting color to white and ambient to black. And I'm getting this:

Any idea what is going on and how to fix it? Effect is visible when object isn't moving but with a lot less artifacts. It doesn't matter what is moving, camera or cubes. I would guess that this is precision problem but is there anything that can be done about it?

//EDIT

Here is a screenshot of cubes:

Also this is how it looks after static batching (this happens because of Lightmap Static in Mesh Renderer is on):

sentences:
How to transition between "rooms" / virtual cameras on a button press? I'm trying to make a game that navigates like the example here:

I'd like it so that after combat, the player can push the button corresponding with an exit (left, right, up, down) and navigate like in this game.

Also I eventually hope to randomize each run of the game so it would hopefully have some flexibility outside of being hard baked.

I've seen examples of it being done with a player object and a collider, but the player won't actually be moving their character. I like this style of navigation because I think it still provides the joy of exploration for the player, but is more friendly of a navigation system for a novice like me.

How would I implement something like this?

sentences: What is "cold storage" in the context of larger MMOs? What is a cold storage and what is it used for? I'm not sure if I should use cold storage in my game. I heard it can be used for chat logs, however I'd rather someone here answer all my questions.

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:
Barter system data type My game has 4 supplies, Gold Wheat Iron Fuel, a player is allowed to select a supply to trade and what supply to receive from merchant NPCs.

Currently, when the user trades an item I have the following logic
I am using c# but this is not the exact code used.

if(sellGold){
    if(buyGold){
        tradeRatio = .5;
    }
    if(buyWheat){
        tradeRatio = 3;
    }
}
else if(sellIron){
    if(buyGold){
        tradeRatio = 1;
    }
    if(buyFuel){
        tradeRatio = 2;
    }
}
...etc

Where the amount a player receives is calculated by multiplying the trade ratio by the amount sold.

This works, it is just rather tedious and would be a pain to add more supplies later. What would a better approach be? I'm thinking of assigning each item a value and that value is different based on the trade type, but that still involves a whole bunch of nested conditionals.

sentences:
Why am I not getting an sRGB default framebuffer? I'm trying to make my OpenGL Haskell program gamma correct by making appropriate use of sRGB framebuffers and textures, but I'm running into issues making the default framebuffer sRGB.

Consider the following Haskell program, compiled for 32-bit Windows using GHC and linked against 32-bit freeglut:

import Foreign.Marshal.Alloc(alloca)
import Foreign.Ptr(Ptr)
import Foreign.Storable(Storable, peek)
import Graphics.Rendering.OpenGL.Raw
import qualified Graphics.UI.GLUT as GLUT
import Graphics.UI.GLUT(($=))

main :: IO ()
main = do
    (_progName, _args) <- GLUT.getArgsAndInitialize
    GLUT.initialDisplayMode $= [GLUT.SRGBMode]
    _window <- GLUT.createWindow "sRGB Test"

    -- To prove that I actually have freeglut working correctly.
    -- This will fail at runtime under classic GLUT.
    GLUT.closeCallback $= Just (return ())

    glEnable gl_FRAMEBUFFER_SRGB
    colorEncoding <- allocaOut $ glGetFramebufferAttachmentParameteriv
        gl_FRAMEBUFFER gl_FRONT_LEFT gl_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
    print colorEncoding

allocaOut :: Storable a => (Ptr a -> IO b) -> IO a
allocaOut f = alloca $ \ptr -> do
    f ptr
    peek ptr

On my desktop (Windows 8 64-bit with a GeForce GTX 760 graphics card) this program outputs 9729, a.k.a. gl_LINEAR, indicating that the default framebuffer is using linear color space, even though I explicitly requested an sRGB window. This is reflected in the rendering results of the actual program I'm trying to write - everything looks washed out because my linear color values aren't being converted to sRGB before being written to the framebuffer.

On the other hand, on my laptop (Windows 7 64-bit with an Intel graphics chip), the program prints 0 (huh?) and I get an sRGB default framebuffer by default whether I request one or not! And on both machines, if I manually create a non-default framebuffer bound to an sRGB texture, the program correctly prints 35904, a.k.a. gl_SRGB.

Why am I getting different results on different hardware? Am I doing something wrong? How can I get an sRGB framebuffer consistently on all hardware and target OSes?

sentences:
Convert array of object to json in unity I need to convert the array of object to json. I have written code to convert object to json. How can I convert the object array to json format

JSONClass jsonClass = new JSONClass ();

    jsonClass ["Array"] = Array;
    jsonClass ["Array"] = new JSONClass ();
    jsonClass ["Array"]["Value1"] = 1;
    jsonClass ["Array"]["Value2"] = 1;
    print (jsonClass.ToString(""));

How to convert this to below format

Here is my expected output

    "Array": [
          [
        "Value1",
          1,
         ]
         [
        "Value2",
          5,
         ]

    ]

sentences:
What makes movement feel smooth, and what are some standard methods to achieve this? I'm either not searching correctly or there is really not a lot of material on character movement in 3D games. I'm mostly interested in how people usually implement character movement in games like FPS and action games, where usually the WASD keys are used to move backward and forward and for strafing, with the mouse used for turning. I'd like to learn what methods are generally used, and what makes the movement handling feel right.

For example, I tried to implement movement handling using some 'walking' force to move my character, by integrating the equations of motion. Needless to say, this felt more like handling a spaceship, rather than a human. Others probably use just some velocity to steer the characters, maybe coupled with a deceleration when no buttons are pressed. I tried something similar in following code, but it still feels kinda clunky.

if(move_comps_[*entity]-&gtmv_direction != glm::ivec3(0))
{
    glm::vec3 mv_dir(0.0);
    mv_dir += (float)move_comps_[*entity]- &gt mv_direction.z
        * transform_comps_[*entity]-&gtforwardVec();
    mv_dir += (float)move_comps_[*entity]-&gtmv_direction.x
        * transform_comps_[*entity]-&gtrightVec();
    mv_dir = glm::normalize(mv_dir);

    glm::vec3& velocity = move_comps_[*entity]-&gtvelocity_;
    velocity += dt * move_comps_[*entity]-&gtacceleration_ * mv_dir;

    if(glm::dot(velocity, velocity) &gt sqr(move_comps_[*entity]-&gtmax_velocity_))
    {
        velocity = move_comps_[*entity]-&gtmax_velocity_ * mv_dir;
    }

    transform_comps_[*entity]-&gtpos_ += dt * velocity + 0.5f
        * move_comps_[*entity]-&gtacceleration_ * sqr(dt) * mv_dir;
}
else if(glm::length(move_comps_[*entity]-&gtvelocity_) &gt 0.0)
{
    glm::vec3& velocity = move_comps_[*entity]-&gtvelocity_;
    glm::vec3 mv_dir = glm::normalize(velocity);
    velocity -= dt * move_comps_[*entity]-&gtacceleration_ * mv_dir;

    if(glm::dot(velocity, velocity) &lt 0.01f)
    {
        velocity = glm::vec3(0.0);
    }
    else
    {
        transform_comps_[*entity]-&gtpos_ += dt * velocity + 0.5f
            * move_comps_[*entity]-&gtacceleration_ * sqr(dt) * mv_dir;
    }
}

Here in essence, I use an integer vector which can hold (-1, 0, 1) in each dimension. When a walk_forward_start event is fired, for example, this z component is increased by 1 and decreased when the player releases the button. This vector is used to find out in which direction to move the player. I also added a simple deceleration mechanism. As I said, this still doesn't feel right, and is certainly not really smooth. What could I do to improve it?

Others have gone as far as implementing advanced techniques such as inverse kinematics, too. I wouldn't go that far, but how far do you have to go to make a movement system feel good?

Essentially, beyond the sauce, I want to know what makes pushing forward, strafing, turning and stopping feel smooth and what are some standard methods to achieve this. Do you use some impulse/force based method? Do you use a linear velocity method?

Note: This may seem like a subjective question and it might be up to some point, but I think there must be some general consensus or else there would be a big variations on how these controls are handled by games.

sentences:
C++ Saving and Loading From Text File In my C++ program I am trying to develop a simple saving and loading function for my game. I can easily get the save function on it, but the loading part of it really stumps me.

What I need is to load the numbers on the file (line by line) and insert them into different variables for my player. I'm just not able to figure that out. I've even looked all around the inter webs.

Here is the code for the player save and load functions:

void Player::Save()
{
    std::ofstream savePlayerFile;
    savePlayerFile.open("Save/playerSave.dat", std::ofstream::trunc);

    savePlayerFile << x << "\n" << y << "\n" << prevX << "\n" << prevY << "\n" << health << "\n" <<
    health  << "\n" <<  mana  << "\n" <<  gold  << "\n" <<  level  << "\n" <<  maxHealth << "\n" <<
    maxMana << "\n" << strength << "\n" << defense;

    savePlayerFile.close();
}

void Player::Load()
{
    std::ifstream loadPlayerFile;
    loadPlayerFile.open("Save/playerSave.dat", std::ofstream::in);

    /*std::string line;
    while(std::getline(loadPlayerFile, line))
    {
        std::istringstream iss(line);
        */
    loadPlayerFile >> ( x && "\n" && y && "\n" && prevX && "\n" && prevY && "\n" && health && "\n" &&
    health && "\n" && mana && "\n" && gold && "\n" && level && "\n" && maxHealth && "\n" &&
    maxMana && "\n" && strength && "\n" && defense);
}

sentences: OpenGL - must I always preserve data that is uploaded to a VBO? If I load my vertex data from a file into a buffer in RAM, and then upload this to the GPU (say, to a static VBO so no need to modify the data), do I need to keep that buffer around? If not, how do I know that the upload is complete?

sentences:
UV Tiling & Offset input values from World Position - incorrect behavior? I'm using ShaderGraph in 2020.1.0f1. I have some shader experience, but it's all been handwriting shaders. I have experience with node-based things of this nature by way of Substance Designer. I'm working on a shader that should allow for seamless visibility between quads by changing the UV offset of a noise pattern based on the world position of the quad.
That said, I'm running into two things. This short (0:05) video shows how I'm expecting this to work - as the X/Y values of the UV Offset are changed, the continuous flow of the noise is smooth.
https://youtu.be/YAd9BtAWVRM
So, I add a position node and a split node, feed the world position into the split, and feed R/G from the split to X/Y of the Vector2 node. That does two things: it makes the preview boxes 3D (becomes a sphere instead of a quad), and "expands" the apparent tiling:

I'm guessing this is because the value from the split is a Vector1 rather than a float, though it seems odd that there's no implicit conversion, or that Vector1 values applied to UV Offset would change the actual appearance.
So, is this due to it being a Vector1 rather than a float? If so, is there a node that can convert from Vector1 to float? Am I going about this the wrong way entirely?

sentences:
How important is understanding Software Project Management for an indie? I ask this because I'm curious to know from people who actually support themselves by making games, if their project management skills contribute to determining the success of a project?

I also have this feeling for some reason that having too much project management can strangle the creative process. Maybe there is a way to prevent that from happening. I don't know.

Thanks to all that reply.

sentences:
Iterating 1D array and getting 2D tile position I know I'm missing something very obvious here, but I have a 1D array that contains integers.I have a map that is 30 x 30 and the center coordinate is 0,0 (This is actually 3D, but I'm essentially removing the Y-axis). Because of this offset, my loop is from -15 to 14, rather than 0 to 29. Is this incorrect?

I'd like to iterate through the array and if the integer is "1", then I'd like to call AddSphere(x,y,z) with the correct x and z values. How would I get the correct values for x and z? The file is designed to be read left to right rather than left to right, right to left, left to right etc... (although if that's a better approach, I can just change the data to match that style).

sentences:
Using shared memory instead of marshalling for C++ native plugins in Unity? So I'm a C++ developer who has been playing with C# for a week or two in order to get acquainted with Unity, and I'm curious about the marshalling process used to transfer data for use in C++ native plugins. From what I can tell, the general consensus is that while using effective C++ plugins can be a performance increase for computation-heavy tasks, the marshalling process of transferring data can be significantly slower than the potential gains provided by the C++ flexibility.

I'm familiar with how shared memory works in C++ and it appears C# has the functionality required to use the buffers as well. From what I understand, the process of marshalling is slow due to copying, creating buffers and transferring chunks from one memory segment into another. Even though there's the problem of cache coherency when operating in shared memory, it may be less than the cost incurred by marshalling. I'm sure I'll have to do some experimenting.

Does anyone have thoughts or experience with using shared memory or marshalling in Unity who could weigh in on the question?

sentences:
How do I find the angle between two vectors? I have 3 points on my screen:

a = a point which is (c.x, 0) makes a line pointing straight up
b = a user input touch, can be anywhere on the screen
c = a moving object

       a
_______.________
|      |       |
|      |       |
|   b  |       |
|  .   |       |
|   \  |       |
|    \ |       |
|     \|       |
|      | c     |
|______._______|

I have drawn some lines so that you can see the vectors.

I want to be able to get the angle between a and b. I have tried this, but it doesn't work, does anyone know what I'm doing wrong?:

//v1 moving object
float boxX = this.mScene.getLastChild().getX();
float boxY = this.mScene.getLastChild().getY();

//v2 user touch
float touchX = pSceneTouchEvent.getX();
float touchY = pSceneTouchEvent.getY();

//v3 top of screen
float topX = boxX;
final float topY = 0;

float dotProd = (touchX * topX) + (touchY * topY);

float sqrtBox = (touchX * touchX) + (touchY * touchY);
float sqrtTouch = (topX * topX) + (topY * topY);

double totalSqrt = sqrtBox * sqrtTouch;
double theta = Math.acos(dotProd / Math.sqrt(totalSqrt));

The answer I usually get is between 0 and 1.
How do I fix this so that I get the angle in degrees?

sentences:
CCSequence with two CCAction I have two CCActions :
CCAction *a;
CCAction *b;

so how to use CCSequence with two CCActions
Thanks

sentences:
When PlayerRemoving event is fired, for loop does not work properly while I was implementing the Backback save feature in my Roblox Game (using game.Players.PlayerRemoving:Connect(), I found that when I used a loop of any form (for, while,etc.), it would not run correctly. Here is a test program which I wrote to observe this issue:

game.Players.PlayerRemoving:Connect(function(player)
    local testList = {"Hello", ",", "world"}
    for i=1,3,1
    do
        print(testList[i])
    end
end)

However, when this code is ran, all I see in the output window is:

Hello

And nothing else.
This issue is causing a lot of issues with the rest of the code, can somebody please help? It would be very useful!

sentences:
How do you start modding a game without an editor? I often come across very impressive mods for PC games that don't have an official editor, other development tools or its source code publicly available. (Take this amazing Multiplayer mod for Just Cause 2, for example.)
How do you go about creating mods for such games?
I'm not talking about replacing the odd texture or 3D model—that sort of thing seems fairly easy given tools to pry them out of game files and put them back in—but more along the lines of adding game behavior. (Tweaking settings files also doesn't count.)

Note that I'm not asking "how to create a mod", I just want to know where to start or where to go to learn.

sentences:
Random Position between ranges Does anyone have a good algorithm for generating a random y position for spawning a block, which takes into account a minimum and maximum height, allowing player to to jump on the block.

Blocks will continually be spawned, so the player must always be able to jump onto the next block, bearing in mind the minimum position which would be the ground, and the maximum which would the players jump height bearing in mind the ceiling

sentences:
How small should touch triggers be at minimum? Is there a known minimum physical size for reliable touch select triggers, considering  only selection (no long-press or drag). From personal experience, I would guess it to be about 5x5 mm (0.2x0.2 inch). Is there a canonical answer?

Context: I want to make my chess-like game board have as many cells as possible, but I still want users to be comfortable selecting cells, as it will be a frequent action.

sentences:
How to do score systems, combos, multipliers, chains, etc I am designing a game, but I am having some trouble implementing a decent score system. Basically I have nodes with two different possible characteristics: color and shape. Since the player click from node to node, I want to award more points to the players which hit the same shape, same color or both, like: (SAME SHAPE x 3! AWESOME!, SAME SHAPE AND COLOR x 5! ARE YOU A WIZARD?!).

However I am having a lot of trouble implementing this. Can someone point me in the right direction or show me algorithms that can do this?

sentences:
Is it possible to have vehicles with physics like GTA in an MMO game? I haven't seen any MMO games with vehicles with realistic physics and that could achieve high speed, why? Is it because of network bandwidth limitations?

Second Life has vehicles, but physics are poor and max speed is pathetic.

sentences:
OpenGL ES God Ray Precision error I have encountered the following (i think) precision error.

(missing link need 10 rep)

My source of inspiration was:

(missing link need 10 rep)

On the PC everything works fine, but on android it shows those weird squares.

I had the same problem with a procedurally masked sprite. When the radius of the circle was getting too big i had the same error so i changed the mask from a shader radius uniform to a texture mask uniform, so i guess there is a precision problem.

This guy here had the same problem but unfortunately i can't see the answer.

(missing link need 10 rep please someone upvote me.)

The code adapted to OpenGL ES is the following:

#version 100

precision mediump float;

uniform sampler2D tex_diff;
uniform vec2 light_on_screen;

varying vec2 texture_coord;

const int NUM_SAMPLES = 128;

void main()
{
    const float exposure = 0.0225;
    const float decay = 0.95;
    const float density = 0.95;
    const float weight = 3.75;

    // Inner used valuesa
    vec2 deltaTextCoord = vec2(texture_coord.st - light_on_screen.xy);
    vec2 textCoo = texture_coord.st;
    deltaTextCoord *= 1.0 / float(NUM_SAMPLES) * density;
    float illuminationDecay = 1.0;

    vec4 c = vec4(0, 0, 0, 0);

    for(int i=0; i < NUM_SAMPLES ; i++)
    {
        textCoo -= deltaTextCoord;

        textCoo.s = clamp(textCoo.s, 0.0, 1.0);
        textCoo.t = clamp(textCoo.t, 0.0, 1.0);

        vec4 sample = texture2D(tex_diff, textCoo);

        sample *= illuminationDecay * weight;

        c += sample;

        illuminationDecay *= decay;
    }

    c *= exposure;

    c.r = clamp(c.r, 0.0, 1.0);
    c.g = clamp(c.g, 0.0, 1.0);
    c.b = clamp(c.b, 0.0, 1.0);
    c.a = clamp(c.a, 0.0, 1.0);

    gl_FragColor = c;
}

Showing the whole engine is useless since it's huge. All the shader input is correct, the coordinates are correct, the only problem is the inner shader computation.

Anybody encountered this or has any ideas for any workarounds?

Scanned the whole net for a solution for this, and i couldn't seem to find one. Any can point me in the right direction? Or maybe someone encountered this type of error in a different context or in a different shader? Maybe i can apply the same workaround here too.

sentences:
Allocator error in Unity Suddenly, a wierd error started to come up in my console saying
More than 2048 allocators are registered. Reduce the allocator count.
This error leads to freezing of editor.

sentences:
Character Models: Single Mesh vs. Individual Parts I was looking up 3D character models from various games (Battlefield 3 and DMC to be specific), just as research work and upon importing the model into Blender3D, I found that every part of the model was a separate mesh/object (head, armor vest, legs, hands, etc.).

This got me thinking: Why didn't the artist model them as a single object?

I think that would be better because:

You can save a few polygons in your model [*].
Doesn't animating separate parts [**] cause clipping issues as one mesh may not deform in sync with neighboring mesh?

[*] All parts were overlapping each other = the armor vest was overlapping chest polygons, which were not visible and thus wasted.

[**] All polygons and edges connected to each other.

sentences:
Joint based destructible physics (like Armadillo Run) I've implemented a destructible terrain system like Worms before (where weapons create holes in the terrain), but for the game I'm designing I want something more like Armadillo Run: https://www.youtube.com/watch?v=4JoPlcyxxb4 where everything is made from individual parts connected by physics joints.

I've figured out how to make a chain of planks using Unity's joints that can fall, swing off each other, bend if unsupported, and break at the joints. But I can't think of how to make planks break instead of the joints. There's an example of what I want at 2:25 in the video, where the plank on the right breaks (not the joints, but the actual plank itself). Obviously I'd just have to destroy the plank object, but how do I decide when to do that?

I'm using the Unity engine (2D physics), but I'd be perfectly happy to implement something myself if someone can direct me to some research on the subject or anything else to help me get started.

sentences:
Issues with 2D Body/Limb system In my game I have programmed Body and Limb classes. The Body is guaranteed to have an origin in the center of its sprite. The Body class has a List of children Limbs, each with their own offset. Every Limb has a Master value which references the parent Body, but it also has a Parent value which references the Limb it is a child of. However, Limbs do not have to have a parent, they can directly connect to the Body.

The Master, Parent, and Children values of the Limb class:

    //Body containing all limbs this limb is connected to and others.
    public Body Master
    { get; set; }

    //Parent limb, if null then limb directly connected to the body.
    public Limb Parent
    { get; set; }

    //Children limbs
    public List<Limb> Children
    { get; set; }

The Limb methods have if statements to handle these situations. In relation to the offsets and rotations of the Limbs around the Body (using transformation matrices) things seem to work fine. Now, the problem I'm having is when a Limb is attached to another Limb. The child Limb draws and behaves as if it is rotating around the Body instead of its parent Limb, and the parent Limb itself vanishes. Limbs without Children that are directly connected to the Master Body have no issues. Because of this sort of recursive hierarchy I believe the problem has to do with reference types but I may be mistaken. Here is some additional code:

Demonstration:

Here is the worldPosition() method which is used to acquire the Limb's position in world space. I suspect it may be the culprit. The Master.Position is already in world space:

    public Vector2 worldPosition()
    {
        if (Parent != null) return (LocalPosition += Parent.worldPosition());
        else return (LocalPosition += Master.Position);
    }

Finally here is the Update() method of the Limb class:
http://pastebin.com/5L5v5p6x

EDIT: Upon further analysis it appears that any changes I make to either Limb seem to affect the other Limb in one way or another even though they are both quite clearly different instances.

Here is the code to make the initial Body and first Limb:

        b = new Body()
        {
            Sprite = FileFactory.Textures["shoulders"],
            Position = new Vector2(this.Position.X, this.Position.Y),
        };

        Limb l = new Limb()
        {
            Sprite = FileFactory.Textures["left_arm"],
            Master = b,
            Offset = new Vector2(2, 13),
            Origin = new Vector2(0, Sprite.Height / 2),
            RotationalDifference = (float)(0.2 * Math.PI),
            RotateSpeed = 0.15f
        };

        b.Children.Add(l);
        b.Initialize();

And the code to add the child Limb to the first (Parent) Limb:

            Children.Add(
            new Limb()
            {
                Sprite = FileFactory.Textures["right_arm"],
                Master = this.Master,
                Parent = this,
                Offset = new Vector2(27, 0),
                Origin = new Vector2(0, Sprite.Height / 2),
                RotationalDifference = (float)(0.2 * Math.PI),
                RotateSpeed = 0.15f
            }
            );

sentences:
How do you make top down tileable mountain ranges like fire emblem? TL;DR: my goal is to gain the knowledge necessary to make these kinds of mountains from scratch.

Hello all,

sorry if this has already been asked, and sorry for any incorrect grammar.

I've been searching hard all over for tutorials and dissecting tilemaps but i just can't figure out how to actually go about making an original tileable mountain range.

some examples of what I'm trying to figure out;

first, a fire emblem map, this is ideal for the kind of maps i want to make for a project, but it just doesn't make sense to me how it looks so damn great and is tileable.

second is the same map tiles, dissected to 16x16 tiles;

doing this helped me find that the maps are not the normal 16x16 i thought they where, only increasing my confusion as to how the original arts started making them...

and third; the same 16x16 tileset, now dissected to 8x8 tiles... now its basically to small for me to make heads or tails of it, spent a few hours trying to put them together like a puzzle, but i can only make small mountains when the tiles are... so indistinguishable to me. I'm just still having a hard time understanding how they tile to extend into large mountain ranges.

if anyone has experience or input or even tutorials, just anything, I'd really appreciate it

sentences:
Unity trigger method does nothing I have the following script on my object:

public class PlayMyCube : MonoBehaviour
{
    [SerializeField] private Animator myAnimationController;

    private void onTriggerEnter(Collider other) {
        if (other.CompareTag("Player")) {
            myAnimationController.SetBool("playSpin2", true);
        }
    }

    private void OnTriggerExit(Collider other) {
        if (other.CompareTag("Player")) {
            myAnimationController.SetBool("playSpin2", false);
        }
    }
}

When the player character is inside the first cube's trigger, my second cube should play a spinning animation. When they leave, the second cube should stop.

But what happens in the game now is, when the character runs into the trigger, it does nothing.

I have configured my trigger object like this:

I have configured the object that should spin like this:

And configured the Animation Controller like this:

And configured my Player object like this:

What can I do to make this animation play when the player is inside the trigger?

sentences:
Load scenes inactive When I call SceneManager.LoadScene() it will set the loaded scene as active.  Can I load scenes at the game startup and just call SceneManager.SetActiveScene() during gameplay?

If so, is there a way to iterate through all the scenes in the Build Settings and load them?  Mine don't have a build index assigned to them until I have called LoadScene().

sentences:
OpenGL light not shining quad I've constructed a scene using OpenGL/GLUT with a spot light but I'm getting troubles with light shining some of the walls

what is going on and how to solve?

sentences:
Collision event function not running I am recreating flappy bird as a quick project to help me understand the ins and outs of unity. However I have hit a road block. When the bird collides with the pipe or ground it is not kicking off the void onCollisionEnter2D(Collision2D target)

The Bird, the pole, and the ground are not triggers. They are all tagged correctly. Here is my code for the onCollisionEnter2D function.

    void onCollisionEnter2D(Collision2D target)
{
    Debug.Log("Entered 2D Collision");

    if (target.gameObject.tag == "Ground" || target.gameObject.tag == "Pipe")
    {
        if (isAlive)
        {
            isAlive = false;
            anim.SetTrigger("Bird Died:");
            audioSource.PlayOneShot(deadClip);
        }
    }
}

Even my debuging code is not being reached. So I am stuck as to why this function isn't being executed when the bird collides with the pole or ground. They both all have 2D collision boxes on them.

sentences:
How to load a text file from a server into iPhone game with AS3 in Adobe AIR? Im creating an iPhone game with Adobe AIR, and I want to be able to load a simple text msg into an dynamic text box on the games front screen from my server (and then be able to update that text file on the server, so it updates automatically in the game after the game is on the app store) How would I go about acheiving that? is it as simple as using a getURL? are there any specifical issues with trying to do this on the iPhone via AIR that I should be aware of?

Thanks for any advice.

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:
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:
geometry shader shim for opengl es 2.0 I just have a few months of OpenGL experience, just starting to get the hang of it.

I find geometry/vertex/fragment shaders to be very powerful. You have a few parameters that translates into a complex representation. One layer of your program can compute these parameters, the "model" only, and sharers can do the "view" part. That gives you a good separation of concerns and a lot of flexibility.

It's a pity that OpenGL ES 2 doesn't have geometry shaders. I think the CPU could totally take over this part in case the GPU doesn't support it and if proper shim libraries were present.

Is there any library that helps unfolding a model into vertexes / vertex attribute parameters / uniques, etc? Maybe one that uses the language of the geometry shaders?

sentences:
Why is my client laggy despite 60 update packets a second? I am developing a small multiplayer game with XNA. It's a usual client-server architecture -- I have a server and many clients communicating with it through UDP (via .NET's Socket class). These clients send data to the server (for example, the player's position) and the server handles it and decides what to do (send it to every other client or drop it).

What's the most efficient "correct" way to send position of moving object from a client to a server? Currently, I send the client's ID and player position 60 times a second (XNA's default update rate) while a player is moving. When I see my own player on the screen, it moves very smoothly, but other don't, despite every client having the same update rate. What am I doing wrong?

sentences:
Making a text only console game in C#. Can't figure out a way to organize states When I say states I mean like what you would call scenes in unity. As in each phase of the game. But in straight up code for a console application in C#.

Example:
Name select.
Race Select.
Store.
Help Screen.

I've tried organizing each phase by methods, and while loops, but i've run into a lot of trouble these ways. How should I do it?

sentences:
Navigating to android app settings > permission from unity I am trying to rout from my unity application to android app settings permissions. till now I achieved to rout to app settings, But i want to take 1 step more to go inside permission i mean App Settings > Permissions.

Code:

try
        {
#if UNITY_ANDROID
            using (var unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
            using (AndroidJavaObject currentActivityObject = unityClass.GetStatic<AndroidJavaObject>("currentActivity"))
            {
                string packageName = currentActivityObject.Call<string>("getPackageName");

                using (var uriClass = new AndroidJavaClass("android.net.Uri"))
                using (AndroidJavaObject uriObject = uriClass.CallStatic<AndroidJavaObject>("fromParts", "package", packageName, null))
                using (var intentObject = new AndroidJavaObject("android.content.Intent", "android.settings.APPLICATION_DETAILS_SETTINGS", uriObject))
                {
                    intentObject.Call<AndroidJavaObject>("addCategory", "android.intent.category.DEFAULT");
                    intentObject.Call<AndroidJavaObject>("setFlags", 0x10000000);
                    currentActivityObject.Call("startActivity", intentObject);
                }
            }
#endif
        }
        catch (System.Exception ex)
        {
            Debug.LogException(ex);
        }

Help if it is possible... any help is appropriated. Thank in advance.

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: Unity Loading Image? I have a quastion about loading screen in unity. I don't want to make a scene between to levels [Main Menu > Loading Scene > Game level]. I want to use Canvas "Image"that run at the start of the game level and then disappear after few seconds [Main Menu > Game level]. Is this good idea ?

sentences:
Should there be a limit to how many in game models there is for a 3d MMORPG? I was considering building a character creator/customizer program that would enable a player to create their own 3d model based off of a series of preset body parts. i.e. A player could choose to add the legs of a horse, the body of a man, wings of a falcon and the head of a snake. From there the player can then customize each body part by tweaking sliders responsible for length, thickness, color, position, etc.

Ultimately this will give players the ability to customize their characters with infinite degrees of freedom (not like preset customizations we see in some MMORPGs i.e. 8 hair cuts, 10 faces, 8 body types, etc.). So as you can imagine this would most likely lead to ever player having a different character.

Would having thousands upon thousands of separate 3d character models some how slow the game down?

I consider that it would not because the most characters that would be rendered in the game I am working on would be 25 to 50 if that.

sentences:
How to orient a layer to connect 2 points AND facing the camera here is my question, which I hope will be in general interest:

If you have got 2 Points in 3D space and want a plane to connect those, you can quite easily use a function similar to "lookAt" to orient the layer pointing with its x-axis from one point to the other. But how can you at the same time make sure the layer is rotated in the way so that the layer is facing the camera (the maximum amount possible, of course it cant be orthogonal to the camera)?
The x Axis from the resulting plane should face from the one point to the other.

sentences:
Is there a collection of images (GUI - interface) program or web page available for programmers / developers games? I would like to add a GUI in my basic XNA games.
Before starting work on "Photoshop" or "Illustrator". I wanted to ask you the following question:
Do you know of a website or other resource program offering a graphics collection ? Oriented (GUI - interface) free preference available to developers ?

sentences:
Tile map/terrain implementation with differing heights of neighbouring tiles Ahoy!

I'm looking for some information about tile maps, or rather, what a specific type of tile map is called.

I'm interested in the kind of implementation used in rollercoaster tycoon, or the transport tycoon series of games and have been looking into vector field terrain and height map terrain but i'm not sure they're suitable for what i'm looking to develop.

It's been a struggle to find any decent info as most people refer to it as an isometric tile map, but I'm looking to create something in 3D with a fixed orthographic perspective. I understand that the underlying storage of the tile map has nothing to do with how it is rendered but i'm not looking to create a 2D tile map like old school pokemon/zelda games, more along the lines of diablo with the capability to include overhanging cliffs and sloping terrain.

I'm just trying to find the right terms to search google and stackoverflow for resources to help me decide which path to proceed.

So far i've managed to flesh out a basic tile map without using the height/y component stored in a VBO and rendered as a wireframe. This looks fine so far but I envisage that I will encounter problems when trying to manipulate a single vertex to create cliffs and slopes without affecting a neighbouring tile.

Is there a specific type of implementation I should be looking into? I thought i'd cracked it when I found a fair amount if info on vector field terrain but i'm not sure this would yield the correct results either.

If anyone can shed some light on this for me please, the help would be greatly appreciated :)

Update

I've included an image for further clarification as to what i'd like to achieve:

Image borrowed from How to create tilted (height) isometric tiles

This image shows the type of terrain i'd like to generate but doesn't include the "cliffs" or overhanging terrain types i'm interested in modelling. It does however raise a few other questions I hadn't considered, namely;

How would 'layers' such as the water (top left of the image) be handled to include the visible ground underneath the water?
How would the "edges" of the map be catered for so that the earth/mud is rendered to depict the world as a non-flat entity?
Could the underlying storage for this kind of terrain be used to model physics such as a ball rolling down a hill or movement speeds of a player traversing a slope?

I had an idea in that each tile of the terrain could be modelled with 8 vertices where the 4 main vertices cover the actual tile itself and the remaining 4 vertices are used to model the sides/walls of each tile. The two problems I see with this implementation is that a) the world map is essentially doubled in size and b) given that not all tiles will include "walls", some tiles will end up with redundant vertices which are not used.

I'd like to create a terrain editor which allows for each tile to be deformed as well as including the ability to change the terrain during game play. This in itself poses additional questions such as; Can a VBO be used to store and render the terrain whilst being modified on the fly and also, is it possible to modify vertices without affecting neighbouring tiles?

I'm under the impression that i'm either over-complicating things or running into analysis-paralysis in that i'm neglecting to write any code to solve the problem without having a clear idea of how I would achieve what I want.

Again, i'm really just looking for a shove in the right direction with this. Is there a specific type of tilemap/terrain implementation that would cater for a 3D map to be deformed by both a map editor as well as during gameplay or do I have to roll my own, so to speak? I'm not trying to reinvent the wheel here but I am struggling to find any resources given that I'm not sure what to be searching for.

If anyone can provide any info, resources or snippets of code, that would be hugely appreciated as i'm eager to get my hands dirty and start producing something other than the flat wireframe I currently have.

Thanks for reading!

sentences:
DirectX 11 Problem with texture loading I am trying to load a texture into my 3d graphics application. I am having trouble with my sampler state specifically. There are no errors generated just my little popup window saying, "Texture failed to load". I did a bit of debugging and couldn't find why my sampler is having trouble loading. All of the HRESULTs return S_OK and yet it throws a popup at me.

resourceManager.h

#pragma once

#include "renderer.h"
#include <d3dx11tex.h>

class ResourceManager
{
private:
    ComPtr<ID3D11SamplerState> m_Sampler;
    ComPtr<ID3D11ShaderResourceView> m_Texture;

    Renderer m_Renderer;
public:
    ResourceManager(Renderer& renderer);

    inline ComPtr<ID3D11SamplerState> GetSampler() const { return m_Sampler; }
    inline ComPtr<ID3D11ShaderResourceView> GetTexture() const { return m_Texture; }

    bool CreateTexture(LPCWSTR file_name);
};

resourceManager.cpp

#include "resourceManager.h"

ResourceManager::ResourceManager(Renderer& renderer)
    : m_Renderer(renderer)
{

}

bool ResourceManager::CreateTexture(LPCWSTR file_name)
{
    auto handlerR = D3DX11CreateShaderResourceViewFromFile(m_Renderer.GetDevice().Get(), file_name, nullptr, nullptr, m_Texture.GetAddressOf(), nullptr);
    if (FAILED(handlerR)) return false;

    D3D11_SAMPLER_DESC sampDesc;
    ZeroMemory(&sampDesc, sizeof(sampDesc));
    sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
    sampDesc.MinLOD = 0;
    sampDesc.MaxLOD = D3D11_FLOAT32_MAX;
    auto handlerS = m_Renderer.GetDevice()->CreateSamplerState(&sampDesc, m_Sampler.GetAddressOf());
    if (FAILED(handlerS)) return false;

    return true;
}

sentences:
Trade offs of linking versus skinning geometry What are the trade offs between inherent in linking geometry to a node versus using skinned geometry?

Specifically:

What capabilities do you gain / lose from using each method?
What are the performance impacts of doing one over the other?
What are the specific situations where you would want to do one over the other?

In addition, do the answers to these questions tend to be engine specific? If so, how much?

sentences:
Separate update and render I'm programming a simple Snake in Java. I'm a complete newbie when it comes to Java and Game Developing, so please bear with me ;)

Until now, I have been using a UI thread, as well as a update-thread.
The update thread just set the position, set the GameObjects, and so on.

I didn't think much of concurrency, but now I've come to a problem.

I wanted to modify the ArrayList<GameObject>, but it throws a java.util.ConcurrentModificationException.

With a little research I found out that this happens because the two threads are trying to access the variables at the same time.

But I didn't really find a way to prevent this.
I thought about copying the array and swapping them out when the rendering is finished, but I would have to deep-copy them, which isn't really the best solution in my opinion.
It probably eats up more CPU resources than a single-threaded game.

Are there any other ways to prevent this?

Thanks a lot for your help!

sentences:
Background Sprite Setting For my 2d game, I want to set background image. So that I am using multiple background images for that purpose.

But it can't set correctly on screen that illustrated in following image.

Also for setting background correctly, I am calculating camera orthographic size based current resolution and loading that sprite dynamically.

My camera inspector setting illustrated in following image.

My basic target is to display my background image in full screen without any bar. For example, If I have resolution of 600x1024 resolution and I am loading same resolution image then it should be display in full screen.

But you see that I can't able to get this result. So please some one help me to come out of this. If you want any more detail then I will provide at any time.

sentences:
How can I implement 3D textures using webgl? I went through the google I/O video but did not get exactly how to do it. If somebody could point me to a simple 3D texture implementation using webgl, it would be helpful.

i basically have a volume, a cube, i want to fill it up with pixel data, which comes from a stack of images along the x-y axis. How do i do that?

sentences:
How can I create an extending chain like the hookshot in Zelda in Unity? In the Zelda games, there is an item called the hookshot. It is a small mechanical apparatus held in one hand that acts similar to, but not the same as the gun. When it is triggered, the hook at the tip of the item springs forward and an extending chain follows behind it. This chain is spawned when the hookshot is triggered and disappears when the hook is retracted. The chain is not visible beforehand, i.e, it is not spooled around any kind of cylinder and unspooled when shot.There are also other games where characters use grappling apparatus that can be made shorter or longer when a character is hanging from a specific point or pivot. Similarly, this grappling tether is created or hidden as needed to support whether the player wants to shorten or lengthen it.

My question is, how could one create an extending chain whose links are only visible when triggered and when retracted disappear from view? This chain does not need to necessarily interact with physics. I've thought of a couple of ways someone could create an effect like this, but I would rather see if there is a better known solution or implementation of this or a similiar effect before I dive in. Potential solutions could include:

A particle effect between the base of the hook and the tip of the gun. This might be far better suited for displaying a non-physical, energy tether, but I am not as familiar with the particle system in Unity and I am curious to see if a chain link could be faked with a particle.
Creating a chain link by link or section by section procedurally based upon the direction the hook was firing in and the distance between the positions of the gun tip and hook base. This seems like a more direct solution, but could have higher processing cost as the links are created on the fly and in rapid succession.
Creating a chain that is hidden when not fired and is made to slowly appear when fired as the hook leaves the hookshot apparatus. This seems like the most likely solution, but I have little to no idea as to how it could be implemented.

I would not be surprised at all if there is a better solution that I didn't mention. I look forward to seeing what people suggest. Thank you.

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: unity real time terrain editor im trying to make an editor for my game. but I want to know is it possible to edit terrain map heights or textures? if the answer is true, should i make it from scratch or can I use unity editor tools in real time? is there any asset for it? thank you for helping

sentences:
How to increase or decrease the speed of a gameObject after solving a puzzle? I am new to unity development and I am trying to make a script where the game player needs to solve puzzles to keep an object moving. How can I make the player increase/decrease this velocity after solving a challenge? Thanks in advance.

Edit 1

I just started with this code to control a Sphere using the arrows:

public class PlayerController : MonoBehaviour {

public float speed;

private Rigidbody rb;

void Start ()
{
    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 * speed);
}

I am thinking to try a method like velocityIncrease that will act after a condition statement like isPuzzleSolved. My intention is to handle the Sphere after getting some points during the puzzle. It will keeps the ball rolling until it reach its goal. My screen will be divided on a field where the ball stays and on the bottom of the screen I need to put an area for the puzzle solving. Thanks to reply.

sentences:
Why is the background image less smooth on the phone? I've just downloaded Gamestate code from create.msdn.com, and as you can see from the image below:

The result is less smooth then the image imported to visual studio, how do I increase the quality?

sentences:
Physics.IgnoreCollision not working right after invoked When invoking Physics.IgnoreCollision in Unity, it seems work but it still have collision detection right after creation.

I have this issue with ejecting empty case after gun fire, it's spawning position located inside of character controller(collider), so when ejecting case created, it immediately hit to my character controller and makes my character slows.

First I thought that it's coming from something else, but it's not, because when I just not spawning the empty case, it never happens.

This is the code:

GameObject ejectedCase = Instantiate(emptyCasePrefab, caseSpawnPoint.position, caseSpawnPoint.rotation);

Collider caseCollider = ejectedCase.GetComponent<Collider>();
Physics.IgnoreCollision(caseCollider, playerCollider);

Note that playerCollider is Collider. I also tried with CharacterController(because it's extended from Collider class) but result was same.

Why I said something like "it's not working right after invoked" because it's actually working after passed some time. If it's not work, character controller step on the empty case and makes camera jittering issue on vertical axis. This is totally gone after ignoring collision detection with above code, however it still works right after creation and makes my character really slow.

How do I avoid this weird glitch, makes IgnoreCollision works right after it invokes?

In addition: I don't want to fix this issue with using Layer Collision Matrix. I didn't tried but it will work sure, however I don't want to spend Layer for this purpose only, because it's number is limited and already using lots of layers in other logics so it makes game logic more complicated if I use Layer to avoid collision detection. I want to know why "Physics.IgnoreCollision" not works because literally it saids "ignore collision" but it wasn't.

sentences:
How can I avoid tons of if/else statements dealing with settings? I am creating a sudoku game using the android sdk. I have a PreferenceActivity filled with different settings, such as "Highlight all digits" or "activate the visual helper".
The problem is that I am trying to avoid using the if else pattern everywhere in my code in order to check if each settings is activated to execute a specific code.
I am looking for the best pattern that could help me to handle my different settings.
My code is pretty clear(I think), I have a Grid class containing all the grid information and a Game view, that handles inputs and interacts with the Grid class.

sentences:
Player moves in a jerky way when riding on a moving platform I have a moving platform script that travels between three positions. This works fine.

I have a script that holds the player to a platform, and this works fine too.

But when I parent my platform that holds my player to an object with the moving platform script, the player's movement is jerky and uneven.

Here are the scripts I'm using:

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

public class MovingMultipalPoint : MonoBehaviour
{

    public Vector3 pointB;
    public Vector3 pointC;
    public float Second = 5.0f;
    public float Speed = 3.0f;
    //public float HoldSecond = 5.0f;

    IEnumerator Start()
    {
        Vector3 pointA = transform.position;
        while (true)
        {
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointA, pointB, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointB, pointC, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointC, pointB, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointB, pointA, Speed));
        }
    }

    IEnumerator MoveObject(Transform thisTransform, Vector3 startPos, Vector3 endPos, float time)
    {
        float i = 0.0f;
        float rate = 1.0f / time;
        while (i < 1.0f)
        {
            i += Time.deltaTime * rate;
            //newRotation *= Quaternion.Euler(0, 90, 0);
            //transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, 20 * Time.deltaTime);
            thisTransform.position = Vector3.Lerp(startPos, endPos, i);
            yield return null;
        }
    }
}

This script holds the player to the platform.

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

public class HoldPlayer : MonoBehaviour
{
    private GameObject target = null;
    private Vector3 offset;
    void Start()
    {
        target = null;
    }
    void OnTriggerStay(Collider col)
    {
        target = col.gameObject;
        offset = target.transform.position - transform.position;
    }
    void OnTriggerExit(Collider col)
    {
        target = null;
    }
    void LateUpdate()
   {
        if (target != null)
        {
            target.transform.position = transform.position + offset;
        }
   }
}

(1st Image) Here is how the moving platform is configured in the Inspector:

(2nd Image) And the holding script:

Also here recorded video of issue

Any ideas how I can keep the movement smooth in this case?

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 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 do you repeat 2D tiles in Java code when you go out of range? I am looking up tutorials on how to make 2D games, and I can just copy and paste their code but I would rather know what it means and how to do it.

Suppose you have a 2D game window that has a map width of 64, how do you actually repeat the tiles when you go out of range when scrolling?

In this render method what line of code is actually allowing the game to repeat the tiles when you go out of range?

From the below code this line stands out to me:

int tileIndex = (xTile &(MAP_WIDTH_MASK)) + (yTile &(MAP_WIDTH_MASK))* MAP_WIDTH;

As this line gives you the X and Y coordinates of which tile you are on, it seems like the bitwise & operator is repeating the tiles, please correct me if I am wrong and also explain to me what the & operator is doing?

Code Example:

 public static final int MAP_WIDTH= 64;
 public static final int MAP_WIDTH_MASK= MAP_WIDTH - 1;
 public static final int PIXEL_SIZE= 8;
 public static final int PIXEL_SIZE_MASK= MAP_WIDTH - 1;
 public int[] tiles = new int[MAP_WIDTH*MAP_WIDTH];
 public int[] colours = new int[MAP_WIDTH*MAP_WIDTH*4];
 public int xOffset = 0;
 public int yOffset = 0;

 public void render(int[] pixels, int offset, int row) {
        for(int yTile = (0 + yOffset) >> 3; yTile<=(height + yOffset) >> 3; yTile++) {
            int yMin = (yTile * PIXEL_SIZE) - yOffset;
            int yMax = yMin + PIXEL_SIZE;
            if (yMin<0) yMin=0;
            if (yMax>height) yMax = height;
            for(int xTile = (0 + xOffset) >> 3; xTile<=(width + xOffset) >> 3; xTile++) {
                int xMin = (xTile * PIXEL_SIZE) - xOffset;
                int xMax = xMin + PIXEL_SIZE;
                if(xMin<0) xMin=0;
                if (xMax>width) xMax = width;
                int tileIndex = (xTile &(MAP_WIDTH_MASK)) + (yTile &(MAP_WIDTH_MASK))* MAP_WIDTH;
                for (int y = yMin; y < yMax; y++){
                    int sheetPixel = ((y + yOffset) & PIXEL_SIZE_MASK)*sheet.width + ((xMin + xOffset)& PIXEL_SIZE_MASK);
                    int tilePixel = offset + xMin + y * row;
                    for(int x = xMin; x< xMax; x++) {
                        int colour = tileIndex * 4 + sheet.pixels[sheetPixel++];
                        pixels[tilePixel++] = colours[colour];
                    }
                }
            }
        }
```

sentences:
3d bounding Box border xna So, I'm trying to develop a 3d table tennis game, and I'm having problems when it comes to colliding the ball with the table. I have a bounding sphere for the ball and bounding box for the table, but the intersection isn't that accurate, and I'm guessing that the bounding box is incorrect since colliding the ball with the racket is good.

I'm trying to display the bounding box so that it would be easier to see where the error is, but I cant seem to implement the tutorials I've found with my code, or just don't know how. And, I'm I right in creating an AABB since my table isn't moving? If anyone could help, it would be greatly appreciated, or if anyone could suggest a better way to collide a ball with a box (if there is) thanks. I've pasted my bounding box detection, and the collision between the sphere and box. If more code is needed I'll post it. Thanks

http://pastebin.com/NDYmhXCh

http://pastebin.com/47vwJWSc

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:
Game is darker on build I've been recently doing test builds of my game. In Unity, I worked on baking the lighting to ensure everything looked fine. However, upon building, the game level becomes far darker and much of the lighting and baking is ineffective.

Here is how the scene looks in the editor:

And here is how it looks in the built game:

It's much darker than intended.

Here are my lighting settings which I've baked in Unity's Editor. These settings and lightmap parameters were designed to, at least in the editor, provide decent quality while making light bake times relatively quick. However, I've noticed that newer Unity's Lighting settings are way different now, so perhaps something is amiss here?

I've been at my wits end trying to figure this out for the past while, but I can't figure out why this is happening or how to fix it. Any ideas?

sentences:
Unreal Engine Niagara Particle Velocity Based on Density of Particles? Goal: Simulation of particles where each particle moves to the direction with the highest density out of candidate directions.

I'm not sure how to do the following operations using UE Niagara.

How to look at the positions of other particles within a Niagara Emitter. I know how to access to the position of other emitters using event handlers.
How to read the positions of particles that are in a certain region in the 3D space (eg. within the bounding box of (0,0,0) (1,1,1)) efficiently.

Please feel free to suggest any other features within UE, but I think Niagara is the way to go.

sentences:
Drawing territories border in 2d map I'm programming a little web strategy game. In the country map I pretend to display each country with a national color. The issue is how to render the borders in a simple and efficient way. Right now I'm planning to set a field to each tile called "border" with values from 0 to 8. The algorithm would check for EVERY tile is its adjacent has a different "owner". If the tile is inside the territory, the border value would be 0, because would not have adjacent any tile with different owner, if not, would vary between 1 (north) clockwise to 9 (north-west) and then draw the border.

I find this simple but too processor-intensive. Are there any other "pro" choices to render territories borders?

sentences:
When a sprite is rotating to follow an angle, how to prevent it from reversing direction after a point? Below is a section of my code which handles a player's sprite rotating towards an angle after a user touches the screen:

touchState = TouchPanel.GetState();
Vector2 touchPosition;

if (touchState.Count > 0)
{
   touchPosition = new Vector2(touchState[0].Position.X, touchState[0].Position.Y);
   targetPosition = Math.Atan2(player.Position.X - touchPosition.X, player.Position.Y - touchPosition.Y);

if (angle_radians < targetPosition)
{
    angle_radians += 2 * fps;
}

if(angle_radians > targetPosition)
{
    angle_radians -= 2 * fps;
}

player.Angle = angle_radians * -1;
}

The problem I'm having is that when the angle goes past a certain point (I believe 3.15 radians?), the logic no longer functions correctly and the sprite reverses direction in a 360 circle until it meets the target position again.

I know there is something I'm missing from this logic, and I can see the problem, but I'm not sure how to approach handling it.

How would I prevent the sprite from reversing direction?

Thanks

EDIT: I tried the solution below but I only receive a positive number from 0-6 for angle_distance, what have I done wrong?

            if (touchState.Count > 0)
            {
                touchPosition = new Vector2(touchState[0].Position.X, touchState[0].Position.Y);
                targetPosition = Math.Atan2(player.Position.X - touchPosition.X, player.Position.Y - touchPosition.Y);
                angle_distance = targetPosition - angle_radians + Math.PI;
                angle_distance = angle_distance - Math.Floor(angle_distance / 2 / Math.PI) * 2 * Math.PI;

                if (angle_distance < 0)
                {
                    angle_radians -= 2 * fps;
                }

                if (angle_distance > 0)
                {
                    angle_radians += 2 * fps;
                }

                player.Angle = angle_radians * -1;
            }

EDIT: I now realise my mistake, correct solution is below

if (touchState.Count > 0)
                {
                    touchPosition = new Vector2(touchState[0].Position.X, touchState[0].Position.Y);
                    targetPosition = Math.Atan2(player.Position.X - touchPosition.X, player.Position.Y - touchPosition.Y);

                    angle_distance = targetPosition - angle_radians + Math.PI;
                    angle_distance = angle_distance - Math.Floor(angle_distance / 2 / Math.PI) * 2 * Math.PI;

                    if (angle_distance < Math.PI)
                    {
                        angle_radians -= 2 * fps;
                    }

                    if (angle_distance > Math.PI)
                    {
                        angle_radians += 2 * fps;
                    }

                    player.Angle = angle_radians * -1;
                }

sentences:
Global variables in a multiplayer environment I would like to know what's the best approach to solve this problem.
In a racing game, i need to create the final result chart.
In a single environment i've tought something like:

private string [] arrivalOrder;

void playerArrived(string playerName) {
   arrivalOrder[arrivalOrder.getLength()+1] = playerName;
}

I would like to know how to do in a multiplayer environment.

How the client can communicate to server "my player finishes the racing"?
Thanks

sentences:
Creating dependent values in the Unity inspector I want to create a few values which will be dependent on each other. Specifically, I want total sum of few values always be 100 In unity inspector no matter how I tweak them.

E.G.:

int total = 100;

int one = 20;
int two = 30;
int three = 45;
int four = 5;

How can I make other values adjust automatically if I tweak one of them in Unity Inspector?

sentences:
Unity2D Sprite gone / not visible when flipped using Vector3.x I have create game object with code

using UnityEngine;
using System.Collections;

public class CharacterBehaviour : MonoBehaviour {

private bool facingRight = true;
private float moveDirection = 0;
private Rigidbody2D theRigidbody2D = null;

void Start ()
{
    theRigidbody2D = GetComponent<Rigidbody2D>();
}

void Update ()
{
    moveDirection = Input.GetAxis("Horizontal");
}

void FixedUpdate()
{
    theRigidbody2D.velocity = new Vector2(moveDirection * 5, theRigidbody2D.velocity.y);

    if (moveDirection > 0 && !facingRight)
        Flip();
    else if (moveDirection < 0 && facingRight)
        Flip();

}

void Flip()
{
    facingRight = !facingRight;
    Vector3 scale = transform.localScale;
    scale.x *= -1;
    transform.localScale = scale;
}
}

and using the material as shown below

In game while not facing left / while the game object is facing right :

But while the game object is not facing right / while the game object is facing left :

*The camera is follow the game object, so that's why i surround the camera with yellow rectangle

the question is, how can i fix this ? how can i fix the sprite to not gone even facing left state, or maybe any suggestion / method to do this ?

EDIT [ HOW TO SOLVE THIS ]

From the answer below, Fuzzy Logic told me to create 2-sided mesh / rectangle, or in this case maybe the sprite, but i have a problem there, then i try to create 2-sided shader from the orignal "Legacy Shaders/Transparent/Bumped Specular" and rename to "Legacy Shaders/Transparent/Bumped Specular 2 sided" with just adding a line of code:

Cull Off

after

SubShader {
    LOD 400

If you need full of shader code, you can download it here.

sentences:
What folders can be safely deleted after building UE4 from source? What folders, if any, can be safely deleted, after building UE4 from source?
After the build, UE4 files occupy 65 GB of disk space, which is way above comfortable for me, since I only had 72 GB free.
I would like to cut the folder down to size, say at least 25 GB.
Are there any files that are not required to use the Unreal Engine with full functionality? Thanks

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: Logic behind a checkers game? I'm starting to make a checkers game and I've got all my graphics + the board drawn. Before I moved on to creating the pieces I was wondering what an easy way to tackle the logic side of the movement of pieces.. Should I make a table of every square, detecting if it has a piece and if so, what color? (i.e 0=empty, 1=red, 2=black) or do you guys have a better idea to this issue? Thanks in advance.

sentences:
How can I position different size creatures in a group automaticly I'm doing a game (in xna) on my free time, as I'm not in the game market, I'm pretty sure I'm missing something that would help me get this right.  Think of Ogre Battle. A group of unit moves, and when they cross enemy, a small automatic Final fantasy battle starts for 2 or 3 round.

I'm struggling on how I should place the creatures in the combat screen. A fight started. (final fantasy rpg battle ) The creatures part of this group needs to be positionned in a 16x16 grid. Some creatures are bigger and use larger than 1x1 square.

I create a class called group to represent groups of creature walking around. So far, I decide to put in an array of 4x4 representing the grid. How do I go around and position all the creatures on that grid and make sure they arent stepping on top of each other ?

some pseudo code I have right now :

 Class Group
  array(4,4) of rectangle
  array(4,4) of creature

  Public sub Update()
    adjustCreaturePosition
  end sub
End class

Class Creature
    CombatValue as List of Enum.Qualities
    PreferedPosition as Enum.Position
    Range as smallint( 1 = melee, 2 = small range, 3 = long range)
End Class

 Public Enum Position
  Front
  Middle
  Back
 End Enum

 Public Enum Qualities
    Melee
    Armored
    Strengh
    Dodge
    Siege
    SmallRange
    DPS
    Nuker
    Controller
    Buffer
    Dex
    Int
    Sick
    Weak
End Enum

In the update of the group class , I need to create a function to set the position of all creatures when the combat starts.

Private Sub AdjustCreaturePosition()
       ' check the "prefered position" of all creep ( front, middle, back).
       ' if there are no more spot left for a creature, I need to check which creature is moved to the middle row based on A. if one of the creature on the front row will be able to attack on middle row ( based on the range ). If no unit can attack from the middle row,  the weaker one is send on the back ( the sum of their combatValue list)
    Next
End Sub

I got no idea how I'll do the AdjustCreaturePosition in a smart way yet. but lets say it works.
Where I'm at a loss is how should I handle large creature who needs a 2x2 grid ?

sentences:
Can't get the logic behind my AABB collision This is my collision detection function in the maze game im working at. I never made a game before and I dont have that much programming experience.

The question I keep asking me continously is why this isn't working. The Solids are instances of the class Solids with rectangular shape(X(Top-left-corner),Y(Top-left-corner),width,height) which are stored in a List< T >. The function below iterates through the List and calls the second function below. checkForCollision is called every FrameUpdate.

Can somebody please help me. I'm becoming desperate :)

private void checkForCollision()
        {
            foreach (Solids wall in level1.WallObjects)
            {
                if (IsCollidedSolids(ref Pl1, wall))
                {
                    Pl1.OnCollision();
                    break;
                }
            }
        }

public bool IsCollidedSolids(ref Player Pl ,Solids act)
        {
            if (Pl.X+Pl.width >= act.X && Pl.Y >= act.Y - act.height)
                return true;
            if (Pl.X + Pl.width >= act.X && Pl.Y -Pl.height <= act.Y)
                return true;
            if (Pl.X <= act.X + act.width && Pl.Y - Pl.height <= act.Y)
                return true;
            if (Pl.X <= act.X + act.width && Pl.Y >= act.Y - act.height)
                return true;
            else
                return false;
        }

sentences:
Library for generating primitive shapes? I'm looking for a library to generate the data for primitive shapes for opengl. I have lights, and I simply wants to draw a sphere to represent the lights transform in the world

I do not want a library that draws it though, I want to control all openGL-related API calls myself (so, freeGLUT is Not what Im looking for), I simply want to generate the vertices, normals, etc for a mesh shape at runtime (a cube, sphere, etc).

Is there any nice, minimal library that can do this task? If not, what is the alghoritm for generating vertices for a sphere-shape?

Thanks

EDIT: I am not looking to load from 3d model formats either

sentences:
How to design Client-server hybrid hit detection with projectile weapons? Hybrid hit detection here refers to a architecture where client sends a hit claim to server and server verifies it with a tolerable error limit to confirm the hit or deny it.

This technique may work well with hit scan or instant hit weapons because you only have to check it for one frame/tick.
But in case its a physics projectile I.e where an actual projectile flies to the target like a real bullet,  the hit is the result of flight over more than one frames and varying physics state. As such verifying the hit could be very cumbersome and resource intensive.

So how would  one go for server client hybrid approach in this scenario?

sentences:
How to make counter unity? How do I count how many diamonds my player has collected in my 3d world
What I need to do is to make a script which will update my text ui when the player collides with a diamond but I do not know how as I auto generate the diamonds
How could I go about writing a script that will update the text score
What I tried so far, but I'm not sure where to place it. (taken from comment)
void OnTriggerEnter(Collider other) {
   if (other.CompareTag("Diamind")) {
      Debug.Log("Picking up...");
      GetComponent<Counter>().ScoreAmount += 1;
   }
}

sentences:
How many threads should an Android game use? At minimum, an OpenGL Android game has a UI thread and a Renderer thread created by GLSurfaceView.  Renderer.onDrawFrame() should be doing a minimum of work to get the higest FPS.  The physics, AI, etc. don't need to run every frame, so we can put those in another thread.  Now we have:

Renderer thread - Update animations and draw polys
Game thread - Logic & periodic physics, AI, etc. updates
UI thread - Android UI interaction only

Since you don't ever want to block the UI thread, I run one more thread for the game logic.  Maybe that's not necessary though?  Is there ever a reason to run game logic in the renderer thread?

sentences:
Loading settings files better? I have recently been working on a small game project and decided to implement settings loading at game startup. The problem is that my method seems to be too hard coded and not scalable without having a huge method:

public String loadSettings(String path) {
    String[] file = loadFileAsString(path);

    isFullscreen = Boolean.parseBoolean(file[0]);
    windowWidth = Integer.parseInt(file[1]);
    windowHeight = Integer.parseInt(file[2]);
    ...
}

As you can see, this method will get very large after a while and is at risk of crashing if someone edits the file incorrectly so what is a better way of loading this data?

sentences:
How can I add biomes to my generated world? I need a way to generate a world realistically. I want to generate worlds similar to dwarf fortress.

My current code for world generation is this:

    worldTiles = ['^',',','.','.']
    def generateWorld(self, x=40, y=20):
        world = []

        for i in range(y):
            row = []
            for z in range(x):
                row.append(random.choice(self.worldTiles))

            world.append(row)
        return world

with the worlds it generates being this:

The world is ok, however what I want is biomes, not just completly random generation.

In case it helps, heres how the current generation works:

A variable called worldTiles has alls the tiles the world can have. This is used by the function. The function, creates an array, and appends a row to it. The row is then added to the world, as another array.

A example world might be:

  [
    ['^', ',', '^'],
    ['^', ',', '.'],
    ['^', ''., '.']
  ]

sentences:
Java Game Optimizing I'm trying to optimize my game. I've got object Handler that goes trought all objects and then render and tick them. If I have lot of objects in game game lags or don't start. Could you please help me? public class Handler {

public LinkedList<GameObject> object = new LinkedList<GameObject>();

private GameObject tempObject;

private Camera cam;

public Handler(Camera cam) {
    this.cam = cam;
}

public void tick() {

    for (int i = 0; i < object.size(); i++) {
        tempObject = object.get(i);

        tempObject.tick(object);

    }

}

public void render(Graphics g) {

    for (int i = 0; i < object.size(); i++) {
        tempObject = object.get(i);

        tempObject.render(g);

    }

}

sentences:
Randomize sound in Unity 5 When I start my game, public AudioSource does not load sound but play a sound.  My code does not have any error.

using UnityEngine;
using System.Collections;

public class random: MonoBehaviour {

    public AudioClip[] gravel;

    void Update()
    {
        if (!GetComponent<AudioSource>().isPlaying){
            GetComponent<AudioSource>().PlayOneShot(gravel[Random.Range(0,gravel.Length-1)]);
        }
    }
}

How can I put my random audio to my audio source.
Video for describle my problem:
In this video play sound twice (because I run my game twice)
In first play I have to attach a file to audio source.
I do not know why my audio source is empty and I have to attach a file to it.
If I can load sound in my audio source I can fix my problem.
I want to play one randomized shot.

sentences:
Terrain & Multi-Texturing I'm using OpenGL (Version 4.4) (and C++ if that matters).

I've created a terrain renderer, the terrain is stored as a 3D scalar field (isosurface/voxels). It uses a slightly modified version of Marching Cubes, to perform polygonization (converting the scalar field to triangles).

Currently I'm texturing the terrain using a horizontal (grass) texture and a vertical (dirt) texture. Then when applying the texture I simply calculate the amount of the horizontal and vertical texture that is required on the current triangle, depending on the normals of the current triangle. Thereby the more a normal is pointing upwards (or downward) the more dominant the horizontal (grass) texture will be.

Terrain Renderer in Action

Fullscreen Image

Now the question is, what would be the best (or a good) way to perform Multi-Texturing on the terrain? I will give all the values in the scalar field a voxel type value as well. So the main question is how should the rendering be handled. I have a couple of ideas of how this could be done, but I'm not sure which of my ideas would be the best one to do or if there's even a better way.

First Idea

Bind all the needed textures, thereby call glActiveTexture(...) for each texture there is.
Now the mesh can be rendered using a single glDraw*(...) call.
This of course only works if the Shader knows when and where to use each texture, or
that the info for using each texture, is stored within the buffer, as some sort of
value which the Shader uses, to "detect" which texture should be used. As mentioned previously this could be the voxel type value.

Problem: The maximum amount of textures which can be bound simultaneously is very limited, so that could (and probably would) create some problems.

Second Idea

Bind a single texture and call glDraw*(...) with a specific first and count value, so that only a part of the mesh is rendered. Which of course is the part which uses the bound texture.
Thereby loop the above until the whole mesh is rendered using all the individual textures.

I don't see any real problem with this idea, the only extra thing we need to take in mind, is that all the triangles need to be sorted according to their voxel type value.

Though we wouldn't be able to fade the textures, like in the image above.

Third Idea

Split the mesh into individual buffers (VBOs and VAOs), so that each buffer only uses a single (or a couple) texture(s). Basically the same as the Second Idea though here the buffer would physically be split according to the textures.

Fourth Idea?

or is there an even better way?

Side Note

Each texture has it's own handle, thereby none of them can be used as a Texture Atlas.

sentences:
Convert triangles to quads of a Mesh Supposing I have applied delaunay triangulation on a convex mesh, and I have all information (edges, vertices etc.) I would like to transform the triangles to quads

I was reading that inverse process, quad to triangle, one takes the vertices like:

quad 1 2 3 4
==>
triangle 1 2 3
triangle 3 4 1

each time we read a quad (4 vertices), we transform it to 2 triangles using these 4 vertices.

What would be the best approach to do triangles to quad?

I was thinking on pairing together adjacent triangular elements, and converting them into
quadrilateral elements by eliminating their shared edges

Do you know any sample code, would be best in c#

sentences:
Switching between world and battle scene with no or minimum loading? I am making a strategy game where the player roams a grid map.
When the player encounter enemy on the map he is transferred to a "battle" scene where two armies are fighting in turn based battle.
Imagine Heroes 3 like game.
My question is:

Should I load the battle scene in additive mode and temporary hide the "world map" and when the battle is finished to just show the "world map" and hide the "battle" scene?

Or i should unload the world scene and load the battle scene, and when the battle is over -> unload the battle scene and load the world scene ?

I think the 1st approach will give me less loading time between the two scenes, but will require more RAM ?
Second approach is standard one, but i will have loading between the scenes ?
My idea is to have no or minimal loading between battle and world scenes.
What do you guys thing ? Did you know what is the best practice in this case ?
By the way, i am using Unity as a engine.

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:
What rotation needs to be applied to align mesh with expected axis of target? I'm using LWJGL and JOML to create a 3D view of hexagons whose positions lie on a torus.
I have a number (NxM) hexagons, whose centres and normals I have calculated to be placed on the torus to completely cover the torus surface, but in the "game" engine I'm using I need to convert each item being rendered to a position and 3 rotation angles. I'm struggling to go from the 3 normals of the item to the 3 angles.
EDIT: Subsequent to posting this I have got some way in creating a matrix with the angles and converting to Euler angles, everything is now turned according to those angles, but they aren't facing directions I expect.
The background
I'm trying to create a visualisation of a Conway Game of Life using hexagons but instead of a simple plane, mapping each hexagon onto a Torus.
I've done the maths to calculate the centres of every hexagon, and the 3 direction unit vectors that they need to point to, when in their places around the torus.
For illustrative purposes, here's a view of the torus and 2 hexagons that would lie on it (not real, this is just me mocking it up in Blender)

What I'm struggling to understand is how to rotate the single mesh for a hexagon to its calculated normals at the position I want to place it.
i.e. How do I rotate some "unit" hexagon mesh (loaded from an OBJ file exported from Blender) to point in the direction of the 3 normals I've calculated they should be for each hexagon around the torus.
I have read a similar question here, but I'm struggling to get from the idea of the 4d rotation matrix to how I convert that to a Vector3f for rotations. I have the 3 vector normals, could create the 4d matrix, but I need a Vector3f (the rotations about x/y/z) to the mesh is drawn correctly.
My code is here. I'm following this guide for using LWJGL to create GameItems (my hexagons) and position/rotate them from a loaded obj file mesh, but as I say, I'm struggling to calculate the rotation Vector3f needed to point in the same direction I've calculated.
Here's the code section relevant to the problem at hand:
    val mesh = loadMesh("/conwayhex/models/simple-hexagon.obj")

    hexGrid.hexAxes().forEach { (location, axis) ->
        // axis is a Matrix3f with my 3 normals at the centre of the hexagon, e.g
        // cX  cY  cZ
        //  0  -1   0
        //  0   0  -1
        //  1   0   0

        val gameItem = GameItem(mesh)
        gameItem.position = location
        gameItem.scale = 0.2f // TODO: calculate this according to the torus size

        // what rotation do I give this?
        // How do I calculate it from the given axis for the current item?
        gameItem.rotation = Vector3f(30f, 30f, 30f)

        gameItems += gameItem
    }

The output of the application given the above static 30 degree rotation is:

Can anyone help me unserstand how I apply the rotation to my items so they align to what I've calculated they should be?

sentences:
How do one NPC follow a succession of target points? I have a project that contains 1 NPC (AI) and 2 target points. In the project I can make the NPC follow any of the 2 target points, but I can not get it to follow target point 1 and then target point 2, and that is what I would like to do, so that I can make a path.

What I would like to know:

tp1 = target point 1 and tp2 = target point 2

What I can do:

In creating the variable that sets the target, I checked the box: instance editable. As you can see in the image, I can set the target in the level editor.

Blueprint of the NPC:

When I went to do the programming for him to follow the other target point (tp2) after reaching the first one (tp1), I did not get it in any way. No results appear with my search, which for me does not make any sense, because in the level editor I can easily.

Looking at the level editor / Looking at the blueprint:

I also tried using the Get All Actor of Class, but without success.

Link from where I also looked for help:

https://docs.unrealengine.com/en-us/Gameplay/HowTo/FindingActors/Blueprints

EDIT 1 (Attempt based on ColdSteel's answer)

I created a variable of type array of actor called varHelp:

As you can see, I added 2 elements to this array, but I can not edit any of the 2.

I researched a way to change this, until I got to this link:

https://answers.unrealengine.com/questions/813065/editing-this-value-in-a-class-default-object-not-a.html?sort=oldest

Unfortunately it caused an error in the code, causing me to give up for now and look for another way to solve my main problem.

Although I created 2 elements in the array, none of the elements appears in the level editor:

But I can create new elements and define them as the desired target points:

However at the time of defining them in the construction script I again error in some detail:

EDIT 2 (Another attempt, based on Stephen's answer)

With the help of Stephen I discovered how to promote a variable (right click button):

New blueprint:

But I still have not got the expected result, see below an explanation of what happens:

Red code (Simple Move) => The NPC moves toward target point 2, without first passing target point 1.

Blue code (AI MoveTo) => Nothing happens.

EDIT 3 (Attempt made thanks to the progress I made with the answers of ColdSteel and Stephen)

This time I managed to get the NPC to do the correct path, but it is not dynamic since the NPC does not go directly from target point 1 to target point 2.

New blueprint:

I know the loop executes all at once, so the value registered in the function to move the NPC was always the last.

With the creation of two Boolean variables, I was able to "circumvent the operation of the loop".

With the delay I assure you that it will allow NPC time to arrive at target point 1, only to go to target point 2.

I know that what I did is far from ideal, to have an idea I would have much more problems if there were more target points.

EDIT 4

Now I can get the NPC to go to target point 2 immediately after reaching target point 1.

I added a collision box to target point 1:

Changes in the blueprint:

Important to inform, that such a loop was not accused as infinite, since I added a collision box only to target point 1.

Now I have to know how to make a code for any amount of target points.

EDIT 5 (Finally I did it!)

For this I used the "Do N" and added an integer variable that will serve as counter.

Blueprint:

Basically, every time the NPC collides with a target point that has collision box, the loop with the "Do N" will be reset, but with the help of the integer variable that serves as a counter, the subsequent target point will be set correctly.

I do not know if this form I found is the most effective and functional. Please feel free to comment and correct me.

sentences:
Libgdx How to overlay two images on Table I'm trying to set the player image inside the circle of the bars. I've tried to use stack, to position it topLeft but it does not work.

    Stack stack = new Stack();

    healthbar = new Image(new Texture(Gdx.files.internal("data/ui/healthbar.png")));
    playerLook = new Image(player.getFrame());
    stack.add(healthbar);
    stack.add(playerLook);

    Table table = new Table();
    table.top();
    table.setFillParent(true);

    table.add(healthbar).expandX().pad(10).left();
    table.add(playerLook).expandX().pad(10).left();

    stack.add(table);
    stage.addActor(stack);

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:
Assign a ScriptableObject to MonoScript through code Sample code:

public class Item : MonoBehavior
{
    public ItemObject item; //the scriptable object

    void Start(){ // do stuff}

}

Normally I would drag and drop the asset of the ScriptableObject in the inspector.

How can I find and assign the asset (from Project View) through the script during runtime and possibly add it to a List<> or Array[]?

sentences:
What would make a good cursor movement sound effect? I know specific questions like this are very borderline on acceptable - but I am having massive trouble finding a non-annoying sound effect for moving the cursor in my game.

The game is a Fire Emblem like SRPG and think it would be cool if I could have a little sound each time the cursor ticks in a menu/selection of character/etc. - it should be a non-intrusive sound (keeping in mind I can adjust volume).

What have you guys used for something like this? Going to various free soundclip sites putting in "cursor move" isn't doing much for me.

sentences:
How can I move an object over linerenderer lines positions? I have 4 cubes the first 3 cubes connected with two lines one of the lines is curved. The fourth cube I want to move over the lines. The lines is built using linerenderer and in the linerenderer there are 397 positions. I created a small script that move an object over the positions. I checked and I have in the array 397 positions and the loop get to 397 but the object (Cube (3)) never moving all the positions only some. Or maybe the positions I get are not the same in the linerenderer ?
This screenshot show some of the positions in the linerenderer this is the positions I want the object to move on :

Why the object is not moving over all the positions , only on some ?
And this is the script I created that should move it :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveOnCurvedLine : MonoBehaviour
{
    public LineRenderer lineRenderer;
    public GameObject objectToMove;
    public float speed;

    private Vector3[] positions = new Vector3[397];
    private Vector3[] pos;
    private int index = 0;

    // Start is called before the first frame update
    void Start()
    {
        pos = GetLinePointsInWorldSpace();
    }

    Vector3[] GetLinePointsInWorldSpace()
    {
        //Get the positions which are shown in the inspector
        var numberOfPositions = lineRenderer.GetPositions(positions);
        //Iterate through all points, and transform them to world space
        for (var i = 0; i < numberOfPositions; i += 1)
        {
            positions[i] = transform.TransformPoint(positions[i]);
        }

        //the points returned are in world space
        return positions;
    }

    // Update is called once per frame
    void Update()
    {
        if(index <= pos.Length - 1)
        {
            objectToMove.transform.position += pos[index] * Time.deltaTime * speed;
            index++;
        }
    }
}

Now I checked using a breakpoint the first position in the linerender at index 0 is : X = 30.57, Y = -6.467235, Z = 4.98
But in my script in the pos array I see that in index 0 the position is :
X = 30.6, Y = -6.5, Z = 5.0
And the result is that the object that move Cube(3) is moving only some of the way and also it's not exactly on the line :

Why the object is not moving over all the positions , only on some ?
Something is wrong in my script with getting the right positions from the linerenderer and maybe also the loop and the move is wrong. I can't figure out ho to do it.

sentences:
How does the SDL dynamic API inject itself in statically linked code I've been using SDL2 for development almost since it came out. Long story short, I stumbled upon the SDL dynamic API explanation. I've looked in SDL_Dynapi.c to understand how it works. I get that the jump table can be updated with function pointers to newer versions of the functions, but what I don't get is how one would actually goes about doing that dynamically.
Did I miss a function declaration, is there some specific function to call outside the application? I have no idea how an updated dynapi loads itself.

sentences:
Can't get normals to work correctly with lighting in OpenGL I'm trying to light up a simple 2d triangle with my cursor as a diffuse light source but can't seem to set the normal correctly for the lighting to look right.  The function that calculates the normal (m3dFindNormal) comes from the OpenGL Superbible (math3d.h) which takes 3 points on a plane and determines the cross product of 2 vectors from those points.  Since this doesn't return a normal of length 1 I then call m3dNormalizeVector3 to get a normal vector of length 1.  I then set the normal for the triangle using glNormal to that vector and draw the triangle.  Using this code the triangle never lights up at all but when I comment out the glNormal call it lights up on the vertices so something must be wrong with the normal.

glShadeModel(GL_SMOOTH);
GLfloat diffuseLight[] = {0.9f, 0.9f, 0.9f, 1.0f};
glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
GLfloat lightPos[] = { x, y, 1.0f, 1.0f }; //x and y are the cursor's position
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
glEnable(GL_LIGHT0);
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glColor3f(0.75f, 0.75f, 0.75f);
glBegin(GL_TRIANGLES);
    M3DVector3f vPoints[3] = {{ SCREEN_WIDTH / 2 - 40, SCREEN_HEIGHT / 2 + 40, 0},
                              { SCREEN_WIDTH / 2 + 40, SCREEN_HEIGHT / 2 + 40, 0},
                              { SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 0}};
    m3dFindNormal(vNormal, vPoints[0], vPoints[1], vPoints[2]);
    m3dNormalizeVector3( vNormal );
    glNormal3fv(vNormal);
    glVertex3fv( vPoints[0] );
    glVertex3fv( vPoints[1] );
    glVertex3fv( vPoints[2] );
glEnd();

I know the light works because things light up when I move the cursor around but they light up at the wrong times.  Anyone know what I'm doing wrong?

sentences:
How to balance hybrid classes? In RPGs sometimes there will be hybrid-classed characters, ie, characters that can fill the roles of multiple characters. Sometimes they're really weak and useless because despite filling out many roles they're just not good enough to do it, and othertimes they're extremely overpowered because they can do the job of characters with a single dedicated role just as well, while still being able to do other jobs.

This often leads to either using those characters all the time, or avoiding using those characters because they're dead weight. Even just "fine tuning the numbers" doesn't seem to work because the weaker they get in regards to a dedicated role character the less useful they are overall, and then when buffing their numbers to make them more capable of holding their own makes a small reduction in power compared to a dedicated role character a minor tradeoff, because they're doing the roles of two characters in one spot.

Is there a way to actually make hybrid-role characters useful while still making players want to carry single-role characters too?

sentences:
What is the view perspective angle of most 2.5D isometric games I examined several quite popular games to determine what perspective angle they are using. For the purpose I created a grid that is 45 and 60 degrees isometric viewed and put it onto a screenshot (of Diablo II in this case). None of these grids fit to the game's perspective. So I tried to find the angle that fits best to the perspective and it is close to 53.5 degrees. However, this number seems like coming from nowhere and I believe there is a strong logic behind the number that defines the perspective angle. I tried 9/16 * 90 degrees and 3/4 * 90 degrees (coming from ratios of screens resolution 16:9 and 4:3) but none of my assumptions seem to be correct. Here are screenshots of what I mean:

60 degrees

45 degrees

Something between the two - 53.5 degrees - quite near to the real number

I really need to know what the real degrees are and where it derives from. Any help is quite appreciated! Thank you!

sentences:
How should I set up 2D animations for weapons in Unity? I have a character composed of several sprites (legs, torso, head, arms). The character has the ability to pick up weapons, which are of varied types.

Each type of weapon has its own animation (sprite sheet). Ideally I want the weapons not only to animate themselves, but also affect how the player is animated (e.g. lean back when swinging sword).

Here's how I'm thinking of setting it up right now:

Player has an animator controller with states for Walking, Attacking, Idle, Flinching and this controls all the body parts.

Main questions:
- How can I incorporate jumping in this?
- How can the weapon animations have control over the rest of the body?

For having different weapons I am thinking of adding different states per weapon type, but I don't think that's a great way, especially when I start adding combos.

sentences:
Do game studios hire people based on their math knowledge alone? I have very little programming skills outside of very basic levels of Java, but I have excellent math and science knowledge. I was wondering what I could offer any potential team if I were to go into video game development? Do people hire people based on their math knowledge alone?

I like to do other things such as writing or drawing, but math and science are the only skills in which I really excel in.

sentences:
How to calculate the reachable space of the end effector in an IK chain? I have an array of points in a 2d worldspace and I want to calculate which points are reachable by the end effector of a limb controlled with a CCDIK chain (with rotation limits applied).

It's a limb with 2 hinges (upper arm & lower arm)
The upper & lower arm have a fixed length
The 2 hinges have fixed rotation limits
This needs to be recalculated every update (continuously) as the limb is attached to a moving body
I work in Unity using C#

Crude Illustration of the problem:

My idea sofar is to create a polygon collider along the outer edges of the reachable space, and then look if the points are within the bounds of that collider. But I have no idea if this is the smartest solution, or if so, how to achieve this.

How could I solve this issue?

sentences:
Complexity of defense AI I have a non-released game, and currently it's only possible to play with another human being. As the game rules are made up by me, I think it would be great if new players could learn basic game play by playing against an AI opponent. I mean it's not like Tennis, where the majority knows at least the fundamental rules.

On the other hand, I'm a bit concerned that this AI implementation can be quite complex. I hope you can help me with an complexity estimation. I've tried to summarize the gameplay below. Is this defense AI very hard to do?

Basic Defense Game Play

Player Defender can move within his land, i.e. inside a random, non-convex, polygon. This land will also contain obstacles modeled as polygons, that Defender has to move around. Player Attacker has also a land, modeled as another such polygon.

Assume that Defender shall defend against Attacker. Attacker will then throw a thingy towards Defender's land. To be rewarded, Attacker wants to hit Defender's land, and Defender will want to strike away the thingy from his land before it stops to prevent Attacker from scoring.

To feint Defender, Attacker might run around within his land before the throw, and based on these attacker movements Defender shall then continuously move to the best defense position within his land.

sentences:
How do you set up PhysFS for use in a game? After my recent question on GD I've been advised to use PhysFS to pack all my game data in 1 file. So I have, and the decission wasn't light, because I've tried out every library in my answers but none contained a single good tutorial whatsoever, in fact PhysFS is the poorest documented library I've ever seen.

After attempting to set up PhysFS in my game I realized it's not as simple as adding the headers to the project, it appears something much more complicated, in fact after my first attempt to install PhysFS the compiler ran out of memory to display errors, it reached the critical count of 50 errors.

So basically what I'm asking here is: How can I set up PhysFS on my game? I'm using Code::Blocks IDE on Windows XP SP3;

sentences:
Geometry design and buffers I'm making some tests with rendering stuff and I'm wondering how to design my Geometry class. For the moment, here is how I do:

Init: Stock array with positions, array with colors, array with normals, … has attributes.
Just before rendering, if my geometry have changed, I update his vertex buffer and index buffer. To do that, I compute interleaved array here and send it to my vertex buffer.

I've made some tests with particles (10000 on iPad), the heaviest function is "Geometry::computeInterleavedArray.

How can I avoid this part? Is it better to stock geometry's data inside a single array with all data already interleaved?

sentences:
Streaming player voice (client -> server) without (minimal) noticeable voice breaking I recently started to jump into voice streaming for my RPG game, for players to communicate by a central server point. I use TCP packets to communication from client->server and from server->client(s).

What I currently do is streaming the microphone from the client (push-to-talk), send the voice data in 4096 bytes chunks, and send them to the client. However, since TCP packets take some time to send and process, as well as standard latency issues, the server forwards the packets to other clients with a certain delay (sometimes up to half a second).

How should I compensate for this delay? (What technique do you recommend?)

sentences:
How to design prefabs in Entity Component Systems In Unity (and I presume other game engines) you can create "prefabs" which are blueprints for game objects. They contain a list of components, and default values for those components. Prefabs can be instantiated many times, which is an efficient way of creating many objects of the same kind.

One feature in particular of prefabs is that you can modify an attribute on a single instance of a prefab, without modifying the prefab itself. Similarly, you can modify the prefab, which will propagate the change to all instances.

I've been working on an implementation of the Entity Component System (for a high-level description of ECS see this question: How to implement n-body in an Entity Component System), and I got stuck on how to implement prefabs efficiently in ECS. I think it's a powerful capability of EC-design, and implementing this on native ECS would be awesome.

I can come up with a few approaches:

Create archetypes, which are predefined lists of components (Unity approach). This does not let me set initial values for the components, nor override them (there is nothing to override). Easy to implement, but doesn't really do what I want it to do.
Create a "prototype" entity from which other entities are cloned, including component values. With this design I can override individual attributes, but when I update the prototype, the clones don't get updated.
Create entities with a reference to a "base" entity. When getting a component from an entity, first look in its component list, then try the base entity. This way when I update a base component, base instances change as well. To override a base component I can simply add it to the instance entity.

Of these three approaches the third approach comes closest, but I don't see a straightforward way to extend it so I can override a single attribute. How can I make this work?

sentences:
How do I leverage code and experience across alternate platforms? I continually build complex engines and libraries within a single platform and technology, to allow me to build increasingly bigger and better games. How do I continue this when development crosses into different platforms? If I switch platforms, how do I leverage past code and experiences?

Games are hard to build. Big games are even harder to build. I've decided that to be able to make big games, I need to start building smaller games, and building up an asset base of code, assets such as graphics and sounds, tools, and most importantly, game engines. I can eventually get there, one game at a time.

Let me give an analogy. To build an MMO 3D RPG, I would approach this by building and releasing small games with increasingly more features. This could entail, for example:

A simple 2D game
A tile-based game
A game with RPG elements (items, equipment, monsters, battle)
A full-fledged RPG
A 3D RPG

The problem now is if I have to change platforms or tools; I don't know how to leverage past code-bases and experience to start with a mature product.

Right now, I'm writing Silverlight (FlatRedBall) games. Let's say I stick with this for ten years, and then suddenly decide to write a PlayStation 6 game, which is in an entirely different programming language.

Granted, I have ten years of game-development experience, and ten years of professional software development experience from my day job, to back me up. I would still like some way to transplant that 2D RPG engine into the new programming language, or else leverage it, somehow.

Is this even possible? What are my options?

sentences:
How to load scene after a set delay? I have tried using IEnumerator and Invoke("method",delay_in_seconds).
My first scene is just an image with my studio name on it. I have script that will load the next scene ("Main Menu") 3 seconds after the first scene is loaded.
For this, I tried using IEnumerator and Invoke with 3 seconds delay before calling Application.LoadLevel.

However, on the device, game is launched, unity splash screen is displayed and "Main Menu" scene appears. it looks like the image scene loads while  unity splash screen is displayed and by the time unity screen is completed, the image scene has done executing.

Is there any way to ensure a scene stays on screen before loading the next scene? I could add a button that player should tap to start game. But I don't want to do that.

sentences:
How can i Zoom and Drag The Multiple Image in RelativeLayout i try but it did not see the effect for the zoom and Rotate the image                 ..Here is my code....

ima1 = (ImageView) findViewById(R.id.image);
    ima1.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            int x_cord = (int) event.getRawX();
            int y_cord = (int) event.getRawY();

            layoutParams1 = (RelativeLayout.LayoutParams) ima1
                    .getLayoutParams();
            switch (event.getActionMasked()) {
            case MotionEvent.ACTION_DOWN:
                savedMatrix.set(matrix);
                start.set(event.getX(), event.getY());
                mode = DRAG;
                lastEvent = null;
                break;

            case MotionEvent.ACTION_POINTER_DOWN:
                oldDist = spacing(event);
                if (oldDist > 10f) {
                    savedMatrix.set(matrix);
                    midPoint(mid, event);
                    mode = ZOOM;
                }
                lastEvent = new float[4];
                lastEvent[0] = event.getX(0);
                lastEvent[1] = event.getX(1);
                lastEvent[2] = event.getY(0);
                lastEvent[3] = event.getY(1);
                d = rotation(event);
                break;

            case MotionEvent.ACTION_POINTER_UP:
                mode = NONE;
                lastEvent = null;
                break;
            case MotionEvent.ACTION_MOVE:
                if (mode == ZOOM) {
                    float newDist = spacing(event);
                    if (newDist > 10f) {
                        matrix.set(savedMatrix);
                        float scale = (newDist / oldDist);
                        matrix.postScale(scale, scale, mid.x, mid.y);
                        layoutParams1.leftMargin = x_cord;
                        layoutParams1.topMargin = y_cord;
                        ima1.setLayoutParams(layoutParams1);
                        System.out.println("=== Mode Zoom = " + mode + " == " + scale ) ;
                    }

                } else if (mode == DRAG) {

                    System.out.println("==== DRAG  " + x_cord + " - "
                            + y_cord);
                    if (x_cord > windowwidth) {
                        x_cord = windowwidth;
                    }
                    if (y_cord > windowheight) {
                        y_cord = windowheight;
                    }
                    layoutParams1.leftMargin = x_cord;
                    layoutParams1.topMargin = y_cord;
                    ima1.setLayoutParams(layoutParams1);

                } else if (lastEvent != null
                        && event.getPointerCount() == 2) {
                    /*newRot = rotation(event);
                    float r = newRot - d;
                    float[] values = new float[9];
                    matrix.getValues(values);
                    float tx = values[2];
                    float ty = values[5];
                    float sx = values[0];
                    matrix.postRotate(r, mid.x, mid.y);
                    System.out.println("=== Mode Rotate = " + mode);*/
                }
                break;

            }
            ima1.setImageMatrix(matrix);
            return true;
        }
    });
}

my Layout XML file is ...

<ImageView
    android:id="@+id/image"
    android:layout_width="50sp"
    android:layout_height="50sp"
    android:clickable="true"
    android:src="@drawable/ic_launcher" >

</ImageView>

<ImageView
    android:id="@+id/image1"
    android:layout_width="50sp"
    android:layout_height="50sp"
    android:layout_x="118dip"
    android:layout_y="30dip"
    android:src="@drawable/ic_launcher" >
</ImageView>

sentences: Perspective projection matrix with a non-orthogonal near plane I'm trying to figure out a way to provide such a perspective projection matrix to a shader that the "near" plane wouldn't necessarily be orthogonal to the camera vector. More specifically, I'm basically trying to clip all vertices above a certain y-coordinate, but I don't have access to the shader programs themselves. Is there such a matrix that would throw those vertices with a y-coordinate over some specific value outside of the clip space?

sentences: Is it possible to physically locate a game console? In theory, is it possible to locate an Internet-connected console?  After all, Google Maps can find my computer's location.  Can a console connected to the Internet be found in the same or a different way?

sentences:
Is this a good way to handle different game screens? While developing my game I am often asking myself if my way of handling different game screens (MainMenu, Game, Ending, Highscore) is a good one.
I am currently using only one activity. The game loop is running in this class.
The currently active screen gets a update and paint method called from this loop like this:

while (running) {
    if (!holder.getSurface().isValid())
        continue;

    float deltaTime = (System.nanoTime() - startTime) / 1000000000.0f;
    startTime = System.nanoTime();

    if (deltaTime > 0.315) {
        deltaTime = (float) 0.315;
    }

    game.getCurrentScreen().update(deltaTime);
    game.getCurrentScreen().paint(deltaTime);

    Canvas canvas = holder.lockCanvas();
    canvas.getClipBounds(dstRect);
    canvas.drawBitmap(framebuffer, null, dstRect, null);
    holder.unlockCanvasAndPost(canvas);
}

One problem I am often facing is that the screen classes aren't activities, so I am unable to start a DialogFragment, as an example, because it needs a FragmentActivity. Since these classes are just instantiated the FragmentActivity never gets started.

If I need a dialog, I am currently just making an Activity to a custom dialog.

How would you handle a game framework? Are there any good examples out there?

sentences: How do I export Daz3D characters into an XNA format? How do I export 3D animated characters created in Daz3D studio to a format suitable for inclusion in XNA video games?  I'm looking for instructions on how to make sure weight, bones, vertices and materials are properly translated over into an XNA useable format.

sentences:
Are there any OpenGL ES 2.0 examples for JOGL? I've scoured the internet for the last few hours looking for an example of how to run even the most basic OpenGL ES 2 example using JOGL but "by Jupiter!" it has been a total fail.

I tried converting the android example from the OpenGL ES 2.0 Programming Guide examples (and at the same time looking at the WebGL example -- which worked fine) yet without any success.

Are there any examples out there?

If anyone else wants some extra help regarding this question see this thread on the official Jogamp forum.

sentences: How do I access device camera in GameMaker Studio 1.4? I've looked everywhere in the documentation for GameMaker and I didn't find anything about how to access the camera.

sentences:
Does GLSL support multitexturing? I am using LWJGL libraries to code myself a game. I want to be able to import a project from blender to my game. I have the wavefront .obj reader and it works perfectly for my needs. Although because my model uses multiple images I do not know how to set that up in my game engine. All it does is stretch the first image I send to the shaders across the entire model. Then I ran across a couple videos that makes me doubt that GLSL can support multiple images. Also, I found a couple solutions but they were depreciated because I use LWJGL 3 with slick-util 3 to load the image.

So I would first like to know, does GLSL support rendering multiple images on a single object?

If GLSL can support rendering multiple images on a single object, how would I proceed conceptually to perform this feat?

P.S. Let me know if want images or anything to better understand my question. Thank you all!

sentences:
How can I generate natural-looking tree leaves in a Minecraft-like world? I'm moving from working on 3D block-world terrain to more specific features like tree leaves and ore veins (the ore veins will likely be done with my existing Perlin noise for the terrain). One thing I'm having with is properly generate clusters of blocks (for example, leaves for trees).

I've tried looping through a radius and randomly skipping blocks so it seems more natural but this still doesn't look natural enough and also makes it based on a cube shape to start. I want some trees to have more of an overall sphere-shape to the leaves, or some to have a cone shape. I haven't really found helpful info on how to loop through coordinates of shapes other than a cube.

What technique(s) should I employ to generate natural looking clumps of tree leaf blocks?

sentences:
Why does my libGDX TextureRegion.split code not work properly? I am using scene2d in libGDX on Android as part of a game I am working on. I have a simple splash screen, which I am trying to display a single image on. The image comes from a file with two tiles in it, and I am using TextureRegion.split() to access it. My problem is, the entire image gets displayed instead of just the first tile.

Here are code snippets to illustrate what I am doing. You should be able to put this in a basic libGDX app to test it out. The image I am using is a png with dimensions of 460 width X 342, (2 tiles of 460X171). I am using the latest libGDX, as obtained from the libGDX setup tool.

What is wrong with my code?

TextureRegion[][] tiles =
    new TextureRegion(
        new Texture( Gdx.files.internal( "foo.png" ) ) )
            .split( 460, 171 );

Stage stage;
Table table;

stage = new Stage();
table = new Table();

table.setFillParent(true);
stage.addActor(table);

Texture fooTex = tiles[ 0 ][ 0 ].getTexture();

Image fooImg = new Image( fooTex );
fooImg.setPosition(
    ( Gdx.graphics.getWidth() / 2 ) - ( fooImg.getWidth() / 2 ),
    ( Gdx.graphics.getHeight() / 2 ) - ( fooImg.getHeight() / 2 ) );

stage.addActor( fooImg );

sentences:
Having the same texture data in different ID3D11Texture2D Sorry if this has been answered elsewhere - I'm rather new to DX.  My question concerns conservation of resources - specifically textures in VRAM.  I assume that upon returning from a call to CreateTexture2D, a copy of any textures data supplied has been copied elsewhere, likely VRAM.  Does DX11 have any facility for having multiple ID3D11Texture2D objects which point to the same data?

This might at first seem silly, but imagine a ID3D11Texture2D which is an array of textures.  In one material, an artist has chosen to blend three identically sized maps, saved on disk as A.dds, B.dds, and C.dds.  Then imagine they have another material which also uses three maps, but this time A.dds, B.dds, and D.dds.

The shader code knows the diffuse texture is a texture array, and also has the number of layers baked (three in each case).  I would essentially like to set up just two ID3D11Texture2D objects, one for each material, but I don't want to waste VRAM for two identical copies of A.dds and B.dds.

I could use explicit texture arrays, of course, but this reduces the number of resources available to the shader and can complicate code somewhat more than would otherwise be needed.

sentences:
How can I store tile maps as PNG images? I want to let players of my top-down game save, load and share worlds as PNG images. How do I read the colors in a PNG file or change them?

I imagine something like this:

BufferedImage mapImg = ImageLoader.loadImage(path);

// (then, later)

for(x = 0; x < mapImg.width; x++) {
    for(y = 0; y < mapImg.height; y++) {
        // Look up the color at this position
    }
}

Here is my ImageLoader class:

public class ImageLoader {

    public static BufferedImage loadImage(String path) {
            try {
                return ImageIO.read(ImageLoader.class.getResource(path));
            } catch (IOException e) {
                e.printStackTrace();
                 System.exit(1);
            }
            return null;
    }
}

sentences:
Trying to bounce a box with a plane using bullet physics I'm trying to simulate a box that bounces with a plane and I'm beginner with bullet physics. I created a plane (box) and and a box that is falling. The problem is the ball is stalled while colliding with the plane and doesn't rotate (no bouncing effect), even if the box is rotated so that it can sharply bounce with the plane. Here is my configuration.

// in update
if (m_pBoxMotionState)
    {
        btTransform transform;
        // get the world transform from our motion state
        m_pBoxMotionState->getWorldTransform(transform);

        btQuaternion quat;
        quat.setEuler(0, 290, 0); //or quat.setEulerZYX depending on the ordering you want
        transform.setRotation(quat);

        XMMATRIX world = btTransform_to_XMMATRIX(transform);
        m_Cube->Draw(world, m_Graphics.getViewMatrix(), m_Graphics.getProjectionMatrix());
    }

// Init
    m_Grid.CreateGrid(360.0f, 360.0f, 50, 50); // width*depth, 360*360
    m_Grid.SetPosition(1, -90, 1);
    m_Cube = GeometricPrimitive::CreateCube(m_Graphics.getContext(), 5.0f, false);

      m_pCollisionConfiguration = new btDefaultCollisionConfiguration();
            // create the dispatcher
            m_pDispatcher = new btCollisionDispatcher(m_pCollisionConfiguration);
            // create the broadphase
            m_pBroadphase = new btDbvtBroadphase();
            // create the constraint solver
            m_pSolver = new btSequentialImpulseConstraintSolver();
            // create the world
            m_pWorld = new btDiscreteDynamicsWorld(m_pDispatcher, m_pBroadphase, m_pSolver, m_pCollisionConfiguration);
            m_pWorld->setGravity(btVector3(0, -10, 0));

            btBoxShape* pBoxShape = new btBoxShape(btVector3(1.0f, 1.0f, 1.0f));
            // give our box an initial position of (0,0,0)
            btTransform transform;
            transform.setIdentity();
            transform.setOrigin(btVector3(0.0f, 50, 0.0f));
            pBoxShape->calculateLocalInertia(4, btVector3(0, 0, 0));
            // create a motion state
            m_pBoxMotionState = new btDefaultMotionState(transform);
            // create the rigid body construction info object, giving it a
            // mass of 1, the motion state, and the shape
            btRigidBody::btRigidBodyConstructionInfo rbInfo(4.0f, m_pBoxMotionState, pBoxShape);
            btRigidBody* pRigidBody = new btRigidBody(rbInfo);
            pGroundShape->calculateLocalInertia(0, btVector3(0, 0, 0));
            btBoxShape* pGroundShape = new btBoxShape(btVector3(360, 1,360));
            btTransform groundShapeTransform;
            groundShapeTransform.setIdentity();
            groundShapeTransform.setOrigin(btVector3(1.0f, -90.0f, 1.0f));

            // create a motion state
            m_pGroundMotionState = new btDefaultMotionState(groundShapeTransform);
            btRigidBody::btRigidBodyConstructionInfo rbGroundInfo(0, m_pGroundMotionState, pGroundShape);
            rbGroundInfo.m_friction = 1.0f;
            rbGroundInfo.m_restitution = 1.0f;
            btRigidBody* pRigidBodyGround = new btRigidBody(rbGroundInfo);

            // inform our world that we just created a new rigid body for
            // it to manage
            m_pWorld->addRigidBody(pRigidBodyGround);
            m_pWorld->addRigidBody(pRigidBody);

sentences:
Purchasing a TV show adaptation rights, how does it work? Basically, I was thinking about a game based on a TV show, just for fun, and ended up thinking "well, it's not like it can be made anyway". Or can it?

In the present situation, developing a game by myself/ourselves on my/our free time, and then using crowdfunding to purchase the rights is not that crazy, if the show is really popular... and the rights not too expensive.

Purchasing the rights of the whole show is obiously a sh!tload of money, but what about adaptation rights? What is the range of price it can be? Is it a percentage of the full rights? Does it depend on the kind of adaptation (novel vs. toy vs. game)?

ps: if it can help answer, I was thinking about a MLPFIM retro RPG. Please don't laugh at me.

sentences:
OpenGL: What to do after running glBufferData? I am interested in understanding a bit more behind how OpenGL does its memory management and what are some good practices before I start heavily coding and back myself into a corner.
The real question I have is regarding memory. I have a class called Mesh that consists of a pointer to some vertex data, a pointer to the face data, as well as the number of vertices and faces. I am familiar with one possible process that OpenGL uses to get these drawn on the screen: generate a buffer for vertices and a buffer for faces, bind them as GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER, call glBufferData to move the data to the buffers, and lastly call glDrawElements to draw them. From here I can understand how I can load several Mesh objects and draw them on screen, and I have no issue there.
My question then lies in where the memory is stored and what I should be doing in order to conserve memory. My assumption is that after the call to glBufferData, the data is copied to the GPU (or to some other register to later be copied to the GPU). Is it safe for me to delete the original Mesh object that was used with the buffer calls? In my head, the mesh data is retained inside the GPU so the data is not lost, and so long as I do not need to reload this data using OpenGL later then I won't miss this data at any point. Also in my head, this frees up RAM space for other uses, so my Mesh, in some sense, now totally lives in GPU memory and nowhere else, and I can do my drawing solely by making OpenGL calls to the correct buffers (so I obviously need to save the generated buffer IDs, but that part goes without saying).
If someone could tell me if this is correct/incorrect logic, as well as good/bad game dev practice?

sentences:
XNA - Error while rendering a texture to a 2D render target via SpriteBatch I've got this simple code that uses SpriteBatch to draw a texture onto a RenderTarget2D:

private void drawScene(GameTime g)
{
    GraphicsDevice.Clear(skyColor);
    GraphicsDevice.SetRenderTarget(targetScene);
    drawSunAndMoon();
    effect.Fog = true;
    GraphicsDevice.SetVertexBuffer(line);
    effect.MainEffect.CurrentTechnique.Passes[0].Apply();
    GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
    GraphicsDevice.SetRenderTarget(null);
    SceneTexture = targetScene;
}

private void drawPostProcessing(GameTime g)
{
    effect.SceneTexture = SceneTexture;
    GraphicsDevice.SetRenderTarget(targetBloom);
    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, null, null, null);
    {
        if (Bloom) effect.BlurEffect.CurrentTechnique.Passes[0].Apply();
        spriteBatch.Draw(
            targetScene,
            new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height),
            Color.White);
    }
    spriteBatch.End();
    BloomTexture = targetBloom;
    GraphicsDevice.SetRenderTarget(null);
}

Both methods are called from my Draw(GameTime gameTime) function. First drawScene is called, then drawPostProcessing is called.

The thing is, when I run this code I get an error on the spriteBatch.Draw call:

  The render target must not be set on the device when it is used as a texture.

I already found the solution, which is to draw the actual render target (targetScene) to the texture so it doesn't create a reference to the loaded render target.

However, to my knowledge, the only way of doing this is to write:

GraphicsDevice.SetRenderTarget(outputTarget)
SpriteBatch.Draw(inputTarget, ...)
GraphicsDevice.SetRenderTarget(null)

Which encounters the same exact problem I'm having right now.

So, the question I'm asking is: how would I render inputTarget to outputTarget without reference issues?

sentences:
Get Closest point between a Box 3D and a Point I have a point A (x, y, z),
and a Box: Center (x, y, z), Size (Width, Height)

How to get the closest point in the box from the point A ?

In Unity I can create a bound, and I can find the non-rotated position like that:

Bounds bounds = _mesh.bounds;
Vector3 closestPoint = bounds.ClosestPoint(pointA);

But then If the bound is rotated, the result is not correct.
So I have 2 options:

Find the way to rotate my closestPoint from the pivot.
Find the math formula myleft.

If someone can help ! thanks.

EDIT: here a video:
the red point is the one find with bound.ClosestPoint
the yellow point is the one find with:

Vector3 closestPointInverse = _currentTarget.InverseTransformPoint(closestPoint);

https://youtu.be/RMRRtSaJv8w

I have also tryed to do my own rotateFromPivot function:

public Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles)
    {
        return Quaternion.Euler(angles) * (point - pivot) + pivot;
    }

When I use it, I get the same result with the InverseTransformPoint method.

sentences:
Procedurally Generated Top View 2D RPG Map Generation Procedural generation is a fascinating concept and is gaining popularity in the gaming industry.  The thought of playing a game that has new content every-time the game is played is very exciting to me.

My question is how would I go about generating top view 2D maps with the appropriate transition tiles?

I know how to create top view maps with stand alone tiles. For example I can generate a procedural map with grass and trees. However I can not generate forests of different sizes and shapes. How do I know which forest sprite to put where? I'm trying to loop over the map tiles and accessing the surrounding tiles to pick which tile is the appropriate one. However wouldn't this approach lead to error in which forest tile is placed where? The computer would have to know the size of the forest and how the forest is shaped.

The problem seems too complex for me. Any ideas on how to break this problem down would be much appreciated or if you just want to talk about procedural generation I'm game for that too.

So far I've generated a forest but I'm having trouble making it look right. Here is what I have so far. https://76295db93db3812642fa5ba984c042fa81ffc37c.googledrive.com/host/0B6H3TRExU5M9eEkyd2FreHhiNlU/

sentences:
Ordering vertices of a face for correct triangle definition I'm trying to ascertain the appropriate order of vertices for the face of a mesh that is programmatically created.  Currently the face is always a quadrangle, but eventually a face can consist of any number of vertices ≥3.  What I have are the Vector3 of the vertices, the Vector3 of the normal, and the Vector3 of both up and left.  Because these faces can have any rotation, they are not guaranteed to be (and will rarely be) completely perpendicular to any of the three primary axes.

I've looked at using dot products and matrices to try to remap them to a 2D coordinate system, but I could not quite get it right, and that rotation could also be problematic for faces on the "top" and "bottom" of a mesh.

As it is, I'm trying to find a formula that would use the vertices, the normal, up, and left to (in the case of a quadrangle) start with the upper-leftmost vertex if facing it from the normal direction and work clockwise from there.  I could use the ordered vertices to properly build triangles that would suit the normal and display properly.

I'm not bad with math, per se, but vector mathematics are outside of my comfort zone, which is in part why I'm going through this exercise.

TL;DR, I have a cube which is transformed and rotated randomly in 3D world space.  I've captured each face into an object that contains the vertices, normal, up, and left direction (normal for the face, up and left as far as the GameObject itself is concerned) and want to order the vertices for triangle mapping for the mesh.

sentences:
How to do (or code) so that an array of Bullet objects can meet with an array of Zombie objects? I just started learning game development using Java.

I have created

ArrayList of class Zombie
ArrayList of class Bullet

Each of the object in the two ArrayList has a variable called rect of type Rectangle which surrounds their own graphics on screen.

My aim is to make an effect when any bullet meets any zombie.

My problem is I don't know how to do "any bullet meets any zombie."

My method: I used the rect variable to test whether both of the object have collided with each other by using the method rect.intersect(r). I'm testing every single bullet in the Bullet ArrayList to see if it has collided with any zombie in the Zombie ArrayList, which means I run through the two ArrayList completely per frame just to carry this feature out. There must be better ways..??

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 do I draw an object that I always want to appear in the same place on screen on a scrolling orthographic camera using lib gdx? So I want to make an endless scroller game and the orthographinc camera is scrolling downward so i want the character to stay with the camera. I'm not sure how to aproach this i've been looking a lot online but couldn't find anything that works. The 2 ways I thought about doing it is to either make the object scroll at the same speed as the camera or in someway draw the object on the cameras "graph". This is the first game i'm making with libgdx so any help or suggestions are appreciated. :) Thanks

This is the gamescreen:

package com.ounceoftech.mygame;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector3;

public class GameScreen implements Screen
{
 OrthographicCamera camera;
 SpriteBatch batch;
 Vector3 touch;
 ship ship;
 Game game;

 public static int ship_x = 540 - 26;

 public GameScreen(Game game)
 {
    this.game = game;
    camera = new OrthographicCamera();
    camera.setToOrtho(false, 1080, 1920);
    batch = new SpriteBatch();
    touch =new Vector3();
    ship = new ship();
 }
 @Override
 public void render(float delta)
 {
    Gdx.gl.glClearColor(255F, 255F, 0F, 1F);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.position.y -= 5;
    camera.update();
    generalUpdate(touch, camera);
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    //Rendering Code
    batch.draw(ship.image, ship_x, ship.bounds.y);
    batch.end();
 }
 public void generalUpdate(Vector3 touch, OrthographicCamera camera)
 {
    ship_x -= Gdx.input.getAccelerometerX() * 2;
    if(ship_x < 0) { ship_x = 0; }
    if(ship_x > 1027) { ship_x = 1027; }
 }
}

This is the object/player:

package com.ounceoftech.mygame;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector3;

public class ship
{
 public TextureRegion image;
 public Rectangle bounds;

 public ship()
 {
   image = Assets.spriteShip;
   bounds = new Rectangle(GameScreen.ship_x, 1600, 53, 256);
 }
}

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:
How can I attach a ball to something? I'm using Unity 2017 and am writing a game wherein you shoot a ball, and when said ball hit something (a cube for example), I want it to remain in that position that it hit.

I tried this but it didn't work:

ball.transform.localPosition = gameObject.transform.localPosition;

Something like this picture :

sentences:
Quaternian coefficient multiplication I have 2 quarternians (Q1 & Q2), I'd like to apply a coefficient to each Quaternian, where the sum of both coefficients = 1.  As far as I'm aware, multiplying a quaternian by another is equivalent to adding them together.

In linear mathematics, this would as simple as:

AC + B(1-C) = Y

and

A.C = S, B*(1-C) = T

so

S + T = Y

I would be lerping C from 0 to 1.  Q1 is dynamic, while Q2 is a fixed target, so for this reason, I don't think Quarternian.Lerp is a practical solution.

How do I mutliply a quaternian by a coefficient, as Q1 * Q1 is equivalent to adding them together, which would be suitable for calculating the final product, ie S+T.

I'm unsure how to go about this.

sentences: Having Your Own Copyrighted App Automatically After Publishing I have a question regarding for the game app and in business. You see, I decided to publish an app to Google Play. When I published it, does this app automatically declared that this app is copyrighted or copyright protected by the publisher and creator like me itself or not? If not, does it have to seek something or required to register this app for copyright authentication via online or at office or not?

sentences:
Taking a 2D slice of a 3D volume I have a regular 3D polygon and I'd like to display 2D slices of it.

What is the best way to achieve this? (Preferrably in OpenGL, but a general algorithm/tecnique would be good as well).

I've already tried by using a camera with narrow z-near/z-far values, but that doesn't seem like a good solution. I don't know if this could be implemented with a custom shader.

Edit: An example of what I'd like to do:

Kind of the opposite of what is commonly known as 'Volume Rendering'.

Here's an older example: http://answers.unity3d.com/questions/941826/2d-slice-from-a-3d-cross-section-slice.html

sentences:
Unity C# - Modifying eulerAngles with slider issues I'm using a slider to rotate an object on the z axis. The slider has a value of 1-360 (Whole Numbers); when the slider is moved, I use that value for the eulerAngles z axis value. (NOTE: The object is part of a child/parent 'string' of instantiated objects and it should only ever rotate on the local z axis). This method is working for some objects in the 'string', but not others. When it's not working, the object I'm trying to rotate spins wildly on the z axis because the objects z value is not a reflection of the slider value (I tested this in the inspector). I can't figure where these 'random' slider values are coming from.

Here is the rotation function I'm using for the sliders On Value Change event:

 public void SliderRotate () {
     Target.transform.eulerAngles = new Vector3(
         Target.transform.eulerAngles.x,
         Target.transform.eulerAngles.y,
         mySlider.GetComponent<Slider> ().value);
 }

BTW - If I change the x and y values to zero, the problem goes away. However, the objects then loose their correct orientation to their parent (I need the x and y to stay where they are).

Thanks in advance for any insight you can offer into this issue.

Windows - Unity 5.3.5f1

Here is an image that might help clarify:

sentences:
How can I create a line that joins two dots? I have four dots and I want to create a line by joining 2 dots horizontally and vertically only. How can I achieve this with flutter?

Here is my code:

import 'package:flutter/material.dart';

class Grid4 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Container(
        padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10),
        color: Colors.orange,
        child: GridView.builder(
          itemCount: 25,
          itemBuilder: (context, index) =>
              Container(decoration: BoxDecoration(
                  color: Colors.white70, shape: BoxShape.circle)),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 5,
            mainAxisSpacing: 40,
            crossAxisSpacing: 50,
          ),
        ),
      ),
    );
  }
}

````

sentences:
Tracking how many people play my Unity game in which language? In my game the user can change the language of the game and I'd like to know how many people play it in English, German, etc.
I'm using Unity, so possibly I would like to implement in Unity Analytics.
I was thinking about adding segments for the languages, but in that case if a user tries all languages, the user will appear in all languages' segments. So it won't really provide that much info.
A possible solution:

When the user changes language, we signal a database to decrease the old language's counter and increase the new language's counter.

But there must be an easier, built-in solution than this.

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:
How can I calculate DeltaTime in seconds? Here is how I've been trying to implement delta time based on different internet resources.

var startTime:Number = getTimer();
game.Update(deltaTime);
deltaTime = Number(getTimer() - startTime) * 0.001;

My issue with this is it doesn't seem to be giving me accurate timing. The main update shows the frame time at 0.001 and when reinitializing the level it goes to 0.002. I'm using dt else where for a timer and later on time based physics so I would like it to work as expected. I must be missing something silly.

sentences:
Why the transform.localPosition never equal to the begin position of the transform? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveScrollView : MonoBehaviour
{
    float seconds;
    Vector3 begin;
    Vector3 end;
    Vector3 difference;

    public static bool go = false;
    public static bool goBack = false;
    public static bool atOriginPos = false;

    void Start()
    {
        seconds = 0.5f;

        begin = transform.localPosition;
        end = new Vector3(0, -1, 0);
        difference = end - begin;
    }

    void Update()
    {
        if (go)
        {
            if (transform.localPosition.x < end.x)
            {
                var mx = transform.localPosition.x;
                transform.localPosition = new Vector3(mx += seconds * Time.unscaledTime, -1, 0);
                difference = end + transform.localPosition;
            }
        }

        if(goBack)
        {
            if (transform.localPosition.x > begin.x)
            {
                var mx = transform.localPosition.x;
                transform.localPosition = new Vector3(mx -= seconds * Time.unscaledTime, -1, 0);
                difference = end - transform.localPosition;
            }
        }

        if(transform.localPosition == begin && goBack)
        {
            atOriginPos = true;
        }
    }
}

At the Start the begin position is (-540.0, -1.0, 0.0) also the transform.localPosition is at the same position.
Then at this line 39 :
if (transform.localPosition.x > begin.x)

The value of the x of the transform.localPosition is 3.039021 and the x of the begin is -540
So it's getting inside and move the transform.
Then when the transform has finished moving I see on this line :
if (transform.localPosition.x > begin.x)

The transform.localPosition x value is -540.7267 and the x value of the begin is still -540
So now it will not get inside and will not move the transform anymore.
But two wrong things happened :

The transform stopped moving but it didn't move to it's original position only close to it.

Because it didn't move to it's exact original position then the localPosition x and the begin x are never equal so the this will never be true :
if(transform.localPosition == begin && goBack)

And the flag atOriginPos is never true.
I want the transform to move back to it's original position and then when it's reached the original position set the flag atOriginPos to true.

sentences:
Fastest way to create a simple particle effect I am looking to the fastest way to create really simple particle effect that will be spammed like hell on the game...

Basically, my game looks like a vectrex game, made mostly of lines... I want to make some small explosions that will be really common.

There are something faster than just moving around some points and rendering with GL_Point?

sentences:
Sphere UV mapping. Texture Streched I am trying to write a sphere mesh algorithm. Unfortunately, is the texture stretched vertically at the very end of the image. This should be near U 0.99~.

Below is the code used for the sphere creation. In the Image below that you can see a sphere created by Maya with the correct textures applied to it. Therefore, the issue is defiantly the UV map created by this code.

If I increase the number of parallels that are wrongly called meridians. Then the texture looks nearly spot on, but one thin line of garbage.

Hope someone sees the issue. I worked on it for 2 days now :(
There is a live version online for a closed examination of the object.
https://upmkuhn.github.io/AGAV/AGAV/

Btw what is the correct terminology for such an issue?

function makeSphere(radius, numParallels, numMeridians)
{
    var index = 0;
    var grid = [];
    var vertecies = [];
    var normals = [];
    var texture = [];
    var faces = [];

    for (var p = -1; p < numParallels; p++)
    {
        var row = [];
        var parallel = Math.PI * (p +1) / numParallels
        for (var m = -1; m < numMeridians; m++) {
            var meridian = 2.0 * Math.PI * m / numMeridians
            var cartesian = sphericalToCartesian(radius, meridian, parallel);
            var vec3xyz = vec3.create(cartesian);
            vertecies.push(cartesian);

            //NORMALS
            vec3.normalize(vec3xyz, vec3xyz);
            normals.push(vec3xyz);

            x = vec3xyz[0] == 0 ? 0 : vec3xyz[0];
            y = vec3xyz[1] == 0 ? 0 : vec3xyz[1];
            z = vec3xyz[2] == 0 ? 0 : vec3xyz[2];
            //UV
            var u = (Math.atan2(x, z) / (2 * Math.PI) + 0.5);
            var v = y * 0.5 + 0.5;

            texture.push(u,v);
            row.push(index++);
        }
        grid.push(row);
    }

    for (var i = 0; i < texture.length;i+=2)
    {
        var u = texture[i];
        var v = texture[i+1];
        if (Math.abs(u-v) < 0.5)
        {
        }
    }

    for (var p = 0; p < (numParallels ); p++) {
        for (var m = 0; m < numMeridians; m++) {

            if (m < numMeridians) {
                var p1 = grid[p][m];
                var p2 = grid[p + 1][m];
                var p3 = grid[p][m + 1];
                faces.push(p1, p3, p2, grid[p + 1][m + 1]);
            }
        }
    }

    return {
        vertecies: vertecies,
        normals: normals,
        texture: texture,
        faces: faces
    }
}

function sphericalToCartesian(radius, azimuth, elevation)
{
    var x = radius * Math.sin(elevation) * Math.cos(azimuth)
    var y = radius * Math.sin(elevation) * Math.sin(azimuth)
    var z = radius * Math.cos(elevation)
    return [x , y , z];
}

sentences:
What is the difference between cudaExternalMemoryHandleTypeD3D12Resource and cudaExternalMemoryHandleTypeD3D12Heap? When we import a D3D12 memory object into cuda we do something like this:

cudaExternalMemoryHandleDesc cuExtmemHandleDesc{};
cuExtmemHandleDesc.type = cudaExternalMemoryHandleTypeD3D12Resource; //here
//...
CheckCudaErrors(cudaImportExternalMemory(&m_externalMemory, &cuExtmemHandleDesc));

What is the difference between cudaExternalMemoryHandleTypeD3D12Resource and cudaExternalMemoryHandleTypeD3D12Heap? When should I use one or the other when importing memory object?

sentences:
Which input event is suitable for this game? I am trying to clone this game:

http://www.ferryhalim.com/orisinal/g3/bells.htm

As i am using libgdx, so the game is both for Android and PC. I was wondering which input event would fit in nicely. SA you can see, bunny moves in accordance with the position of cursor. There is no cursor in android so i will have to do something different. Any help would be appreciated. Thanks in advance.

sentences:
Hit Detection When rotating the camera This bug/feature has been plaguing me for a while and i want to know the best way to fix it.
I'm testing simple hit detection with a wall, like:

 if (Forward button)
        if(Inv.w.z < -49 || Inv.w.z > 49)
            pos.z = 0.0f;
        else if(Inv.w.x < -49 || Inv.w.x > 49)
            pos.z = 0.0f;
        else
            pos.z = +1.0f;

where Inv.w. is the camera positions.
Now obviously when i now hit that certain point i can no longer move away from the wall or anywhere in fact. How can i change this code to allow for the camera to be turned away from the wall so therefore i should be allowed to move?

for example, the player hits the wall and i cant move until i turn around or to the side?

I know its something to do with velocity but im pretty new to this so please bare with me if this is easy.

sentences:
Resolving penentration after collision using Separating Axis Thereom I implemented collision detection in my game using SAT. The detection works, but I'm trying to use the algorithm to figure out the penetration vector of the two OBBs and push them apart (before doing the 'actual' collision handling).

I think I got the penetration vector successfully. However I'm not sure which of the two entities in the collision to apply it on (i.e. add to the position of which entity).

If I apply it on both entities, obviously nothing happens. How can I know to the position which entity I need to add the penetration vector so the entities 'touch' at the exact point of collision?

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:
Isometric map (2D) - Click detection - Mouse mapping - How to implement it? I'm building an isometric engine.

I use TILE_SIZE * TILE_SIZE (minecraft like) tiles.
(I'm using 64 * 64 tiles but I can change the number when I want)

I can access for each tiles to this informations :

 - OFFSET_LEFT(same for every tile on a layer)
 - OFFSET_TOP(same for every tile on a layer)

 - x (classic 2D tiled coordinates)
 - y(//)

 - isometric i

 - isometric j

Tile are drawed at (i * TILE_SIZE, j * TILE_SIZE)
I use the following formula to get from x to i and y to j :

int i = (x - y) / 2,
    j = (x + y) / 4;

No problem for displaying, I got my diamond shape :

I try to find a formula to convert my cursor coordinates into those isometrics ones(i, j) with the following questions in mind I wrote on the screenshot.

After doing i * TILE_SIZE, etc... Finding a way to handle offsets(??????)...

I'm gonna render this off-screen :

And banzai, tile detection with some getPixel()...

But to do that, I have to resolve the problems I highlighted with the balise  in the following topic.

Final purpose : get the tile index in my tile array(wich I suppose I can have with i + j ?)

I'm without a clue for days, reading a lot of topic, but some of them sprout some chinese like sqrt(what the... is this creature ?) or matrix transform ????

So even with all the topic on the subject here, I was unable to find a proper solution fulfilling my project's need. Thanks for reading me; ask me if I missed some informations.

EDIT :
About the link you gave :

int i = y / tile_size + x / (2 * tile_size),
j = y / tile_size - x / (4 * tile_size);

This one give some 'good results'(I don't really know if it's working but the numbers seem rights) but I can't handle :

- offsets
- when I click outside the map

sentences:
Learning math from the basic to become a game programmer Hi i want to become a game developer. Im currently doing some web programming. I want to learn
game programming. Im not good in math thats why i decided to learn from basic math to be sure i will not missed
some important concepts. Do you have some advice if my way of learning is ok. thanks.

sentences:
How to arrange child objects in a grid i have a gameobject that have a group of plane meshes that created randomly as child every one of this planes have a "2f" offset in x axis between every plane

what i wanna do is i wanna make the parent object arrangement the child objects on rows and columns even if one of this child deleted during the game or added so if i have 8 planes mesh it should look like that 2 rows and 4 columns like that but i don't know how to do that ?

i know how to get child objects and making offset but i do't know how to get the format like that in the image

i wanna to arrangement the planes meshes that i can acces from this for loop

 void Update(){
          Transform[] children = new Transform[transform.childCount];

                 //Debug.Log(transform.childCount);
                     for (int i=0; i<transform.childCount; i++) {
                         children[i]=transform.GetChild(i);

                     }
      }

sentences:
Libgdx shaperender within a circle as limitter I encountered a problem, where my small entities would be rendered
out of the bounds of my radar.

At the time I solved it like this: ensure, that the object would be within the circle, but, that's not optimal, because I need variable scale for different entitie sizes, which causes further problems to be solved.

So is there a way, that I can do the following:

  draw all items within the circle and ensure that nothing is drawn outside

I thought about something, like a circle canvas, which draws all, but displays only that, which is in the bounds.

The points and lines within the circle are of a variable width / height.
I'd prefer to draw everything, and cut the other stuff off.

Thanks in advance!

€dit: Gosh forgot an important thing: I draw the items with a shaperenderer, and all things are rect's , and it probably wont be polygons

sentences:
What is the recommended library for using Lua from C++? I am currently planning how to integrate Lua scripting in my 2D Game Engine, and i would like to go straight to the most adequate solution for having C++ classes and objects exposed.

I've read this (if it helps you help): http://lua-users.org/wiki/BindingCodeToLua

If you have a better scripting language to recomend, go for it ;D

All help is welcome, i need to pickup the best solution to start implementing
Thanks

sentences:
Unity 5.5.1f1 new UI system: Button in scrollview is not working on Android. Is this known issue? Is there a workaround? It works perfectly in the editor, but on Android it only sometimes registers an OnClick when I press it with my finger.

I'm on Unity 5.5.1f1

Is this a known issue? I'll post some videos of it if no-one has seen this before.

The scrollview is based on the default one from the Create\UI\scrollview menu
Ive added a vertical layout group to it, to which I add prefabs that contain buttons. These are the buttons that are not working.
The canvas is in front of the camera in worldspace and is scaled down to 0.02 in X and Y

VVVVVVVVVVV  UPDATE VVVVVVVVVVVVV

I wrote my own workaround using 2D colliders instead of buttons
The colliders are registering hits just fine.
But when I wrote a class to not register hits if the scrollview moves, I get similar behaviour!
Heres the crude little workaround class I wrote..

public class ScrollButton : MonoBehaviour
{
    public StoreItem Item;

    bool FingerDownOnMe;

    public void BeOnClicked()
    {
        VisualDebuggerRef.SetTxt("a store button" + " " + Random.Range(0, 10000));
        FingerDownOnMe = true;
    }

    // This is called on all these objects whenever the scrollview moves
    public void ScrollviewMoved()
    {
        FingerDownOnMe = false;
    }

    void Update()
    {
        // 'UppedthisFrame' will be true whenever any touchs phase == TouchPhase.Ended
        if (Refs.man.Clickdetect.UppedthisFrame && FingerDownOnMe)
        {
            FingerDownOnMe = false;
            Item.ButtonHit();
        }
    }
}

I'm guessing Unities UI classes work in a somewhat similar way to my workaround one. The problem is that the scrollview is registering as being moved when it should not be. This may be because of my test device which is an S7. Maybe the touch resolution is so high it is registering movement that is smaller than one pixel??

Also maybe the fact the the entire canvas has been scaled down could be affecting this? Say Unities classes have a distance threshold, if they are not taking into account scale then working on a scaled down canvas might make the distances they are using too big, so the threshold is reached too easily

Im going to add a distance limit to my workaround...

VVVVVVVVVVVVV UPDATE2 VVVVVVVVVVVVVVVV

This workaround code using colliders works perfectly..

public class ScrollButton : MonoBehaviour
{
    const float scrollThreshold = 0.25f;

    public StoreItem Item;

    bool FingerDownOnMe;
    Vector3 HitPos;

    public void BeOnClicked()
    {
        //VisualDebuggerRef.SetTxt("a store button" + " " + Random.Range(0, 10000));
        FingerDownOnMe = true;
        HitPos = transform.position;
    }

    void Update()
    {
        // 'UppedthisFrame' will be true whenever any touchs phase == TouchPhase.Ended
        if (Refs.man.Clickdetect.UppedthisFrame)
        {
            if (FingerDownOnMe && Mathf.Abs((transform.position - HitPos).y) < scrollThreshold) Item.ButtonHit();

            FingerDownOnMe = false;
        }
    }
}

I'm going to report this issue as a bug to Unity

sentences:
Good ways to implement cutscenes in 2d RPG I want to know of some different ways to implement cutscenes in a 2D RPG game with SDL2 and C++.

My current idea is creating different functions in different files for different cutscenes and running them whenever I need to show a cutscene.

However, this doesn't seem like a very easy or simple way to render cutscenes. How would I effeciently implement cutscenes?

sentences:
Camera roll has no effect Consider my following (abstracted) C# w/ SharpDX code:

class Game
{
    Camera _camera = new Camera();

    private void Window_KeyDown(object sender, KeyEventArgs e)
    {
        // Roll
        if (e.KeyCode == Keys.Home)
        {
            _camera.TurnRoll(-0.05f);
        }
        else if (e.KeyCode == Keys.End)
        {
            _camera.TurnRoll(0.05f);
        }
        // Other rotation / movement works...
    }
}

class Camera
{
    private Vector3 _position;
    private Vector3 _rotation;
    private Vector3 _right;
    private Vector3 _up;
    private Vector3 _forward;
    private Matrix  _view;

    public Camera()
    {
        _right = Vector3.Right;
        _up = Vector3.Up;
        _forward = Vector3.ForwardLH;
        UpdateViewMatrix();
    }

    public void TurnRoll(float roll)
    {
        // Relative rotation
        _rotation.Z += roll;
        UpdateViewMatrix();
    }

    private void UpdateViewMatrix()
    {
        Matrix cameraRotationMatrix = Matrix.RotationYawPitchRoll(_rotation.Y, _rotation.X, _rotation.Z);
        Vector3 cameraTarget = Vector3.TransformCoordinate(Vector3.ForwardLH, cameraRotationMatrix);
        cameraTarget = cameraTarget.Normalize();
        cameraTarget += _position;

        // I bet the problem lies in and/or after this line
        Matrix rotateYTempMatrix = Matrix.RotationY(_rotation.Y);

        _right   = Vector3.TransformCoordinate(Vector3.Right,     rotateYTempMatrix);
        _up      = Vector3.TransformCoordinate(Vector3.Up,        rotateYTempMatrix);
        _forward = Vector3.TransformCoordinate(Vector3.ForwardLH, rotateYTempMatrix);

        _view = Matrix.LookAtLH(_position, cameraTarget, _up);
    }
}

My problem: Even when pressing the Home and End keys, the camera roll visibly stays untouched. I have trouble correcting my UpdateViewMatrix function, and I bet that the error is in there. I'm a bit lost with the maths here and my tries to use another rotation matrix to update the _up vector all failed or created other problems.

Can anybody clear my math mind up and help me correct this method?

EDIT: Solved with the help of winged's answer below. I edited the code to be

private void UpdateViewMatrix()
{
    Matrix rotation = Matrix.RotationYawPitchRoll(_rotation.Y, _rotation.X, _rotation.Z);

    _forward = Vector3.TransformCoordinate(Vector3.ForwardLH, rotation);
    _forward += _position;

    _up = Vector3.TransformCoordinate(Vector3.Up, rotation);

    _view = Matrix.LookAtLH(_position, _forward, _up);
}

However, this is still not completely correct. The camera rolls now, which solves this question. But if it is rolled and I try to yaw it, the yaw happens like as if the camera is non-rolled and moves along the default Y-axis :/. Especially when looking downwards 90 degrees this causes something like gimble-lock to happen (or IS it gimble lock?) because rolling and yawing the camera has the same effect then.

EDIT2: I completely replaced my rotation with quaternions. I don't know why people think these are "harder" or at least "different" to understand. This solution works perfectly.

public void Turn(Vector3 turning)
{
    // Relative rotation
    Quaternion delta = Quaternion.RotationYawPitchRoll(-turning.Y, -turning.X, -turning.Z);
    _rotation = delta * _rotation;
    _rotation.Normalize();
    UpdateViewMatrix();
}

public void TurnRoll(float roll)
{
    Turn(new Vector3(0, 0, roll));
}

private void UpdateViewMatrix()
{
    Matrix view = Matrix.RotationQuaternion(_rotation);
    Matrix translation = Matrix.Translation(-_position.X, -_position.Y, -_position.Z);
    _view = translation * view;
}

sentences:
Box2d Raycast C++. Always returning false? (trying to check if player is grounded) I'm trying to add Box2d to my C++/SFML platformer game. I have my ground tiles with a b2staticBody. And the player character is b2_dynamicBody.

My usual method to check if player is grounded is to Raycast straight down from centre of sprite to just below the foot level. (NOTE: I do note that SFML is y-down).

For now, I just want the raycast to return true if it hits anything. But it always returns false. I watch the player land on the ground and can walk along the floor and fall off it (ie. The built-in box2d collision is working)

Here is my code (I am brand new to using Box2d in c++, so sorry if it's wrong. There aren't too many good examples to be found online)

void guy::update() {
bool bGrounded = false;
b2RayCastOutput output;
b2RayCastInput input;
input.p1 = bodyPtr->GetPosition();
input.p2 = bodyPtr->GetPosition() + b2Vec2(0, 1.f * Constants::PPU);
input.maxFraction = 1.0f;
b2Fixture* fixture = bodyPtr->GetFixtureList();
std::cout << "p1: " << input.p1.x << " , " << input.p1.y << " / p2: " << input.p2.x << " , " << input.p2.y << std::endl;
std::cout << "sprite pos: " << sprite.getPosition().x << " , " << sprite.getPosition().y << std::endl;
if (fixture->RayCast(&output, input, 0))
{
    bGrounded = true;
}
else
{
    bGrounded = false;
}
std::cout << "isGrounded: " << bGrounded << std::endl;
}

The console outputs seem ok (ie. p1 and p2 are where I expected them to be), but the bool always returns 0.

Of course I am very open to an improved jumping function. Eventually I want to be able to add the ability to hold the jump button for some time to get a bigger jump. But the only way I can think to start with is checking if the player is touching ground first.

NOTE: Here is the ground Tiles start function (at the bottom you see i CreateFixture():

void Tile::start(size_t x, size_t y, sf::Texture& texture, bool isSolid, b2World* world)
{
worldPtr = world;
bIsSolid = isSolid;
sprite.setTexture(texture, true);
sprite.setOrigin(sprite.getTextureRect().width / 2.f, sprite.getTextureRect().height / 2.f);
sprite.setPosition((float)x * Constants::PPU, (float)y * Constants::PPU);

if (isSolid)
{
    bodyDef.position.Set(sprite.getPosition().x, sprite.getPosition().y
    );
    bodyPtr = worldPtr->CreateBody(&bodyDef);
    b2Vec2 topEdge(-1, 0);

    box.SetAsBox(sprite.getTextureRect().width / 2.f, sprite.getTextureRect().height / 2.f);

    bodyPtr->CreateFixture(&box, 0.f);

}

}

Here is the player start() in case it will help:

void Guy::start(b2World* world)
{
worldPtr = world;
texture.loadFromFile("Textures/guy.png");
sprite.setTexture(texture, true);
sprite.setOrigin(sprite.getTextureRect().width / 2.f, sprite.getTextureRect().height / 2.f);
setPosition(4 * Constants::PPU, 10 * Constants::PPU);

bodyDef.type = b2_dynamicBody;
bodyDef.position.Set(sprite.getPosition().x, sprite.getPosition().y); // TODO: Does this need to be offset?
bodyPtr = worldPtr->CreateBody(&bodyDef);

box.SetAsBox(sprite.getTextureRect().width / 2.f, sprite.getTextureRect().height / 2.f);

fixtureDef.shape = &box;
fixtureDef.density = 65.0f; // TODO Magic numbers
fixtureDef.friction = 0.05f;

bodyPtr->CreateFixture(&fixtureDef);
bodyPtr->SetFixedRotation(true);

}

sentences:
Writing Logic behind card games I'm not a dev noob, but definitely never done anything in game dev. There is a trump based card game we play in town that I plan on coding. I'll be either using python/ajax/pyqt or c++/qt.

My question is as follow, what kind of advice would you give to writing card based games?

sentences:
Raycasting - weird lines on walls when ray is facing up or right I am trying to make a raycasting game. Everything is rendered correctly except when the ray is facing up (angle > PI) or facing right(angle > 0.5PI and < 1.5PI) lines are drawn on walls. I am not sure what is causing it to happen but I know that the lines are not affected by the rotation of the player only by the players position. I also tried rounding the rays position but that did not help.
Right and up ray walls.

The walls up close.

Left and down ray walls.

Code:
        let rayX, rayY, rayAngle, rayDeltaX, rayDeltaY

        for (let i = 0; i < this.screen.width; i ++) {
            rayAngle = this.angle - this.fov / 2 + i * (this.fov / this.screen.width)

            if (rayAngle < 0) {
                rayAngle += Math.PI * 2
            }
            else if (rayAngle > Math.PI * 2) {
                rayAngle -= Math.PI * 2
            }

            rayX = this.x
            rayY = this.y

            let stepY

            if (rayAngle > Math.PI) {
                stepY = -this.tileSize
                rayY = Math.floor(rayY / this.tileSize) * this.tileSize - 1
            }
            else {
                stepY = this.tileSize
                rayY = Math.floor(rayY / this.tileSize) * this.tileSize + this.tileSize
            }

            rayX = this.x  + (rayY - this.y) / Math.tan(rayAngle)

            rayDeltaY = stepY
            rayDeltaX = stepY / Math.tan(rayAngle)

            while(true) {
                if (this.Map.map[Math.floor(rayY / this.tileSize) * this.Map.width + Math.floor(rayX / this.tileSize)] == '#') {
                    break
                }

                rayX += rayDeltaX
                rayY += rayDeltaY
            }

            let rayHorizontalX = rayX
            let rayHorizontalY = rayY
            let rayDistanceHorizontal = Math.sqrt((this.x - rayHorizontalX) ** 2 + (this.y - rayHorizontalY) ** 2)

            rayX = this.x
            rayY = this.y

            let stepX

            if (rayAngle > 0.5 * Math.PI && rayAngle < 1.5 * Math.PI) {
                stepX = -this.tileSize
                rayX = Math.floor(rayX / this.tileSize) * this.tileSize - 1
            }
            else {
                stepX = this.tileSize
                rayX = Math.floor(rayX / this.tileSize) * this.tileSize + this.tileSize
            }

            rayY = this.y + (rayX - this.x) * Math.tan(rayAngle)

            rayDeltaY = stepX * Math.tan(rayAngle)
            rayDeltaX = stepX

            while(true) {
                if (this.Map.map[Math.floor(rayY / this.tileSize) * this.Map.width + Math.floor(rayX / this.tileSize)] == '#') {
                    break
                }

                rayX += rayDeltaX
                rayY += rayDeltaY
            }

            let rayVerticalX = rayX
            let rayVerticalY = rayY
            let rayDistanceVertical = Math.sqrt((this.x - rayVerticalX) ** 2 + (this.y - rayVerticalY) ** 2)

            let rayFinalDistance

            if (rayDistanceHorizontal < rayDistanceVertical) {
                rayFinalDistance = rayDistanceHorizontal
                ctx.fillStyle = 'darkblue'
            }
            else {
                rayFinalDistance = rayDistanceVertical
                ctx.fillStyle = 'blue'
            }

            let rayCorrectedDistance = rayFinalDistance * Math.cos(rayAngle - this.angle)

            let lineHeight = this.tileSize * (this.screen.width / 2 / Math.tan(this.fov / 2)) / rayCorrectedDistance
            let lineBottom = this.projectionPlane.centerY + lineHeight * 0.5
            let lineTop = this.projectionPlane.height - lineBottom

            ctx.fillRect(i, lineTop, 1, lineHeight)
        }

Any help would be appreciated.

sentences:
What approaches are there to re-designing 8/16-bit sprites for HD? I'm new to game development, and my skills with Photoshop are not that great.

I was planning to try to convert a old game to HD, but for this I need HD sprites. What is a good way to approach converting 8/16 bit sprites into something like HD? I mean something like this:

sentences:
Data structure for logical representatios of maps for a 2D top-down RPG I wish to logically represent a map for a 2D top-down RPG using a a bidimensional list (in python) structure. The map is like a variable size chess board. The first dimension represents the north-south direction of the map and the second represents the west-east direction.

For a square map of i.j cells ,in other words, a list of i lists, of j elements each, each element containing another list of variable representing what is contained in that square cell of the map, like type of terrain, any object, character occupying it, etc, which can be dinamically modified during gameplay.

Is this a good practice that can be easily interpreted by a graphical engine to draw a map?

I have the logical part of the game in python clear in my head, but I know nothing of graphical engines and don't wish to create something that cannot be tranformed easily by a graphical engine in future. Does any one knows a graphical engine that could use this data structure and draw based on it? It does not need to be in python itself, as long as it can be worked with without MUCH programing in other languages.

sentences:
Does Java support OpenGL by itself? Note: This is long but I explaining everything that you need to know. Don't read half way through it and say "What's the question?". It's simple but long and I need help as soon as possible.

So I asked a question not long ago that was similar but it wasn't my best work. What I'm trying to do is make a small jar with no other files but the jar (maybe natives if needed) that handles a window and graphics for games. I'm making this for some people I know who don't want to get into advanced graphics and stuff to make games, plus I figure it would be easier to stick everything they need into one jar that they know how to use. Anyway I found JOGL but after like the past 3 hours or so all I got with JOGL was the memory to never use it because it's a pain to install (at least for me) and everyone says a different way to install it and I need like 100 files along with my jar to get it to work. So since I'm not dealing with JOGL i figured that it's best to try and find something else. So does anyway know any way to get OpenGL into java without libraries that add more files and if so just like 1 file? I'm trying to get it so it's just that jar and nothing else. I just want this done but I'm very confused. I would also like it to be able to run on Windows, Linux and Mac. I only have a Windows machine although I can get Linux to test it on and I know someone who has a Mac but keep in mind I'm building it on a Windows machine. So my question really is how would I be able to stick OpenGL (I would like OpenAL and maybe OpenCL too) in a single jar and nothing else? I have a few exceptions such as I'm kinda ok if I need a few natives but I don't want 10 jars and 50 natives and I need it to work on all kind of machines, and also I would like to be able to use swing to handle the window.

sentences: How to determine the amount of idel time left in main thread for Unity before next frame? Hi I'm trying to improve a thread tool and would like to make a function which use the idle time before the next frame. So how can I determine  the time left?

sentences:
Computing the UV coordinates of a 3D point that lies within a 3D triangle From a triangular mesh I have a 3D triangle T represented by 3D vertexes v0, v1 and v2. Each vertex has an associated UV coordinate into a common texture image, represented as uv0, uv1, uv2.

Furthermore there is 3D point P, that is guaranteed to be within the triangle T (coplanar to and within boundary of T).

My question is given point P, and triangle T, how does one go about calculating the UV coordinates of P?

sentences: How to write a script for circular motion? Сan any body explain me the script for the tangential motion,so that when i cut the rope circle should move tangentially:

sentences: Getting a CineMachine FreeLook Camera to work with a GamePad(joystick) I have no idea how to get the FreeLook cam to work with the second stick on a gamepad. The docs seem to have nothing on the topic. Has anyone done this before ?

sentences:
How to support all iOS device screen sizes / resolutions in my game I made this game. Right now the game supports all iOS devices except iPhone 5.

The definition of each level of the game is kept in a plist. The creation of each level is done through a graphical level editor. Each device family has its own plists. So, right now the game has 100 levels and 200 plists; 100 plists for the iPhone family and 100 plists for the iPad family.

In order to support the iPhone 5 I need to create 100 new plists and adjust the plists accordingly, which is time consuming, not to mention the creation of new levels...

The editor for creating and editing the levels is solely based on the manipulation of UIViews that describe the game elements. So, this is the code that I wrote to save and restore the state of each UIView in one level of the game.

- (void)encodeWithCoder:(NSCoder *)aCoder {
    // Save the screen size of the device that the view was saved on
    [aCoder encodeCGSize:self.gameView.bounds.size forKey:@"saveDeviceGameViewSize"];

    // ****************
    // ALL properties are saved in normalized coords
    // ****************

    // Save the center of the view
    CGPoint normCenter = CGPointMake(self.center.x / self.gameView.bounds.size.width, self.center.y / self.gameView.bounds.size.height);
    [aCoder encodeCGPoint:normCenter forKey:@"center"];

     // I rely on view bounds NOT frame
    CGRect normBounds = CGRectMake(0, 0, self.bounds.size.width / self.gameView.bounds.size.width, self.bounds.size.height / self.gameView.bounds.size.height);
    [aCoder encodeCGRect:normBounds forKey:@"bounds"];

     // Here I save the transformation of the view, it has ONLY rotation info, not translation or scalings
    [aCoder encodeCGAffineTransform:self.transform forKey:@"transform"];
}

- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {

        // Restore the screen size of the device that the view was saved on
        saveDeviceGameViewSize = [aDecoder decodeCGSizeForKey:@"saveDeviceGameViewSize"];

        // Adjust the view center
        CGPoint tmpCenter = [aDecoder decodeCGPointForKey:@"center"];
        tmpCenter.x *= self.gameView.bounds.size.width;
        tmpCenter.y *= self.gameView.bounds.size.height;
        self.center = tmpCenter;

        // Restore the transform
        self.transform = [aDecoder decodeCGAffineTransformForKey:@"transform"];

        // Restore the bounds
        CGRect tmpBounds = [aDecoder decodeCGRectForKey:@"bounds"];
        CGFloat ratio = self.gameView.bounds.size.height / saveDeviceGameViewSize.height;
        tmpBounds.size.width *= (saveDeviceGameViewSize.width * ratio);
        tmpBounds.size.height *= self.gameView.bounds.size.height;
        self.bounds = tmpBounds;
    }
    return self;
}

I am really stuck here. I cannot explain what is wrong with this code. The UIViews are correctly positioned when restored on the same device. This is not true when the level is opened on another device. There are slightly misplaced elements and distortions.

Here are two pairs of screenshots demostrating the issues:

What is the correct approach to handle the scaling of the levels on different screens? Should I rely on AutoResizingMasks (I need to support iOS 4 and later)? In any case I would like to give a solid paradigm on how to achieve this.

sentences: .blend scenes are not showing texture in Unity I am new to Unity and Blender. I am getting a problem when importing .blend files into Unity: in Unity scenes the textures created in Blender are not showing.  But there are no problems with color. How can I fix this problem?

sentences:
HLSL registers and slots I'm learning DirectX11 and since I'm beginning to write some shader code I don't understand the difference between binding slots and HLSL registers. The shader model 5.0 introduced the keyword register, that I assumed is a synonym for slot but it's not.

What I know:
I know that a register is 4 floats (16 bytes), and that a variable cannot straddle two registers so padding is added according to HLSL packing rules.
I also know that if I compile two shaders (say, vertex and pixel shader) in from the same file the register specified are by shader usage so if I use register b0 two times everything compiles fine if resources are accessed by each shader indipendently.

but what about this:

cbuffer Transform : register(b0)
{
    float4x4 worldMatrix;
};

cbuffer clipPlane : register(b1)
{
    float4 clipPlane;
};

I bind my resources to the shader like this:

Game::GetInstance()->GetDeviceContext()->PSSetConstantBuffers(0, 1, &mCameraConstantBuffer);
Game::GetInstance()->GetDeviceContext()->PSSetConstantBuffers(1, 1, &mLightsConstantBuffer);

But if a register is 4 floats shouldn't the two resource overlap?
What about sampler and shader resource registers?

Can someone provide me with a reference about the structure of these registers? MSDN documentation is really of no help sometimes.

sentences:
How to randomly calculate the necessary velocity changes to reach a x,y,z target? I am working on creating a mini vector graphics ping pong table, as described in this previous post: Trying to use 3D vectors for a 2D ping pong game

Currently, the stage I am at, I am trying to make it so that when the ball exceeds the X bounds of the table, it will reflect backwards and at a new target: a random x,y,z position on the opponent's side of the table.

Trying to use this post as a starting point:
How can I launch a GameObject at a target if I am given everything except for its launch angle?
I have attempted to adapt some of that example code in my program, but I am not quite getting the desired results.

** updated code **

update: function(paceFactor) {
  this.ball.pos3D.x += this.ball.vel.x * paceFactor;
  this.ball.pos3D.y += this.ball.vel.y * paceFactor;
  this.ball.pos3D.z += this.ball.vel.z * paceFactor;
  this.ball.vel.y += this.gravity * paceFactor;

  if (!this.stop && Math.abs(this.ball.pos3D.x) > 15) {
    this.stop = true; // for testing to prevent velocity from getting changed due to bad values returned from velocityForNextTarget()
    var modifier = this.ball.pos3D.x < 0 ? 1 : -1;
    var velocity = this.velocityForNextTarget(modifier);
    this.ball.vel.x += velocity.x;
    this.ball.vel.y += velocity.y;
    this.ball.vel.z += velocity.z;
  }

  if (this.ball.pos3D.y >= 0) {
    this.ball.vel.y *= -1;
    this.ball.pos3D.y -= this.ball.pos3D.y;
  }

  this.convert3Dto2D();
},

velocityForNextTarget: function(modifier) {
  var targetX = 5 * modifier;
  var targetY = 0;
  var targetZ = 0;

  var deltaX = this.ball.pos3D.x - targetX;
  var deltaY = this.ball.pos3D.y - targetY;
  var deltaZ = this.ball.pos3D.z - targetZ;

  var sqrMagnitude = (deltaX * deltaX) + (deltaY * deltaY) + (deltaZ * deltaZ);
  var speed = Math.sqrt((this.ball.pos3D.x * this.ball.pos3D.x) + (this.ball.pos3D.y * this.ball.pos3D.y) + (this.ball.pos3D.z * this.ball.pos3D.z));

  var gSquared = this.gravity * this.gravity;
  var b = speed * speed + (deltaY * this.gravity);
  var discriminant = (b * b) - (gSquared * sqrMagnitude);

  var discRoot = Math.sqrt(discriminant);

  var t = Math.sqrt((b - discRoot) * 2 / gSquared);

  return {
    x: deltaX / t * t / 2,
    y: deltaY / t - this.gravity * t / 2,
    z: deltaZ / t * t / 2,
  };
},

So what I am trying to do is make it so that when the ball reaches the location of a player, it will target the center of the opponent's side of the table, and the ball will move there, and right now this code is making the ball rapidly jump off the screen as soon as it hits the x bounds, and I am not sure what I am doing wrong with the math in velocityForNextTarget()...

I should also mention that gravity is just a constant that I am only adding to my Y velocity so far.  I am not sure if that's "right" ?

sentences:
Getting one rigidbody to follow another, but still react to stuff Unity3D/C# Basically what I'm doing is having a ball you can pick up and drop on a ramp. When you pick up the first ball, the second ball follows close behind, and when you drop the first ball on to the ramp the second ball drops on to the ramp as well, rolling down and launching off. The second ball continues to follow the first through the air.

How could I go about getting the second ball to follow the first, while still keeping the rolling-gravity effect?

Thanks.

sentences:
How can I test my game for epilepsy-safety? I've been developing a game which is rather blinky in terms of color and brightness contrasts.  It's an iPhone game, so the screen will be quite small, but I've heard about Wipeout XL failing the epilepsy test.

How does one ensure that a game won't cause epileptic seizures for users?

I am an indie developer, so a low-budget solution would be ideal.

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 can I draw a quad in wireframe with modern OpenGL, without rendering the interior bisecting edge? I want to draw a quad (not two triangles). I actually know that triangles are faster, as I answered this question.

But let's say I am building a 3D modeling tool. It makes sense to draw a quad for the user (like Maya and 3D Max do) and not two triangles especially if he is actually working with quads. Is there any other option than using geometry shaders to accomplish this?

I understand that I can draw two triangles and make them co-planer. Unfortunately this will still make the two diagonal points connected, I don't want this. I want a pure quad. I don't want the line connecting the two points, Exactly like what you see in a modeling tool. I am actually rewriting a modeling tool that I wrote few years ago, and can't get the same behavior I got with the older OpenGL.

Here is an image of the tool I am re-writing using modern OpenGL. I used QUADS, so the question is about an alternative that gives this same behaviour especially I am using two pass rendering to render the model and it's outline. That's why I don't want the line separating the two triangles to appear.

sentences:
Why does a 3D scene need to be voxelized before it can be transformed into a navmesh? Why do solutions such as Recast voxelize a 3D scene before transforming it back into polygons?
Would it not be possible to just determine intersections of meshes, check for slope angles and adjust triangulations in that way? I think agent height problems could also be solved by testing sweeps upwards against the other meshes.

sentences:
Using an interpolated game loop (such as Gaffer's final game loop), will the frame be rendered out of sync? A highly recommended game loop is one from an article called Fix Your Timestep. It presents a method to update using a semi-fixed time step with interpolated rendering.

The problem with this is that, by interpolating the rendering, you are effectively averaging two states in the game - the current and the previous. If the previous frame is averaged with the current frame, the player will be shown the game slightly delayed.

If the player is stationary in one update, then teleports in the next, the interpolation will show a state where the player is mid-way between a teleport very briefly.

For time-critical games, is my thinking correct that the player may see a different/slightly lagged state on screen (the interpolated state) than what is actually stored in memory?

The only fix I can think of is to interpolate the current state + the next, not yet calculated, state. This gives the correct image on screen instead of a slightly delayed previous image... but then we are stuck in a paradox of calculating the next future update.

Or perhaps the time difference is so minimal that it doesn't matter?

I am referring to the following line, the current state is where we are at this moment in time and not fully displayed:

State state = currentState * alpha + previousState * ( 1.0 - alpha );

sentences:
Finding diagonal objects of an object in 3d space Using Unity3d,
I have a array which is having 8 GameObjects in grid and one object (which is already known) is in center like this where K is already known object. All objects are equidistant from their adjacent objects (even with the diagonal objects) which means

(distance between 4 & K) == (distance between K & 3) = (distance between 2 & K)

1 2 3
4 K 5
6 7 8

I want to remove 1,3,6,8 from array (the diagonal objects).
How can I check that at runtime?

my problem is the order of objects {1-8} is not known so I need to check each object's position with K to see if it is a diagonal object or not. so what check should I put with the GameObjects (K and others) to verify if this object is in diagonal position
Regards,
Sam

sentences:
GGX specular BRDF is way over 1! Now, the classic Torrance derivation for roughened surfaces which Cook took into vectorized form yields the familiar parametrization of a specular BRDF where we have the NDF which decides how much perturbation is around the average normal direction of the macrosurface. For example, in the isotropic GGX version, an alpha value is used to modulate just how rough the surface is or just how much specular reflection a partical halfdirection yields from the microsurface normal.

Then there's the geometry term which is, numerically, a protective term from the classic denominator of dot(n,v) * dot(n,l) which can tend to zero and the whole term to infinity. It also has a more physically intuitive side rendered irrelevant by the sheer horror of division by zero.

And there's the Fresnel term, the least threatening of all of them.

Basically, it's DGF / (4(n.v)(n.l)). And if any of these terms fail, it goes to hell. Hence, all of these terms have normalizing terms which force them in the [0,1] range. Unfortunately, the one I was studying from Epic does not converge give in to the normalization and some values at grazing angles get frustratingly high.

The BRDF is the ratio between the outgoing radiance and the incoming irradiance. Anything beyond 1 is weird to me. But 477.43 is... Well... I've double-checked everything, the math is a direct match. And yet...

Any ideas?

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:
Having multiple different friction values on a single piece of track? I am trying to figure out a good/performant way to give a piece of track multiple values of dynamic friction. A track piece is 10x10 units in Unity and the idea is to puzzle them together to a big track like the tracks in Trackmania. The game itself features no acceleration, except from gravity. To make things more interesting I want to give each track piece at the start of the scene multiple random friction values within a given range.
Currently I achieve this by making each piece of track consisting of 100 little tiles which are 1x1 units and they get a random friction values assigned. This approach works somewhat fine as long as there are less than 30 to 40 track pieces(3000-4000 tiles) but with more than that the fps are dropping really low. As it is a racing type of game I had to set the "Fixed Timestep" in the project settings to 0.001 to get accurate time measurments and this is hurting the performance as well. With a lower timestep the collision detection with all the little tiles is really bad too.
Is there a more elegant and/or performant way to achieve this in within the unity physics system?

sentences:
Adjust treble and bass on Audio in XNA I am trying to "muffle" the sounds that are being played in my game and the best way I can think of doing this, is by lowering the treble of the sound.

I have looked through all the members of the Song / SoundEffect / SoundEffectInstance classes and I cannot find a way to alter the sounds.

How can I accomplish this?

sentences:
How can I add these bones to my meta human? Or is there a way I can make virtual bones count when retargetting? Paid for animations thinking they would be fine and they mostly are but... the hands are using these IK bones that I do not have. Is there a way I can add the bones to my meta skeleton within unreal? I tried creating virtual bones but they dont seem to come up in the retarget manager :( Also, I can only seem to add one virtual bone to the root whereas both the foot and hand IK root bones are parented to the root bone here.

Any help would be massively appreciated!

sentences:
Collision on the first rectangle only - Why? I've made a very simple collision detection, it works fine. However, when I decided to load in all my rectangles into a list and then give each of them collision, it only adds it to the first one. Any ideas? I've tried it with a for loop as well.

Here's the code:

    Rectangle interaction, interaction2, interaction3;

    List<Rectangle> collisionList = new List<Rectangle>();

        public GamePlayScreen()
            {

                interaction = new Rectangle(200, 200, 32, 32);
                interaction2 = new Rectangle(400, 200, 32, 32);
                interaction3 = new Rectangle(200, 400, 32, 32);

                collisionList.Add(interaction);
                collisionList.Add(interaction2);
                collisionList.Add(interaction3);

            }
    // This right here is just to show you guys that it is getting updated.
    // This is not the real update, I refrained from posting that since it might confuse
    // people.
    public override Update(GameTime gameTime)
    {
    CheckCollision();
        }

     float xx;
     float yy;

        private void

CheckCollision()
            {
                foreach (Rectangle rect in collisionList)
                {
                if (player.Sprite.Bounds.Y > rect.Top - 33 && player.Sprite.Bounds.Y < rect.Bottom && player.Sprite.Bounds.X < rect.Right && player.Sprite.Bounds.X > rect.Left - 30)
                {
                    player.Sprite.position.Y = yy;
                }
                if (player.Sprite.Bounds.Y < rect.Bottom && player.Sprite.Bounds.Y > rect.Top && player.Sprite.Bounds.X < rect.Right && player.Sprite.Bounds.X > rect.Left - 30)
                {
                    player.Sprite.position.Y = yy;
                }
                if (player.Sprite.Bounds.X > rect.Left - 30 && player.Sprite.Bounds.X < rect.Right && player.Sprite.Bounds.Y > rect.Top - 30 && player.Sprite.Bounds.Y < rect.Bottom)
                {
                    player.Sprite.position.X = xx;
                }
                else
                {
                    xx = player.Sprite.position.X;
                    yy = player.Sprite.position.Y;
                }
                }

            }

    //The Draw method

    spriteBatch.Draw(scrollDownButtonNormal, interaction, Color.White);
                spriteBatch.Draw(scrollDownButtonNormal, interaction2, Color.White);
                spriteBatch.Draw(scrollDownButtonNormal, interaction3, Color.White);

I will of course continue to work on this, and post a solution if I find one.

~Etarnalazure

UPDATE
Just checked with a boolean if the other boxes react, it changes to true. So it means it works just fine (I put the boolean in between each if loop to check if it registered any collision).

sentences:
Cocos2d-x project every time must compile the project plus other libraries I'm using cocos2d-x v3.6 for win32 desktop and Visual Studio 2013 with c++.

When I change the code and then compile the project again, I must re-compile my project AND other libraries every time (e.g. libraries: libbox2d and libcocos2d), and this phase takes a long time.

I don't know why I get this bad behavior of having to re-compile the dependency libraries every time with the project.

Is there is any way to change this bad behavior, to compile the project only without dependency libraries every time?

sentences:
Securing JavaScript / PHP game data Followup to securing-http-data-from-a-javascript-game-to-server.

I'm working on something similar, in that I have a PHP backend and a JavaScript frontend, which plays around with the HTML5 canvas element for drawing.

There will be some heavy client-server communication required, as the player will get timely updates from the server with regards to actions that other players are taking.  In turn, the client will update the server with his actions that have been taken.

My question is what is the best way to secure such data?  Since the client is basically JavaScript, what are some good ways to secure my game data / game states from being tampered with.

I had a thought (spurred by answers to the previous question), about generating a hash based on the currently active session, storing that in a game state database, and validating it server-side.  However, I would imagine that any data sent back to the server via AJAX can be scrubbed for any key that I send back.

sentences:
Can I use my self made piano version of a popular copyrighted song as my game background music? I am making a game, the theme of the game is kind of romantic, and I, myself, have made a piano version of a modern pop song that would fit with that theme. The song in question is still under copyright, and I'm not the owner of the copyright.

Can I use it as a background in my game? Would there be any legal issue regarding copyright/IP etc?

sentences:
OpenGL ES, orthographic projection and viewport I want to make some simple 2D game on iOS to familiarize myself with OpenGL ES.
I started with Ray Wenderlich’s tutorial (How To Create A Simple 2D iPhone Game with OpenGL ES 2.0 and GLKit). That tutorial is quite good, but I miss some parts of a puzzle.

Ray creates an orthographic projection using some magic numbers like 480 and 320. It is not clear to me why he took these numbers, and as far as I can see - sprites are not mapped to the iPad simulator screen one-to-one pixel. I tried to play with parameters with which the ortho matrix is created, but I cannot figure out the maths in here.

How can I calculate numbers (bottom, top, left, right, close, far) which will be parameters to the orthographic projection matrix creation and have the sprite on the screen shown in its original size?

sentences:
Why do I get these errors in VS when I use OGRE_NEW? I am trying to get more experienced with Ogre 3D and I am following the basic tutorials on the website. All the code samples compile just fine.

The first time I encountered an "error" was in Basic Tutorial 3.

The code line where Visual Studio says something is not right is

mTerrainGroup = OGRE_NEW Ogre::TerrainGroup(mSceneMgr, Ogre::Terrain::ALIGN_X_Z, 513, 12000.0f);

Visual Studio compiles this line but it shows an ugly red line beneath it and on mouse hover it says

  #define OGRE_NEW new (__FILE__, __LINE__, __FUNCTION__) Error: no instance of overloaded 'operator new' matches the argument list" or if I mouse hover over Ogre::TerrainGlobalOptions() it says "Error: expected a type specifier

I searched on Google but couldn't find my answer. I got about a year C++ experience but that was mainly with the WinSock libary.

Thanks in advance.

sentences:
Box2D/Farseer Collision Detection I am looking for literature - or a simple explanation - on how the Farseer (and for that reason, the Box2D) collision detection system works - specifically the logic that comes after the broadphase culling:

What data structure does it use?
How does it use that data structure to determine if a collision has occurred?
How does it calculate the response normals?

NB: I am not asking how to use it, I merely want to know how it works as a matter of personal enlightenment.

sentences:
Is there a way to use an arbitrary number of lights in a fragment shader? Is there a way to pass an arbitrary number of light locations (and colors) for the fragment shader, and loop over them in the shader?

If not, then how are multiple lights supposed to be simulated? For example with respect to diffuse directional lighting, you can't just pass a sum of the light weights for the shader.

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:
Create a seemless grid-based polygonal tileset The aesthetics I am going for is demonstrated by many simulation games such as Simcity. But I am looking at this particular example: Polygonal Planet Project by Oskar Stålberg.

I understand the concept: when the player places or upgrades a tile, the game looks at adjacent tiles to figure out which tile should be used. And in most cases, a tile would be self-contained, so I just need to design all possible variant of such tile.

And I have some experience on procedural generation in 3D, so coding isn't the main problem for me.

What I am wondering, are:

Does this type of continuous 3D tilesets have a name? I tried to google some examples/tutorials but failed to find the appropriate keyword.
Are there tools to make the process of creating tile variants easier?
Is there a preferable process to create such tileset? Do I start by creating structures then divide them into repeatable patterns, or should I start with basic tiles and find way to create smooth transition between them?

That's probably too much to answer in detail, but I would like some pointers on this topic (more about asset design than programming I suppose). Thx!

sentences:
DirectX11: Drawing multiple objects How can I draw many different objects on screen at once, with multiple vertex buffers, using DrawIndexed()? (Drawing the same object is simple, and I'm not looking to instance)

...but I am looking to transform two different vertex buffers. (Yes I am using indexed vertices)

sentences: What basic windows form games should I build as a newbie in game development? I am a complete newbie in game development. I want to know about some basic games that I can start building with simple algorithms and basic knowledge. I have already made few basic games like minesweeper, TicTacToe, basic card games, and a snake game. I just want to have an idea to start a new fun project.

sentences:
D3D11 SetShader States I have some questions regarding the XXSetShader and what happens after, for instance I would like to know if when XXSetShader is called the subsequent calls would be bound to that particular shader, like PSSetShaderRsources. Because at load time I am bounding the resource views needed for that particular shader, then the next one and so on, but what I found is that the resources were not bound, I need to set them again every time the XXSetShader is called.

Am I doing something wrong? it's not supposed to work like that, the purpose of this is to have the least change states at runtime.

Thanks.

sentences:
Problem with transparent textures in SFML I have been told that this is kind of a common problem with transparent textures, but didn't get any further information on how to solve it.

In my code, I'm trying to render this texture (a square with rounded corners, where rounded corners have some alpha)

What I get instead is this

Notice those greyish places on the corners of the textures - where rounded corners are supposed to be.

What could be causing this? I have a pure-white texture, so I don't expect a single pixel to get any darker than the background. All pixels should have at least the color of background, but as you can see, there is something darker.

Zoomed even more:

Any help would be highly appreciated.

sentences:
How best to handle ID3D11InputLayout in rendering code? I'm looking for an elegant way to handle input layouts in my directx11 code.

The problem I have that I have an Effect class and a Element class. The effect class encapsulates shaders and similar settings, and the Element class contains something that can be drawn (3d model, lanscape etc)

My drawing code sets the device shaders etc using the effect specified and then calls the draw function of the Element to draw the actual geometry contained in it.

The problem is this - I need to create an D3D11InputLayout somewhere. This really belongs in the Element class as it's no business of the rest of the system how that element chooses to represent it's vertex layout. But in order to create the object the API requires the vertex shader bytecode for the vertex shader that will be used to draw the object. In directx9 it was easy, there was no dependency so my element could contain it's own input layout structures and set them without the effect being involved.

But the Element shouldn't really have to know anything about the effect that it's being drawn with, that's just render settings, and the Element is there to provide geometry.

So I don't really know where to store and how to select the InputLayout for each draw call. I mean, I've made something work but it seems very ugly.

This makes me thing I've either missed something obvious, or else my design of having all the render settings in an Effect, the Geometry in an Element, and a 3rd party that draws it all is just flawed.

Just wondering how anyone else handles their input layouts in directx11 in a elegant way?

sentences:
What is "Rapid" in reference to the MSN Games GDK? I have herd a little talk about the MSN Games GDK lately, and what wondering what Rapid was.

It sounds like some sort of testing environment, is this true? How can I get access to it? Or find out more about it?

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:
Extending a ScriptableObject to have a get property instead of a field, without losing serialized data I have a ScriptableObject that's already used extensively in my project:
public class SFXClip : ScriptableObject
{
    public AudioClip clip;

    // other properties
}

I want to extend it to a derived version something like this:
public class SFXRandom : SFXClip
{
    [SerializeField] List<AudioClip> audioClips;

    override public AudioClip clip
    {
        get
        {
            return audioClips[Random.Range(0, audioClips.Count)];
        }
    }
}

But of course, I can't do that without making the clip field on the original object into a virtual property. If I do that, I'll lose all the AudioClip references in existing SFXClip instances in my project's Assets.
Is there a way I can implement this change without losing that data?

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:
How can I keep track of a battle log on a web game? Recently I started working on a Web turn-based PvP RPG game. Now I'm working on the battle system but I encountered some issues:

How can I keep track of everything that happens in the battle? It should keep track of the characters on the field, inventory, the damage done etc.

I first thought I would simply put it in the (MySQL) database, but I think it will be too much. Especially if several people are in a battle. I thought of puting this in sessions or cookies but I don't think thats reliable.

Does anyone have an idea how I can do this?

sentences:
Should components have sub-components in a component-based system like Artemis? I am designing a game using Artemis, although this is more of philosophical question about component-based design in general. Let's say I have non-primitive data which applies to a given component (a Component "animal" may have qualities such as "teeth" or "diet").  There are three ways to approach this in data-driven design, as I see it:

1) Generate classes for these qualities using "traditional" OOP. I imagine this has negative implications for performance, as systems then must be made aware of these qualities in order to process them. It also seems counter to the overall philosophy of data-driven design.

2) Include these qualities as sub-components. This seems off, in that we are now confusing the role of components with that of entities. Moreover out of the box Artemis isn't capable of mapping these subcomponents onto their parent components.

3) Add "teeth", "diet", etc. as components to the overall entity alongside "animal". While this feels odd hierarchically, it may simply be a peculiarity of component-based systems.

I suspect 3 is the correct way to think about things, but I was curious about other ideas.

sentences:
Exporting spritesheet for Cocos2d I would like to know how people usually save the animations in order to load them easily in Cocos2d with as few hard-code as possible.

E.G. The solution I thought of is to have one plist file containing information about each frame, and the second plist to contain information about each of the animation(name of the animation, which frames to play, and the delay probably).

If this is the correct solution, how can I generate such plist files for spritesheet automatically?

sentences:
Finding average input value over time in seconds I'd like to find the average input value from a controller over the last n seconds (say the last 0.1 seconds) and do this every frame.

I can see how to do this for the past n frames by storing a list of values for the last n frames and averaging that total every frame, but I want to account for a variable frame rate as the resulting output is driving a character controller and should feel precise and consistent. I tried storing a list of value pairs containing the input value and delta time value for every frame, then counting back through the list of delta time values until they sum to n seconds, then using the total of those input values to work out the average, but it seems a bit clunky and means I have to guess how big the list should be to store enough values, is there a better way?

sentences:
Character Controller Rotation in Unity I am using the following code for moving a capsule:
Vector3 move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
controller.Move(move * Time.deltaTime * playerSpeed);

I am using the following code for the camera, which is a child of the capsule. (xRotation is intialized to 0.0f, and playerBody is a transform):
        float mouseX = Input.GetAxis("Mouse X") * mouseSpeed * Time.deltaTime;
        float mouseY = Input.GetAxis("Mouse Y") * mouseSpeed * Time.deltaTime;

        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        playerBody.Rotate(Vector3.up * mouseX);

The character is always moving in the same direction, ignoring the rotation. How can I fix this?

sentences:
Trying to make sprite float up and down Using LibGDX + Box2D and my understanding of the answer posted from this question: Here

I apply the following impulse:

// modify sprite's Box2d Body object
int a = 8; // amplitude
int f = 1; // frequency
int p = 1; // phase
float value = (float) ( a * Math.sin( 2 * Math.PI *f * TimeUtils.millis() + p ) );
body.applyLinearImpulse( 0, value, body.getPosition().x, body.getPosition().y, false );

// render it
sprite.setPosition( body.getPosition().x, body.getPosition().y );
sprite.draw( spriteBatch );

But this just causes my sprite to go straight up and offscreen rather than doing a wave. What part of the algorithm am I doing wrong?

sentences: Why does the volume not decrease when I move away from the AudioSource? I created a simple scene with an audio source and a player that can move. The main camera is a child object of the player. I set the audio source volume rolloff to "logarithmic rolloff". As far as I understand, this means that the sound should become weak very fast when the main camera moves away from the audio source. But this does not happen: as I move the player (with the camera) away from the audio source, the volume remains the same. I see, in the rolloff graph of the audio source, a line denoted by "Listener", which moves to the right as the camera moves away from the source. But still, the volume remains the same. Why?

sentences:
Moving all the particles in effect LIBGDX I have a few particle effects that I would like to be in a circle shape
in libgdx i.e. not a cone shape. I have done this by setting the direction
of the particle effect from 0 to 360. The problem is that the particle effect
is moving. So, as the emitters are moving, but not the particles themselves,
the overall shape becomes conical. This could simply resolved by moving all the
particles along with the particle emitters, but I can't fnd any way of doing
this. I have considered drawing the effect to a Frame Buffer Object in one
position, then draw the texture to each new position. However, this would mean I would have to flush the SpriteBatch each time a draw a particle effect, and that would be very expensive.

Is there any  way to move the entire effect, with both the emitters and the particles?

Thannks in advance

sentences:
Is GPU locality of reference worth worrying about? Does locality of reference make as much of a difference to GPU performance as it does CPU performance?

For example, if I send 200 draw commands to the GPU, will I see a (potentially) noticeable difference if the data for each command is contiguous in memory instead of jumping around the buffers/texture maps?

Side question: I'm assuming the GPU ensures against false sharing issues by having most resources immutable. But in the case where they're not, is that why threads always do four fragments' worth of work?

sentences:
Persistence of Random Sorry if this is such a simple thing, but for some reason I can't get my head around it.

Imagine you have a world, that you have "seeded" with a value.  You base all your randomisations off this value - perhaps you made mountains, monsters, or any other such thing.

Then the user saves her game, and then picks up where she left off a few days later.

We can store the seed we started with easily enough.  But, it will reset to the beginning.  What I would actually like is to "start off where we left off".  Therefore, with persistence, do I need to be storing the iterations that we applied on said random number generator?  When loading the saved game, do we go through the iterations to arrive at the place we should be?

An alternate would be to initialise a world using a random seed, and then throw it away when we save, so that any subsequent load, has a new random number generator.

Thoughts and ideas welcome :)

Edit

To reiterate from the comment I made below, my first thought was to wrap all access to the Random class, and track the number of iterations.  This could be saved alongside the seed.  When loading, one would re-initialise the class, and then loop through the iterations (effectively throwing away the result) to arrive at the point you'd have been at originally.

Also, added c# tag.

sentences:
How should I send large amounts of data from java to c++ (within the same process) I'm writing a game that is mostly in Java (because that's the language I'm most comfortable with) while the graphics are in C++ (because of speed, and because the Vulkan API is hard enough to learn when I'm not using a third-party language binding). I start a thread in Java and have it create a Swing window, it then runs a native method that takes the HWND handle from the window and some other information as parameters. Once in native code it binds the window to a Vulkan surface and from their the graphics engine is it's own independent thread, if possible I don't want to make any more JNI calls (performance concerns).

My issue is, I handle server-client connectivity on the Java end, and my server is responsible for sending the client models and textures when the player needs them. The obvious solution would be to pass these textures and models over JNI so that the graphics engine can  make use of them but I'd REALLY like to not do that.

I've considered using memory mapped files but that would require using boost since there otherwise isn't a cross-platform mmap library, and it also seemed silly to me that I'd get the data over the network, it'd then be stored in RAM, and then I'd allocate it a different area of RAM so that it can be accessed in native.

Other than JNI and memory mapping I, with my limited experience, cannot think of any other possible solution to this problem and am hoping to find some suggestions or perhaps some inspiration. This question isn't strictly related to game development and I considered asking it over at Stackoverflow but their community is really doo doo.

sentences:
Profiling server side game loop in java I am looking for tips to profile the server side game loop of a Java program for CPU usage. I tried to use the TPTP plugin for Eclipse so far.

The problem I am having is that it is really slow. For example the startup of the server is normally done in less than a minute. But with the profiler it takes about 30 minutes.

Okay, I can enable the profiler only after the server is started, but I am still facing the problem that it is way too slow and using much CPU. So I am unable to connect a number of clients in order to reproduce the problem (even with disabled timeouts).

I already did some optimization based on no client at all and some very short profiling sessions with one client. This is, however, not really helpful because the game server is doing most of its work only if a player is in reach.

I am thankful for any tips on profiling for CPU usage.

sentences:
Unable to achieve two finger panning I'm looking to achieve a two finger smooth pan system in my project.
However, the code below does not work, any interaction with the screen doesn't change to position of the camera.

I am unsure where did I go wrong as I'm quite new to Unity.

Any help will be greatly appreciated.

void Update () {

    //Detect If there are a) two fingers, b) touching the screen.

    if (Input.touchCount == 2 && Input.GetTouch(0).phase == TouchPhase.Began)
    {
        if (Input.GetTouch(0).phase == TouchPhase.Began && Input.GetTouch(1).phase == TouchPhase.Began)
        {
            if (Input.GetTouch(0).phase == TouchPhase.Stationary && Input.GetTouch(1).phase == TouchPhase.Began)
            {
                if (Input.GetTouch(0).phase == TouchPhase.Moved && Input.GetTouch(1).phase == TouchPhase.Began)
                {

                    Vector2 defaultCamera = transform.position;

                    Touch touchZero = Input.GetTouch(0); //Get locality of first touch.
                    Touch touchOne = Input.GetTouch(1); // Get locality of second touch.

                    Vector2 originalMid = Vector2.Lerp(touchZero.position, touchOne.position, 0.5f);

                    // Find the position in the previous frame of each touch.
                    Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition;
                    Vector2 touchOnePrevPos = touchOne.position - touchOne.deltaPosition;

                    Vector2 touchMid = Vector2.Lerp(touchZeroPrevPos, touchOnePrevPos, 0.5f); //Get locality of midpoint between touches.

                    // Find the magnitude of the vector (the distance) between the touches in each frame.
                    Vector2 finalTouch = touchMid - originalMid;

                    transform.position = defaultCamera + finalTouch * Time.deltaTime; //transform camera using the new vector.

                }
            }
        }
    }

sentences:
Before multiplayer match setup I am implementing a before-match setup in following way:

Users request a multiplayer match (click "New Game" button or similar)
After enough users request the match – connection is established
Users are then moved into Select level view
On that view, there is "Become Master" button, which an user can use to become Master
The Master has ability to select level to play
After clicking "Become Master" – the users vote – simple popup appears "Accept User X becoming Master?"
If > 50% agrees, user X becomes master.
Master then selects level he wants. After 10 seconds, game starts – all users are moved to In-game view, to play selected level.

Question: I am wondering if I am not doing this too complicated? Shouldn't I randomly choose the master, or somehow make selection mechanism simpler?

sentences:
Looking for some insight on programming design for attacking and attack types in a game So, I'm starting to introduce attacking to our 2D space RTS (This is in Unity, so it's component driven). Initially it was as simple as "enemy in range, damage applied". However there will be multiple "types" of weapons/attacks that are associated with their particular ship or structure. As well as other factors involved past just raw damage such as the damage type, and possibly inertia in the future.

Would you guys have each unit and structure type have it's own attacking type. Meaning you make a script for each unit/structure that defines it's attack type, damage, effects, range, particles, sprites...etc And attach that as a component?

Or make a script that defines an attack type, a script for the projectile type associated with that...etc And then extend those and modify those for each unit, attaching each script to the unit/structure.

I hope I'm making some sense, I've been pondering this for so long I'm not sure if I'm solving a problem, or just making up my own problems and digging myself into a hole.

When you have a game that can have a multitude of attack types that may or may not be limited to a specific unit/structure, how do you design the framework that tied that together to the specific units/structures in a component-driven design environment?

If this is not clear enough let me know.

Edit: Great answers, thank you.

Expanded Question:

The answers seem to vary from "each object can have it's own attacking script" to "Have the attack types as their own scripts and assign that to each object for a more reusable solution". Lets say I have a "blaster" attack, it shoots a red projectile at a certain speed. It's damage, rate of fire, and projectile size are dependent on the unit firing it. Is it better to just make an attack script for that unit, or try and modify a "blaster attack" to fit the purpose of each unit that wants to use it?

sentences:
Rendering multiple RenderTargets to the screen Let's say I have a background and a set of entities.
I have managed to draw the background into a Texture2D using a RenderTarget
I have also managed to draw all my entities into another RenderTarget

Now I want to take these two Textures and render them on the screen as so:

// Top-level rendering
entitiesSystem.Process();
background.Process();
Texture2D entitiesTexture = entitiesSystem.EntitiesTexture;
Texture2D backgroundTexture = background.BackgroundTexture;

graphicsDevice.SetRenderTarget(null);
graphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
spriteBatch.Draw(
    backgroundTexture,
    LevelManager.LEVEL_RECTANGLE,
    null,
    Color.White,
    0.0f,
    Vector2.Zero,
    SpriteEffects.None,
    1
);
spriteBatch.Draw(
    entitiesTexture,
    LevelManager.LEVEL_RECTANGLE,
    null,
    Color.White,
    0.0f,
    Vector2.Zero,
    SpriteEffects.None,
    0
);
spriteBatch.End();

Here is how the background system renders the background:

graphicsDevice.SetRenderTarget(BackgroundTexture);
spriteBatch.Begin();
for (int i = 0; i < 2; i++)
    spriteBatch.Draw(textures[i], positions[i], Color.White);
spriteBatch.End();

Almost the same thing happens for the entities: I set the render target to the relevant one (not the same as the one for the background), start the spritebatch (again, not the same one), draw the entities and end the spritebatch.

If I set BlendMode to additive, the result is correct (they blend together). However, if I set to to AlphaBlend, then I can only render one of them (depending on the SpriteSortMode).

I have come as far as understanding that the problem lies in not preserving... something, but I am not sure how to preserve it :P

By the way, I read that multiple render targets are not supported for the XBOX... Soooooooo... what is the alternative of doing what I am doing now?

sentences:
Books on layout and space sequencing in game design I'm currently looking into level design books. So far I've read two, The How's And Why's of Level Design and the Ultimate Level Design Guide.

While both were useful they did not discuss layout and space sequencing as much as I was looking for. I'm looking for stuff like this:

I couldn't find books that pertain to this specific subject. Do you happen to know any?

sentences:
Is a Masters degree in computer science beneficial over a Bachelors in the game industry? Suppose a student (who is seeking to become a video game developer) is studying Computer Science at a state-level university, and is about to complete his or her bachelors degree.

Would the student stand a better chance to get hired as a game developer later if they proceeded to obtain their masters degree in Computer Science, or if they tried to instead obtain an internship or entry-level development position at a local software developer (not game development, but still software development)?

sentences: LIBGDX Perspective Camera in an Isometric view? how can I set a PerspectiveCamera to view the game in an isometric view? What kind of angle would I use, and how would I actually translate this into the code? Math isn't my forte, so I can't really understand the maths on the wikipedia article here. It mentions to points A and B, but I'm not sure what those points would be.

sentences:
Querying game objects in real-time I'm thinking about working on a game where I need to find all the objects matching certain properties.

For instances I might need to look up all the objects...

Producing gold.
Whose level is 5 or higher.
Within 10 meter from a point.
Currently fighting.
That have anything to do with metal (e.g. producing, consuming, made of, wearing, standing on etc).

And so on and so forth. I would also like to be able to add new objects with new properties without having to change everything else.

Ideally I would need to run multiple queries per frame (hundreds or thousands per second). I'll probably rely on some properties way more than others, but this kind of usage pattern is likely to change over time.

Is there any data structure, design pattern, method or idea to help me implement an efficient real-time query system?

I've been thinking about assigning to each object a dynamic set of tags with properties, then recursively partition the space storing in each partition a mapping from those tags to the objects. It might work, but I'd like to hear about existing solutions before wasting efforts.

sentences:
Object is moving more than it should I have the following code for Food:

exports.Food = function(x, y) {
this.MOVE_X_FROM_POSITION = 10;
this.ACCELERATION = 0.05
this.image;
this.firstX = x;
this.firstY = y;
this.x = x;
this.y = y;
this.width = 10;
this.height = 10;
this.velocity = {
  x: 0,
  y: 0
}
this.acceleration = {
  x: this.ACCELERATION,
  y: 0
};
this.render = function(ctx) {
  if (typeof this.image != undefined) ctx.drawImage(this.image, this.x - this.width / 2, this.y - this.height / 2);
  return this;
}
this.update = function() {
  this.velocity.x += this.acceleration.x;
  this.velocity.y += this.acceleration.y;
  this.x += this.velocity.x;
  this.y += this.velocity.y;
  if (this.x >= this.firstX + this.MOVE_X_FROM_POSITION) {
    this.acceleration.x = -this.ACCELERATION;
  } else if (this.x <= this.firstX - this.MOVE_X_FROM_POSITION) {
    this.acceleration.x = +this.ACCELERATION;
  }
}

... and so on

I want the food to move 10 steps from it's first location one side and 10 steps the other side. The problem is that if the script is running longer it becomes to move far more than 10 steps from it's original position. PS: update function is called in the loop every 30 times per second

Where could be the problem? Thank You in advance

EDIT

Here is actually a demonstration of my problem:
https://jsfiddle.net/02jbmxnw/1/

sentences:
Unity3D WWW get HTML displayed in browser I currently have in a web page, on a localhost server, some information that I want to use in Unity. My problem is that this information are stored in some js variables.

I tried to use the WWW class in a coroutine, but I only get the html source code. Is there a way to get the value of this variables inside Unity Editor ?

Thanks !

sentences:
Character controller falling with positive speed I'm having very weird problems with my player's vertical movement. I'm using a Character Controller component with a capsule collider and no rigidbody. For testing purposes, I've ended reducing my jump script to just this line:
    owner.CharacterController.Move(new Vector3(0, 0.01f, 0));

When executing this script, the player should just fly upwards at a constant speed, right? Well, what ends up happening is that the player starts jumping in place repeatedly. The jumps are smooth, as if the movement was being affected by gravity. I thought that the standard Character Controller doesn't handle gravity automatically and you have to do it yourself, so I can't understand what's going on here. There is no other code affecting the player, if I comment that line it just rests in place. If I try a different direction (like (0.01f, 0, 0)) the player moves in a straight line in the provided direction as expected. But when moving vertically, weird stuff happens :S

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:
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:
Moving an object around the the circle to the specific location in circumference Well I have run out of ideas how to approach this particular problem.See the picture below:

So the idea is that the object (dot in black) has to get to a point mark X (red X mark).However the limitation is that it has to get there without crossing the circle (i.e going in the straight line the the X mark).I was reading on some steering algorithsm but seems rather too complicated for this problem.Also I should mention that the object has the speed and velocity and position attributes which controls how its moving.

Now I was reading some ideas on how to move an object around a circumference here:

Here

However this doesn't entirely answer my question.The thing is I first need to get to the circle in order to be able to move around it.What I was thinking,was to allow the object to move towards  the position in a straight line until it hits the circle and then start moving along the circumference of the circle.Also the "X" mark can be anywhere on the circle even right in-front of it (not behind on the other side of the as in this example shown in the image)

I am not a game developer and thus never came across issues like so.The idea is that there will be more than one black object trying to get to their own "X" mark on the circle from random positions.(They idea is that they will be surrounding some objects in the middle). Here is an image to show what I mean,where each black object has an X position that they need to attend to without directly going through the circle.(Sorry for my bad drawings,was using laptop track-pad to do these images)

Anyway I am kinda lost with this and would to see different on tackling this particular problem.

sentences:
What is the proper way of creating bullet in libgdx ashley ecs framework? I'm still thinking, how do I properly pool a bullet in libgdx ashley? Because the PooledEngine is available, which the Entities, Components and Systems are already Pooled. I made this below example, which I just create a builder-pattern to spawn a bullet. Without using the ashley ECS framework, I used this memory-management reference to create a bullet pool as result this made me more confused.

class EntityFactory {

     ...

     public EntityFactory(World world, PooledEngine engine) {

          this.engine = engine;
          this.world = world;

     }

     public Entity createBullet(float x, float y) {
          ...
     }

}

class GunSystem extends IteratingSystem {

     EntityFactory factory;

     public GunSystem(EntityFactory factory) {
          super(Mappers.gunFamily);
          this.factory = factory;
     }

     @Override
     public void processEntity(Entity entity, float deltaTime) {
          GunComponent gun = Mappers.gun.get(entity);
          NodeComponent node = Mappers.node.get(entity);

          float bulletX = ...;
          float bulletY = ...;

          if(gun.reload) {
               Entity bullet = factory.createBullet(bulletX, bulletY);
               node.putChild("bullet", bullet);
          }

          if(gun.fire) {
               Entity bullet = node.getChild("bullet");
               ... move body to target destination
               BulletComponent b
               b.state.fired = true;
               node.removeChild("bullet");
          }

     }

}

Question what do you think is the proper way of creating bullet pool in ashley ecs framework?

sentences:
UDP + digital signature vs TCP vs other solutions to guarantee message authenticity TCP guarantees message authenticity rather reliably using packet sequence number.
Other option would be going with UDP and using digital signatures to make the message authentic.
What could be my other options (basically are there any I missed)?
Maybe there is some sort of framework which I could use which would allow me to plug into a game engine without writing all authentication logic(each time using tcp i would need that clients login into my system, with udp i would rely on client public signatures inside my db).

TY

sentences:
Keeping balance between widely different character classes So I've been theory-crafting an idea for a game I think would be interesting, but I'm trying to work out the kinks in my idea. Here's my dilemma:

Let's say a player can choose between two classes, being a foot soldier or piloting a large vehicle like a tank. To keep gameplay diverse, there needs to be some players as foot soldiers and some as tanks. In games such as BF4, the individual soldier has so many anti-vehicle weapons that vehicles are actually somewhat weak. Is there a good way to balance classes such that an endgame infantry unit is equal(not inferior or superior) to a vehicle such as a tank or ship?

I was also thinking of an AI squad mechanic, where the player can command a small number of AI foot soldiers, so this might be worked into the balancing. I'm just trying to think of a way to have all classes be appealing to the player.

sentences:
A more data oriented design approach to Entity Component System game engine I'm creating my first c++ game engine project (for learning purposes) and in it I've attempted to implement an entity/component system utilizing some data oriented design principles while also not fully giving up my object oriented way of thinking. I have data only component structs:

(Example)

Position.h

struct Position
{
    Vector3D position{ 0.0f, 0.0f, 0.0f };
};

which are stored in arrays within my SceneManager class:

SceneManager.h

class SceneManager
{
    //Some other code....

private:
    //So only systems have access to component arrays
    friend class BGraphics::RenderSystem;
    friend class BInput::InputSystem;
    friend class BPhysics::MovementSystem;
    friend class BPhysics::CollisionSystem;
    friend class BAudio::AudioSystem;

    //Component arrays. Each index of the arrays represents an entity.
    //So positionComponents.at(1) represents entity 1's position.
    Array<Position, 10> positionComponents;
    Array<Velocity, 10> velocityComponents;
};

As you can see, my engine's system classes are the only ones who have access to the component arrays and so every system can process components. There are some other things involved in this setup that I don't want to get too deep into for simplicity's sake. My issues are as follows:

Each system accepts a SceneManager reference in an Update function like so:

RenderSystem::Update(SceneManager& scene)
{
   //Use scene component arrays necessary for processing...
}

What I'm struggling with is right now my components seem like global variables in that every system has access to them and can change their state. Though it seems like a lot of data oriented design involves structs like these with public data for which other functions can operate on, changing their state. With that being said, is there something I'm missing with my implementation that would make my component data more encapsulated and safer? How am I suppose to think about handling data in a safe way when utilizing data oriented design? Any clarity is appreciated.

sentences:
A good way to build a game loop in OpenGL I'm currently beginning to learn OpenGL at school, and I've started making a simple game the other day (on my own, not for school). I'm using freeglut, and am building it in C, so for my game loop I had really just been using a function I made passed to glutIdleFunc to update all the drawing and physics in one pass. This was fine for simple animations that I didn't care too much about the frame rate, but since the game is mostly physics based, I really want to (need to) tie down how fast it's updating.

So my first attempt was to have my function I pass to glutIdleFunc (myIdle()) to keep track of how much time has passed since the previous call to it, and update the physics (and currently graphics) every so many milliseconds. I used timeGetTime() to do this (by using <windows.h>). And this got me to thinking, is using the idle function really a good way of going about the game loop?

My question is, what is a better way to implement the game loop in OpenGL? Should I avoid using the idle function?

sentences:
balloon ligher than air with libgdx, impementation of FixtureDef.density, gravityScale, linearDamping? I use libGdx/box2d's physic. My intention is to create a balloon filled with helium (a body, what hovers above a surface, if we apply a little force to it - it moves fast but not far, if we push against a obstacle - it collide and jump back (restitution)).
I was suggested to use linearDamping or gravityScale to achieve similar behavoir.
So far I achieved a ball behavior: it hovers, it moves (not as intended, just simple move), but no restitution. Here my code:

        mBallDef = new BodyDef();
        mBallDef.type = BodyType.DynamicBody;
        mBallDef.position.set(x, y);

        mShape = new CircleShape();
        mShape.setRadius(radius);

        mFixDef = new FixtureDef();
        mFixDef.shape = mShape;
        mFixDef.density = 0.7f;
        mFixDef.friction = .5f;
        mFixDef.restitution = .8f;

        mBall = world.createBody(mBallDef);
        mBall.setActive(true);
        mBall.setAwake(true);

        mBallFix = mBall.createFixture(mFixDef);
        mBall.setGravityScale(.2f);
        mBall.setLinearDamping(5.5f);

Touch implementation (just moves a balloon up, it's for test, nothing special)

Gdx.input.setInputProcessor(new InputHandler()
    {
        @Override
        public boolean touchDown(int screenX, int screenY, int pointer, int button)
        {
            mBall.applyLinearImpulse(0, 15.5f, mBall.getWorldCenter().x + mShape.getRadius(),mBall.getWorldCenter().y - mShape.getRadius(), true);
            mBall.setAngularVelocity(0);

            return true;
        }

    });

When I use for gravity - .2f and for linearDamping - 5.5f, a ball hovers, but I loose a restitution for my balloon. The restitution is available only for linearDamping below 1.5f. And I was told that it's not good practice to keep gravity far away from 1.
My experiment with FixtureDef.density failed, changing it to various values (grom -2 to 2) has no visible effect.
The questions are:
1) What's use of density? It doesn't provide visible affect.
2) What values I should declare to create balloon ligher than air?

sentences:
Unity get component throwing NullReferenceException only in standalone build I'm having a very frustrating issue with GetComponent().

private void Show()
{
    var transition = GetComponent<TransitionAnimation>();

    Debug.Log($"Transition: {transition}");
    transition?.FadeIn();
}

In the editor, this works just fine. transition is not null and FadeIn() is called. In the standalone build, GetComponent() returns null, throws a NullReferenceException, and execution stops before it can even print transition to the console.

This is the output from the log file.

Uploading Crash Report
NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Component.get_gameObject(UnityEngine.Component)
  at UnityEngine.Component.GetComponentInChildren (System.Type t, System.Boolean includeInactive) [0x00001] in <e314adc5a7494b5f8760be75461a94d4>:0
  at UnityEngine.Component.GetComponentInChildren[T] (System.Boolean includeInactive) [0x00001] in <e314adc5a7494b5f8760be75461a94d4>:0
  at Winglett.RR.UI.Gradient.Show () [0x00001] in /Users/redacted/Documents/repos/radical-relocation/Assets/_Core/Scripts/UI/Gradient.cs:63
  at (wrapper delegate-invoke) <Module>.invoke_void()
  at Winglett.RR.Gameplay.GameState.SetPause () [0x00001] in /Users/redacted/Documents/repos/radical-relocation/Assets/_Core/Scripts/Gameplay/GameState.cs:46
  at Winglett.RR.Gameplay.GameState.SetPause_STATIC () [0x00000] in /Users/redacted/Documents/repos/radical- relocation/Assets/_Core/Scripts/Gameplay/GameState.cs:70
  at Winglett.RR.UI.Wrapper.SetGameStatePause () [0x00000] in /Users/redacted/Documents/repos/radical-relocation/Assets/_Core/Playground/ui/Wrapper.cs:27
  at UnityEngine.Events.InvokableCall.Invoke () [0x00011] in <e314adc5a7494b5f8760be75461a94d4>:0
  at UnityEngine.Events.UnityEvent.Invoke () [0x00023] in <e314adc5a7494b5f8760be75461a94d4>:0
  at Winglett.RR.Utils.ESCButton.Update () [0x00026] in /Users/redacted/Documents/repos/radical-relocation/Assets/_Core/Scripts/Utilities/Other/ESCButton.cs:21

I wondered if the issue might be because the gameobject is disabled. So I tried GetComponentInChildren<TransitionAnimation>(true); where true is an overload for inactive gameobjects. This didn't change anything.

sentences:
Opengl in 500 lines point in triangle question https://github.com/ssloy/tinyrenderer/wiki/Lesson-2-Triangle-rasterization-and-back-face-culling
I am on lesson 2 of the "Opengl in 500 lines" tutorial. I follow the part of the lesson in "The method I adopt for my code", but I don't understand this leap from
P = A + uAB-vector + vAC-vector

to
0-vector = uAB-vector + vAC-vector + PA-vector.

sentences:
Unity Shader-Graph randomly tiled sprite Lets say I have a shader with a clean white tile. Then I use it on a wall and tile it a few times.

I also have a sprite with numbers.

Now, is it possible and if yes how. To put a random sprite number ontop of the already tiled texture.
Example:
I am pretty sure this can be achieved with shadergraph, but I am hardly an expert and I really dont want to spend a month or more try-erroring my way through...

sentences:
What's the most efficient way to find the intersection point of a missile and a bitmap terrain? Following up on my earlier question about finding the slope of a 2D bitmap terrain I now need to know the best way of finding the point on the 2D terrain that the missile hit. Obviously, I can see if any pixels under the missile intersect terrain, but say it has moved quite deep into the terrain.

What is the best way to step back to find where it initially collided? I could move back X pixels at a time towards the missile's previous position, but what would be a good value of X? And is there a smarter way? Maybe moving half the distance, then a quarter etc?

sentences:
UE4 "get" and "set" component without using an actor specific reference i'm using Unreal Engine 4 and I want to get the variable mode from some actors by referencing them but the only option that i can find in the menu is actor specific like this.

So what i want is a version of the component in my image that is not "Target H1" specific. And i also need the same thing for the "set" component please. and if this is not possble can someone tell me please.

sentences:
My VBO is always empty I'm trying to render an obj file with a VBO but I have some problems. I have a Renderer object that has a method "setPositions()" that simply stores some data from a QVector to a VBO. The render part is in another method. I couldn't render anything, so I wanted to check if the array was really copied in the VBO. Instead of working on the Qvector, I wrote this simple code to make some test to render a simple square. As you guessed, the bufferSize variable is still at 0, and I have no render.

     /* setPositions() */
     float vertices[] ={
          0, 0, 0,
          100, 0, 0,
          100, 100, 0,
          0, 100, 0
     };
     glGenBuffers(1, &pos); // Gluint pos : class attribute

     glBindBuffer(GL_ARRAY_BUFFER, pos);

     glBufferData(GL_ARRAY_BUFFER,
                   12 * sizeof (float),
                   NULL,
                   GL_STATIC_DRAW);
     glBufferSubData(GL_ARRAY_BUFFER,
                      0,
                      12 * sizeof (float),
                      &vertices[0]);

     int bufferSize = 0;
     glGetBufferParameteriv (GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &bufferSize);

     if (bufferSize != (12*sizeof(float)))
     {
          glDeleteBuffers (1, &pos);
          std::cout << "sizes mismatch. Buffer: " << bufferSize << " Array : " << 12*sizeof(float) << std::endl;
     }

     glBindBuffer (GL_ARRAY_BUFFER, 0);

     /* render() */
     glBindBuffer (GL_ARRAY_BUFFER, pos);

     glEnableClientState (GL_VERTEX_ARRAY);

     glVertexPointer (3, GL_FLOAT, 0, BUFFER_OFFSET (0));

     glDrawArrays (GL_QUADS, 0, 4);

     glDisableClientState (GL_VERTEX_ARRAY);

     glBindBuffer (GL_ARRAY_BUFFER, 0);

Does somebody have an idea ?

sentences:
ECS, databases, XML and serialization My entity/component/system engine is coming along quite nicely; I have two very different apps working on the same executable. (One 2-d scroller, one 3D Asteroids-type game).

In the interest of getting something working, I've been creating XML definitions of the games, and editing them using a small custom tool that does little more than ensure that I don't add components that don't exist, and that the files are valid XML.

I'm at something of an apex or flection point in that the tools and process I'm using really aren't suitable for production.

Hand-editing large XML files is an error-prone, painful process. (JSON is well supported and pithy, but still requires visual syntax checking.) I could switch to a database such as SQLite, but I have yet to find a good graphical interface (something along the lines of SQL Server Management Studio would be nice).

Are there any COTS tools that can ease this process? I found a C# SQLite implementation with a basic ORM, but it doesn't support complex types like Vector3 or Rectangle. I can serialize these into strings or edit the ORM code to support those types, but then I wind up with my own branch of an OSS component which invites maintenance headaches further down the road.

Another thought was to just do everything in SQL Server and generate the XML from there, and have a tool that keeps the DB schema in sync with the component types in my engine, which is similar to using an ORM.

What's a good solution for this problem? I've read that bigger studios (as in, more than one guy) build their own tools for this kind of thing. I can do that, but I'd really rather be writing my game than building a tool set that only I will ever see.

To clarify: how do those that use entity/component/system engines create and maintain their data that defines the game?

sentences:
Using sky for indirect lighting - should I remove the sun? I'm attempting to achieve slightly more realistic ambient lighting in outdoor scenes using the sky cubemap.

When rendering an object, I first calculate the direct lighting contribution using standard phong diffuse and specular shading from each light source. In outdoor scenes, this is usually a directional light used to model light from the sun.

I then add in the indirect diffuse lighting contribution by sampling a high mip level of the sky cubemap at the normal to the surface. However, it recently occurred to me that, since my sky cubemaps contain the sun, I am actually including the contribution from the sun twice! I'm introducing a directional light to model the sun in the direct lighting stage, then introducing further lighting from the skybox itself.

My question is this: Should I modify my sky cubemaps so that they don't include the sun, or should I just remove the directional light instead?

sentences:
State Machine with State per Entity I have a generic state machine implementation like this:

public abstract class State<TOwner>
{
    public virtual void OnEnter(TOwner owner) { ... }

    public virtual void OnExit(TOwner owner) { ... }
}

public sealed class StateMachine<TOwner, TState>
    where TState : State<TOwner>
{
    public TState CurrentState { ... }
}

Usage looks a bit like this (more or less):

public abstract class SoldierState : State<Soldier>
{
    public abstract void Update(Soldier owner, GameTime gameTime);
}

public class RestState : SoldierState
{
    public static readonly RestState Instance = new RestState();

    private RestState()
    {
    }

    public override void Update(Soldier owner, GameTime gameTime) { ... }
}

public class Soldier
{
    private readonly StateMachine<Soldier, SoldierState> state = ...;

    public void Update(GameTime gameTime)
    {
        this.state.CurrentState.Update(this, gameTime);
    }
}

Importantly, notice how my state classes are singletons. This means every soldier will share the same SoldierState instances.

This is fine until I need to store state per soldier. For example, suppose I want to ensure that soldiers remain in the rest state for a minimum of 10 seconds. That means that any soldier that enters the rest state needs to have an associated piece of data tracked for it.

I could just use a dictionary:

public class RestState : SoldierState
{
    ...

    private readonly IDicionary<Soldier, TimeSpan> restTimes = ...;

    public override void Update(Soldier owner, GameTime gameTime)
    {
        TimeSpan restTime;
        restTimes.TryGetValue(owner, out restTime);
        restTime += gameTime.Elapsed;

        if (restTime > TimeSpan.FromSeconds(10))
        {
            soldier.State = FightingState.Instance;
            restTimes.Remove(soldier);
        }
        else
        {
            restTimes[soldier] = restTime;
        }
    }
}

However, I'm concerned about the efficiency (or lack thereof) here. Is there a better way to achieve what I want? Would I be better off having state instances per entity instead of trying to use singletons?

sentences:
My app crash using OpenAL but only in Release Mode I'm building up a complete game engine so, basically, it integrate a sound system. The problem is that a line make me crash in my code. The strange thig is that my app crash ONLY when I compile using Release mode, in Debug Mode it run just fine.

I'm using MSVC 16.XX (I don't know exact version, but it is the latest at the time I am asking this question)

(language used is c++)

void PSound::GetDevice()
{
    const ALchar* DeviceList = alcGetString(NULL, ALC_DEVICE_SPECIFIER); //This Line make app crash

    if(DeviceList) {
        while(strlen(DeviceList) > 0) {
            Devices.push_back(DeviceList);
            DeviceList += strlen(DeviceList) + 1;
        }
    }
}

sentences:
crashing generating fire-balls(bullets) with Box2D I got crash, making fire-balls as bullets.

I guess I should not use   "private Array fireballs" in player class.
it seems like when I add one more fire as index of 1 into the list, the first index does not look working on destroying in for loop in player class.
it seems only destrying index of 0.

in playscreen class,

 public void handleInput(float dt){
       if (Gdx.input.isKeyJustPressed(Input.Keys.SPACE)){
            playerBlue.fire();
        }

in player class,

private Array<FireBall> fireballs;
public void update(float dt) {
  for (FireBall ball : fireballs) {
        ball.update(dt);
        if (ball.isDestroyed())
            fireballs.removeValue(ball, true);
    }

 }
public void fire() {
    fireballs.add(new FireBall(screen, b2body.getPosition().x, b2body.getPosition().y, Blue.runRightSide ? true : false));

}

in fire class,

public class FireBall extends Weapon {
private TextureRegion fireball;
private float rotate;
public FireBall(PlayScreen screen, float x, float y, boolean rightside) {
    super(screen, x, y, rightside);
    fireball = new TextureRegion(screen.getAtlas().findRegion("fireball"),0,0,40,40);
    setRegion(fireball);
    setBounds(getX(),getY(),getWidth()*2,getHeight()*2);

}

@Override
protected void defineWeapon() {
    BodyDef bdef = new BodyDef();
    bdef.position.set(rightside ? getX() + 12 / AlienAdvantrue.PPM : getX() - 12 / AlienAdvantrue.PPM, getY());
    bdef.type = BodyDef.BodyType.DynamicBody;
    if (!world.isLocked())
        body = world.createBody(bdef);//?
    FixtureDef fdef = new FixtureDef();
    CircleShape shape = new CircleShape();
    shape.setRadius(3 / AlienAdvantrue.PPM);
    fdef.filter.categoryBits = AlienAdvantrue.FIREBALL_BIT;
    fdef.filter.maskBits = AlienAdvantrue.GROUND_BIT
            |AlienAdvantrue.Enemy_Head_BIT
            |AlienAdvantrue.BRICK_BIT
            |AlienAdvantrue.COIN_BIT
            |AlienAdvantrue.Enemy_BIT;

    fdef.shape = shape;
    fdef.restitution = 1;
    fdef.friction = 0;
    body.setLinearVelocity(new Vector2(rightside ? 2 : -2, 2.5f));
    body.createFixture(fdef).setUserData(this);

}

public void update(float dt){
    stateTime += dt;
    rotate +=100; // flip faste// ?
    rotate(rotate);
    setPosition(body.getPosition().x - getWidth() / 2, body.getPosition().y - getHeight() / 2);

    if((stateTime > 3 || setToDestroy) && !destroyed) {
        world.destroyBody(body);
        destroyed = true;
        stateTime=0;
    }
    if(body.getLinearVelocity().y > 2f)
        body.setLinearVelocity(body.getLinearVelocity().x, 2f);
    if((rightside && body.getLinearVelocity().x < 0) || (!rightside && body.getLinearVelocity().x > 0))
        setToDestroy();
}

}

sentences:
Backface culling without light leaking through I want to be able to see through walls, so to do this I used planes for the walls, and enabled backface culling. However with shadow mapping I have a lot of light leaking through:

I read that using a thick wall solves this, so I did just that. This solved the leaking light:

but now I cannot see through the walls (camera is within the room in the above screen), all the backfaces are inward.

How could I prevent light leaking, as well as enable seeing through the walls?

sentences:
Most efficient way of drawing a lot of cubes OpenGL ES I have to draw a lot of cubes in my OpenGL programme for android. All the cubes have the same size but different colors. I know that calling glDrawArrays is expensive operation so I should call it less as possible. But as I know I have to call it 6 times (one per each side) and since I have more than 500 cubes it's not efficient at all. Does anyone have the idea what to do?

Btw, I am using OpenGL ES 1.0.

I saw that I can use one big VBO but I don't know how to do that.

sentences:
OpenGL: How to render a "shadow" for an object that's behind another? First off, an image from Fez that depicts the effect I'm after:

I'm trying to achieve a similar effect in my project. I'm quite certain this is done with a stencil buffer, but the resources on such effect are scarce. How should I approach this? I'm guessing I'm after a sort of "AND" stencil where I'd render a semi-transparent black rectangle over the player where only the pixels that had both the player and a map object.

I'm not sure if it has any effect on it (besides maybe inverting the stencil operations..?), but for other reasons, my pipeline first renders the world and the player is rendered last.

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:
Entity interpolation with a Unity listen server How can this be done? I've implemented client side interpolation but I'm at a loss on how to implement it on a listen server. In order for the listen server player to see the same thing as the clients, it needs to display it's past positions.

The problem with this is, as far as I know, there's no way to specify positions for rendering and positions for collision and everything else in Unity. transform.position is used for everything. Is there a way to draw in a different position?

sentences:
Why does my object "jump" immediately as the game starts? I'm having a problem where, when I start my game, my game object (a 3D plane) immediately jumps 300 pixels or so. I suspect this has something to do with my joystick handling code that I've written to move this game object:

 xMin1 += Input.GetAxisRaw("LeftRight");
 yMin1 += Input.GetAxisRaw("UpDown");

 //_targetPlane is my game object
 _targetPlane.transform.position = new Vector3(xMin1, yMin1, 2.5f);

The object jumps even if I don't touch the joystick. Am I doing this wrong?

sentences:
Side Menu using Libgdx I want to make it so that when the player presses start, a side menu slides out and gives a player some option on one side of the screen, similar to Angry Birds or Pokemon. I'm not sure how to go about doing this but I think its somthing like putting an if statement in the render method?

render(){
     if(menuVisible){
     //draw menu?
     }
}

I'm fairly new to libgdx so I do not know how to use it to its fullest extent yet.

sentences:
Unity: Record real time game play in high quality using offline rendering? I'm looking to record Unity gameplay at really high quality (360 Stereo 8k 120 fps). I can't do this in real time due to the GPU resources required so I need to do offline rendering (frame perfect rendering).
The problem is offline rendering by its nature doesn't accept user input, so I can't record live gameplay footage. I'm looking for a solution that lets me record live gameplay and then render it out at this higher quality.
I considered recording the user input or the gameobjects properties and then playing them back while rendering the footage. I tried a number of assets like Ultimate Replay 2.0, Record and Play, GameObject Recorder, even tried Unity Recorder to an animation but none of them record all of the changes to components on a gameobject. I think I'll have to write my own code, although I'm not sure what the best method would be, I'm reluctant to sink to much development time into this if there's an easier solution that I've overlooked?
Initially I'm looking for a solution that works inside the Unity editor but would love to be able to give this ability to end users.

sentences:
Unity 5 Standard Assets for Linux / Ubuntu Unity recently has released Unity3D Editor for Linux machines. But in its website there is no support for Linux / Ubuntu. As of Unity 5 standard game assets have been removed from the editor itself and should be installed apart.

For installation I should follow these steps:

http://unity3d.com/get-unity/download?ref=personal
Additional Downloads
Standard Assets

But there are only options for Windows and OS X, nothing for Linux. So what should I do? Is it possible to do it manually?

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:
Blender to UE4: Custom rig has bones ending up in the wrong place I'm trying to create a custom mesh and rig in stock Blender 2.8 and export it via .fbx to stock UE 4.23. Unfortunately, the bones of the skeleton end up in entirely the wrong place.

In short, the bones behave strangely. From what I can tell, the child of the root bone seems to fold into the root, dragging along all its own children. The weirdest part about this is that everything works perfectly fine in UE4. The animations work and so does everything else (aside from the usual scaling woes), only that added sockets end up in the wrong place. If I try to transform any of the bones in any way, the mesh goes completely haywire.

I already watched Epic's latest stream on this topic and tried to replicate the thing from that stream, but it has the same problem. I tried renaming the Armature to "Root", having a separate root bone, having no dedicated root bone at all, moving the rig and mesh around, applying those movements, having different spots for the pivot point set, different combinations of all those, in addition to trying different Blender->UE pipeline "tricks" from earlier Blender versions like playing around with the scaling, but nothing has any effect.
From what I have gathered, renaming the Armature or messing with Blender's scaling isn't a wise choice anyway, since apparently this can cause severe problems down the road.

I'm starting to run out of ideas, hopefully somebody can help me out.

sentences:
How do i get a kniematic body to collide with my tilemap? My kinematic body does not sense collision with my tilemap.  Ive defined collision for the tilemap via the drag and drop collision boxes in the tileset.  I dont know what could be the issue.
KinematicBody2D
extends KinematicBody2D

export var max_speed = 48
export var min_speed = 16
export var acceleration = 4
var speed = min_speed

# Called when the node enters the scene tree for the first time.
func _ready():
    pass

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
    var velocity = Vector2()
    if Input.is_action_pressed("ui_up"):
        velocity.y -= 1
    if Input.is_action_pressed("ui_left"):
        velocity.x -= 1
    if Input.is_action_pressed("ui_down"):
        velocity.y += 1
    if Input.is_action_pressed("ui_right"):
        velocity.x += 1
    if Input.is_key_pressed(KEY_Q):
        speed += acceleration
        speed = clamp(speed,min_speed,max_speed)
    else:
        speed -= acceleration
        speed = clamp(speed,min_speed,max_speed)
    if velocity.length() > 0:
        velocity = velocity.normalized() * speed
    var collision = self.move_and_collide(velocity * delta)
    if collision:
        print_debug("collision")

https://github.com/MonkeyToiletLadder/godotTilemap
I'm hoping someone can download my project settings and see what the issue is. Id be happy if i got a working example from someone.  Thank you.

sentences:
Finding correct index of triangles I'm generating a basic terrain and it looks something like this:

// Load the vertex and index array with the terrain data.
    for (j = 0; j<(m_terrainHeight - 1); j++)
    {
        for (i = 0; i<(m_terrainWidth - 1); i++)
        {
            index1 = (m_terrainHeight * j) + i;          // Top left.
            index2 = (m_terrainHeight * (j + 1)) + i;      // Bottom left.
            index3 = (m_terrainHeight * j) + (i + 1);      // Top right.
            index4 = (m_terrainHeight * (j + 1)) + (i + 1);  // Bottom right.

            // Top left
            vertices[index].position = glm::vec3(m_heightMap[index1].x, m_heightMap[index1].y, m_heightMap[index1].z);
            vertices[index].texture = glm::vec2(m_heightMap[index1].tu = 0.0f, m_heightMap[index1].tv = 0.0f);
            indices[index] = index;
            index++;

            // Bottom left.
            vertices[index].position = glm::vec3(m_heightMap[index2].x, m_heightMap[index2].y, m_heightMap[index2].z);
            vertices[index].texture = glm::vec2(m_heightMap[index2].tu = 0.0f, m_heightMap[index2].tv = 1.0f);
            indices[index] = index;
            index++;

            // Top right.
            vertices[index].position = glm::vec3(m_heightMap[index3].x, m_heightMap[index3].y, m_heightMap[index3].z);
            vertices[index].texture = glm::vec2(m_heightMap[index3].tu = 1.0f, m_heightMap[index3].tv = 0.0f);
            indices[index] = index;
            index++;

            // Top right.
            vertices[index].position = glm::vec3(m_heightMap[index3].x, m_heightMap[index3].y, m_heightMap[index3].z);
            vertices[index].texture = glm::vec2(m_heightMap[index3].tu = 1.0f, m_heightMap[index3].tv = 0.0f);
            indices[index] = index;
            index++;

            // Bottom left.
            vertices[index].position = glm::vec3(m_heightMap[index2].x, m_heightMap[index2].y, m_heightMap[index2].z);
            vertices[index].texture = glm::vec2(m_heightMap[index2].tu = 0.0f, m_heightMap[index2].tv = 1.0f);
            indices[index] = index;
            index++;

            // Bottom right
            vertices[index].position = glm::vec3(m_heightMap[index4].x, m_heightMap[index4].y, m_heightMap[index4].z);
            vertices[index].texture = glm::vec2(m_heightMap[index4].tu = 1.0f, m_heightMap[index4].tv = 1.0f);
            indices[index] = index;
            index++;
        }
    }

Now If I wanted to find which grid square the player is on, we could simply (if the camera position is relative to the terrain)

    //Grid square the camera is on
    int gridX = (int)std::floor(cameraX / gridSquareSize);
    int gridZ = (int)std::floor(cameraZ / gridSquareSize);

Continuing, we know that each face consists of two triangles, and the top triangle is represented by three vertices which index corresponds to top left, bottom left and top right. The bottom triangle would then be top right, bottom left and bottom right. Now I'm having a hard time trying to find height values (y-values) at these points because if I try to do

//Top left triangle
glm::vec3(0, vertices[(m_terrainHeight * gridZ) + gridX].position.y, 0) //Top left
glm::vec3(0, vertices[(m_terrainHeight * (gridZ) + 1) + gridX].position.y, 1) //Bottom left
glm::vec3(1, vertices[((m_terrainHeight * gridZ)) + (gridX + 1)].position.y, 0) //Top right

we conclude that the top left and bottom left position will be okay, but the top right position won't get the correct index, because as it is now (if we say that gridX = 0 and gridZ = 0), the index will generate a value of 1, which is not the correct height value at that position because the index we want should be 2 (top right). So, is there a way I could write the code so I would get the correct index for the triangles of the terrain?

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:
Heightmap, how can i prevent bad odd numbers I am building my world-editor for my game. I've noticed, that, no matter how i implement the heightmap, i'll end up with dumb odd numbers in calculations.

For example, lets take a HeightMap of 4x4 which covers a area of 2x2 OpenGL-Units. Thats a small image which shows the problem. The black lines and numbers represent units in OpenGL, the red lines and numbers repesent pixel/values on my heightmap.

You can easily see, that in the top image, every number is really odd and i actually need a lot of additional code to calculate everything correctly (OpenGL-position -> heightmap-pixel and heightmap-pixel -> OpenGL-position).

In the bottom image however, i am missing height-values for the right and the bottom row of vertices.

I thought i could just use +1 pixel for every heightmap, this would solve this problem but i am sure it will introduce problems at other ends.

How would you guys handle this?

As stated in the comments, the real problem here is, that i need to calculate OpenGL-position -> heightmap-position and OpenGL-range -> heightmap-range fairly often to draw on the heightmap and the math gets really hard to handle with the mapping as seen in the top-image.

sentences:
lwjgl licence and requirements for commercial use is it completely legal to use light weight java game library in a commercial 2 dimension game engine like drag and drop not straight code?if yes what are their  requirements?if not what are my options?
thanks in advance.

sentences:
Interesting/Innovative Open Source tools for indie games Just out of curiosity, I want to know opensource tools or projects that can add some interesting features to indie games, preferably those that could only be found on big-budget games.

EDIT: As suggested by The Communist Duck and Joe Wreschnig, I'm putting the examples as answers.

EDIT 2: Please do not post tools like PyGame, Inkscape, Gimp, Audacity, Slick2D, Phys2D, Blender (except for interesting plugins) and the like. I know they are great tools/libraries and some would argue essential to develop good games, but I'm looking for more rare projects. Could be something really specific or niche, like generating realistic trees and plants, or realistic AI for animals.

sentences:
Unity: Unsharp edges I have a Unity Project and somehow the edges of objects in my Scene (Scene view and game view) look like this:

I think I already had that problem once, but in my recent projects, this didnt happen anymore.

Is there any solution to that?

sentences:
Detecting Hitbox Collisions (Rectangle) So I have some Hitboxes set up on 2 classes, HealthPickup and Player.

public static Rectangle Hitbox;

public override void Initialize()
{
    Hitbox = new Rectangle(Pos.X, Pos.Y, 32, 32);
}

That's just general code, there are other things in the classes too. So what I want to know is why this doesn't work:

// This is in the HealthPickup class' Update function.
if (Hitbox.Intersects(Player.Hitbox))
{
    Console.Beep();
}

Doesn't work if I put it in the main update function either. Am I missing something?

sentences:
glRotatef rotation never applied to 3d cube I have a floating cube that I want to rotate around the Y axis. The cube renders fine, the proper size, the proper coordinate, the proper texture/faces, etc.

However, the rotation is never applied. My update logic calculates a new rotation value, between 0 and 360.

// Set the coordinates, rotate Y axis
GL11.glTranslatef(x,y,z);
GL11.glRotatef(rotation, 0, 1f, 0);

// Each cube face rendered, etc...
GL11.glColor3f( //...
GL11.glTexCoord2f(//..
GL11.glVertex3f//..

No matter what combination I've tried, the cube never changes it's rotation.

Update Per a comment, I was using glBegin outside the glRotatef and the comment advised that I use glPush/Pop:

GL11.glPushMatrix();
    GL11.glTranslatef(x,adjY,z);
    GL11.glRotatef(rotation, 0f, 1f, 0);
GL11.glPopMatrix();

GL11.glBegin(GL11.GL_QUADS);
block.renderVertex(x,adjY,z,1,null,0.1f);
GL11.glEnd();

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:
Shader compile log depending on hardware I'm done with the core of my graphics engine and I'm testing it on every platform I can get my hands on. Now, what I noticed is that different drivers return different shader and program compile log content.

For example, on my friend's laptop if you successfuly compile a shader then the log is simply empty. However on my PC I get some useful information along with it.

So if I compile a vertex shader, I'll get:

  Vertex shader was successfully compiled to run on hardware.

Which isn't that impressive, but is what happens when I compile a program. On my friend's computer the log is empty, since the program compiles. However on my own computer I get:

  Vertex shader(s) linked, fragment shader(s) linked.

Which is awesome, because I'm attaching a geometry shader with 0 (I have a geometry shader file with trash, so it doesn't compile and the pointer is set to 0), and the compiler just tells me which shaders linked.

Now it got me thinking, if I was going to buy a graphics card, is there a way for me to get the information about whether or not I'll get this "extended" compile information? Maybe it's vendor specific? Now I don't expect an answer TBH, this seems a bit obscure, but maybe somebody has any experience with this and could post it.

sentences: Tile draws pixels from adjacent tiles Whenever I try to draw from the tile palette, this is the result. why does this happen? I have tried messing around with the palette, how the sprite editor has sliced the tiles and played around with the anchors and cell sizes, but to no avail. I found a few threads about offset tiles in the tile map, but it doesn't help at all. Any leads as to why this happens?

sentences:
Cocos 2D - Hold down CCMenuItem I am using the following code to move a CCSprite left and right.

-(id)init{
    CCMenuItemImage * moveLeftButton = [CCMenuItemImage itemFromNormalImage:@"Move Left Button.png" selectedImage:@"Move Left Button.png" target:self selector:@selector(moveLeftVoid:)];
}
-(void)moveLeftVoid{
    id moveLeft = [CCMoveBy actionWithDuration:.3 position:ccp(-10, 0)];
                [_mainSprite runAction:moveLeft];
}

This does work, but only as a single tap. What I want for the CCSprite to move continously in that direction when the CCMenuItem is held down. Then when it's released the character stops moving. If you need to see more code, please just ask. :) Thanks

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:
Sprite rotation: is it better to rotate with a quaternion or via sprite swap? Considering this question:
"In a generic game engine where you have an object sprite (e.g. Unity), is it better (in terms of performance) to implement a clockwise rotation calculating at each frame the incremented rotation (e.g. having a quaternion "q" representing a rotation of n degrees and at each frame computing newrotation = q * oldrotation) or having say 20 snapshot sprites of a complete rotation and changing the sprite at each frame (effectively a 2D animation)? "

Is there a non engine-specific answer to this question? If so, which one?

sentences: How can I make particles glow and cast light on its surroundings? Im currently attempting to make a firefly effect on a dark forest. The level has very low light and the player is one of the few light sources. To let the player see the level better, I am attempting to making glowing fireflies appear randomly on the map. One way is to use a particle system. But I cant make the particles cast light one the surroundings. Is there a way to do this?

sentences:
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded I am creating a project in Unity 5 free and using external dlls. I have a scene that is running normally within Unity but when I try to build the project as a standalone windows game I get this error which stops the build

Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0

  at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0

  at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0

  at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0

  at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0

  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0

  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0

The following assembly referenced from C:\MyProject\Assets\Plugins\MyPlugin.Unity.dll could not be loaded:
     Assembly:   UnityEditor    (assemblyref_index=3)
     Version:    0.0.0.0
     Public Key: (none)
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (C:\MyProject\Assets\Plugins\).

Could not load file or assembly 'UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
Could not load file or assembly 'UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

I guess there must be a mistake in the way the dll is loaded or something? What is causing this error?

EDIT The Visual studio projects build properly with no errors

sentences: How can I draw outlines around 3D models? How can I draw outlines around 3D models? I'm referring to something like the effects in a recent Pokemon game, which appear to have a single-pixel outline around them:

sentences:
How to make it two seconds for Time.time? var targetscript : Diamond;
var red : Color;
var orange : Color;

function Start () {
    gameObject.camera.backgroundColor = red;
}

function Update () {
    if (targetscript.score > 4) {
        gameObject.camera.backgroundColor = Color.Lerp(red, orange, Time.time);
    }
}

So right now, if the score is larger than 4 then it would change the camera background color to orange with lerp. But its too quick. I read on the internet that Time.time is 1 second. What is the alternative way but for 2 or 3 seconds? I tried this : http://answers.unity3d.com/questions/328891/controlling-duration-of-colorlerp-in-seconds.html
I tried the code for the voted answer but it didn't work. It still lerps through quickly. Does anyone have any ideas? Thanks

sentences:
Rendering a lot of Models at once with XNA In an hexgrid based game, I render all terrain tiles as a separate model, reusing the same texture objects on all similar tiles. The tiles is a pretty simple model.

When the terrain is set to be at 20x20 or more (so 400 tiles), the game really slows down. The "slowdown point" is about the same on my i5 laptop or my i7 desktop.  The game takes around 30megs in the memory. Here is how the render looks like :

The way I render each tile is the following :

foreach (ModelMesh mesh in ModelSupport.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
        effect.EnableDefaultLighting();
        effect.World = transforms[mesh.ParentBone.Index]
            * mScale * mRotationY * mPosition;
        effect.View = Camera.ViewMatrix;
        effect.Projection = Camera.ProjectionMatrix;
    }

    mesh.Draw();
}

Any suggestion of how I could optimize the rendering of a large amount of models?

sentences:
Inventory Grid Detection I'm working on creating an inventory system for a game. The inventory system will use cells and 2D images to represent items, like Minecraft, Diablo, or WoW. I've hit a bit of a snag when trying to let the player place items in the bag (click and drag style).

So far, I've successfully created the inventory grid, which is really smoke and mirrors:

public class InventoryMenu {
boolean objectSelected = false;
Item selectedItem;

public final int COLUMNS = 5;
public final int ROWS = 7;

ArrayList<Item> inv = new ArrayList<Item>((ROWS + 1) * COLUMNS);
Sprite slot;

public void render(Graphics g) {

    for (int i = 0; i < 40; i++) {
        int col = i % COLUMNS;
        int row = ROWS - i / COLUMNS;

        slot.draw(g, (Camera.width - slot.getWidth() * COLUMNS) + slot.getWidth()* col, row * slot.getHeight());

        if (inv.get(i) != null) {
            inv.get(i).render(g);
        }
    }
    if (selectedItem != null) {
        selectedItem.render(g);
    }
}

Basically, I have an arraylist that can hold items, and it just draws the "slot" image 40 times and if there's an item in that "slot" it draws the item image too. Cool? Cool. The problem comes if I want to allow the player to select an item in their inventory and move it to a different slot. I have no problem letting them pick it up (I use a pretty primitive brute force, but with any reasonably sized inventory, it works):

private Item grabItem(Point2D mouse) {
    for (Item i : inv) {
        if (i != null) {
            if (i.getPhysicsShape().contains(mouse)) {
                Item pick = i;
                selectedItem = pick;
                objectSelected = true;
                i = null;
                return pick;
            }
        }
    }
    return null;
}

That bit of code lets a player pick up an item, but placing it fails - it rarely gets the right slot, except if its the bottom row (0-4):

setDown(){
    int slotLoc = calcSlot(InputHandler.mouseCoords);
    placeItem(slotLoc);
}

private void placeItem(int loc) {
    if(loc < 0 || loc > ROWS * (COLUMNS + 1))
        return;

    int col = loc % COLUMNS;
    int row = ROWS - loc / COLUMNS;
    selectedItem.pickUp((Camera.width - slot.getWidth() * COLUMNS) + slot.getWidth() * col, row * slot.getHeight());

    inv.set(loc, selectedItem);
    selectedItem = null;
    objectSelected = false;
}

private int calcSlot(Point2D mouse){
    int colPos = (int) (COLUMNS - (Camera.width - mouse.getX()) / slot.getWidth());
    int rowPos = (int) (ROWS+1 - (mouse.getY()) / slot.getHeight());

    if (colPos > COLUMNS || colPos < 0 || rowPos < 0 || rowPos > ROWS + 1) {
        dropItem();
        return -1;
    } else {
        return colPos + 4*rowPos;
    }

}

I'm fairly confident that the problem is in calcSlot, but I can't seem to find where. Any help would be greatly appreciated, I'm sure it's something silly.

Images!!

So, I can pick up an item with no problem, and it automatically places it in the last slot. So far, everything is gold.

I can then click that image and lift it out of the grid, and it follows my mouse (mouse is hidden by PrntScrn, but its at the top left corner of the image:

When I try to place the item by clicking in the middle of slot 33, however, it derps and places it, inexplicably, in slot 27.

sentences:
Tile slopes and jittery movement I'm trying to handle slopes in a tiles based world. I'm using basic linear interpolation to find the Y coordinate of the character based on his X position. But i have a problem, when the character move up or down the slopes the sprite is all jittery, it doesn't move smoothly and i can't figure out why.

I don't use a "true physics engine" all the engine does is AABB collision and tell when a collision occurs and let you handle the reaction. When the character is on a slope no "gravity" (Y velocity) is applied the Y position is adjusted by hand using the linear interpolation result.

Here is the linear interpolation function that i use :

float InterpolateY(Vector2 point1, Vector2 point2, float x)
{
    float x1 = point1.X;
    float y1 = point1.Y;

    float x2 = point2.X;
    float y2 = point2.Y;

    float y = y1 + (x - x1) * (y2 - y1) / (x2 - x1);

    return y;
}

I've made a webm to show you the problem (ignore the fact that the sprite sink into other tile it doesn't matter for the moment)

Link to the webm : https://webmshare.com/play/vPXLD

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:
Is this a correct backward Euler implementation? I want to simulate a mechanic object like this:

init acceleration a;
init velocity v;
init position x;
loop {
  get delta time dt;
  v = v + a*dt;
  x = x + v*dt;
}

I use the velocity (which is the derivative of position) at the end of each time step to approximate the new position. So this should be exactly what the backward euler method does.

Do I have an error in reasoning?

sentences:
Verify if a circle is completely inside a rectangle or not? I am a beginner in game development. I am using the libGDX library.

I'd like to know the best algorithm to verify if a circle is completely inside a rectangle. I tried using the the static method overlaps() of the Intersector class like this:

if(!Intersect.overlaps(ball.getBoundingCirle(), wall.getBoundingRectangle())) { // ball is a circle and wall is a rectangle
            ball.reset(midPointX, midPointY);
        }

but I won't be accurate. I have read a lot of algos for circle and rectangle collision what I want is to detect when the circle touches any of the side of the rectangle (while inside). I read this answer but it didn't help me.

sentences:
Collider inside collider in MRTK VR: Move the brain via controller while being able to click the spheres I faced a similar issue in 3d unity,
Collider inside another collider: Move the brain via mouse while being able the click the spheres
There is a box collider on the brain and individual sphere colliders on the spheres.
One of the suggestions was setting up a layer mask with the mouse, which worked surprisingly well. Now I would like to be able to accomplish the same in MRTK with Windows Mixed Reality Controllers. I need to know how to set up a similar layer mask for the pointers in MRTK so that clicks are only registered on the spheres but the brain can be rotated by click and drag.

sentences:
How do I discourage "loot from party members who are about to leave" behavior? In my RPG, I have companion characters that can potentially leave the party. A behavior I have witnessed among testers is something that I think many RPGs deal with, namely that players will strip the party members of all equipment before they leave the party. For instance:

One tester removed all gear from a companion, then talked to them and chose the "I want you to leave" dialogue option.
Another tester saw that a companion was removed from the party via a scripted event, then loaded to an earlier save, stripped the gear from the companion, then re-played the scripted event.

I want to avoid this behavior because it encourages meta-gaming/save-scumming and breaks immersion. If this were a real life group of medieval adventurers, one of the group members wouldn't be ordered to strip down to their underwear moments before being ambushed and captured.

I don't want gear to be "stuck" on a character so that it can never be upgraded (I once played an RPG where I was frustrated that my companion had mediocre armor, but I wasn't permitted to swap it for superior armor I found later).

Is there any way that I can get the best of both worlds by allowing character equipment to be improved, while preventing (or at least limiting the incentive) to meta-game/save-scum and loot characters who are about to leave?

sentences:
Replacing 4 additive sprite layers with a single shader. Just can't get it right I'm using directx9 and have 4 textures I want to draw on top of each other. if I do this:

PDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
PDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ONE);

SetTexture(0,texture1);
DrawSprite();

SetTexture(0,texture2);
DrawSprite();

SetTexture(0,texture3);
DrawSprite();

SetTexture(0,texture4);
DrawSprite();

I Get EXACTLY the cool effect i want. but I suspect this level of blatant overdraw is inefficient. I'm sure this can be compressed into a single draw call somehow, and run faster. The trouble is, everything I try does not look the same, whether I try a fixed-function muyltitexturing approach setting the 4 textures as different texture stages, or whether I try to implement it inside an fx file as a shader. Nothing has the same effect.

Is it even possible?
I'm guessing within a shader it could be done by just mulitplying the sampled texture at each stage with the current screen value, but tbh I'm not sure if that is accessible to the shader (or how).
My current code works, but it bugs me I'm drawing 4 huge textures separately :D

sentences:
Multiple pipelined game loops I am considering using the following game engine design pattern, but I am unsure if it's a good idea or not:

Each major task (drawing, physics, logic, networking, disk I/O) will have its own isolated thread or subprocess
Each of these threads can be put to sleep if it is running too quickly, so as to not consume an excess of CPU resources
Threads can only talk to each other through some well-defined interface to avoid messy, buggy, thread-unsafe conditions from occurring
This approach enables parallelism and scalability, but causes a thread safety problem: what if one thread is accessing data that another thread is currently processing?
We could introduce fine-grained locking, but it still can't be guaranteed that the collective states of all of a thread's data objects are coherent.
To solve this, collections of objects are maintained inside state objects, and state objects are double-buffered. The intent of this is to ensure that other threads only see a valid, coherent set of data. If one thread happens to be processing data that another thread wants to read, then the other thread reads from a buffered state, which is guaranteed not to be written to.
However, buffering these states introduces a delay where one thread sees old data from the last cycle of the other thread.
Another problem might occur when a reading thread has a slower "tick rate" than a writing thread: the writing thread may have flipped the state buffer multiple times, while the reading thread is still processing one "tick" using the same state. However this can be solved using OO references.
Pipelining should be achievable using this approach, because the draw thread could be drawing information that entered the pipeline 30 milliseconds ago, while more information is being processed
Ultimately, what I'd like to see is completely decoupled processing for all of the tasks in a game, implemented in a way that helps leverage multi-core environments, and maybe leaves some future expansion room for scaling the server side of things amongst multiple machines. I am aware that this is probably overkill for most purposes :-)

What are the criticisms or pitfalls of this approach? Is this the "right" way to do things? Am I thinking about this backwards?

sentences:
Load character instead of load level I have some trouble finding out how I can load my character at the start of the level, instead of resetting the whole thing. The game mechanics are quite straight forward; don't touch the walls. If the player touches the walls, he "pops" (seeing as it is a balloon.)

This is my current script:

public class playerSpawner : MonoBehaviour {

public Sprite charAlive, charDead;
public AudioClip popAudio;

void  OnCollisionEnter2D (Collision2D col ){

    if (col.gameObject.name == "dirtWalls") {
        AudioSource.PlayClipAtPoint(popAudio, transform.position);
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        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
    yield return new WaitForSeconds(3/2);
    Application.LoadLevel ("untitled");
    // LOAD LEVEL RESETS EVERYTHING, MAKE LOAD CHAR INSTEAD?
}

}

How can I just respawn the player object instead of resetting the whole scene?

sentences:
Is Unity's Random seeded automatically? I seem to recall Unity's Random is automatically seeded; checking the documentation it doesn't say it outright, but a certain interpretation of their words might seem to imply it.

  The seed is normally set from some arbitrary value like the system
  clock before the random number functions are used. This prevents the
  same run of values from occurring each time a game is played and thus
  avoids predictable gameplay. However, it is sometimes useful to
  produce the same run of pseudo-random values on demand by setting the
  seed yourself.

(emphasis added)

sentences:
How can I implement a command system for a point-and-click style adventure game? I'm making a point and click adventure game, and I'm currently trying to figure out the best way to implement a command system.

Assume a Monkey Island or Maniac Mansion style interface, with a palette of verbs, and objects in the scene and in the inventory. Clicking on these, you build up a sentence to execute.

for example, you might click look at and then a tree to get "look at tree" or click on an apple, and then give, and then a girl, to get "give apple to girl".

There are three possible forms of a sentence:

verb, for example "save"
verb noun, for example "pick up apple", "look at octopus"
verb noun noun, for example "give pickle to rabid dog", "use crowbar with pickle jar"

In different situations, I'll want the action to be carried out to be defined by different objects.

For example, for the give verb, there might be a default action defined that makes the character say something like "I'd prefer to hang on to that", or the rabid dog might define an action where it eats anything you attempt to give it.

If the interface is to work like Maniac Mansion, then you build the sentence, and then tell it to execute (in Maniac Mansion, by either clicking the sentence, or clicking again on the last thing you clicked on).

If it's to work like Monkey Island, the sentence executes as soon as it's complete, which poses a problem for verbs like use which might sometimes take one noun, and other times two.

So how would you implement a system that handles this?

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:
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:
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:
Custom List Editor dependent on data from separate class's data I want to make a custom inspector that I'm not really sure how to approach. The idea is I have a quest framework with a class that holds onto the quest data and another class that is intended to hold onto dialogue data. The quest system is agnostic of my dialogue system.

I want to be able to display the quest and dialogue data this way:

QuestName0

DialogueGiveQuest (TextAsset field)
DialogueQuestIsActive (TextAsset field)
DialogueQuestIsComplete (TextAsset field)

QuestName1

DialogueGiveQuest (TextAsset field)
DialogueQuestIsActive (TextAsset field)
DialogueQuestIsComplete (TextAsset field)

etc...

Here's a pseudocode class layout

public class QuestData : MonoBehaviour
{
    List<Quest> quests;
}

public class DialogueData : MonoBehaviour
{
    public TextAsset dialogueGiveQuest;
    public TextAsset dialogueQuestIsActive;
    public TextAsset dialogueQuestIsComplete;
}

public class Interaction : MonoBehaviour
{
    QuestData questData;
    List<DialogueData> dialogueData;
}

[CustomEditor(typeof(Interaction))]
public class InteractionEditor : Editor
{
    public override void OnInspectorGUI()
    {
        var interactionData = (InteractionData)target;
        //foreach interactionData.questData.quests
          // draw quest name
          // make sure there's a dialogueData element for each quest
          // draw field for each DialogueData
    }
}

An obvious issue is dialogueData doesn't care about what's going on with questData.quests so if the inspector were to draw normally it would display 2 lists. I'd like the dialogue data to add and remove elements to itself depending on the quest data but that sounds like it be a real challenge to serialize.

sentences:
Where is Advertisement.Banner class in Unity Advertisement v2.3.1 package? I'm implementing Unity Ads in my game, now i'm using Advertisement package v2.3.1 from package manager. I set up rewarded and video ad, but can't do anything with Banner ads.

I set up id in a project dashboard and just call Show function with banner placement id.

private IEnumerator ShowBannerWhenReady()
{
    while (!Advertisement.IsReady(bannerPlacementId))
    {
        yield return delay;
    }
    Debug.Log("Showing Banner");
    ShowOptions options = new ShowOptions {resultCallback = HandleBannerShowResult};
    Advertisement.Show(bannerPlacementId, options);
}

As for unity documentation Advertisement namespace have Banner class, but i don't see it in my project. So on android build i don't see any banner or smth, other ads work as expected.

sentences: What C++ containers should I use for my UI elements? I am writing some UI stuff for my games in C++. Basically its a very common problem, but I dont know the best answer yet. Suppose inside my UI Library I have a view class which renders 2D/3D scene. This view can contain many subviews. I needs a container which allows me to iterate over these views fast and also insert/delete subviews. I am not sure which container is best for the job - list, vector or something else?

sentences:
Calculating surface normal numerically Say I have a 2D surface defined with the use of bitmap.

I want to use this bitmap for collision detection (white color is where object can move freely, with black I mark the walls).

How can I numerically calculate the surface normal vector at given point?

For example, in the attached picture, how can I calculate the surface normal vector for the red point?

sentences:
Framerate is affecting speed of object I'm experimenting with building a game engine from scratch in Java, and I have a couple questions. My main game loop looks like this:

        int FPS = 60;
        while(isRunning){
            /* Current time, before frame update */
            long time = System.currentTimeMillis();
            update();
            draw();
            /* How long each frame should last - time it took for one frame */
            long delay = (1000 / FPS) - (System.currentTimeMillis() - time);
            if(delay > 0){
                try{
                    Thread.sleep(delay);
                }catch(Exception e){};
            }
        }

As you can see, I've set the framerate at 60FPS, which is used in the delay calculation. The delay makes sure that each frame takes the same amount of time before rendering the next. In my update() function I do x++ which increases the horizontal value of a graphics object I draw with the following:

bbg.drawOval(x,40,20,20);

What confuses me is the speed. when I set FPS to 150, the rendered circle goes across the speed really fast, while setting the FPS to 30 moves across the screen at half the speed. Doesn't framerate just affect the "smoothness" of the rendering and not the speed  of objects being rendered? I think I'm missing a big part, I'd love some clarification.

sentences:
Map scrolling around the world I am developing an TBS (turn based strategy) game. I have created a simple canvas renderer to render hexagonial map. I already implemented scrolling on the map. My current problem is that I want to make it like in the civilizations games that you can scroll around the world. But I am kind of stuck on how to implement that. I had the idea of checking if a tile was rendered and if there is still space to the left render next sibling and so on, but this would turn out into long loops. My map array (2d) holds all the tiles and every tile has a member which holds all the siblings. How would you solve this?

This is a screenshot from the example. You can check it out on http://civ.minerjs.com. The code is also available to browse on the site using developer tools. Thanks for reading!

sentences:
How do I destroy a Unity prefab when it goes off-screen? I made an infinite path using prefab.Path moving in the negative x direction. I want to destroy the path clone once it goes offscreen.

My path move script is:

var Speed:float = 5;
var hasseen:boolean;
function Start () {
    rigidbody2D.velocity.x = -1 * Speed;
    hasseen=false;
}
function Update() {
    if(renderer.isVisible) {
        hasseen=true;
    }
    if(hasseen) {
        if(!renderer.isVisible) {
            Destroy(gameObject);
        }
    }
}

and my prefab script is this:

var path_pre:Transform;
var i:long = 0;
function Update() {
    if(i<1000000) {
        Instantiate(path_pre, Vector3(i*25, -3, 0), Quaternion.identity);
        i++;
    }
}

sentences:
How to find the optimum path, on a road, for a car? For the moment I have an AI car, that follows points (let's call this Waypoints), that I built by myself.

Of course, it's not optimal because of my poor human hand, and car knowledge.

After this drawing, I put waypoints (about 80) on this red line, and my car is able to follow it (and dodge other cars, but that's another story).

But... It's not perfect: I read some articles, but I don't know how to  implement the generation of the perfect path..

http://www.drivingfast.net/techniques/racing-line.htm (speaking about an 'Apex', but I don't know how to find this particular point)
"Searching for the Optimal Racing Line Using Genetic Algorithms" (too complicated for my little game)

sentences:
Best source for sound effects? What is a good source for sound effects for use in an indie game production (C#, XNA)?

The sounds do not need to be free.
They, however, should have a clear licence for commercial use.
The website should allow for searching, browsing and preview (or better: pre-listening).

I already had a look at http://www.1soundfx.com but their collection is not too large. I am specifically looking for sound effects. No music and no ways to make my own sounds.

All help is greatly appreciated!

sentences:
How can I tile Perlin noise to more accurately represent a world map? I'm currently working on my game.
I would like to generate the world map with Perlin noise, and wrap it just like a real world map.
I've found a algorithm to create a map wrapped along X and Y axis:

Procedurally Generating Wrapping World Maps

The problem is that this map have no linear equator and poles. If you cross the north pole, you will end up in the south. A realistic map should be like this:

So when you cross the north pole you end up at the opposite longitude. So when you get an arial view of this flat map, you get something like this:

The problem is that I don't know how to generate a perlin noise that repeat itself like this. In the website I linked, they use a 4D Perlin noise. But I still can't figure out how to use it for my case.
Here is the code used in the link:

for (var x = 0; x < Width; x++) {
    for (var y = 0; y < Height; y++) {

        // Noise range
        float x1 = 0, x2 = 2;
        float y1 = 0, y2 = 2;
        float dx = x2 - x1;
        float dy = y2 - y1;

        // Sample noise at smaller intervals
        float s = x / (float)Width;
        float t = y / (float)Height;

        // Calculate our 4D coordinates
        float nx = x1 + Mathf.Cos (s*2*Mathf.PI) * dx/(2*Mathf.PI);
        float ny = y1 + Mathf.Cos (t*2*Mathf.PI) * dy/(2*Mathf.PI);
        float nz = x1 + Mathf.Sin (s*2*Mathf.PI) * dx/(2*Mathf.PI);
        float nw = y1 + Mathf.Sin (t*2*Mathf.PI) * dy/(2*Mathf.PI);

        float heightValue = (float)HeightMap.Get (nx, ny, nz, nw);

        mapData.Data[x,y] = heightValue;
    }
}

I'm currently using spherical coordinates, but the map is distorded at the poles.

sentences:
Error compiling irrlicht android using ndk in Mac I'm new to irrlicht and I have started with irrlicht android port. I have made the following changes to android.mk file:

LOCAL_CFLAGS := -O3 -DANDROID_NDK -DDISABLE_IMPORTGL -I./../include/ -I./include/ -I/documents/karthik/android/android-ndk-r9/platforms/android-18/arch-arm/usr/include

LOCAL_LDLIBS := -L/documents/karthik/android/android-ndk-r9/platforms/android-14/arch-arm/usr/lib/libGLESv1_CM.so -ldl -llog -L/documents/karthik/android/android-ndk-r9/platforms/android-14/arch-arm/usr/lib/libGLESv1_CM.so

I have tried compiling irrlicht android using ndk-build in terminal.It showed the following errors at first:

In static member function 'static void irr::os::Printer::log(const c8*, irr::ELOG_LEVEL)':
error: format not a string literal and no format arguments [-Werror=format-security]
In static member function 'static void irr::os::Printer::log(wchar_t const*, irr::ELOG_LEVEL)':
 error: format not a string literal and no format arguments [-Werror=format-security]
In static member function 'static void irr::os::Printer::log(const c8*, const c8*, irr::ELOG_LEVEL)':
error: format not a string literal and no format arguments [-Werror=format-security]
In static member function 'static void irr::os::Printer::log(const c8*, const path&, irr::ELOG_LEVEL)':
error: format not a string literal and no format arguments [-Werror=format-security]
make: *** [obj/local/armeabi/objs/irrlicht/os.o] Error 1

and then I googled that and made changes in os.cpp file as follows:

Changed the code,

__android_log_print(ANDROID_LOG_INFO, "log", message);

to

__android_log_print(ANDROID_LOG_INFO, "log","%s", message);

This change solved that issue, and then I got another error:

In file included from jni/importgl.cpp:55:0:
jni/importgl.h:37:22: fatal error: GLES/egl.h: No such file or directory

Again I changed GLES/egl.h to EGL/egl.h and solved that issue, got:

fatal error: irrlicht.h: No such file or directory

I even solved this , atlast I'm here with this error:

error: 'EglDisplay' was not declared in this scope
error: 'EglSurface' was not declared in this scope
error: 'EglWindow' was not declared in this scope
error: 'EglContext' was not declared in this scope

sentences:
share distribution question I just developed a facebook game(mifia like), but the graphics I made are not good, because it is reference with some existing photo, trace with AI, and coloring it.

Therefore, I invited my friend to join me, he is a graphic designer, owns a company with his friend (I know both of them), for the shares, I expect at least 70% for me, and at most 30% for them (both of them want to join).

Therefore, they give me a counter offer, 60% for me and 40% for them, of course, I feel their counter offer is unacceptable because they only build the image in part time, and all the other work just like coding, webhosting...etc, is what I do in full time. Why they said they worth 40% is that they will make a good graphic, they can provide a advertise channel(on local magazine), etc... Actually, I don't think the game need advertisement on local magazine because the game is not target for local...

Please give me some comments on this issue (is the share fair? what is the importance of the image of the game, is it worth more than 30%), or can anyone share the experience on this.

sentences:
Level Modeling Workflows in Maya for Unity I'm wondering what the standard workflow for modeling static levels for Unity (or for that matter, other High-Level engines) is? My somewhat limited knowledge tells me that the best process is modeling the entire static level in Maya, texturing, then baking AO and some static lighting into the scene, then importing the single level asset into unity to add dynamic objects.

Is there another way that I should be doing this that is more efficient in a performance sense or from a workflow point of view?

I know the question is somewhat open ended, but generally i'm asking what the standard workflow for level modeling is.

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:
Why doesn't my orbit form an ellipse? I'm playing around and trying to build an orbit simulator. Unfortunately, it isn't working out to well. Instead of forming some sort of elliptical orbit, I get this:

Here is the code I'm using to generate the orbits:

public class OrbitBehaviour : MonoBehaviour {
    public Double Mass;
    private List<GameObject> _bodies = new List<GameObject>();
    private float _gravConstant = 6.673f * Mathf.Pow(10.0f, -11.0f); // Units: m3 kg-1 s-2
    private int delay = 0;
    private float _distanceConversion = 6.68458712f * Mathf.Pow(10.0f, -12.0f); // m -> AU (Astronomical Units)
    private float _massConversion = 1.67403241f * Mathf.Pow(10.0f, -25.0f); // kg -> E (Earth masses)
    private float _timeConversion = 1.1574074074074074074074074074074e-5f; // s -> D (Days)

    // Use this for initialization
    void Start() {
        _bodies = GameObject.FindGameObjectsWithTag("mass").ToList();
        _gravConstant *= Mathf.Pow(_distanceConversion, 3.0f);
        _gravConstant /= _massConversion;
        _gravConstant /= Mathf.Pow(_timeConversion, 2.0f);
        gameObject.GetComponent<Rigidbody>().AddForce(Vector3.left * 10f);
        Mass = Mass * _massConversion;
        Time.timeScale = 99.0f;
    }

    // Update is called once per frame
    void FixedUpdate() { StepSimulation(); }

    private void StepSimulation() {
        // Walk each body in the system
        foreach (GameObject body in _bodies) {
            if (gameObject == body) {
                continue; //skip self
            }
            Vector3 tSeparationVector = body.transform.position - gameObject.transform.position;
            tSeparationVector = tSeparationVector.normalized;
            OrbitBehaviour bodyBehaviour = body.GetComponent<OrbitBehaviour>();
            Double tForceValue = _gravConstant * (this.Mass * bodyBehaviour.Mass / tSeparationVector.sqrMagnitude);
            gameObject.GetComponent<Rigidbody>().AddForce(tSeparationVector.normalized * (float)tForceValue);
        }
    }
}

Does anyone know what I am doing wrong here?

sentences: RK4 integration and Continuous Collision Detection I'm using this method to detect collision between two AABBs. The algorithm is simple, fast and works great. It uses the relative velocity between the two objects to calculate TOI. This works fine with Euler, but now i'm trying to switch to RK4, which makes it hard for me to determine the TOI since i can't just divide the distance between the two AABBs by their relative velocity. Since RK4 is so popular, how do people deal with this issue? How to calculate a TOI for a swept AABB with RK4?

sentences:
How can I modify a static humanoid asset? I am new to Unity 3D. I bought an asset from the Unity Asset Store recently. It came in a "walking" stance. I was wondering if it was possible to modify this stance to become fully supine; so can I modify the legs so that they are straight and next to each other?

I am not sure if I can do this or not in Unity, or if I have to download Blender or Maya to do this.

I have already tried forcing a stance change, through vertex snapping, but I am not having any luck with that. I have also tried editing the Character Joint settings, but I think that is if I wanted to animate the model, which I don't.

This is what my character looks like currently:

I edited the character as per DMGregory's suggestion, but I am having trouble reimporting it back into my scene:

sentences:
Spherical coordinate from cartesian coordinate I am implementing a type for Ogre 3D rendering engine to provide spherical coordinates.
So far everything is working fine, until I try to build spherical coordinates from a cartesian vector.
Here is the code I am trying right now, but it's not working correctly (changing phi and theta result in only half a sphere).

/** @return a relative spherical coordinate from a cartesian vector. */
        static SphereVector from_cartesian( const Ogre::Vector3& cartesian )
        {
            using namespace Ogre;
            SphereVector result;
            result.radius = cartesian.length();
            result.phi    = cartesian.x   > Real(0) || cartesian.x   < Real(0) ? Math::ATan( cartesian.z / cartesian.x )   : Radian( Math::HALF_PI );
            result.theta  = result.radius > Real(0) || result.radius < Real(0) ? Math::ACos( cartesian.y / result.radius ) : Radian( 0 );
            return result;
        }

Here is the version currently in the repository:

static SphereVector from_cartesian( const Ogre::Vector3& cartesian )
                {
                        using namespace Ogre;
                        SphereVector result;
                        result.radius = cartesian.length();
                        result.phi    = cartesian.x   > Real(0) || cartesian.x   < Real(0) ? Math::ATan( cartesian.z / cartesian.x )   : Math::ATan( 0 );
                        result.theta  = result.radius > Real(0) || result.radius < Real(0) ? Math::ACos( cartesian.y / result.radius ) : Math::ACos( 0 );
                        return result;
                }

I have been searching for the right algorithm and I think I'm close but I can't figure out it correctly yet.
My maths skills are not so good so I'm having trouble understanding what I'm doing wrong.

Any idea how it should be done?

sentences:
Memory issues with new game on s3 I am building a new game with AndEngine and for some reason i keep getting this debug statement in the Logcat:

  01-31 21:29:50.503: I/Choreographer(697): Skipped 152 frames!  The application may be doing too much work on its main thread.

Im not really sure what is causing this error exactly during my game. I am checking a lot of collisions, but they arent initiated until after the game play scene has started.

I also noticed on my Galaxy S3 the game causes my phone to "flicker" when swiping changing home screens and pulling down the task bar at the top.

I think this error has something to do with it, but I am not sure. What do you guys think?

Also each time the user goes to another level I initialized the collision detectors all over again. But I don't unregister or stop the last collisions that were started. I thought they would be automatically cleaned up when the new one is initialized.

What do you guys think?

sentences:
How to remove large indentation in TextMeshPro? When I changed the center text with the size tag, the line height remained the same.

After I used the tag to resize:

How do I remove indentation?

sentences:
Sprites: Are there any tools to scale sprites individually without using Photoshop/GIMP? I am using TexturePacker as tool to pack my 2D sprites, it is good but it doesn't provide the possibility to scale individual sprites to a specific scale.

I am wondering whether there is any good tool or command line to scale the files in the original folder without having to use TexturePacker.

What I am trying to do is to fix some scaling errors that the illustrator that produced the files did without having to re-scale/fix things using Photoshop that is more time expensive.

sentences:
Simulation of a two-masses connected by a rod 2D system I'm working on a multitouch-based interface and I want to add some physical behavior to gestures (pan, zoom and rotation). I thought model the system like that:

When a touch starts, a point mass is created.
As the finger moves, I calculate it's velocity vector.
When the touch ends, I suppose the mass is released and starts to move freely.

My problem comes when I have two masses (I don't need more than two masses to model this system):

The masses should act as if they were connected by a massless rod and, optional, they can slide along the rod with some coefficient of friction.

I attach a picture to explain the thing better.

I forgot almost all the physics I knew at college and now I'm a developer.

I know that at time t the masses have a position (x, y), a velocity and one or more forces or accelerations acting on it. And I want to know those values at time t+dt.

I would like to have some advice or approach to this problem. It's not about integrators or numerical analysis. My main doubt is about the rod constraint (keep the distance between masses) and the rotation movement.

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:
AABB for a tile based world I'm on my way with a tiled based game. I have correctly implemented scrolling, position handling etc.

I have (before) had a simple collision system that is a really bad one, and now I'm going to switch from simple x and y checks to AABB.

The real problem isn't really about AABB itself, since I've made a simple application demonstrating the technique - it works like intended. This is for singular, independent objects that is static.

Since I know the technique and how to resolve collisions correctly I wanna apply this AABB technique to my tile world. It is now the real problem (or question?) arises.

Since the world is built on tiles and the world's objects is built together to a world, how would I implement the AABB? Before it was only for single static objects, now for a whole world. Is it possible to create a single world static object or are there any better idea out there?

Should I create a single box for every single tile in the world? It doesn't sound well, but how should I fight this problem down?

Any help is appreciated!

Comments to Nick's answer:

  Considering what you've said about how you previously had a "simple collision system that was a really bad one", I assume you want the latter.

That's correct. The previous collision system made my character get stuck in tiles and it wasn't working properly.

  So you can see how it will haphazardly overlay your four tiles. Your AABB for the object then is a rect with x=7, y=10, w=12, h=15. Let's say this is your only obstacle in the world.

I understand, I think. Does this necessarily mean I have to create a single AABB for every tile?

  You can see that due to his width and height, he now overlaps the top left of your obstacle at {7,10}. So resolve the collision. That's all there is to it.

Yep, that part I understand. For now, the world is built from a single 2D array, but is it really efficient to create an AABB for every obstacle?

Oh, I think it does not really matter if I only loop through the obstacles and tiles in the area where the player is..

sentences:
NullReferenceException when accessing variables in a 2D array in Unity I have made a class including variables in Monodevelop which is:

public class GridInfo : MonoBehaviour {

    public float initPosX;
    public float initPosY;
    public bool inUse;
    public int f;
    public int g;
    public int h;
    public GridInfo parent;
    public int  y,x;
}

Now I am using its class variable in another class, Map.cs which is:

public class Map : MonoBehaviour {

    public static GridInfo[,] Tile = new GridInfo[17, 23];

    void Start() {

        Tile[0,0].initPosX = initPosX;  //Line 49
    }
}

I am not getting any error on runtime, but when I play in unity it is giving me error

NullReferenceException: Object reference not set to an instance of an object
Map.Start () (at Assets/Scripts/Map.cs:49)

I am not inserting this script in any gameobject, as Map.cs will make a GridInfo type array, I have also tried using variables using GetComponent, where is the problem ?

sentences:
How do I resolve a sphere-triangle collision in a given direction? I am trying my hand at game physics.

I understand that the basic way to pull back a sphere when it collided is to negate the penetration distance:

// If collided...
// `distance`: distance form triangle face; a negative number
// `normal`  : triangle face, in vec3
// `position`: sphere center, in vec3
position.x -= normal.x * distance;
position.y -= normal.y * distance;
position.z -= normal.z * distance;

But I don't want to change y coordinate, while the player is on the ground like this (side view):

How can I calculate the expected translation?

I have these values:

penetration distance, as a negative number (shown in blue)
triangle face normal, as a vec3 (shown in red)
triangle vertices, as 3 vec3s

and

sphere radius, as a number
sphere center, as a vec3

Answers in any programing language are welcome!

updated Jul 17, 2014

I found a hint. It's difficult to explain, I will attach 2 more figures.
It seems, dashed lines in following figures are the translation value what I need, I guess.

and in another case

sentences:
8 directional movement - Maintain vertical position I have a top-down game that has 8 directions of movement (top/down/left/right/topright/topleft/bottomright/bottomleft).  There are sprites for each direction of movement.  This is just an example spritesheet:

The problem is when I want to retain the vertical position.  When I let go of the buttons on the keyboard, it polls the keys quickly and ends up facing the character in either left/right/up/down position depending on the last key that was released.

I added a delay for polling the keypresses, but I do not like this solution as it creates a noticeable lag.

Can anyone think of logic that would be able to allow my sprite to retain the proper direction when the keys are unpressed?  Here is the current code:

if (kbState.IsKeyDown(Keys.Up) && kbState.IsKeyDown(Keys.Left))
    character.ChangeDirection(Direction.UpLeft);
else if (kbState.IsKeyDown(Keys.Up) && kbState.IsKeyDown(Keys.Right))
    character.ChangeDirection(Direction.UpRight);
else if (kbState.IsKeyDown(Keys.Down) && kbState.IsKeyDown(Keys.Left))
    character.ChangeDirection(Direction.DownLeft);
else if (kbState.IsKeyDown(Keys.Down) && kbState.IsKeyDown(Keys.Right))
    character.ChangeDirection(Direction.DownRight);
else  if (kbState.IsKeyDown(Keys.Up))
    character.ChangeDirection(Direction.Up);
else if (kbState.IsKeyDown(Keys.Down))
    character.ChangeDirection(Direction.Down);
else if (kbState.IsKeyDown(Keys.Left))
    character.ChangeDirection(Direction.Left);
else if (kbState.IsKeyDown(Keys.Right))
    character.ChangeDirection(Direction.Right);

Edit

Settled for the following code:

float delay = 0.04f;
float DELAY = 0.04f;
....

//Get movement
delay -= (float)gameTime.ElapsedGameTime.TotalSeconds;
if (delay < 0)
{
      int vertical = kbState.IsKeyDown(Keys.Up) ? -1 : kbState.IsKeyDown(Keys.Down) ? 1 : 0;
      int horizontal = kbState.IsKeyDown(Keys.Left) ? -1 : kbState.IsKeyDown(Keys.Right) ? 1 : 0;
      movement = new Vector2(horizontal, vertical);
      delay = DELAY;
}

character.Update(gameTime, movement);

Seems I have to use a delay in order to get this to work.  Thanks for the feedback guys.

sentences:
Generating random values, keep trying till value within bounds are generated Sorry for the strange topic name, couldn´t think of a good way to describe it.
I´m basically trying to achieve the following:

I'm placing items randomly on the screen, but these items shouldn't be placed near eachother at a given distance.
This is the process I have in my head right now:

generate a random location
check if this location is not near any other objects
it is near -> start the process over to generate a new item (till it is not near anymore)

I've run into this scenario multiple times but could never think of a way to efficiently do this, while I do feel that there is a simple way to do it. Here is the implementation I have right now. I feel like I should use a while loop but I can't get my around how to do it.
The code is in AS3 but that shouldn't matter.

public function generatePlanetsFromXML(xml:XML):void
    {
        planets = new Array();

        for (var i:int = 0; i < xml.projects.project.length(); i++) {

            var planet:Planet = new Planet();
            planet.data = xml.projects.project[i];
            planet.radius = (Math.random() * 20) + 20;
            addChild(planet);
            addObject(planet);

            planets.push(planet);

            calculatePlanetLocation(planet, i);
        }

    }

    private function calculatePlanetLocation(planet:Planet, i:int):void
    {
        var randomX:int = (Math.random() * (worldwidth - planet.width)) + 20;
        var randomY:int = (Math.random() * (worldheight - planet.height)) + 20;

            //get a location that isn't close to another planet
            //keep looping till the distance is higher than minimum distance
            for (var j:int = 0; j < planets.length; j++) {

                if (i != j) {

                    var dx:int = planets[j].x - randomX;
                    var dy:int = planets[j].y - randomY;
                    var distance:int = Math.sqrt((dx * dx) + (dy * dy));

                    if (distance < minPlanetDistance) {

                        trace("retry getting location..");
                        planet.alpha = 0.3;
                        calculatePlanetLocation(planet, i);

                    }else {

                        //distance is fine, planet can be placed!
                        planet.x = randomX;
                        planet.y = randomY;
                    }

                }else if (i == 0) {

                    //first planet should always be placed
                    planet.x = randomX;
                    planet.y = randomY;
                }

            }
    }

sentences:
Implement delay using polling or threads? I'm making a real-time risk-like game in Python. Players can move armies from one region to another. I want army movement to take time proportional to the distance between the two regions, therefore I need to keep a new timer every time an army moves from one region to another (until the army arrives).

I've thought of 2 ways to do this:

One way is to have a list of moving troops and do a for loop through this list every iteration of the main server loop to check if the time is up for each unit.

Another way is to create a new thread for each moving troop and have the run() method of the thread continuously check whether the time is up yet for the unit.

Which way is better?

sentences:
Dialog/event system in Java/libGDX I hope that I'm posting this correctly as I'm new to the site, feel free to correct me if I'm in the wrong spot.

As for my issue:
I'm working on an 2D side-scrolling platformer game in libGDX, and I've run into an issue that I've considered before but never received a solid answer. Here's an example of what I'm wondering about:
In games like, say, the Legend of Zelda, when the player steps on a switch, or catches a torch on fire, this can open a door or release a monster or cause a myriad of other things to happen.

Now, I imagine that this utilizes some sort of Event-trigger relationship or messaging system, but it seems that it would be insane to hardcode all of these events into the game engine itself, even when utilizing an event-based system.

The same goes for tutorial and dialog systems: the player interacts with an NPC, or some sort of in-game object, and the dialog/tutorial continues at certain points.

In my game, I will specifically need to be able to have events triggered after a character does a certain thing, and I will need to be able to have series of dialogues triggered.  I think that I know how I could hardcode these things, but I'm going to have numerous levels that I wish to develop with a level editor such as Tiled, instead of hardcoding them.  Because of this, I don't know how I would integrate events into such a system.

My questions are: what do game programmers do to avoid hardcoding these things into their games? With something like a massive quest system with tons of dialog, or numerous levels with switches and events to trigger, how are these integrated into the game?

Thank you for any answer you can give me, I'm really stumped on this one :)

P.S. If you need any more clarity on what I'm asking for, please tell me so I can give more detail if needed.

P.P.S
I saw this post Level editor event system, how to translate event to game action but I've seen on other pages that people go back and forth on whether to use a scripting language, or some sort of file format like XML or JSON, and it's very confusing...

sentences:
score and high score system for multiple levels I'm trying to create a scoring system for a game with multiple levels. For this I'm using the binary formatter instead of playerprefs (I read online that playerprefs are not that secure). I have created the system but whats happening is that the score is not resetting to 0 when I load a new level. If in one level the score was 10 and I start some other level, the score in this level starts from 10 instead of 0. This is the code I have so far:

public class ScoreIncrease : MonoBehaviour
{
  public Text scoreTxt;
  public int score;

void Start()
{
    LoadScore();
}

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        Save();
    }
}

public void Save()
{
    score++;
    scoreTxt.text = "Score" + score;
    BinaryFormatter bf = new BinaryFormatter();
    FileStream file = File.Open(Application.persistentDataPath + "/scoreContainer.dat", FileMode.Create);

    ScoreContainer scoreContainer = new ScoreContainer();
    scoreContainer.score = score;
    bf.Serialize(file, scoreContainer);
    file.Close();
}

public void LoadScore()
{
    if(File.Exists(Application.persistentDataPath + "/scoreContainer.dat"))
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Open(Application.persistentDataPath + "/scoreContainer.dat", FileMode.Open);
        ScoreContainer scoreContainer = (ScoreContainer)bf.Deserialize(file);
        file.Close();
        score = scoreContainer.score;
        scoreTxt.text = "Score" + score;
    }
  }
}

[Serializable]
public class ScoreContainer
  {
    public int score;
  }

How can I change this so that each level has a separate highscore and all levels have a start score of 0?

sentences:
Flashing candle light What is a simple way to simulate flashing candle / torch / fire light?
I'm not asking about animating the flames, I'm only interested in the light surrounding the fire, similar to what this device does: https://www.youtube.com/watch?v=dPsVr4pU8Tg

sentences:
Batching texture to texture rendering in Unity on the gpu I'm working on a 2D sidescroller within Unity 5.1. The terrain is intended to be semi-infinite in all 4 directions, procedurally generated using a noise algorithm.

I'm using a 3x3 grid of quads as "chunks" that I shift/update as the camera pans around. The issue I'm having is related to the dynamic texture I have tied to each chunk. When they need to be created rather than just shifted around, I'm not quite sure how to render individual tiles from a single texture to specific locations on another texture without using system memory.

Using setpixels, I believe it is passing color data each apply to the gpu side. Using gui/graphics with a rendertexture to drawtexture or any variants seems to be doing individual draws per call rather than giving me the opportunity to batch them. Using the native gameobjects has FAR too much overhead considering I'm trying to make tiles only be 8x8 pixels in size (meaning higher screen res = more on-screen tiles).

So, is it possible within Unity to do a low level texture to texture render/blit/draw/whatever without pulling texture data into system memory AND still batching same material/texture calls together without having to buy some toolkit from the asset store?

If any of this doesn't make sense, please ask anything you need to be able to help me and I'll update as needed.

Thanks!

sentences:
What is the standard practice for animating motion -- move character or not move character? I've downloaded a bunch of (free) 3d warriors with animations. I've noticed for about 25% of them, the 'run' animation physically moves the character forward in the z direction. For the other 75%, the animation just loops with the characters feet moving etc., but does so in place, without changing the character's physical location.
I could fix this by:
1.) Manually updating the transform in code for this 75%, to physically move the character
2.) Alter the animation by re-recording it, with a positive z value at the end (when I did this it caused the character to shift really far away the rest of the units, probably something to do with local space vs world space I haven't figured out yet).
But before I go too far down this rabbit hole, I wonder if there is any kind of standard? In the general case, are 'run' / 'walk' animations supposed to move the character themselves, or is it up to the coder to manually update the transform while the legs move and arms swing in place? Is one approach objectively better than the other, or maybe it depends on the use case? If so, what are the drawbacks of each? I know nothing about animation, so I don't want to break convention (if there is one).

sentences:
How to detect line break in a String using UnityScript? Code:

var i:int=0;
var text:String;
var compare:String="";
var isFound:boolean=false;
function Start(){
text=AssetDatabase.LoadAssetAtPath("Assets/words.txt",TextAsset).text;
}

function Update(){
    if(!found)
   com("textToSearch");
  }

 function com(s:String){
    if(i<text.Length){
    comText=comText+text[i];
    if(//condition for line break)
    if(comText==s){
       print("found");
       found=true;
    }
   else{
         comText="";
      }
   i++;
   }

 }

In the text document each word ends with a line break. So if I just found a condition for a line break then I can easily search through the document.

sentences:
OpenGL ES 2.0: Mixing 2D with 3D Is it possible to mix 2D and 3D graphics in a single OpenGL ES 2.0 game, please?

I have plenty of 2D graphics in my game. The 2D graphics is represented by two triangular polygons (making up a rectangle) with texture on them. I use orthographic matrix to render the whole scene.

However, I need to add some 3D effects into my game. Threfore, I wish to use perspective camera to render the meshes.

Is it possible to mix orthographic and perspective camera in one scene? If yes, is there going to be a large performance cost for this? Is there any recommended approach to do this effectively? I wil have 90% of 2D graphics and only 10% of 3D.

Target platform is OpenGL ES 2.0 (iOS, Android). I use C++ to develop.

Thank you.

sentences:
Colour values of a pixel array from a spritesheet image wrong (C++, SDL2) So basically what i want to do is create a 2D tile based rendering system in C++ that renders each pixel on the screen manually.
Rendering an individual pixel on the screen works just fine (or render the whole screen blue for example).
But i want to load the individual pixel colours of my sprites out of a spritesheet image and heres my problem:

I am able to create the image and access the pixels of the image, however the individual pixel values seem to be wrong. (I compared the pixel values with the supposed hexadecimals on paint.net)

Heres my code for the spritesheet:

    SpriteSheet::SpriteSheet(std::string path, int tileWidth, int tileHeight)
    :
    path(path),
    tileWidth(tileWidth),
    tileHeight(tileHeight)
{
    image = IMG_Load(path.c_str());

    if (image != NULL){
        width = image->w;
        height = image->h;
        pixels = (Uint32 *) image->pixels;
        std::cout <<std::hex <<  pixels[17] << std::dec << std::endl;

        //this prints out: 3030303 when it should be FF007F46

    }
    else{
        std::cout << "SpriteSheet couldnt be loaded!" << std::endl;
    }
}

Note that the pixel format is: AARRGGBB

Edit: I tried using a ".jpg" instead of a ".png" and i got different colour values again, but still not the right ones.

Edit2: I'm pretty sure the pixel format in which my image is getting loaded in is wrong.
Any ideas how to get it to ARGB8888? I tried using SDL_ConvertSurface and SDL_ConvertSurfaceFormatbut i can't seem to get it right.

sentences:
How to correct mouse position to world position in xna/monogame I'm making a small game where the player shoots projectiles by clicking the mouse.  Everything worked fine before adding in a camera.  Now the position of the new projectiles is always off.
shoot code:
    if (mouseState.LeftButton == ButtonState.Pressed)
        {
            Vector2 mousePos = new Vector2(mx, my);
            Vector2 worldPosition = Vector2.Transform(mousePos,
            Matrix.Invert(game.camera.transform));

            Shoot(new Vector2(mx, my), new Vector2(pos.X + 8 * scale.X, pos.Y + 8 * scale.Y),
            gameTime);
            buttonTimer--;
        }

Camera code:
    public class Camera
    {
    Handler handler;

    public Matrix transform { get; private set; }

    public Camera (Handler handler)
    {
        this.handler = handler;
    }

    public void Update (GameTime gameTime)
    {
        foreach (Player p in handler.players)
            Follow(p);
    }

    public void Follow(Player target)
    {
        var offset = Matrix.CreateTranslation(1200 / 2, 800 / 2, 0);

        var position = transform = Matrix.CreateTranslation(
            -target.pos.X - ((16 * target.scale.X) / 2),
            -target.pos.Y - ((16 * target.scale.Y) / 2),
            0);

        transform = position * offset;
    }
}

Bullet code:
    public class Projectile
{
    public bool isActive = true;

    Game1 game;
    Handler handler;
    Spritesheet ss;

    public Vector2 pos;
    public Vector2 scale;

    int type;

    public Vector2 vel;
    public Vector2 direction;
    public Vector2 origin;

    long startTime = 0;

    float speed = 14;

    int particleTimer = 0;

    Rectangle Bounds;

    public Projectile(Vector2 pos, Vector2 scale, int type, Game1 game, Handler handler)
    {
        this.pos = pos;
        this.scale = scale;
        this.type = type;
        this.game = game;
        this.handler = handler;

        this.ss = game.bullet_ss;

        origin = pos;
    }

    public void LoadContent(ContentManager content)
    {

    }

    public void Update(GameTime gameTime)
    {
        pos += direction * speed;
        CreateParticles();

        Collision();

        Bounds = new Rectangle((int)pos.X, (int)pos.Y, (int)(8 * scale.X), (int)(8 * scale.Y));
    }

    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(ss.frames[type, 0], pos, null, null, null, 0, scale);
    }

    private void Collision()
    {
        if (type == 0)
        {
            foreach (Platform p in handler.platforms)
            {
                if (this.Bounds.Intersects(p.Bounds)) isActive = false;
            }
        }
    }

    private void CreateParticles()
    {
        if (particleTimer > 2)
        {
            for (int i = 0; i < 3; i++)
            {
                Vector2 position = new Vector2(handler.rand.Next(8) * scale.X, handler.rand.Next(8) *
                scale.Y);
                Vector2 v = new Vector2(handler.rand.Next(8), handler.rand.Next(8));
                Particle p = new Particle(position + pos, v, new Vector2(4, 4), 0, game, handler);
                handler.particles.Add(p);
            }

            particleTimer = 0;
        }
        particleTimer++;
    }

What fixes can I implement so that the projectiles are created in the correct positon?

sentences:
How to fix the character flip when using an orthographic camera in libGDX I used an orthographic camera to follow the character (player), but the problem is that my character is flipped.  There are no tutorials on how to fix this.  Please help as fast as possible.

Here is my create method:

public void create () {

    batch = new SpriteBatch();
    float width=Gdx.graphics.getWidth();
    float height=Gdx.graphics.getHeight();
    camera=new OrthographicCamera();
    camera.setToOrtho(false,width,height);
    camera.update();
    tiledMap= new TmxMapLoader().load("assets\\untitled.tmx");
    tiledMapRenderer=new OrthogonalTiledMapRenderer(tiledMap);
    player=new Player(new Vector2(0,0));
    sr= new ShapeRenderer();

}

Here is my render method:
public void render () {

    Gdx.gl.glClearColor(0, 0, 0.2f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA,GL20.GL_ONE_MINUS_SRC_ALPHA);
    player.update();
    camera.position.set(player.getPosition().x,player.getPosition().y,0);
    camera.update();
    tiledMapRenderer.setView(camera);
    tiledMapRenderer.render();
    sr.begin(ShapeRenderer.ShapeType.Line);
    sr.setColor(Color.BLUE);
    sr.rect(player.getPosition().x,player.getPosition().y,player.getCurrentFrame().getRegionWidth(),player.getCurrentFrame().getRegionHeight());

    sr.end();
    batch.begin();

    batch.draw(player.getCurrentFrame(),player.getPosition().x, player.getPosition().y);
    batch.setProjectionMatrix(camera.combined);
    batch.end();
}

sentences:
Setup sub platforms inside Unity I want to automate some of my Unity build process. I know that setting up automatic builds for platforms is relatively easy, just start Unity headless and tell it to build platform X!

This is fine for most things however I have some platform specific things for a given platform. For example I have achievements for Steam, GoG and my own thing if you are running truly standalone. I can easy switch between them by setting #define STEAM_BUILD to make a build with steam features enabled. This is setup for each platform that I support.

At the moment I have to change the script manually and re-build every time. I want to make a build server do this all for me but how do I tell Unity to build my PC version with a certain #define X set?

sentences:
Order of rotation in Euler angles I'm want to control the direction my camera looks, so I'm using Euler angles, so rotating around an axis is relative to rotation around previous axis. Something like this.

I want to always rotate using the blue axes. So I'm using three separate matrices to track rotation along their respective axes.

...

glm::vec3 mulVec (glm::mat4 const&, glm::vec3&);

glm::vec3 camPos = glm::vec3(0.0f, 1.0f, 0.0f);
glm::vec3 target = glm::vec3(0.0f, 0.0f, -5.0f);
glm::vec3 camup  = glm::vec3(0.0f, 1.0f, 0.0f);

tulsi::ModelInput a1;

while (1) {

    ...

    a1.tick();  // Tracks user input.

    glm::mat4 lookat = glm::lookAt(
                    camPos,
                    mulVec(a1.yAxis * a1.xAxis, target),
                    mulVec(a1.yAxis * a1.xAxis, camup)
                    );
    ...
}

I get the desired output (rotate around x axis then y)

But when I switch the order of multiplication, I get different output (rotate around y then x axis)

glm::mat4 lookat = glm::lookAt(
                    camPos,
                    mulVec(a1.xAxis * a1.yAxis, target),
                    mulVec(a1.xAxis * a1.yAxis, camup)
                    );

So whats happening here. I'm assuming the order should not matter.

sentences:
What backwards compatibility to specify for an app for iOS and Android? I'm having an app built, I'm not a programmer and I dont know exactly what to specify.

I want it to work on iPhones and iPads and iPod touches and also on Android devices - tablets as well as smartphones, and the Kindle Fire.

What backwards compatibility do I need to specify, at a sensible level?

sentences:
Create borders and clickable areas from image Crusader Kings, Europa Universalis and several other strategy games use provice based maps where "tiles" are not squares nor hexagons. Border style indicates different ranks/owner.

I've done some research and this is what I found from modding guides: they seem to use a source image to dynamically generate the borders which are used to separate the provices but also to indicate currently selected areas (border changes color or flashes etc) and Im pretty sure that same file is used for "clickable areas" (click on provice to get province details screen).

Source image contains all the provinces painted with solid colors. This image is same size as height map (water bodies and land masses) to align geographical shapes with provinces.

Then there's some sort of dictionary file (text, JSON etc) that has all the province colors that maps these colors to meta data about the province. It also makes provinces "loopable" for game engine in order to add them to in-game database and to use colors to find the correct shapes from image.

Example in JSON:

// "key" is RGB color that points to correct province in previous image
"253:28:37": {
  "name": "Kent",
  "otherStuff": 13
},
"142:133:150": {
  "name": "Oxford",
  "otherStuff": 54
}

How to create referenceable borders and clickable areas from source image?

sentences:
Pausing game with State machine and handling jumps I am adding pause functionality to my upcoming racing game.The players can jump in it.

Time.timeScale = 0 is obvious solution to pause game.I am avoiding this solution as users can do in app purchases in pause menu and with timeScale to 0 its somehow preventing them.

So to overcome that problem I have added state machine pattern to start,pause,resume,finish game.

The thing is when I pause game with my state machine pause behaviour it pauses the game properly without any hesitation until the player is Jumping and pause occurs.

When player is jumping everything gets pause perfectly,just player falls to ground.

So to overcome that problem what I tried was if user pauses game and player is on air the isKinematic on player gets set to to true and game gets pause with player halt on air.

The problem with this approach was that when user resume the game ,unexpected jump movement happens, i.e., player does not land on expected position .

Example if player on y = 10 and game gets pause, with Time.timeScale player will always land on Z = 17 ,but with my this second approach player sometimes land on Z = 20 ,Z = 21 Z = 19 etc

so my question is how will I do properly pause game with state machine without causing unexpected jump movement.

sentences:
2D Side-scrolling Strategy Game Pathfinding Help Hey Guys,I am trying to implement dungeons into my 2d RTS ish game.The dungeons is made out of rooms, you start at the top, and you can unlock rooms with scouts.The picture is the unlocked version of the dungeons, except for the middle part where it says "locked".For example the long rooms in the picture are actually consists of 3-4 rooms.
The dungeon is handbuilt by me, there are no obstacles except for unlocked areas and walls.No need for collision avoidance.The boxes with up and down indicates "ladders", when a unit wants to go up/down it just fades out and fades in the new layer, no moving up/down animation.You control the units by mouse.No jump mechanic etc, they just move flat on the green areas.

So I think I need to calculate and store which ladders(or nodes) the unit needs to take to reach the target, I need to check if ladders are connected to each other I think.But I don't know, not a great programmer.I have looked into Astar and dijkstra's algorithms but they seem complicated to implement, there is a built in Astar in gamemaker but it uses grid system and doesn't seem to fit to my problem.
Do I really need to learn one of those algorithms or can I get away with a simpler approach?Any pseudo code you guide me with?I would really appreciate the help.I know a bit of c# and unity.Thanks a lot!

sentences:
Defect in polygon sorting I have a 2D game with sprites that come from texture atlases.  I'm trying to resolve the sorting of my sprites for rendering.

I want two sprites to be ordered by their order of insertion, or z-order, when they overlap.  Otherwise I'd want to sort by their texture index to keep sprites from the same texture together.  I use the std::sort function for sorting a vector of queued sprites.

When queueing a sprite I transform its vertices to screen-space vertices on the CPU.  The resulting polygon is used in the overlap test, which is based on this post on Stack Overflow about rectangle intersection:

bool Polygon::overlaps(const Polygon &rhs) const
{
    return overlapCheck(rhs, *this) && overlapCheck(rhs, rhs);
}

bool Polygon::overlapCheck(const Polygon &rhs, const Polygon &current) const
{
    bool result = true;

    for (int i = 0; i < NUM_VERTICES; ++i)
    {
        int i2 = (i + 1) % NUM_VERTICES;
        glm::vec2 p1 = current.positions[i];
        glm::vec2 p2 = current.positions[i2];

        glm::vec2 normal(p2.y - p1.y, p1.x - p2.x);

        float minA, maxA;
        overlapCheckEdges(*this, normal, minA, maxA);

        float minB, maxB;
        overlapCheckEdges(rhs, normal, minB, maxB);

        if ((maxA < minB) || (maxB < minA))
        {
            result = false;
            break;
        }
    }

    return result;
}

void Polygon::overlapCheckEdges(const Polygon &poly, const glm::vec2 &normal, float &min, float &max)
{
    bool haveMin = false;
    bool haveMax = false;

    for (PosIterator it = poly.positions.begin();
      it != poly.positions.end(); ++it)
    {
        float projection = (normal.x * it->x) + (normal.y * it->y);

        if (!haveMin || (projection < min))
        {
            min = projection;
            haveMin = true;
        }
        if (!haveMax || (projection > max))
        {
            max = projection;
            haveMax = true;
        }
    }
}

My sprite comparison method:

bool Polygon::operator < (const Polygon &rhs) const
{
    if (overlaps(rhs))
    {
        return zOrder < rhs.zOrder;
    }
    else
    {
        return textureIndex < rhs.textureIndex;
    }
}

The problem, of course, is that something's wrong with the sorting.  I render my scene like this:

Transform t;
t.position.x = 33.0f;
t.position.y = 33.0f;

// "wall" and "slug" comes from texture atlas #2
// "altar" comes from texture atlas #1

// Queued sprites are translated to polygons based on given matrix
renderer.queueSprite("wall", projection.getMatrix() * t.getMatrix());

t.position.x = 0.0f;
t.position.y = 0.0f;

renderer.queueSprite("slug", projection.getMatrix() * t.getMatrix());

renderer.queueSprite("altar", projection.getMatrix() * t.getMatrix());

renderer.draw(); // Sprites are sorted then drawn

The sprites have sizes of 32x32 units.  This is what I expect to get:

I get this instead:

The pink slug and the white altar are in the wrong order.  Oddly enough, if I put the dark wall at (32, 32) instead of (33, 33) so that it's just touching the slug and altar, I get the right order.

I've also noticed that in the comparison method the altar is only ever compared with the wall.  In a single sort I see this sequence of comparisons:

slug, wall
slug, wall
altar, wall

sentences:
How can I use Body tracking in Android using ARCore or some other libraries? I know that ARCore on Android doesn't support Body Tracking like ARKit does. But is there some alternative or workaround to achieve it? Some other SDKs or Libraries or maybe even if there is some way to do it through ARCore itself?
To make it clearer I plan to use something like this in an AR game for Android. I plan to develop it in Unity 2019.4.x.
My search result in Google didn't yield a useful result as it gets mixed with ARCore Motion Tracking (which isn't what I am talking about here) or implementation with ARKit. But I got a little hope that there might be some way out after reading this post on Unity Forums.

sentences:
Modify Element of Struct Array I have this struct array in GLSL.

struct Test {
    vec2 value1;
    vec3 value2;
    float value3;
}
uniform Test u_test[5];

How can I modify the elements of this array one at a time?

I know that the location of individual objects in an element in the array can be accessed using glGetUniformLocation(program, "u_test[0].value1") but I'd like to upload an entire instance of Test at once.

sentences:
Set Sampler states: Linear, Bilinear, Trilinear Filtering/Interpolation How do you set each of these sampler states in the hlsl

Linear filtering
Bilinear filtering
Trilinear filtering

sentences:
How can I convert a model's rigging from standard bones to a biped in 3DS Max? I've purchased a rigged 3D model from Turbosquid. Unfortunately the model has been rigged using standard bones instead of a biped.

Is the a way I can automatically converting the skinning from bones to biped?

sentences: Why do we put deltaTime as an argument in render() LibGDX? I know that deltaTime is the time the last frame took to be rendered. However, I have no idea why we have to put it inside the parameter of the render method. I also don't know how the render method takes use of the deltaTime.

sentences:
Camera Matrix Transform to scroll through level - Monogame, XNA I am trying to change the way I scroll through a level. Currently I have a static camera class which stores a direction enum and a vector 2 position. This class then has a method to move the position of the camera (vecotr2) based on the direction value. This is called in the update method. Then when drawing my tile grid I loop through the number of visible tiles in the viewport and add the position of the camera to the counters to get the texture of the tile in question to draw. (note the main game class calls the level draw class passing it the sprite batch after starting it)

This seems like a pretty bad approach. I have seen in a few place that I should be using a matrix transformation to move the camera and then pass this as part of the draw method. However, I have absolutely no idea how to achieve this, I am literally lost.

I have attached my code below, and would greatly appreciate any advice you could provide.

Camera:

// Stores the position and scroll direction of the camera.
 static class Camera {

static public Vector2 Position;

static public ScrollDirection Direction;

public static void MoveCamera(Level level) {
    Vector2 scrollSpeed = new Vector2(20, 18);
    if (Camera.Direction == ScrollDirection.Up)
    {
        Camera.Position.Y = MathHelper.Clamp(Camera.Position.Y - scrollSpeed.Y, 0, (level.Height * 50 - level.mViewport.Height));
    }
    else if (Camera.Direction == ScrollDirection.Down)
    {
        Camera.Position.Y = MathHelper.Clamp(Camera.Position.Y + scrollSpeed.Y, 0, (level.Height * 50 - level.mViewport.Height));
    }
    else if (Camera.Direction == ScrollDirection.Right)
    {
        Camera.Position.X = MathHelper.Clamp(Camera.Position.X + scrollSpeed.X, 0, (level.Width * 50 - level.mViewport.Width));
    }
    else if (Camera.Direction == ScrollDirection.Left)
    {
        Camera.Position.X = MathHelper.Clamp(Camera.Position.X - scrollSpeed.X, 0, (level.Width * 50 - level.mViewport.Width));
    }
}

}

Level:

public void DrawTiles(SpriteBatch spriteBatch) {
    // Calculate the position of the camera in terms of tiles.
    Vector2 cameraPosition = new Vector2(Camera.Position.X / Tile.Width, Camera.Position.Y / Tile.Height);
    // Calculate the offset of the camera position for when it is part way through a tile.
    Vector2 cameraOffset = new Vector2(Camera.Position.X % Tile.Width, Camera.Position.Y % Tile.Height);

    // Loop through the number of visible tiles.
    for (int y = 0; y <= mViewportTiles.Y; y++) {
        for (int x = 0; x <= mViewportTiles.X; x++) {
            // Check that we have not exceeded the dimensions of the level.
            if (x + cameraPosition.X < Width && y + cameraPosition.Y < Height) {
                // If the tile is not an empty space.
                if (tiles[x + (int)cameraPosition.X, y + (int)cameraPosition.Y].Texture != null) {
                    // Get the position of the visible tile within the viewport by multiplying the counters by the tile dimensions
                    // and subtracting the camera offset values incase the position of the camera means only part of a tile is visible.
                    Vector2 tilePosition = new Vector2(x * Tile.Width - cameraOffset.X, y * Tile.Height - cameraOffset.Y);
                    // Draw the correct tile based on the position of the camera in the appropriate position within the viewport.
                    spriteBatch.Draw(tiles[x + (int)cameraPosition.X, y + (int)cameraPosition.Y].Texture, tilePosition, Color.White);
                }
            }
        }
    }
}

public void Update(GameTime gameTime) {
   Camera.MoveCamera(this);
}

Thanks in advance

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:
Is it "wrong" to build Unity games entirely with UI elements VS sprites? I find myself coming on board a Unity project with an outsourced programming team. Our mobile game has a number of minigames and they have built them entirely out of UI elemetents, or raw images on only one or two canvas elements. Now, I know the term "wrong" is open to interpretation since the games are quite simple and they run fine on the modern devices we've tested them on.

However my somewhat perfectionist attitude often has me concerned about the "correct/best practice" way of doing things and I have a hard time letting go of the idea that this is not the best way to be developing the games. I look at the Unity best practices of not having too many elements in a canvas due to redrawing it anytime something changes, sprite renderers optimized polygon trimming as opposed to max rects to keep overdraw down, etc. And the response I get from the programming team is, "the screen-ratio ability of canvas elements makes it easy to handle different aspect ratios, so that's how we build games".

I don't want this to be a down voted "personal" question, so is there a more compelling reason to not build simple mobile games in this fashion? Or is it a case of if it works on targeted devices and isn't causing issues why not?
Thanks in advance for any replies,
Jaysin

sentences:
Batching and Z-order with Alpha blending in a 3D world I'm working on a game in a 3D world with 2D sprites only (like Don't Starve game). (OpenGL ES2 with C++)

Currently, I'm ordering elements back to front before drawing them without batch (so 1 element = 1 drawcall). I would like to implement batching in my framework to decrease draw calls.

Here is what I've got for the moment:

Order all elements of my scene back to front.
Send order list of elements to the Renderer.
Renderer look in his batch manager if a batch exist for the given element with his Material.

Batch didn't exist: create a new one.
Batch exist for element with this Material: Add sprite to the batch.

Compute big mesh with all sprite for each batch (1 material type = 1 batch).
When all batches are ok, the batch manager compute draw commands for the renderer.
Renderer process draw commands (bind shader, bind textures, bind buffers, draw element)

Image with my problem here:

But I've got some problems because objects can be behind another objects inside another batch.

How can I do something like that?

sentences:
How do i update opengl lightning equation in my fragment shader to make my texture less glossy and more like a fabric I built a model in blender, and am currently trying to import it into my android app using assimp together with opengl, i dont have any issues with the importing but my goal is to make the object look realistic as possible, and this is where my problem lies...I have implemented normal mapping using both the diffuse and normals of my texture but after rendering it the objects looks smooth and glossy, yes the bumps were rendered well and i like it but i need the material to look more like a fabric (cloth/textile), please how can i do this? do i need to update my lighting equation or the issue is with my original diffuse texture?

Here is my original diffuse texture

Here is my rendered model

Here's my fragment shader

    void main()
{
    // obtain normal from normal map in range [0,1]
    vec3 normal = texture2D( normalMap, textureCoords ).xyz;
    // transform normal vector to range [-1,1]
    normal = normalize(normal * 2.0 - 1.0);  // this normal is in tangent space

    // get diffuse color
    vec3 color = texture2D( textureSampler, textureCoords ).xyz;
    // ambient
    vec3 ambient = 0.1 * color;
    // diffuse
    vec3 lightDir = normalize(tangentLightPos - tangentFragPos);
    float diff = max(dot(lightDir, normal), 0.0);
    vec3 diffuse = diff * color;
    // specular
    vec3 viewDir = normalize(tangentViewPos - tangentFragPos);
    vec3 reflectDir = reflect(-lightDir, normal);
    vec3 halfwayDir = normalize(lightDir + viewDir);
    float spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);
    vec3 specular = vec3(0.2) * spec;

   gl_FragColor  = vec4(ambient + diffuse + specular, 1.0);
}

Here's my vertex shader

mat3 transpose(mat3 m) {
    return mat3(m[0][0], m[1][0], m[2][0],
    m[0][1], m[1][1], m[2][1],
    m[0][2], m[1][2], m[2][2]);
}

void main()
{

    gl_Position     = mvpMat * vec4(vertexPosition, 1.0);

    vec3 fragPos = vec3(model * vec4(vertexPosition,1.0));

    vec3 T = normalize(normalMatrix * tangent);
    vec3 N = normalize(normalMatrix * normal);
    T = normalize(T - dot(T, N) * N);
    vec3 B = cross(N, T);

    mat3 TBN = transpose(mat3(T, B, N));

    //values for fragment shader
    tangentLightPos = TBN * lightPos;
    tangentViewPos  = TBN * viewPos;
    tangentFragPos  = TBN * fragPos;
    textureCoords   = vertexUV;
}

sentences: How to Change an Icon based on what Collider the Player Hits So I have a 2D platform game where a player goes around collecting fruit but currently I only have one icon. Currently I use an image on a canvas to display the fruit image. How can I make the UI image change based on what fruit the player collects?

sentences: How to port a Skyrim Legendary Edition mod to Skyrim Special Edition, and vice-versa? There are a lot of mods I want to port, but I don't know how to go about it and do it properly to avoid crashes, etc. Could you put all of the steps and relevant information here so I can use it as a future reference? I am trying to port a major mod with scripts, 3d models, new items, new spells and whatnot.

sentences:
Manage vertical levels rendering I've been working on a semi-professionnal project for more than one year.
The game is in 3D with a TopView camera.
In this game, the player will be in very vertical spaces, with lots of ladder and stairs.

The actual problem is that I need to show only what is at the actual height of the player.

I have made a shader that 'cut' the objects above a given height.

The problem is that my mesh are open above this height, and we just see nothing inside.

If you have any idea on how to make something to fill an open mesh or any other system that will do the job, i'll be very pleased to read you :)

This is what I have

This is what I aim to (black above top of walls)

sentences:
Unintended twisting of geometry while generating a mesh? I am creating a real time animation of tori (toruses), and I've run into a problem where at certain angles of my tori, the geometry is twisting up where it should remain straight.

Here is an animated gif of the animation. (sorry I can't embed this)

If you look closely you can see small twists appearing and disappearing in the geometry. Every frame, I am updating the 3D spline which is the guide for the torus, and at certain angles, the mesh gets distorted/twisted.

I've used two different approaches to generate the meshes seen here, one uses the algorithm found here, in an earlier question of mine, and the other, I used a third party quaternion library.  Both approaches produced different, but similar twisting effects.

I'm hoping there is a conceptual idea about 3D rotations I'm missing, as opposed to a small bug in my code, which would take too much of your time to lay out here.

sentences:
Good Way to Handle Scheduled Events in Mobile Multiplayer Strategy Games I am developing a mobile strategy game like Clash of Kings. There are scheduled events in the game (like constructing buildings, recruiting troops, and attacking to other settlements) which happen when a specified time comes.

I was wondering what is a good way to handle these kind of events?

In my current design, I am using AWS products everywhere. A load balancer redirects a user request to one of the http servers which runs a nodejs code. Nodejs script creates an event record which contains required data to do the event later.(For example it contains number of soldiers, defender settlement, event time etc. in case of attacks.) It then inserts a record to a table called Events in DynamoDB(NoSQL DB in AWS). DynamoDB supports something like a callback system using AWS Lambda and DynamoDB Streams, which basically allows me to run a serverless code whenever new data is inserted to a table. I am planning to write a lambda function that connects to an internal worker computer through an internal load balancer, and gives event data to the worker for it to process. Worker runs a java code, and uses a priority queue to hold events. At each second, it pops events whose time has come from priority queue and spawns threads to handle them. Threads does the required calculations, inserts the results to DynamoDB, and possibly sends notifications to users through AWS SNS.

The reason I did not connect directly to workers from http servers was to use http servers to answer user queries as fast as possible, and carrying load to the background system.

Do you think handling timed events like this is a good solution? Is there a standard or a better way to approach this problem?

My main concern is that I will be running a loop that sleeps for 1 sec and polls the priority queue. If I was able to design a callback like system, which calls a function when the event time comes, I would be using less resources. Is there such an architecture or a system that makes this easy?

As an alternative, I read that some browser strategy games do not have background processes, and they do available events on user requests. Before handling each request, they run a code that does due events. Would that be a better approach?

As a footnote, I want to develop a system that is easily scalable which can support number of users in the order of millions.

sentences:
Why can't this event call its parent event? It's me... Back again... with another Unreal problem...

I have an Event in my Parent Class called Overridable :: PreDialogueScreenEnter

I have overridden the same Event in a Child Class:

Yet when I attempt to call the parent event from the child class, the option is greyed out.

Tl;Dr:

Why call parent event not work >:|

sentences:
How can I add a transparent overlay to a UI in libGDX? I am attempting to use the following code

        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
        shapeRenderer.setColor(3,3,3,.3f);
        shapeRenderer.rect(0,0,gameWidth,gameHeight);
        shapeRenderer.end();

So that when the menu is accessed, a transparent background appears. The problem I am facing is that when I try to do this the objects rendered by the SpriteBatch seem to misbehave. Upon further research i found that attempting to nest that code within SpriteBatch.begin() and SpriteBatch.end() is the cause of that. However, If I try to place the code after the SpriteBatch.end(), because the SpriteBatch has ended the objects rendered by it do not appear behind the transparent rectangle.
(I tried assigning SpriteBatch and Shaperender a different camera, however, that didn't fix the problem.) How can I fix this or find another way to implement the transparent background for the menu.

sentences:
How to store Lua script's inner state? Situation:

I am working on an Entity-Component system, and I am using LuaBridge as a Lua binder.
There is only one Lua State.
Currently when I update the game objects, I just check whether it has a script defined or not. If there is, I call luaL_dostring() on it, and I call its update() function.
I have a script, where I declare a global variable in its start() (it is called when the script runs for the first time), and increment it at every update() then print it out

Question:

I would like to achieve separated inner state saving for my scripts.

For example If I add the same script to two different game objects, currently the printed out numbers will be 1,2,3,4,5,6 instead of 1,1,2,2,3,3, etc.
This is because they use the same Lua State (correct me if I am wrong)
But as I heard it's not a good practice to have a lua state for every script because If I just have 5 scripts, and I add these to 3 different game objects, there would be already 15 lua states.

How should I achieve my goal?

sentences:
Ball oblique impact physic in Java? I know Q3 + Q4 = 90

I searched internet and many physic topics, but not found how to calculate this values in Java?

(I found V3 and V4 but not found Q3 and Q4)

So how can i calculate V3, V4, Q3, Q4 values after the collision in Java?

sentences:
Best practice for play location of projectile sound effects? I am encountering an issue where I have a bullet that is destroyed on impact which is cutting off my bullet impact sound effect due to the audio source being destroyed. I like the idea of the sounds being attached to the projectile, but not sure if that is best practice.
I can play the sound from an NPC script, but not sure if that will open up other issues. Is this a better approach since the NPC material is "metal" so I should store all the "Metal hit" sound effects on the NPC?
...vs. having to store all material variations of impact on the projectile?

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:
Feasability of mobile 2D multiplayer RPG game with interactive bitmap background I'm looking to develop a 2D multiplayer RPG game for Android, with a bird's eye view similar to that of zelda/pokemon. The game is very simple in all ways since my intent is for thousands of players to occupy the same world which I imagine requires good performance. However, I am unsure about the performance requirements of two properties:

the tile map that is used as a background is dynamic (interactive). For example, a player steps in the water, and the water turns black. Every tile in the game does this.
the tile map is the same object used for all players, but it is displayed differently on each user's mobile device, even though the players exist in the same world. For example, the water that turned black is displayed as red on all other players' screens.

I have knowledge of java, but almost none regarding game dev. tools. Is there a best process for these requirements? Should I develop in pure java, or use some tool like Slick2D etc.? How performance intensive are these properties, if even possible?

Edit: There are no collisions in the game or difficult animations, I am imagining simply changing the colors of the tiles (like in the examples), and a client-server architecture

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:
What is the easiest way to make an online high scores table? I made an 2d Android game with using Libgdx library. This game like Flappy Bird. And every user have a highscore. I want to store this highscores respectively to an online database and return the rank of the user in the world ranking.

How to do this? In backend ,which architecture should I use? Is there a tutorial for this?

sentences:
C++ && SFML game class Im making c++ && sfml game for my teacher.
I need to make game class naturaly I make constructor and destructor, but I cant figure out what methods should game class contain.
curently it has these : init() - init all variables and other stuff
(before I moved to c++  I was making games in HTML,JS but I never used OOP there. So I have no exp. doing games like this)

sentences:
Programming and drawing to deal with different screen sizes and resolutions I started making an XNA game years ago and picked it up recently.

I'm looking later to convert it to use Monogame so that it can be deployed on various mobile devices and OS, though I have a sinking feeling that a lot of the sprites and code will be broken by the changing screen sizes when I move outside of the emulator.

The game is currently hard coded to to 800x480 and the level placements and sprite sizes were all done to fit that at the time.

So question:

What do I need to ensure this works and displays properly on a variety of screens and devices?

sentences:
AI to help player by suggesting upgrades Suppose I'm creating a racing game.. I would like to implement an awareness system AI, that will suggest to the player that he can buy that booster or some other upgrade, .. etc. How should I start implementing that? A FSM ? A decision tree ?

Suppose that I have variables like, how many crashes, how much is the damage, how many gates I have passed, .. etc how would I use those variables then to say for example you need to buy that stuff?

sentences: Future of Julia in game development industry I read in many posts that Julia is faster than many languages especially C++, What's the future of Julia in game development industry ? Will it replace all legacy C++ ?

sentences:
VertexColor shader is not working correctly in built application I want to change the vertex colors of my mesh. The light sources must not affect the objects with this shader, its lighting must be determined only by its vertices colors, so I turned the Lighting Off. I use this simple shader:

Shader "VertexColored/Simple" {
Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
}

SubShader {
    Pass {
        ColorMaterial AmbientAndDiffuse
        Lighting Off

        SetTexture [_MainTex] {
            Combine texture * primary
        }
    }
}
Fallback "VertexLit"
}

And this script:

using UnityEngine;
using System.Collections;

public class BehaviourScript : MonoBehaviour {
    void Start() {
        Color[] exclrs = new Color[11]
        {
            new Color32(25, 25, 25, 255),
            new Color32(50, 50, 50, 255),
            new Color32(75, 75, 75, 255),
            new Color32(150, 150, 150, 255),
            new Color32(200, 200, 200, 255),

            new Color32(255, 255, 255, 255),

            new Color32(200, 200, 200, 255),
            new Color32(150, 150, 150, 255),
            new Color32(75, 75, 75, 75),
            new Color32(50, 50, 50, 255),
            new Color32(25, 25, 25, 255),
        };

        Mesh mesh = GetComponent<MeshFilter>().mesh;
        Vector3[] vertices = mesh.vertices;
        Vector3[] normals = mesh.normals;

        Color[] colors = mesh.colors;

        for(int i = 0; i < vertices.Length; i++)
        {
            for(int j = 0; j < 11; j++, i++)
            {
                colors[i] = exclrs[j];
            }
            i--;
        }

        mesh.colors = colors;
    }
}

When the game is launched, in editor I can see this:

This is EXACTLY what I wanted to achieve!

But in built for PC(x86) version I see this:

Why the results from the editor and from the built .exe differs? What should I do to see my effect in built version? Maybe I need to use an another shader?

sentences:
What is the difference between “dynamic generation” and “procedural generation”? When I think of a dynamically generated game, I think of things like Diablo with randomly generated levels. When I think of a procedurally generated game, I think of things like Flappy Bird and other infinite runners.

But both of these just randomize a level. Is it that procedurally generated games are constantly being generated and dynamically generated games are all generated up front? Or are these terms interchangeable?

What is the difference between a dynamically generated game and a procedurally generated game?

sentences:
How to implement scene changing in real-time? I want to implement real-time scene changing effects to make my game could changing from spring to summer, summer to fall, fall to winter. And Chaning effects like this game. Giana Sisters.

I think Giana Sisters use animation to transit from two scenes, but I dont know how to make these animations.

Is any other suggestions could make this effects?

sentences:
How to create a Ghost Replay feature in a game? When you set a personal best lap time in a console racing game, you have the option
to compete against your ghost.

How can this feature be created for a single player casual type game?

sentences:
Programmatically create a trigger within abnormally shaped room So I'm trying to create a trigger in each of my rooms. These rooms can be created by players. Basically, I need to know all the objects in a room. These rooms can be shaped in weird and wonderful ways. I'm struggling to figure out how to "fill" an area? The other problem is that some walls are curved.

My current thinking is:

Loop over all the walls in a scene. Do 4 raycasts from each side of the wall and see if we hit other walls. If we do, we are likely in a room.
From the offset, literally check each node adjacent to that until we fill the room. Once I have this though, Im not sure what to do with it.

How do I create bounds that I can check for collisions with this data?

Edit: Adding an image for clarity. Red and blue should be 2 different rooms and I want to get all items in each of these rooms

sentences:
Torque2D, Class vs Datablock I'm scripting my first game with Torque2D and have not fully understood the difference between "Class" and Datablock.

To me it seems like Datablock is similar to a struct in C/C++ or a Record in Pascal. If I create Datablocks with keyword new, are they instantiated in the same way as a "Class"?

I have a large TileMap and need to attach some information to each Tile. I was thinking to use a Datablock, as a struct, to attach this information to the tile's CustomData property.

The two questions are: What is a Datablock and should I use a Datablock or a "Class" for this tile information?

sentences:
How to know the boundaries of an isometric tile? In a 4x4 square tile, it's easy to know which pixels are inside the tile's boundaries. I know immediately that the 4th vertical pixel is supposed to be drawn but the 5th isn't.

However, on a rhombus' shaped tile, those boundaries aren't that obvious since the picture that contains it is a rectangle. This means that, within that rectangle, there will be pixels that are supposed to be seen and pixels which aren't.

If I'm drawing an isometric tile, how would you suggest I get to know which pixels are within its boundaries and which aren't?

I thought about drawing border lines so that I can draw the texture inside but since the texture should be a power-of-two size, there's no middle pixel on each axis, so it won't be just a matter of connecting 4 dots. So I decided to connect each of the 2 middle pixels in each edge, with the closest pixel on the closest edge (1st picture on top). However, if I draw inside of them, the texture won't reach the edge, which I imagine will create gaps. If this is the case, should I draw the lines one pixel beyond those two middle pixels in each side to get the outside boundaries (2nd image on top)? Are these lines a reliable indicator of which pixels should be seen?

sentences:
How to update "dynamicVertexBuffer" correctly with "setdata" on XNA? I developed a small 3d games xna and uses a "DynamicVertexBuffer" and "DynamicIndexBuffer" to store and draw my vertices. Everything works fine, but my problem is the "Update" function where I update my buffer.
Each apel update I have to reset my buffer using the keyword "new DynamicVertexBuffer (...." It goes down the performance and reduce the frames per second of my games.

Do I have to initialize my buffer each time in my function "Update ()"? Is it okay to reset every time my buffer to each call / frame

I can not find a solution to update correctly my Dynamicbuffer with "setData ()" function without having to initialize whenever my buffer just before. Am I obliged to Reset-"DynamicVertexBuffer" and "DynamicIndexBuffer" before the update? If I call "setData ()" before reset it, I throw an exception:

Works well but I have initialized every time "dynamicIndexBuffer" and "dynamicVertexBuffer" before update! (Consumes more resources?)

    public override void Update(GameTime gameTime)
    {
                foreach (Octree.Node node in regions[regionIndex].Nodes.Where(n => n.ItemGroup == a).Where(m => arcadia.camera.Frustum.Contains(m.boundingBox) != ContainmentType.Disjoint))
                {
                    //build indices
                    node.Cube.SetUpIndices(indexIndiceBuild);
                    //Add indices tho the collectionList
                    foreach (int indice in node.Cube.Indices)
                    {
                        list_structure_indices.Add(indice);
                    }
                    //Add vertex to the collectionList
                    foreach (VertexPositionTexture posText in node.Cube.Vertices)
                    {
                        vertexPositionStructureCube.Add(posText);
                    }
                    //Add vertexBuffer to the collectionList
                    indexIndiceBuild += 24;
                }
                    //Declare and initialize new buffers
                    //VertexBuffer Initialize again
                    vertexBuffer_cube = new DynamicVertexBuffer(
                    arcadia.Game.GraphicsDevice,
                    VertexPositionTexture.VertexDeclaration,
                    vertexPositionStructureCube.Count,
                    BufferUsage.WriteOnly);

                    //VertexBuffer SetData (update)
                    vertexBuffer_cube.SetData<VertexPositionTexture>(vertexPositionStructureCube.ToArray());
                    //IndexBuffer Initialize again
                    indexBuffer_cube = new DynamicIndexBuffer(Game.GraphicsDevice, IndexElementSize.ThirtyTwoBits, list_structure_indices.Count, BufferUsage.WriteOnly);
                    //IndexBuffer SetData (update)
                    indexBuffer_cube.SetData(list_structure_indices.ToArray());
                    .........
}

I'm just trying to update with "SetData" with new vertices and indices but i throws the exception:
    "The array is not the proper size for the Amount of data requested."

    public override void Update(GameTime gameTime)
    {
                    .........
                    //Only "setdata()" without initialize buffer again ??
                    //VertexBuffer SetData (update)
                    vertexBuffer_cube.SetData<VertexPositionTexture>(vertexPositionStructureCube.ToArray());

                    //IndexBuffer SetData (update)
                    indexBuffer_cube.SetData(list_structure_indices.ToArray());

                    .........
}

sentences:
(LIBGDX) args instead of variables names I added Kryonet to my libgdx project like this...

Created a "libs" folder in core project, droped kryonet.jar in there.
In build.gradle of the root project added this line:

project(":core") {
   ...
   dependencies {
    ...
    compile fileTree(dir: 'libs', include: '*.jar')
   }
}

But I keep seeing "arg" instead of the variable names

When I try to see the class this is what it shows:

No button to attach source is being displayed..
Any Ideas?

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:
How can I load a scene when starting a new game if the loading scene have a Main Camera? The problem is that if I turn the camera on enabled in the editor it will show part of the scene mixed with the main menu scene. And if the loading scene main camera is enabled off I will get error Display 1 No cameras rendering.

I have two scenes in the Hierarchy.
The first is Main Menu. The main menu have a camera.

Now I did that when I click on the button START A NEW GAME
It will load another scene:

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

public class NewGame : MonoBehaviour
{
    public void StartNewGame(int SceneIndex)
    {
        SceneManager.LoadScene(SceneIndex);
    }
}

In this screenshot you can see in the Inspector I'm calling the method StartNewGame and the index 1. Index 1 present the second scene that should be load: The Space Station

Now in the scene: The Space Station I have also a MainCamera under Player. The MainCamera is turned off in the editor. And I need somehow to switch between the Main Menu scene camera and the The Space Station scene camera.

If I will turn on the MainCamera in the inspector I will see some objects of the first scene and the second scene and then the game will start without the main menu and the player will fall down.

If I start the game when the MainCamera is turned off I will the Main Menu but then when I click on START A NEW GAME it will show me the message Display 1 No cameras rendering.

The last screenshot is of the Build Settings: Edit > Build Settings...
I added the two scenes to the build. The first scene at index 0 is the Main Menu the second scene at index 1 is The Space Station:

sentences:
Bullet Physics Terrain Im trying to Load an RGB image (.BMP) into bullet's btHeightfieldTerrainShape

Im using a loader that creates a openGL height map, it stores the data in a vector float, but I cant get the btHeightfieldTerrainShape to accept it.

I changed the vector float into a float array which contains height data according to the debugger, when loaded it takes forever to load the terrain, and when its loaded it is a flat terrain.

It is alot of code, but I can add it if needed.

The Code

sentences:
How to monetize a free XNA game? I have written a windows based game in XNA. I wish to release it for free but I would also like to monetize it in some way. What are my options?

Possible ways:

Ads - what current libraries/services are available?
Donations - PayPal, what else?
MicroTransactions - what current libraries/services are available?

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:
Orienting a model to face a target I have two objects (target and player), both have Position (Vector3) and Rotation (Quaternion).  I want the target to rotate and be facing right at the player.  The target, when it shoots something should shoot right at the player.

I've seen plenty of examples of slerping to the player, but I don't want incremental rotation, well, I suppose that would be ok as long as I can make the slerp be 100%, and as long as it actually worked.

FYI - Im able to use the position and rotation to do plenty of other things and it all works great except this last piece I cant figure out.

Code samples run in the Target's class, Position = the targets position, Avatar = the player.

EDIT

Im now using Maik's c# code he has provided and it works great!

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:
Windows-Linux cross platform game The answers to this cross-platform related question are useful, however I want my (C++) game to run on Windows and Linux (and be packaged for Ubuntu) only. I'm not interested in platforms like mobile or consoles.

Are there any specific tips or suggestions for this case?

Also, if I get the game to work on linux, is it difficult to add support for OSX?

Updating with more information:

It will be a 3D game simulating the motion of spacecraft in the solar system. We will use Ogre3D for the graphics. We're still in the design phase, so there's no code written yet.

sentences:
snapping an angle to the closest cardinal direction I'm developing a 2D sprite-based game, and I'm finding that I'm having trouble with making the sprites rotate correctly. In a nutshell, I've got spritesheets for each of 5 directions (the other 3 come from just flipping the sprite horizontally), and I need to clamp the velocity/rotation of the sprite to one of those directions. My sprite class has a pre-computed list of radians corresponding to the cardinal directions like this:

protected readonly List<float> CardinalDirections = new List<float>
                           {
                               MathHelper.PiOver4,
                               MathHelper.PiOver2,
                               MathHelper.PiOver2 + MathHelper.PiOver4,
                               MathHelper.Pi,
                               -MathHelper.PiOver4,
                               -MathHelper.PiOver2,
                               -MathHelper.PiOver2 + -MathHelper.PiOver4,
                               -MathHelper.Pi,
                           };

Here's the positional update code:

if (velocity == Vector2.Zero)
            return;

        var rot = ((float)Math.Atan2(velocity.Y, velocity.X));
        TurretRotation = SnapPositionToGrid(rot);

        var snappedX = (float)Math.Cos(TurretRotation);
        var snappedY = (float)Math.Sin(TurretRotation);
        var rotVector = new Vector2(snappedX, snappedY);

        velocity *= rotVector;
        //...snip

private float SnapPositionToGrid(float rotationToSnap)
    {
        if (rotationToSnap == 0)
            return 0.0f;

        var targetRotation = CardinalDirections.First(x =>
                (x - rotationToSnap >= -0.01 && x - rotationToSnap <= 0.01));
        return (float)Math.Round(targetRotation, 3);

    }

What am I doing wrong here? I know that the SnapPositionToGrid method is far from what it needs to be - the .First(..) call is on purpose so that it throws on no match, but I have no idea how I would go about accomplishing this, and unfortunately, Google hasn't helped too much either. Am I thinking about this the wrong way, or is the answer staring at me in the face?

EDIT: Thanks Gregory for the answer. Only thing I really had to modify from the answer  was to re-construct the velocity vector to the new snapped rotation (I'm sure there are further optimizations that I can do, but for now it's enough that it works!):

        var snappedX = (float)Math.Round(Math.Cos(TurretRotation), 3) *
                           velocity.Length();
        var snappedY = (float)Math.Round(Math.Sin(TurretRotation), 3) *
                           velocity.Length();
        var rotVector = new Vector2(snappedX, snappedY);

FOLLOW-UP EDIT:
The initial answer worked very well as a naive implementation, but suffered from inaccuracies of up to 45 degrees when dealing with negative angles; -3.14 snapped to -2.356 for instance. To correct that, I added a check to account for those situations.  Below is a complete implementation of a SnapToGrid method. Some optimizations have been made, like pre-computing the various divisors of Pi to avoid the division. Further optimization could possibly be achieved by looking for short-circuit scenarios, i.e. if rotationToSnap ~=0, but if anyone has further optimizations, I'd be curious to see them!

public static float SnapPositionToGrid(float rotationToSnap)
{
    if (rotationToSnap == 0)
        return 0.0f;

    var modRot = rotationToSnap  % MathHelper.PiOver4;

    float finalRot;

    if (modRot < RoundedPiOver8)
    {
        if (modRot < -RoundedPiOver8)
            finalRot = rotationToSnap + -MathHelper.PiOver4 - modRot;
        else
            finalRot = rotationToSnap - modRot;
    }
    else
        finalRot = rotationToSnap + MathHelper.PiOver4 - modRot;

    return (float)Math.Round(finalRot, 3);
}

sentences: No RenderWindow class in SFML? In their official tutorials it is said that to draw graphics on screen, i have to use RenderWindow instead of Window. But when i write sf:: RenderWindow window, error pops up saying that there is no RenderWindow in sf::  . I  copy-pasted the code but it still does not works. What could possibly be the  reason behind this ?

sentences:
How do I have a camera follow my object in Unity? I have an object that automatically moves by itself and I want the main camera to automatically follow it.(Like in games such as geometry dash and jetpack joyride)
This is the code for the automatic moving object in case it is needed:

using UnityEngine;
using System.Collections;
public class automove : MonoBehaviour {
public static int movespeed = 5;
public Vector3 userDirection = Vector3.right;

public void Update()
{
    transform.Translate(userDirection * movespeed * Time.deltaTime);
}
}

So does anyone know any good scripts I could add to the main camera to follow this object that automatically moves? Thanks in advance!

sentences:
2D AABB vs AABB side of collision and collision depth I realize there have been a multitude of questions involving 2D AABB vs AABB collision, but the questions and responses always avoid the simple questions that make it difficult.

To keep things simple, we are going to assuming that AABB1 is a moving(vector velocity and direction known) rectangle that is much taller than it is wide, and AABB2 cannot move and is a smaller square.  If AABB1 were to move towards AABB2 from any angle how would you figure out which side of AABB2 it collided with?

Further, when calculating collision depth, I mean the distance it travels into the object on the x-axis and the y-axis.  When finding those distances, how would you find what point would you use as reference? From what I can tell, you couldn't just use one point for every collision because with AABB1 (it is much taller than wide), the top left point would be irrelevant when finding the penetration depth on a collision with the bottom right corner.

Another but less important question than the other two, how can you handle an object with a velocity vector with a high enough magnitude to move through an entire wall in one frame.  Say a wall is 50 pixels wide and a player is moving 100 pixels per frame, it could jump through the wall without triggering a collision.

If further information is needed to help solve my problems or understand the problem, please ask. I haven't found any post that helps and I don't have enough reputation to post pictures to elaborate in more detail.

sentences:
Adding a function call to a prefabbed button in Unity For each of my scenes, I have an empty GameObject _Manager that stores my scripts for setting up the level, keeping track of variables, etc.

On my main screen, I have a play button that isn't instantiated; I simply dragged it into the editor. In my script Main.cs I have a function Play() which calls LoadLevel("Game"). To get my play button to call the Play function, I dragged _Manager into the onClick slot and selected the function. This worked fine and I have a functional play button.

Unfortunately, this is not working for the prefabbed buttons I need to instantaite in my Game scene. In Game.cs I have a function LayoutButtons() which is both public and returns void, yet I am unable to drag _Manager into the slot on my prefabbed button. Even if I do it before converting the button to a prefab, it simply disappears once it becomes a prefab.

I've managed to work around this by putting my LayoutButtons() function in a new script which I attached directly to the prefab, but I'd like to keep the function within Game.cs and attached to my manager object if that's possible.

sentences:
Game runs in UE4Editor but not standalone I have just completed these instructions to build and run UE4Editor for Linux.

I created a new C++ project and in the editor I hit the Launch button and after a while it compiled and ran successfully.

If I close down UE4Editor and cd to MyTestProject/Binaries/Linux/ there is a MyTestProject executable, but if I try to run that from the shell I get

error while loading shared libraries: libApexCommonPROFILE.so: cannot open shared object file: No such file or directory

How do I set up the program so that it can be run standalone, not from within the editor?

sentences:
Ray picking - get direction from pitch and yaw I am attempting to cast a ray from the center of the screen and check for collisions with objects.

When rendering, I use these calls to set up the camera:

GL11.glRotated(mPitch, 1, 0, 0);
GL11.glRotated(mYaw, 0, 1, 0);
GL11.glTranslated(mPositionX, mPositionY, mPositionZ);

I am having trouble creating the ray, however. This is the code I have so far:

ray.origin = new Vector(mPositionX, mPositionY, mPositionZ);
ray.direction = new Vector(?, ?, ?);

My question is: what should I put in the question mark spots? I.e. how can I create the ray direction from the pitch and roll?

Any help would be much appreciated!

sentences:
Client send rate for network games As I understand for a client server model, it's common practise to send input to the server and then the server applies the input to update the state of the game. The server then sends updates to clients regularly. The client in the meantime does prediction, before it receives the "true" state.

My question is how often to send input. Surely it should be sent every frame otherwise some input (during frames which are not sent) will not be processed by the server. Will this be too heavy for the network. What is common practise?

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: What are these yellow lines between toggles, and how do I turn them off in Unity? I don't understand what these faint yellow lines are and how to turn them off (see screen shot). I have created toggles from a prefab and to save time have been duplicating them and moving them. Unity chugs everytime I move a group of them, and I imagine it is because it is recalculating how to draw these lines. All of the toggles have lines between them. Send help!

sentences:
Popular genres in Asian (non-Japanese) markets? From time-to-time I've wondered what kind of games are popular in Asia (India, China, Korea, Singapore, etc...). I hear about developers in the US and UK who outsource work there, but what goes into the games they make for themselves?

Related, you hear these days about how Japanese developers have been marketing their games more for American audiences these days (with mixed success). In what ways could American developers aim their development toward Asian audiences?

sentences:
Help me adjust this RPG logarithmic leveling formula! I'm trying to find a formula that's fits the way I want my player to gain experience and level up. I know this is primarily opinion based but I hope someone can help me!

I've used the following formula as a base, I found it here:

//Calculate level
Level = Math.Max( Math.Floor(6.7f * Math.Log(Experience + 455f) + -40f), 1 );

//Calculate experience for level
Experience = (long)(Math.Exp((Level - -40f) / 6.7f) - 455f);

I wrote a script that will show what it will look like, which is this:

I want to find a way to make it very easy for the player at early levels (let's say until level 15~), and then slowly harder. I'm not sure how to change the formula or if it's even possible! Hope you can help!

sentences:
How do I counteract FXAA blur? FXAA is a cheap post processing anti-aliasing method which works great with deferred pipelines where traditional MSAA may not be a viable option. It's also easier to implement than alternatives such as SMAA.

Unfortunately, as a quick Google search will show, a lot of PC gamers hate it because even when setting the shader to its best quality settings it still adds a slight blur to the outputted image. This is particularly noticeable when a scene has textures with fine detail and/or small specular highlights.

Is there a way to counteract this blur without reintroducing significant aliasing?

sentences:
Making enemy boss movement better than just moving randomly I am making a game where I have a player spaceship on left side and an enemy spaceship (boss) on the right. I need some ideas on what my enemy should do.

If I move my enemy down and up, down and up, etc.. then the player will be able to predict the enemy's movements. On the other hand, I don't really want the enemy to move randomly. It won't look good if the enemy is just moving to and shooting at random places.

I am also thinking of making my enemy move left, and when it reaches the outside of the screen then coming back in from the right side. Let me know what you guys think.

sentences:
Subclasses of GameInfo and Input in UDK We have two main subclasses of GameInfo for the two game types we have. I'm wondering if it's possible to get one of these to read a different .ini file because we'd like to move a few of the controls to different buttons for that mode.

It looks to me like it's just going to read Input.ini for this, regardless of the game type.

sentences:
How are collision and collision callback systems usually implemented? I'm writing my own game engine for learning purposes and was wondering about common ways to handle collision callbacks/responses. I'm NOT looking for ways to resolve collisions (no math needed here), I just want to know how systems are commonly set up to respond to one another.

For example, what I have designed now is a system where any entity, if they want to interact with the physical world, adds one of a few predefined shapes to the "physical objects list". One entity might want to add two squares to use as various bounding boxes, another entity might just add a circle as a collision area etc. Once every iteration, the collision detection system looks for collisions, and if it finds one, it checks the shape object's "parent" (the entity that added the shape) and notifies it of a collision and passes it a vector that can resolve it.

Even if someone can simply point me to an article that discusses this concept I would be grateful, as I haven't found any with some basic Google searches. (I also wouldn't know what to call this, collision callback is a term I made up, not sure if it makes sense).

sentences:
Unity2D: Floor tiles moved or missing I'm following the 2D Roguelike tutorial, which can be seen here. I don't want to get fancy, just follow the existing steps.

I've reached the part where all it's supposed to do is draw the playfield.  But it looks like this:

and I don't know why.

Some of the floor tiles are appearing beyod the outer wall, and others are missing (or maybe they're stacked on top of other tiles).

(EDIT: I discovered that the "missing" tiles are because I had the sprites in the wrong layer, and fixed them. I still have several appearing to the left of the outer wall, though.)

I tried to debug it in Visual Studio. The plan was to step through it line by line to see how the tiles are put down, but the debugger doesn't show the playfield until the whole thing is complete.

sentences:
Using 3D models in an 2D Game in libGDX In my libGDX 2D RPG-Game (like Zelda or something) I want to display some items as 3D-Objects. Since I'm using an OrthographicCamera like this:

this.gameWorldCam = new OrthographicCamera();
this.hudCam = new OrthographicCamera();
gameWorldCameraViewport = new ExtendViewport(FRUSTUM_WIDTH, FRUSTUM_HEIGHT, gameWorldCam);

I don't know how to render 3D-Object on it. In my render loop I call this:

// 2D
spritebatch.begin();
...
spritebatch.end();

// ----------------------------------------------
// Just some hardcoded model creation for testing
// ----------------------------------------------
Model model;
ModelInstance instance;
ModelBuilder modelBuilder = new ModelBuilder();
model = modelBuilder.createBox(
  5f,
  5f,
  5f,
  new Material(ColorAttribute.createDiffuse(Color.GREEN)),
  Usage.Position | Usage.Normal
);
instance = new ModelInstance(model);
// ---------------------------------------------

// 3D
modelBatch.begin(gameWorldCam);
modelBatch.render(instance);
modelBatch.end();

// 2D
spritebatch.begin();
...
spritebatch.end();

What do I have to do, to get the proper result? Right now, nothing of the green 3D cube is visible.

sentences:
How to smooth terrain to lower polygon count? I'm using Unity.
I've created a simple Beach using Terrain editor.
The problem is that Stats show me already a lot of Triangles only for Terrain renderer: 40K .

So my question is: how can I create a Unity Terrain suitable for Mobile game ?
How can I smooth terrain edge ?

Thanks

sentences:
How do I save a screenshot and load it as a texture for use in game? I have a Unity level that takes a screenshot taken in the previous level and applies it as a material to a Plane, the problem is that it will get stuck and not apply the most recent version of the screenshot.

I figure that the best way would be to handle it with a C# script instead of just simply dragging and dropping the image file from the assets folder like I have been doing.

sentences:
Register Enemies in game development I'm working on a game to learn the basic for game concepts. I end up with the following problem. I got a class called enemy, but now I want different types of enemies. These enemies extend from this class enemy. So I can have different enemies with that share different properties. The problem is that I want to spawn a different enemy each time. But to do this I need to know all the enemies available to choose on randomly.

I have been thinking and I got two approaches to solve this. The first one I end up is to have an enum with different enemies, and get a random value from the enum and spawn that enemy, but for this, I need to hard code all the enemies into the enum. And another one is to have a GameRegister class, that have a register for all available enemies, like when you do modding in Minecraft for example. I can have a registered class to register enemies or objects. And if I want to select a random enemy I know all the enemies available. I think is the best approach because if I want to add more enemies or anything, I only need to register for that class.

I don't have any idea at all to how to implement this pattern, and I didn't find anything on the internet. Can someone give some tips or clarify what I want to do? Because I have the main idea but I get completely lost when I need to design this.

I'm working on Java using libGDX, if is useful for some reason.

sentences:
Server/Client architecture I have high experience In Java and Networking. Our team have built a effective server that can create thread-pools managing many players. But we have hit a brick-wall. The way our server works is that our clients directly all just connect to the server. The client sends information to the server. For example, Client 004 pressed W. And the server calculates and responds. But here's the problem. What exactly do we send over the data stream? Do we send strings and decode them on the client/server side, or serialize objects? Sadly that question is very opinion based. So let me re-phrase it. What data do we send over the stream? For example, you can use W,A,S,D To move around. Im guessing it should look like this.

User Pressed W > Client sends string saying w to server > Server calculates movement > Server sends string saying player position to player > User updates players position.

But then we have to render other players. So we thought about this

User MPressed W > Client sends string saying W to server > Server calculates movement > Server checks if any others players are in the area > Server saves data of all players and yourself into a string and adds positions and sends to client.

Fair enough. But imagine if the server had to send over information, like the other players clothing, their health, mana, position, current animated frame.

The string might look like this:

"Bob, 12, 321, 391.34, 2914.2, Left, 0, False, null, null, sword, null, null"

Just for one player! To be sent over. The string concept is becoming long and tedious.

I have re-wrote this several times. And I still do find it confusing to understand the question myself.

But to shorten it down. How do I create a system where its a mmo really.

We've created the server, client art. We've payed for a large server with ddos protection. But we don't know what to send over the sockets.

sentences:
Difficulty with linked lists in drawing I've recently started game development in C++ and decided to make an ASCII based snake game. To hold the values of the snake tail I decided to use a linked list due to its flexibility when it comes to manipulating it.

Each node holds the x and y coordinates of a segment of the snake's tail.

The linked list is successful in holding data, creating a new node whenever the snake eats the fruit, but I do not know how to implement this data into my draw function.

I am aware of the issue being caused by a logical error in my program due to the while loop breaking my if else sequence. I just don't know how to fix it.

Here is my current draw function:

void draw() {
    system("cls");
    for (int i = 0; i < width+2; i++)
        cout << '#';
    cout << endl;

    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            if (j == 0)
                cout << '#';
            if (i == posY && j == posX)
                cout << 'O';

            Node *current = head->next;

            while (current != nullptr) {
                if (i == current->y && j == current->x)
                    cout << 'o';
                current = current->next;
            }
            if (i == fruit.y && j == fruit.x)
                cout << 'F';
            else
                cout << ' ';
            if (j == width-1)
                cout << '#';
        }
        if (i != height-1)
            cout << endl;
    }
    cout << endl;

    for (int i = 0; i < width+2; i++)
        cout << '#';
    cout << endl;

    cout << "Score: " << score << " || Tail len: " << tailLen << endl;

}

As you can see I've tried to retrieve the values from the nodes via a while loop. Unfortunately by doing so extra spaces are added and the frames are extremely glitchy. I've been racking my brain over this issue for ages. Any suggestions would be appreciated, thanks.

Screenshot:

sentences:
glOrthof not being applied I have had a problem with OpenGL where glOrthof is not being applied, leading to my frame having the default 1:1:1 ratio. Here is the code initializing it:

    public void reshape(GLAutoDrawable glAutoDrawable, int i, int i1, int i2, int i3) {
        GL2 gl=glAutoDrawable.getGL().getGL2();
        if(window.getWidth()!=screenWidth||window.getHeight()!=screenHeight)window.setSize(screenWidth,screenHeight);
        unitsTall=window.getHeight()/(window.getWidth()/unitsTall);
        gl.glMatrixMode(GL2.GL_PROJECTION);
        gl.glLoadIdentity();
        gl.glOrthof(0.0f, unitsWide, 0.0f, unitsTall, 0.0f, 1.0f);
        gl.glMatrixMode(GL2.GL_MODELVIEW);
    }

unitsWide is equal to 100. Here is the code for drawing the rectangle:

    public static void drawRect(float x,float y,float width,float height){
        GL2 gl=Render.getGL2();
        gl.glRotatef(-rotation,0,0,1);//Rotation needed to be reversed
        gl.glColor4f(red,green,blue,alpha);
        gl.glBegin(GL2.GL_QUADS);
        gl.glVertex2f(x,y);
        gl.glVertex2f(x+width,y);
        gl.glVertex2f(x+width,y+height);
        gl.glVertex2f(x,y+height);
        gl.glEnd();
        gl.glFlush();
        gl.glRotatef(rotation,0,0,1);
    }

The "Render" class is the class with all of the main methods for OpenGL. Here is the code that I used for drawing the rectangle:

Graphics.drawRect(0,0,0.5f,1);

Finally, here is a screenshot of what it looks like when this code executes:

I have looked around and have not found any other problems like this. Please tell me what I might be doing wrong.

sentences:
How portable are OpenGL versions, really? If I write a game engine that uses OpenGL 1.5 (not assuming what else I do), is it portable now and is it still portable five years from now or are/will support for OpenGL by hardware and drivers (be) exclusive to their (much more farther along) target OpenGL versions?

Lately I've been looking at a lot of answers on this website that direct users to divert their work towards the most recent OpenGL versions, citing hardware surveys of DirectX support and only recommending earlier versions as a last, final resort (as if to imply there is something wrong with them that makes all usage of them invalid or pointless).

If I only have computers that can provide OpenGL <=1.5 or <=2.1 contexts should I just give up game programming if I can't afford a new computer with hardware and drivers for 3.x and 4.x?  Or should I finish my game engine the way I intended to?

Will by the time I get a 4.x supporting setup will there be new versions and a lack of backwards compatibility that trash all usage of 4.x?  Will 4.x ever dominate over earlier versions support wise before a new major version is realized and released?

sentences:
Level of Detail/Load on Demand for crowds: replace groups of objects instead of individual ones? I have been thinking of using level of detail to make rendering crowds easier. The idea is to replace a group of meshes with a single one representing a group.

For example, you have 1 individual cube mesh. If you get 100 cubes together in a close space, replace all of those with a generic "blob of 100 cubes" mesh, that would be simplified and hopefully have a lower polycount than the sum of all 100 cubes. If 100 "blob of 100 cubes" meshes are together, then replace them with a simpler "blob of 10000 cubes" mesh. And so on.

There are many different challenges in doing this. Such as how to detect the objects are close? How to render the blob so it looks realistic enough? What to do about each object's metadata (physics, game variables)? etc So before I delve too much into it, I would like to see what is the current state of this technology and how people have been using this.

But I cannot find anything related to it. I've been looking for it for days, but every search I do about "LOD" and "crowds" only returns things about how to simplify each individual mesh of each game unit (ie. replacing a high poly count character, with a low poly character). Instead of replacing many game units with fewer ones, which is what I want to do. I've obviously played many games, and I can easily tell when they're using LoD for simplifying individual units. But I don't remember a single game that would replace groups. Am I looking it up wrong? Is there a specific term for this thing that I should be looking up for instead? Do you guys happen to know some case study examples of games that do this that I could check? Or maybe this isn't done at all?

Any help to point me in the right direction would be appreciated. Thanks.

sentences:
How to resize an image loaded using ContentManager in XNA I am new to XNA programming and I loaded the background image using ContentManager as a Texture2D object.

The background image which I have is of size 480*320. I have kept the minimum game window size as 640*480. My question is how would i resize the background image to the size of the game window.

Thanks in advance!

sentences:
How can I look up an object given only the name of its type? This question came from a fellow developer on Twitter, and I figured StackExchange would be a better format for explaining & sharing the answer. To paraphrase the question:

I'm setting up an in-game dev console in my Unity game, where a user should be able to call any method on any MonoBehaviour in the scene.

I want to use something like FindObjectsOfType<>, but because it's coming from a string input by the user, the class name is unknown at compile time.

I also want this to work universally, on any MonoBehaviour, not just ones I've specially instrumented or registered with the console system.

Is there a way to find instances of a type with a particular name, and call methods on them, using something like reflection?

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:
Step by step 3D Game Design in Unity My main question is related to 3D game design for Unity, but please let me introduce my idea so that you can understand what I really mean.

I am very eager to develop an adventurous - travel 3D game (Unity), where the main character is given some kind of task in country A and if he deals with it, he goes to the upper level, which is in another country and so on.

I have never developed a computer game before. I have knowledge of c# and a bit of java (for the programming part of the game). But I really don`t know where to start with the design. I have to think of a main character, episodic characters, environment and distinctive buildings for each country in 3D (for e.g. The Eiffel Tower in Paris, The Colloseum in Rome, The Great wall of China etc. ).

My question is: where to begin with the 3D design of the characters, the cities and the buildings? Can you please give me step-by-step instructions so that I can do something good and meaningful?

I know that Blender is a good option for 3D modeling, but is it the only thing needed for the 3D game design? I have experience with Adobe Illustrator, so can I use it to some extent in this case (for 3D game elements)?

Can I use Illustrator then import it in Blender and finally import the Blender product in Unity?

I accept every advice given. I really need someone to explain these things to me because for now I am really puzzled and not orientated from where to begin.
Thank you!

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 can i draw Arc in center of the screen on canvas in android RectF rectf = new RectF(10, 100, 700, 800);
c.drawArc(rectf, 0, 90, true, paint);

the above code is draw the arc using drawArc() method of canvas but i try to draw arc in a center of the screen.

sentences:
XNA Monogame GameState Management not deserilaizing I am having some trouble serializing/deserializing in a little game I am doing to teach myself monogame.

Basically, I am using the gamestatemnanagement resources common to monogame (screen manager etc). Then I am serializing my screen manager component and all associated screens in the OnDeactivated method:

 protected override void OnDeactivated(Object sender, EventArgs args)
    {
        foreach (GameplayScreen screen in mScreenManager.GetScreens())
        {
            DataManager.SaveData(screen.Level.LevelData);
        }
        mScreenManager.SerializeState();
    }

The Save data bit is to do with something else.

Then I then override OnActivated to de serialize

    protected override void OnActivated(Object sender, EventArgs args)
    {
        //System.Diagnostics.Debug.WriteLine("here activating");
        mScreenManager.DeserializeState();
    }

However, when this runs it just loads a blank screen - it goes into the game initialize and the game draw method, but doesnt go down into the screens initialize or draw methods.

I have no idea why this might be - any help would be greatly appreciated. I am not the only one who has encountered this - I found this post also - https://monogame.codeplex.com/discussions/391117

sentences:
How to highlight non-rectangular hotspots? So my question is highly related to Creating non-rectangular hotspots and detecting clicks.

Yet again, I've irregular hot-spots (think the game Risk). So basically, we can detect clicks on these hot-spots easily using color key mapping as discussed in above question which I don't have any problems implementing (which is also covered here in details).

The problem is about highlighting these irreguar hotspots. So let me explain the question a bit more - the above color key mapping guide uses this as a world map:

Then the author color-maps the imaginary countries:

Now we can now detect the country the pointer is over. In the same article author mentions outlining countries on mouse-over. Though to get the effect, he creates unique border assets for each country - like:

For the game I'm working on I'm using the same color-key mapping idea to detect hot-spots, but I didn't like the way of highlighting hot-spots. Coloring all the hot-spots is already a time-consuming job for me - as I have 25+ hot-spots for each map. Further, the need to have 25 unique border/highlight asset per hot-spot doesn't sound right.

Anyone have a better idea/suggestion on highlighting these hot-spots?

sentences:
Who controls my player's movement? In my game, does my player object control the movement, or does the map object control it? (Or some other object?)

The player doesn't know about the map's contents to stop at solids, interact with objects etc. Am I doing it wrong?

I'm currently dispatching data from a virtual joypad.

EDIT:

What if I dispatched movement notifications to my player and had it check with the map before moving, but the player would do the actual moving? Would that work?

EDIT2:

At this point I'm thinking about a top down game. Just to clarify, I want the player to move in 4 directions, not 8, and to be centered on the tile which they are standing on.

sentences:
Unity - Exposing a function to the inspector I wish to expose a script's function to the inspector, but I have no clue how to. I found something about Invoke() which was a start, but it isn't clear how to finish.

My code for the class:

 [System.Serializable]
     class MoveAction : UnityEvent<MonoBehaviour>, IUIAnimationEvent
     {
         #region Move
         public MoveAction()
         {

         }
         //to ensure only one mover coroutine can be active.
         IEnumerator moveRoutine = null;
         #region Solution 2: using fields and not parameters
         Transform from;
         Transform to;
         float overTime;
         public delegate void UIchain(MonoBehaviour mono);
         public event UIchain NEXT_FUNCTION;

         public MoveAction(Transform from, Transform to, float overTime, IUIAnimationEvent chain)
         {
             this.from = from;
             this.to = to;
             this.overTime = overTime;

         }
         public void Move(MonoBehaviour mono)
         {
             if (moveRoutine != null)
             {
                 mono.StopCoroutine(moveRoutine);
             }
             moveRoutine = _Move(from, to, overTime, mono);
             mono.StartCoroutine(moveRoutine);
             Invoke(mono);
         }
         IEnumerator _Move(Transform from, Transform to, float overTime, MonoBehaviour mono)
         {
             Vector2 original = from.position;
             float timer = 0.0f;
             while (timer < overTime)
             {
                 float step = Vector2.Distance(original, to.position) * (Time.deltaTime / overTime);
                 from.position = Vector2.MoveTowards(from.position, to.position, step);
                 timer += Time.deltaTime;
                 yield return null;
             }
             if(NEXT_FUNCTION != null)
             {
                 NEXT_FUNCTION(mono);
             }
         }

This is a lot of code, but the interesting part is the Move(MonoBehaviour mono) function. I want to expose that to the editor. How?

EDIT:

Something like this would be preferable:

sentences:
2D Rotation of an object along a curve line I would like to rotate an object along a curve. I managed to move the object along the curve using bezier curve algorithm. The hard part is to rotate the object constantly(no limit on maximum angle), and have to land at the end position. The angle have to be multiply of 360 when it land on the end position. A good example would be Maplestory, the item is dropped when a monster is killed. The item is rotated constantly and it will always landed at the correct angle.
Start position and End position will be provided, as is used by the bezier curve algorithm, is there any algorithm for the rotation part?

sentences:
How does an HLSL shader actually end up affecting the render output? I understand the syntax of HLSL, for example let's pretend I have this as my HLSL:

struct VOut
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

VOut VShader(float4 position : POSITION, float4 color : COLOR)
{
    VOut output;

    output.position = position;
    output.position.xy *= 0.7f;    // "shrink" the vertex on the x and y axes
    output.color = color;

    return output;
}

float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET
{
    return color;
}

and I compile it like this:

D3DX11CompileFromFile(L"shaders.hlsl", 0, 0, "VShader", "vs_5_0", 0, 0, 0, &VS, 0, 0);
D3DX11CompileFromFile(L"shaders.hlsl", 0, 0, "PShader", "ps_5_0", 0, 0, 0, &PS, 0, 0);

How does it like... know to change... I'm confused about exactly what the pipeline between HLSL and the actual pixels/vertices on the screen is.

Is this what actually "applies" them?

dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS);
dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), NULL, &pPS);

// set the shader objects
devcon->VSSetShader(pVS, 0, 0);
devcon->PSSetShader(pPS, 0, 0);

Keep in mind I'm like a literal beginner at this stuff. Can someone maybe explain what it's doing? I'm assuming the vertex HLSL function goes through every vertex and then changes them to whatever I have in the function, and the output is what was changed... and similarly for the pixel shader?

Another confusion, I know what a pixel is, and I understand what a vertex is... but what exactly does the pixel shader do?

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:
How to create a custom set of coordinates based on two points in Unity? As the title says, I am having problems finding a way to create a new set of local coordinates based on two points. Here is an example:

Consider that the two gameObjects are not one parent of another, therefore I cannot use something like transform.localPosition, furthermore I tried using transform.TransformPoint(), however the latter works only if if I want to create it with respect to a single point.
I think it is a silly question, yet I am not finding a way to solve it, so any help is greatly appreciated!

sentences:
Downscaling an asset, still pixellated? I created a rounded rectangle in photoshop, and I rasterized the rectangle before I saved it. Yet, when I try to use the rectangle in libGDX, it looks pixelated. How can I make it so that it's smooth?

Here is how my rectangle looks now:

My original image is 2048x2048, and I'm using batch to rescale it depending on the screen size. For example, this is how I draw the rectangle:

    batch.draw(img, Gdx.graphics.getWidth()/2-fitW/2, Gdx.graphics.getHeight()/2-fitH/2, fitW, fitH);

Where fitW and fitH depend on the current screen width and height (arbitrarily set to 300 now). So I'm essentially downscaling the original 2048x2048 rectangle to one that's 300x300. Can this be why the image is not rasterized?

sentences:
Why is my obj file imported into pyglet showing a blank screen? I am trying to figure out how to import .obj files generated using Blender into my Pyglet game. There is an importer object, example code, and an example .obj/.mtl file within Pyglet's contrib directory.

The pyglet contrib version works (and is flickery; comment out w.flip) with the pyglet/contrib .obj/.mtl files. When I try to run it with my .obj and .mtl files I get a blank screen.

Why am I seeing a blank screen instead of my Blender-generated object?

FWIW, here's my test repo.

sentences:
Hybrid App - Game Encyclopedia Image Asset An in-game encyclopedia usually consists of entries and images for things related to the game. For example, pokemon's pokedex. Image of Pokemon, text description and so on.

I've happen to encounter a road block of sorts making a game with an "encyclopedia". From my database, each row is one object with several columns as the different property of the objects. (I know that might sound like redundant information to some devs. Don't kill me pls. I'm just trying to be clear.)

It goes somewhere along the lines of:

Name | Rarity | Pattern | Collected
Ramen | Rarity 1 | 1 | Yes
Ramen | Rarity 1 | 2 | Yes
Ramen | Rarity 2 | 3 | Yes
Udon  | Rarity 5 | 1 | No

So the issue here is this: Game Encyclopedias tend to have a black silhouette for items you have yet to collect and it's colored in after you've collected it. Each item can have a 'pattern' on it, making it either differently colored or sparkling. Though, the shape remains constant.

Basically, the silhouettes can just be repeated for each item that is of the same type, for example, all "Ramen" items have the same silhouette so if they aren't collected yet, reuse same image. I thought I could probably tint the images and have a base image (light gray of sort), but if I did that, the entire image tints, even the parts I wouldn't want it to, which includes but is not limited to: white spaces (or transparent), the "bowl" part of the ramen image, possibly added on "sparkle effects" for even rarer items.

I'm currently attempting to achieve this in a game using the Ionic Framework because I recently got into hybrid apps; I think they are pretty fun to develop! And has since learnt angularjs and js in general. No idea the exact process that Cordova (phonegap) uses to convert all of this into android and iOS so I'm sort of looking out for three things:

1) How to link/pair/associate my database with my image asset?
2) How do I specifically tint certain parts of an object/Or overlay two objects over each other, one tinted and one base coloured.
3) Does it work on the mobile platform AFTER it compiles from js to Java. (Only working on android at the moment).

sentences:
Letting the user draw a Polygon Body and Image In my game, I want to provide the user with a drawing feature.

By free hand drawing, the user creates a polygon shape. Then, in my game implementation, I have to create a body for the found vertices and generate an image based on that polygon shape.

My problem is how to create an image that matches the user-provided vertices. I've heard that cocos2d has something called Image Masking. I don't understand how I could implement it in AndEngine. Could someone help?

sentences:
Box2D Weird collision behavior I'll let the gif speak first.

As you can see, the small cube just kinda floats there like it has a forcefield. This weird glitch only happens with small cubes, smaller than 60 pixels for some reason. It's 32x32. And I have no clue why this happens, at all. I've debugged and debugged, but I am at my end.

Box class

//Header
class Box
{
public:
    Box(const std::string& _textureName, int _x, int _y, int _width, int _height, SDL_Renderer* _renderer, b2World* _world);

    void draw(SDL_Renderer* _render) const;
    void update();
private:
    SDL_Texture* m_image;
    SDL_Rect m_bounds{};

    b2PolygonShape m_polygon;
    b2FixtureDef m_fixture;
    b2BodyDef m_bodyDef;
    b2Body* m_body;
};

//CPP
Box::Box(const std::string& _textureName, int _x, int _y, int _width, int _height, SDL_Renderer* _renderer, b2World* _world) : m_image(IMG_LoadTexture(_renderer, _textureName.c_str()))
{
    SDL_QueryTexture(m_image, nullptr, nullptr, nullptr, nullptr);

    m_bounds.x = _x;
    m_bounds.y = _y;
    m_bounds.w = _width;
    m_bounds.h = _height;

    m_bodyDef.type = b2_dynamicBody;
    m_bodyDef.position.Set(_x / World::PPM, _y / World::PPM);
    m_body = _world->CreateBody(&m_bodyDef);

    m_polygon.SetAsBox((_width / World::PPM) / 2.0f, (_height / World::PPM) / 2.0f);

    m_fixture.shape = &m_polygon;
    m_fixture.density = 1.0f;
    m_fixture.friction = 0.3f;

    m_body->CreateFixture(&m_fixture);
}

void Box::draw(SDL_Renderer* _render) const
{
    SDL_Point center;
    center.x = m_bounds.w - (m_bounds.w / 2);
    center.y = m_bounds.h - (m_bounds.h / 2);

    const auto angle = (180 * m_body->GetAngle()) / M_PI;

    SDL_RenderCopyEx(_render, m_image, nullptr, &m_bounds, angle, &center, SDL_FLIP_NONE);
}

void Box::update()
{
    m_bounds.x = m_body->GetPosition().x * World::PPM;
    m_bounds.y = m_body->GetPosition().y * World::PPM;
}

World class

//Header
class World
{
public:
    static constexpr float PPM = 32.0f;
    static constexpr int VELOCITY_ITERATIONS = 5;
    static constexpr int POSITION_ITERATIONS = 8;

    World();

    void update();
    void render(SDL_Renderer* m_renderer);

    void createBox(const std::string& _textureName, int _x, int _y, int _width, int _height, SDL_Renderer* _renderer);
private:
    float m_timeStep;

    b2World m_world;
    b2BodyDef m_groundBodyDef;
    b2Body* m_groundBody;

    std::vector<Box*> m_boxes{};
};

//CPP
World::World() : m_world(b2Vec2(0.0f, 9.8)), m_timeStep(1.0f / 60.0f)
{
    m_groundBodyDef.position.Set(400.0f / PPM, 590.0f / PPM);
    m_groundBody = m_world.CreateBody(&m_groundBodyDef);

    b2PolygonShape groundBox;
    groundBox.SetAsBox(400.0f / PPM, 20.0f / PPM);
    m_groundBody->CreateFixture(&groundBox, 2.0f);
}

void World::update()
{
    m_world.Step(m_timeStep, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
    for (auto box : m_boxes)
    {
        box->update();
    }
}

void World::render(SDL_Renderer* m_renderer)
{
    for(auto box : m_boxes)
    {
        box->draw(m_renderer);
    }
}

void World::createBox(const std::string& _textureName, int _x, int _y, int _width, int _height, SDL_Renderer* _renderer)
{
    m_boxes.push_back(new Box(_textureName, _x, _y, _width, _height, _renderer, &m_world));
}

If anybody has any idea why this might happen, please let me know. Thank you.

sentences:
How can I create a world map like Mario 3's? I want to create a world map similar to the type that Mario 3 on NES uses

where Mario can walk between levels (nodes?) by pressing up, down, left and right on the controller, and Mario can only pass through a level when it has been cleared.

What I have so far is a list of level nodes:

std::vector<SLevelNode*> NodeList;

struct SLevelNode
{
    CVector2D Position;
    CVector2D Size;
    CVector2D Origin;

    int ID;
    int Type;

    SLevelNode* pNeighbourNode[4];
};

The level node contains stuff like position, the type of level node (ground level, water level, castle level and so on). It also contain a neighbor node array, which in my case is 4, since I want the player to, eventually, be able to walk from a level node in all four directions. A level node might only have two ways of travel though, left and right for example.

Besides the level node, I also have a path piece, which is a piece of road between the level nodes:

struct SPathPiece
{
    CVector2D Position;
    CVector2D Size;
    CVector2D Origin;

    int Type;

    float Rotation;
};

The type variable is either a horizontal piece, a curve piece, a bridge piece and so on.

So far my character can walk between the level nodes by dragging a 2D vector between them, that the player traverse with. I want, however, the player to start walking from a level node, walk through the road pieces (between the nodes) and end up at the goal level node.
I'm not sure how to make the level nodes "know about" the road pieces that is placed between the start node and the goal node. Have a list of path pieces in each level node?

I have though about using A* and make a path finding map but it feels like it's over-complicates things.

I would like some help on how to achieve this.

sentences:
Tips for writing 3D Collision detection with opengl I would like to any tips/articles/tutorials on how to write collision detection using OpenGL and C++ in 3D mainly just simple box collisions etc but also if there are any advanced resources that would be great to. i also don't wont to use any external library`s if possible.

thanks

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:
What size textures do I need for a 2D grid based game if my tiles are larger than textures I have? I'm building a grid-based game for iPad, and for usability purposes I've selected my game grid to be built of 75x75 squares. However, so far I've seen that the majority of (free)texture catalogs I can find are either 16x16 or 32x32.

Currently I have the graphics engine stretch the 32x32 texture onto a 75x75 tile, which does not look very sharp.

How can I make my game look good -  do I need to create textures whose size is equal to my game tile? Should I try to stitch multiple textures together (like 4 texture squares per game square)?

sentences:
Hide network latency for ingame dialog I have a tick-based Multiplayer-RTS game: Client sends action to server at Frame n which will be broadcasted to all clients and executed at Frame n+x (x depends on network latency of slowest player)

I'm unsure how to hide this latency in GUI dialogs. E.g. a value that is adjustable with a slider between 0 and 100. The current solution simply fills a "virtual" value with the actual value at game start and always operates on that value. It is highly unlikely that a change command for this does not get executed (TCP, unconditional change execution) but it is possible (packet sent and ignored during pause)

I also wanted to keep that value local to the dialog and not store it somewhere else. Start idea: Get the current value on dialog open and use this while the dialog is open. Problems: Maybe the value was changed before (packet sent, but not executed) in which case the change does not get displayed. An idea I have is storing the last value I got and update the slider if that value has changed. Maybe only when the sliders position itself did not change (by the user). However then after the update it will detect that change and change it again which leads to a change of twice the amount requested. I could also update the "last value" when the packet is sent but that will cause the (time-based) update to change it back till the actual change is made which might even result in a loop of back-and-forth changes. How can I keep the GUI and game in sync but allow visual changes? Seems I'm missing a little piece here...

Another part where this is even worse is with other kinds of dialogs. E.g. an ordering dialog (put some entities in a specific order) or a number input that is used to request producing the specified amount, hence the game may also decrease this, not only the packet. I could not find any guides or solution besides "use inter/extrapolation" which is not applicable here. How do others do this?

Edit: Maybe a little example for the strategy I though off with its flaws:
A) OK

Value=4
Open Dialog -> Show Value=4
User Changes Value to 6 (Slider position change)-> Sent to server
Server sends "6" -> Slider changes to "6" (no change as it already is)

B) OK

Same as A) but dialog closed before receiving from server
Dialog reopened -> Show Value=4
Server sends "6" -> Slider changes to "6"

C)

Value=4
Open Dialog -> Show Value=4
User Changes Value to 6 (Slider position change)-> Sent to server
User Changes Value to 7 -> Sent to server
Server sends "6" -> Slider changes to 6 BAD
Server sends "7" -> Slider changes to 7 => OK, but strange and may cause feedback loops

D)

Value=4, change to 6 requested
Open Dialog -> Show Value=4 (6 was stored in the old dialog)
User Changes Value to 7 -> Sent to server
Server sends "6" -> Slider changes to 6 BAD
Server sends "7" -> Slider changes to 7 => OK, but strange and may cause feedback loops

So on one hand I only want to show visual values (and store them between dialogs) but on the other hand I want to keep them in sync with the actual value. So only solution here seems to be to persistently store the visual value and make sure, each update will eventually be executed. But I'm still clueless what to do with values that can be changed by the came (e.g. production orders that decrease once they are processed)

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:
Möller-Trumbore intersection point I am using the Möller-Trumbore method as part of my (still very basic) collision detection system.

The information I'm craving about is the distance from the ray origin and intersection point. The intersection point would be fine too obviously.

I probably wrongly assumed t in the code below is actually the distance from the ray origin to the intersection point. If it actually is, then I don't know what's wrong with my code.

I have got a simulation with a mesh and "bullets", sometimes firing a collision acurately, and sometimes not (bullets passing thru mesh, or firing a colision before it actually should hit).

bool rayTriangleIntersect(const XMFLOAT3 &orig, const XMFLOAT3 &dir, const XMFLOAT3 &v0, const XMFLOAT3 &v1, const XMFLOAT3 &v2, float &t, float &u, float &v) {
// http://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/moller-trumbore-ray-triangle-intersection

    float kEpsilon = 0.000001f;
    XMFLOAT3 v0v1 = v1 - v0;
    XMFLOAT3 v0v2 = v2 - v0;
    XMFLOAT3 pvec = XMFLOAT3Cross(dir, v0v2);

    float det = XMFLOAT3Dot(v0v1, pvec);

    if (det < kEpsilon) return false;

    float invDet = 1.0f / det;

    XMFLOAT3 tvec = orig - v0;
    u = XMFLOAT3Dot(tvec, pvec) * invDet;
    if (u < 0 || u > 1) return false;

    XMFLOAT3 qvec = XMFLOAT3Cross(tvec, v0v1);
    v = XMFLOAT3Dot(dir, qvec) * invDet;
    if (v < 0 || u + v > 1) return false;

    t = XMFLOAT3Dot(v0v2, qvec) * invDet;

    return true;
}

Is t really the distance im looking for ? If not how do I get it, or the intersection point. I've heard of baricentric coordinates in a triangle related to u and v - is it the way to go ? If yes I'd be thankful for an example or link related to the Möller-Trumbore method.

Thanks!

sentences:
AudioClip is empty saving recording from Microphone EDIT: I updated the code to what I have currently. I'm not sure why but, the editor and my platform complained when I put the WWW in a co-routine, it seems to load the audio clips to the object but I cannot play them. In a script attached to the object I wait until the Audio Clip is loaded before I try to play it.

So I am trying to record some Audio through the microphone and then save an AudioClip to the disk as a .wav file and also save the filepath as a playerpref and then later I can come back and load the string into a url but, for some reason the Audio Clip doesn't get loaded properly as I can see that there is an audio clip on my audio source in runtime but, it has no name and it has no sound on it. However, when I press play in the inspector I can hear my sound

I am using SavWav.cs to save my audio clips to .wav files.

Here is the url(filepath) I am sending to my load method:

string filename = string.Format(@"CapturedAudio{0}_n.wav", Time.time);
string filepath = Path.Combine(Application.dataPath, filename);

Here is the method I am using to get the AudioClip:

private void SpawnObject(string savedNames, Vector3 savedPositions, Quaternion savedRotations)
{

        GameObject cubeToSpawn = Instantiate(cube, savedPositions, savedRotations);
        WWW www = new WWW("file:///"+savedNames);
        cubeToSpawn.GetComponent<AudioSource>().clip = www.GetAudioClip(false, false, AudioType.WAV);

}

The obj is just a cube with an AudioSource attached to it that I instantiate prior to calling this method above.

The filepath works fine for saving but, for some reason it doesn't want to load the audio clip. Any help would be greatly appreciated.

sentences:
How to add a fluorescent effect on an image in Unity I have recently been attempting to create a true on-screen representation of a fluorescent orange colour on an image. Whereby, I believe post-processing with unity will deliver the best results.

Thus, I was wondering if someone could kindly guide me through the steps to add a fluorescent effect to my image?

As a reference I would like to try match pantone 804c on screen.

Image in question:

I have tried to follow tutorials like this, but unfortunately they all are working on 3D scenes. I have a pre-existing jpg image that I want to modify.

sentences:
Is "reverse season pass" a thing? "Reverse Season Pass" is a name I just made up and I want to know if something like this already exists with a better name.

We all know regular season passes: you buy a pass for a game you already paid for, which gives you access to future dlc, which doesn't exist yet, and may or may not be worth the money. AAA publishers love those things and they're pretty BS for the customer, because they are expected to pay for something that doesn't exist yet, or may never exist, or may not even be worth the money. You just have to trust them with your money, and there's no guarantee the base game hasn't been already sliced up into future dlc prior release.

Now lets say you have a story-driven game you want to release in episodes, like I want to do. The game itself is already completely done, all episodes are ready, you just want to pace the content over a few weeks like a show on tv to create discussion and excitement in the fandom for each new episode. The episodes would be added to the base game, meaning the episodes aren't sold separatly, you want to sell the whole experience.

However, if you're like me and you're still a nobody in the gaming industry, charging full price for a game, that's supposedly done (you can't know for sure, right?), which is going to be released in pieces supposedly, seems... very shady. I wouldn't blame anyone if they found that suspicious.

Lets say your game as a whole is worth 30$ and you have five episodes, so 6$ per episode. What I thought of doing, which I think is pretty fair, is to adjust the price depending on how many episodes are already released. When the first episode is released, the game costs 6$. When the second episode is released, the game costs 12$, then 18$ with three episodes, 24$ with four episodes, and at last, 30$ for the full game with all five episodes.

On top of that, when people buy the game early, when only one or two episodes are available for example, they already essentially bought a season pass on top of the game and will receive all other episodes for free. That way, people pay for the game only what it's currently worth and early adopters are rewarded for their early purchase and show of trust.

Has anyone ever done something similair? Is there a name for it?

sentences:
Path Planning in a chaotic, ever-changing environment I've implemented Path Planning a few times, using A* on nav meshes, and also Continuum Crowds but now I am trying to plan paths in very chaotic environments.

In this environment, new routes and new blockages are created constantly, and chaotically. This is because the environment is fully destructible, and the debris can create new obstacles.

In such an environment, nothing can be pre-computed. What would be a good way to sense the traversability in such a world? There is no concept of a grid in my world, b.t.w, but I wonder if I should introduce an artificial one for the purpose of planning.

But if navigation could be achieved without a grid, that would be much better of course.

Note that the navigation is not merely dynamic in the sense that certain transitions get opened/closed, but actually chaotic. This stops me from a simple approach of enabling/disabling certain edges on the navigation mesh. That approach would be usable if, e.g. a gate gets locked/unlocked. But in my case, in a blink of an eye, the routes could be drastically changed where simple mutations of a pre-computed mesh are not doable.

sentences:
360 Orbital Camera Controller I have a stationary cube in my scene that I'm orbiting a camera around. I have my MainCamera nested under a GameObject that I'm calling 'OrbitalCamera'.

I setup the script so that a click (or tap) and drag will rotate the camera around the object in space so it feels like you're rotating the cube (ie: if I click the top of a face on the cube, and pull down, I'm rotating the X value) but you'll actually be rotating the camera.

For the most part, my script works. However, after rotating the Y so much, the camera is upside down and the X gets inverted. Here's my script:

public class OrbitalCamera : MonoBehaviour {
    public bool cameraEnabled;

    [SerializeField] private float touchSensitivity;
    [SerializeField] private float scrollSensitivity;
    [SerializeField] private float orbitDampening;

    protected Transform xFormCamera;
    protected Transform xFormParent;
    protected Vector3 localRotation;
    protected float cameraDistance;

    void Start () {
        cameraEnabled = true;
        xFormCamera = transform;
        xFormParent = transform.parent;
        cameraDistance = transform.position.z * -1;
    }

    void LateUpdate () {
    if (cameraEnabled) {
            // TODO:: FIX PROBLEM WHERE WHEN CAMERA IS ROTATED TO BE UPSIDEDOWN, CONTROLS GET INVERSED
            if (Input.GetMouseButton(0)) {
                if (Input.GetAxis("Mouse X") != 0 || Input.GetAxis("Mouse Y") != 0) {
                    localRotation.x += Input.GetAxis("Mouse X") * touchSensitivity;
                    localRotation.y -= Input.GetAxis("Mouse Y") * touchSensitivity;
                }
            }
        }

        Quaternion qt = Quaternion.Euler(localRotation.y, localRotation.x, 0);
        xFormParent.rotation = Quaternion.Lerp(xFormParent.rotation, qt, Time.deltaTime * orbitDampening);
    }
}

Is there a good method to achieve this type of 360 camera? I'd like dragging from right to left to always move the camera left and dragging left to right to always move the camera right -- no matter how the camera is oriented.

sentences:
How do I change a Unity 4.6 Sprite's textureRect at runtime? I'm using Unity 4.6, and I've made a sprite like this:

    AtlasFrameData frame = _testAtlas.GetFrameByIndex(0);
    Rect spriteRect = new Rect(frame.Position.x, frame.Position.y, frame.FrameSize.x, frame.FrameSize.y);
    Sprite _theSprite = Sprite.Create(_testAtlas.AtlasTexture, spriteRect, new Vector2(0, 0));

The texture is an atlas, and I have a bunch of data read in from an XML file telling me where the frames are. I want to do this in Update():

    AtlasFrameData frame = _testAtlas.GetFrameByIndex(_currentFrame);
    Rect spriteRect = new Rect(frame.Position.x, frame.Position.y, frame.FrameSize.x, frame.FrameSize.y);
    _theSprite.textureRect = spriteRect;

But I'm unable to do this since .textureRect is readonly. I could create a new Sprite each frame, but I suspect this is not going to perform well with tons of Sprites.

sentences:
Statemachine to behaviour tree? Background
I was able to convert simple statemachines like this...

Into a BT looking like this (Notation describtion)...
root
  sequence  #After another
    playAnimation name:idle
    sequence
      walks? # Breaks current sequence if false
      playAnimation name:walk
    sequence
      runs?
      playAnimation name:run

Goal
But how do we convert more complex multi-layered animation states into a behaviour tree ? How would such a BT look like ? The difficult parts here are transistions between the different states, something i couldnt solve in an BT.

Question
Is it possible to convert every statemachine into a behaviour tree ?
What does the theory says and how does it look like in practice ?

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 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:
Why are committed resources better than placed resources? This NVIDIA document regarding dos and don'ts in DirectX 12 states the following:

  Use committed resources where possible to give the driver more
  knowledge

  This allows the driver to better manage GPU memory
  A good use case for placed resources are resource heaps that are e.g. used during streaming and do hold different sets of read-only
  textures over their life time

But this raises more questions than it answers:

What additional knowledge is given to the driver if I use a committed resource? The information on the resource that I pass to both CreateCommittedResource and CreatePlacedResource is pretty much the same...
What does it mean that the driver will better manage GPU memory?
If I know what the allocation/deallocation patterns look like in my game, isn't it better if I manage GPU memory manually with placed resources, instead of letting the GPU decide where to place each resource, and potentially run into VRAM fragmentation in the long run? Or will the driver perform heap defragmentation?
CreateCommittedResource creates an implicit heap each time it is called, while CreatePlacedResource simply creates the resource over the memory I choose on an existing heap, and is therefore much faster. Wouldn't it be preferable in most cases to use placed resources instead? Especially if I am interested in creating loading screens that don't miss a single frame deadline?

I am quite surprised to read from NVIDIA that committed resources are preferable to placed resources. Could anybody explain in more detail what else is happening under the hood, so committed resources are preferable to placed resources?

sentences:
Using random numbers with a bias I appear to be awful at describing the question so I'll try and describe the problem.

I want to add a random amount of heads to my creatures but I want to be able to determine several things.
a) The minimum number of possible heads
b) The maximum number of possible heads
c) The probability of the number being high/low within the above values.

So i could add heads like so:
addHeads(5, 10, 0.5); // should produce creatures with "around" 7.5 heads but they could have anywhere from 5 to 10.

So random number generation isn't the problem, but controlling and actually using them in a game is. :D

sentences:
Should a socket server and game server be separate processes? Assume a simple standard client/server game.  For the server, is it worthwhile to have a separate process that listens for connections and messages from clients and sends the data via local sockets or stdin to another process that runs the actual game server?

The other option would be to have both things be done in a single process. Queueing incoming messages and executing them in the right order there shouldn't be a halting issue.

I am wondering if the extra resources to separate the two "activities" is actually worth it. How should I decide? I'd like to hear any pros/cons.

sentences: Game Design vs Game Development What is the difference between a video game developer and a video game designer?

sentences:
How do I use unpackHalf2x16? I'm trying to use (un)packHalf2x16, without success so far. I'm drawing with:

glVertexAttribIPointer(0, 2, GL_UNSIGNED_INT, 0, 0);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glDrawArrays(GL_POINTS, 0, n_points);
glDisableVertexAttribArray(0);

and on the shader

#version 330 core
#extension GL_ARB_shading_language_packing : require
in uvec2 A0;
// (...)
vec4 t = vec4(unpackHalf2x16(A0.x), unpackHalf2x16(A0.y));

But nothing gets drawn. I'm pretty sure buffer's content is right, and if I use vec4 t = vec4(0); I can see it's working properly.
How is this packing / unpacking thing supposed to work? I can't find any example.

sentences:
How to force a garbage collector swep on libgdx? I found that you can control your memory usage on libgdx with:

int javaHeap = Gdx.app.getJavaHeap();
int nativeHeap = Gdx.app.getNativeHeap();

But, How can I force a garbage collector cleanup? I want to force in special moments, like screen change on a game.

sentences: How to make 2d map that isnt based on tiles I am working on a game, and need to make a 2d map that isnt based on tiles. An example of something similar to what I want is all those racing games like "bike race" where the map is just somewhat a line. While I have made tile based 2d games before, both using map editors and programming myself, I have no idea where to begin to make a map type like that. Are there any programs that are used to make such maps? If not, how might I go about it? Just draw the line in an image editor, and program objects to go over that image, and then set up collision detection on the line so that players can't go through it?

sentences:
How would one construct a realistic "infrared vision" effect? How would you go about constructing a realistic infrared vision effect with shaders? By realistic I mean one that looks realistic, like this example.

I have an idea about making a texture to determine how much heat a material emits and then determine by using the dot product of normal and view vector how much of that heat reaches the viewer but I'm not even sure that this is how thermal vision even works so I wanted to check if there's a better approach before starting to implement something that might be entirely wrong.

sentences:
What is the point of the XNA.Input.Button enum? I am trying to make an InputManager class that will let me basically bridge XNA's various input methods and do a corresponding action in my game. Part of this is designing different keybindings.

Suppose I have a class GamePadBinding : InputBinding<Button> - this is the Button enum from XNA.Input and has a variety of different buttons (Left, A, etc). However, to actually check input, I have to call something like if (GamePad.GetState(PlayerIndex.One).DPad.Left == ButtonState.Pressed), and the problem with that is that it uses a struct with readonly values.

How am I expected to store an enum of type Button and compare that with this? I really am not seeing the point of this enum.

sentences:
Support for different resolutions in a tabletop environment Right now I am experimenting with XAML and C# to write a small Windows Store App which supports displaying a playmat with cards. However not everyone uses the same resolution and with a somehow fixed layout I run really fast into some issues. Having a really high resolution yields

where all the zones are huge (and ugly stretched) and the icons as well as the fonts are really small. Changing to a low resolution yields

which is okayish so far, yet I would need to find out how to scale assets like the displayed card such that it fits the zones.

Are there any best practices, creating such fixed layouts and optimizing them for different resolutions? How should I correctly compute the sizes for a card on the table? And is there anything to keep in mind when creating fullscreen content for different resolutions?

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:
Why does my button not working? I am a new game developer, and I am making a game in unity. I have button, and the button doesn't work at all.
Also I have a "game object" with a script:
using UnityEngine.SceneManagement;
using UnityEngine;

public class Pause : MonoBehaviour
{
    public GameObject Panel;
    public GameObject PauseButton;
    private bool isopen = false;
    private bool can;

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape) && isopen == false && can)
        {
            Pause_();
        }
        else if (Input.GetKeyDown(KeyCode.Escape) && isopen)
        {
            resume();
        }
    }

    public void Can(){
        can = true;
    }

    public void Cannot(){
        can = false;
    }

    public void Pause_()
    {
        isopen = true;
        Panel.SetActive(true);
        PauseButton.SetActive(false);
        Time.timeScale = 0f;
    }

    public void resume()
    {
        isopen = false;
        Time.timeScale = 1f;
        Panel.SetActive(false);
        PauseButton.SetActive(true);
    }

    public void MainMenu()
    {
        isopen = false;
        SceneManager.LoadScene("MainMenu");
    }

    public void Continue_Time()
    {
        Time.timeScale = 1;
    }
}

And that also doesn't work.
P.S I have 3 canvases.
I look forward to see an answer.

sentences:
Should unbind buffers? I'm making some tests with OpenGL ES 2 and got some questions, my current program is like that:

Init
-------
-> create index buffer
-> fill index buffer glBufferData …
-> create vertex buffer
-> fill vertex buffer glBufferData …

Draw
-------
 1. Apply vertex buffer

    -> Bind VAO
       -> bind vertex buffer
          - enable attributs (glVertexPointer, …)
       -> unbind vertex buffer
    -> Unbind VAO
    -> Bind VAO

 3. Apply index buffer
 4. Draw

The problem

The given code crash, after some researches, I've understood why: I need to unbind my index buffer in init part (after "fill index buffer glBufferData") or unbind it before the first "Bind VAO"

My questions are:

Can I put my index buffer in VAO (VAO stock index buffer?)?
Did I have to unbind buffers after each update (glBufferData)?

In my application I've got some buffers who are updated on each frame (Exemple: Particles) so I've got an OpenGL stack like that:

-> bind buffer 1
-> update buffer 1
-> close buffer 1
-> bind buffer 1
-> draw

First 3 lines update the Vertex buffer, the two last draw object, that should be something like that:

-> bind buffer 1
-> update buffer 1
-> draw

Thanks

sentences:
How can I find a position between 4 vertices in a fragment shader? I'm creating a shader with SharpDX (DirectX11 in C#) that takes a segment (2 points) from the output of a Vertex Shader and then passes them to a Geometry Shader, which converts this line into a rectangle (4 points) and assigns the four corners a texture coordinate.

After that I want a Fragment Shader (which recieves the interpolated position and the interpolated texture coordinates) that checks the depth at the "spine of the rectangle" (that is, in the line that passes through the middle of the rectangle.

The problem is I don't know how to extract the position of the corresponding fragment at the spine of the rectangle. This happens because I have the texture coordinates interpolated, but I don't know how to use them to get the fragment I want, because the coordinate system of a) the texture and b) the position of my fragment in screen space are not the same.

sentences: Populating Static Mesh Array I'm trying to populate a Array of Static Meshes from the On Begin Play event with all the static meshes that are children of the primary object but can't seem to access them as static meshes, any suggestions?

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:
Does Unity for PC use Direct3D or OpenGL? I am a mac developer using Unity and I hardly use a PC. When you build a Unity game for Windows, does it use Direct3D or OpenGL?

P.S. I'm not sure if it's called Direct3D or DirectX

sentences:
Unity - Sprite disappears completely when just a part of it is outside the camera's FOV I'm making a game in Unity, and when the player walks past a sprite, the sprite disappears, and when the player walks back toward it, it reappears. You can see a video of the problem here https://www.youtube.com/watch?v=jgLN3m94tBo

I've also included my camera script below if anyone wants to check that out. Any help on this matter would be more than appreciated.

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

public class Camera : MonoBehaviour {

private Transform target;

private float minX = 7.99f;
private float minY = -19.09f;

public float maxX, maxY;

void Start()
{
    target = GameObject.Find("Player").transform;
}

void LateUpdate()
{

    transform.position = new Vector3(Mathf.Clamp(target.position.x, minX, maxX), Mathf.Clamp(target.position.y, minY, maxY), transform.position.z);
}
}

Here's a screenshot of my camera's settings

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:
Move an object with other objects connected (via joints) the right way What is the best way to move an object with other objects connected to it via joints?

Let's assume we have the following setup:

A player that can move on the x and the z axis

"Normally configured" RigidBody
Moving like this:

    void FixedUpdate() {
        Vector3 movement = new Vector3(Input.GetAxisRaw("Horizontal"), 0f, Input.GetAxisRaw("Vertical"));
        movement = movement.normalized * 2f * Time.deltaTime;

        // m_rb is the RigidBody of the player
        m_rb.MovePosition(transform.position + movement);
    }

Another object that should be moving with the player as it were its child

Connected to the player via a fixed joint
"Normally configured" RigidBody

When moving the player without any object connected the movement looks as expected:

Now moving the player with the object connected results in some kind of dragging effect as seen here:

One way to solve this behaviour would be to also move the connected object:

// m_otherRb is the RigidBody of the connected object (m_other)
m_otherRb.MovePosition(m_other.transform.position + movement);

Is there a better way to solve this? Shouldn't the joint handle the movement of the other object? Moving the connected object like this results in many problems like to high impulse forces when colliding with something as both elements get pushed towards the collider. Also handling the rotation of the connected object isn't as easy as the position.

sentences:
How to Implement Screen Freeze in Godot Many 2D games have an intentional screen freeze (say, 75 milliseconds) when the player takes or deals damage. During this freeze, all physics and animation processing stops.

How can one implement a screen freeze in Godot?

If you want to suggest how to do this in Unity or another engine, that's fine too. It might help me to figure out how to do it in Godot.

My only idea is to have a boolean called is_screen_freeze along with some variables freeze_start_time and freeze_duration. In all my nodes' _process() and _physics_process()methods, I can just pass if is_screen_freeze is true. This seems like a rather inelegant way of going about a screen freeze, and I'm not even sure it would work since animations would probably keep playing. Is there a better way?

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:
Light propagation through sub-step ray tracer I have this crazy idea.

What if you made a real-time 3D render that for each frame, progressed some number of light bouncing. In effect this is a ray tracer but it does the ray tracing in steps. First step is direct lightning, second step is 1 degree of indirect lightning and third is 2 degrees of indirect lightning.

For each step, you would accumulate the information in a new frame buffer. Obviously there are limitations to this because you are only considering what's on screen but is the idea sound? Can it be done? What does it look like?

I'm eager to try it out because it appears simple but I'm wondering if something like this doesn't already exist.

Basically a ray tracer implemented with real-time 3D rasterization that converges over time (with sub steps, more than 1 pass per frame) this convergence can be adjusted.

sentences:
Problem if 2 HTC Vive into field of view of emitters? I am developing an app for a trade fair that uses the HTC Vive.

Now I am wondering how the HTC Vive syncs with the sensors...I suppose it uses bluetooth, are the sensors "coupled" with the glasses for example with a MAC-Address or sth like that, so another glasses will not work at all, before not configuring it?

I mean, if for any reason another glasses (connected to other computer but powered on) come into the field of view of the emitters, could it be a problem?

Since I have no access at the moment for a second HTC Vive I can't just test it.

If someone has info regarding this it will be very useful.

sentences:
How can I prevent P2P connections from leaking player IP addresses? There's a common issue in multiplayer PC games like the older versions of Call of Duty where any connected player in a match can easily sniff the game packets and read the IP addresses of all the connected players. This is undesirable privacy-wise.

How can I reasonably protect players from malicious actors that may use their IP for nefarious purposes?

sentences:
SpriteFont not found in Nuclex Framework I am using MonoGame to port my XNA Windows Phone app to iPhone. All is well except that my fonts look distorted/smudged on the iPhone.

Turns out this is due to the way that MonoGame builds the content fonts. They basically let XNA compress them, then MonoGame uncompresses them and re-compresses them again in PVRTC, this causes the distortion. The MonoGame team is aware of that, however no solution out from them yet. Other users have suggested using the Nuclex spritefont processor to bypass compression as shown here, however am unable to do that since I get the following error on build:

Error   1   Building content threw Exception: Font could not be found
   at Nuclex.Fonts.Content.FreeTypeManager.OpenWindowsFont(String searchedFaceName, FontDescriptionStyle style)
   at Nuclex.Fonts.Content.FreeTypeManager.OpenFont(String pathOrFaceName, FontDescriptionStyle style)
   at Nuclex.Fonts.Content.FreeTypeFontProcessor..ctor(FontDescription fontDescription, FontHinter hinter)
   at Nuclex.Fonts.Content.NuclexSpriteFontDescriptionProcessor.Process(FontDescription input, ContentProcessorContext context)
   at Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor`2.Microsoft.Xna.Framework.Content.Pipeline.IContentProcessor.Process(Object input, ContentProcessorContext context)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
   at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem[] sourceAssets, String[]& outputContent, String[]& rebuiltContent, String[]& intermediates, Dictionary`2& dependencyTimestamps, KeyValuePair`2[]& warnings)   c:\users\ramsay\documents\visual studio 2010\Projects\MonogameContent\MonogameContent\MonogameContentContent\BoldFont.spritefont    MonogameContent

The author of the Nuclex framework explains the error

  There's no well-defined API for looking up the font names in Windows,
  so I'm checking the names embedded in the *.ttf files in the Fonts
  directory to find "Courier New" with the appropriate style flags.

So am now I have no idea how to fix this problem and am looking for any advice. It impossible to release an app with all the text looking smudged. However other MonoGame iOS apps are out there with undistorted text, so I am sure there is a solution, but I could not find it anywhere.

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:
Game shifts to edge of screen when clicking Play button in Unity I’m attempting to help my young daughter who is trying to learn Unity. I know very little about the program.
Recently, she developed a basic game consisting of a dragon and a person.
When she presses the play button, the game shifts to the edge of the screen and does not start.
I have attempted to research the issue but with my limited knowledge on the subject I could not find anything. Any help or suggestions would be appreciated!
09/22 - After reading the comment and following the recommendations  I do believe it’s a camera issue. I’ve attempted to move the camera around using the X, Y and Z axis is but I can’t get it to actually change the view. See the attached screenshot.

10/02/2020 - My daughter went back and redid the game from the start. The issue is that the game will not allow her to enter play mode until she places the dragon. However, as soon as she places the dragon and presses play the game moves the camera. So the issue apparently occurs prior to or at the time she places the dragon but because she can't enter play mode prior to this point I'm not sure where the issue occurs.

sentences:
HLSL Textured Light: outputs only a specific part of the texture (new problem) Problem 1

I am trying to create a spotlight that instead of giving the circle within the spotlight a simple color, applies a texture to it. However, where the texture is supposed to be is only a black circle: image.

Solution: the position I used for my texture wasnt correct.

old and faulty code:

float4 TexturedSpotlightPixelShader(VertexShaderOutput input, float2 TextureCoordinate : TEXCOORD0) : COLOR0
{
    //I left out all the other code in the shader, full code is at the bottom of the thread
    color = tex2D(SpotlightTextureSampler, TextureCoordinate);
}

better code that solved my 'black problem (but created a new one):

float4 TexturedSpotlightPixelShader(VertexShaderOutput input) : COLOR0
{
    //I left out all the other code in the shader, full code is at the bottom of the thread
    color = tex2D(SpotlightTextureSampler, input.Position);
}

where at that point input.Position was set to the worldPosition in the vertexshader (which turned out was the reason for problem 2)

Problem 2

My spotlight now applies the texture, however the texture is repeated multiple times in miniature, as such: image

Solution:
I added these lines in the vertex shader:

input.Position3D.w = 1.0f;
output.Position = mul(viewPosition, Projection);

and by adding/changing these lines in the pixelshader:

float2 TextureCoordinates;
TextureCoordinates.x =  input.Position.x / input.Position.w / 2.0f + 0.5f;
TextureCoordinates.y = -input.Position.y / input.Position.w / 2.0f + 0.5f;
color += tex2D(SpotlightTextureSampler, TextureCoordinates);

however, there was still a third problem.

Problem 3

The third and probably (I hope :P) the last problem, my spotlight now only shows a part of my texture and manually resizing the image (in the image file, not in my code) doesnt change what part of the texture is shown, as such: image

Solution:
In my vertexshader I used the 2D positions (viewmatrix multiplied with the projection matrix) where I should have used a viewmatrix not based from my camera but from my spotlights point of view (and a projection matrix also for my spotlight's point of view)

My new code:

float4x4 View2, Projection2;

VertexShaderOutput SimpleVertexShader(VertexShaderInput input)
{
//left out a lot of code here
output.Position = mul(mul(worldPosition, View2), Projection2);
}

Full Code

Link to the shader code and the link to the xna/c# code.

sentences:
How do I set the UV coordinate from a texture value in HLSL? I have a UV render pass, where RG is the image and B is always set to 255:

I want to set the UV pass texture value to UV Coordinate; when I test it, the result should pixelate noise, like the below image:

I have tested it in other shader languages like cgprogramm, GLSL test in Unity
or useing Zdepth for mipmap but I can not get an anti-aliased result; all the results are the same:

float4x4 World;
float4x4 View;
float4x4 Projection;
float4x4 WorldInverseTranspose;

float4 AmbientColor = float4(1, 1, 1, 1);
float AmbientIntensity = 0.1;

float3 DiffuseLightDirection = float3(1, 0, 0);
float4 DiffuseColor = float4(1, 1, 1, 1);
float DiffuseIntensity = 1.0;

float Shininess = 200;
float4 SpecularColor = float4(1, 1, 1, 1);
float SpecularIntensity = 1;
float3 ViewVector = float3(1, 0, 0);

texture ModelTexture;
texture UvTexture;

sampler2D textureSampler = sampler_state {
    Texture = (ModelTexture);
    MinFilter = Point;
    MagFilter = Point;
    AddressU = Wrap;
    AddressV = Wrap;
};

sampler2D textureSamplerUV = sampler_state {
    Texture = (UvTexture);
    MinFilter = Linear;
    MagFilter = Linear;
    AddressU = Clamp;
    AddressV = Clamp;
};

struct VertexShaderInput
{
    float4 Position : POSITION0;
    float4 Normal : NORMAL0;
    float2 TextureCoordinate : TEXCOORD0;

};

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 Color : COLOR0;
    float3 Normal : TEXCOORD0;
    float2 TextureCoordinate : TEXCOORD1;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    float4 normal = normalize(mul(input.Normal, WorldInverseTranspose));
    float lightIntensity = dot(normal, DiffuseLightDirection);
    output.Color = saturate(DiffuseColor * DiffuseIntensity * lightIntensity);

    output.Normal = normal;

    output.TextureCoordinate = input.TextureCoordinate;
    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    //******* is here
    float4 textureColorUV = tex2D(textureSamplerUV, input.TextureCoordinate);

    float2 cord = float2(textureColorUV[0],textureColorUV[1]);

    float4 textureColor = tex2D(textureSampler, cord);

    return saturate(textureColor);
}

technique Textured
{
    pass Pass1
    {
        VertexShader = compile vs_1_1 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

How do I set the UV coordinate from a texture value in HLSL?

sentences:
Find new position of rotated by 10 degrees line I have a line that goes to x (x1) of 300, and then I rotate the line by -10 degrees. How can I get the new x (x0) of the rotated line?

Here's a picture to show what I mean:

Are there any books that would help me learn this stuff?

sentences:
How can I show information from a variety of sources in my debug menu? I'm creating a debug menu, and I want to be able to show a lot of information (variables) on that menu. This information will come from a lot of classes (instances).

How can I show a lot of information from a lot of classes in my debug menu? How can I get access to all the variables of the instances of the classes that I need information from?

sentences:
Pathfinding to Get In Attack Range with "Transparent" Tiles Currently I'm using A* and a raycasting algorithm to determine the path an entity (Player) should take to get close enough to the enemy (Enemy). The player has an attack range (it's illustrated around the enemy to show how close the player has to get to the enemy in order to attack it).

This works pretty well, but as soon as I add tiles that prevent entities from moving from them, but allows them to attack through them (imagine a river).

Using my current implementation the player entity takes the purple route to attack the entity, but I want it to take the yellow path.

I came up with the following, but this is highly inefficient:

Mark the tiles around the enemy (cyan circle), which are in line of sight to the enemy (raycasting) as possible destinations
Run the pathfinding algorithm to find which one of those destinations is the closest to the player

I know A* is good for finding a single destination and Dijkstra is better for multiple destinations, but since I already got this working with A* I wanted to know if it's possible to achieve this is an efficient manner.

Side question: how are the tiles where you cannot walk through, but can shoot through called in the industry? I know the wall likes entities are mostly called "solids".

sentences:
I have to make a game in 9 days. AHHH! If you just want to get to the question and skip the background, go to the next paragraph if not, keep reading. O.k., so, I'm 13 and I make games in my spare time. They've never really been shared with anyone or anything so I decided I would enter the STEM Video Game Challenge for middle schoolers. I decided to use Stencyl to make the game and it was January so I figured I would work on it at some point. After that I joined a play at my school which takes up a ton of my time and today I realized its March 3rd which means I have 9 days to make a game-gah!

So, I have to make a game in 9 days and I'm probably going to use stencylworks. I just need an idea that I could execute in 9 days and just general tips for efficient game development. Sorry that this is kind of a loose question and thanks in advance!

sentences:
Separating logic/update from render/drawing code in a single thread using sleep I've read that the speed of game objects should not be hindered by FPS but instead should be based on time. How can I seperate the update/draw code to maximize performance without limiting the drawing rate and provide a constant logic update rate based on time?

My current pseudo code is as follows

loop
{
    draw();
    if (ticksElapsed() > 100)
    {
        update();
        ticks+= ticksElapsed();
    }
}

The problem is the drawing code hinders the performance of the update() rate. And it consumes 100% cpu because if sleep is thrown in, it throws off both drawing/logic functions.

I am also using SDL and it doesn't seem to have a vsync option. I've also heard of the terms fixed and variable time-stepping however I'm not sure how that can be done with sleep()

sentences:
Splitting a tetris game apart - where to put time-management? I am creating a tetris game in C++ & SDL, and I'm trying to do it "good" by making it object-oriented and keeping scopes small. So far I have the following structure:

A main with some lowlevel SDL set up and handling input
A game class that keeps track of score and provides the interface for main (move block down, etc)
A map class that keeps track of the current game field, which blocks are where. Used by the game class.
A block class that consists of the current falling block, used by game.
A renderer class abstracting low level SDL to a format where you render "tetris blocks". Used by map and block.

Now I have a though time where to place the time-management of this game. For example, where should be decided when a block bumps the bottom of the screen how long it takes the current block locks in place and a new block spawns?

I also have an other unrelated question, is there some place where you can find some standard data on tetris like standard score tables, rulesets, timings, etc?

sentences: How do you refer to the objects covering the ground? Newbye here. In the industry lingo, what is the best way to indicate the objects covering the ground (trees, rocks, ...)? Is props OK?

sentences:
Reduce texture switches in UI I'm working on game which uses LibGDX's Stage2d for GUI.

All textures for UI are packed into one texture atlas.

Fonts (BitmapFont) are generated in runtime by gdx-freetype for different locales and font sizes (at least 6 locales and 4 font sizes for each locale) and then placed into separate texture.

Game UI contains much different elements (strategy game with lots of numbers) - buttons, icons, text labels, which usually alternate between each other and trigger many texture switches when drawn. I wonder if there's any way to reduce the number of texture switches as it sometimes takes up to 5ms per frame for stage.draw().

The only way I see is to draw fonts only when all UI textures are drawn, when it is possible, but it will produce awful code and will harm the hierarchy of elements in stage.

I didn't merge textures (but thought of it), because:

Textures use different filtering (MipMapLinearNearest for UI textures, Linear for fonts) and it will require manual texture filtering switches or mess with stage2d overriden Label class.
UI texture already has a size of 2048x2048px, and I can't add all font size textures to it as it will require higher texture sizes, which are not supported by many old devices.

Is there any good way of solving this issue?

sentences:
Way to structure items in code? I have an "Item" class here that is used to create items.

public class Item {
    private String name;
    private int id;
    private int worth;

    //constructor
    Item(String _name, int _id, int _worth) {
        name = _name;
        id = _id;
        worth = _worth;
    }

    public String getName() {
        return name;
    }
}

This works fine and dandy.. but I don't know how to give them unique ID's, I thought about using

private static Item[] items;

and then when they're created add them to this array, but is that the only way? Also where do I put my code to initialize all the various items in the game? Should it be in the main method, or have a loader of some sort, or have them declared straight away in the Item class using

private static Item apple = new Item("Apple",0,3);

?

sentences:
Generating objects randomly from prefabs in Unity2D I am developing an infinite runner using Unity. I have already figured out how to loop a set of backgrounds randomly but I am having problems doing the same for the objects.

So, I have a few objects or obstacles in my prefabs. I want them to generate randomly in the game, not everything at once though.

How do I do that? Can I please get a well-explained piece of code for the purpose?

EDIT : I want the objects to be destroyed as soon as they move out of camera's view (The cam which is following the player).

Thank you.

sentences:
Google Analytics collect and visualize custom data I was wondering if Google Analytics (GA) can be used to collect custom metadata about app usage and performance.

An example would be to measure and collect the average frame rate (fps) of the app on the device. How can this data be presented into the Google Analytics Report? If possible, please make an example by sample source code.

sentences:
Unity Facebook WebGL build... Does this work or not?!?! Getting conflicting answers So here is the facebook documentation..

It seems to be saying you can output a Facebook WebGL build from Unity and upload it.
It does not work for me, I get this message when I upload.

"Games must reference one of our supported SDKs via our CDN."

Theres also this thread, with people saying it is not supported.

https://forum.unity.com/threads/facebook-instant-games-support-html5.499198/

Yet the latest version of Unity has a WebGL option when building to Facebook platform.

What is going on?
Does or doesn't this work?

sentences:
How can I mimic an isometric perspective using square tiles? Can an isometric perspective be mimicked with traditional square tiles? Can't the effects of the 45-degree overhead view simply be "drawn in" to the square? How would this work?

Picture this: the tiles themselves are square (not diamond) but all objects placed on them (sprites, terrain objects like trees, buildings, etc) are drawn from isometric view as if they were on diamonds.

This might be a silly question to ask, but I'm having difficulty understanding isometric perspective.

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:
GLSL Shader not compiling (Android & LibGDX) and no log available I'm trying to get a "ripple"-shader working for OpenGL ES 2.0+ (using LibGDX).

However, I can't get it to compile, and for some reason ShaderProgram.getLog() returns an empty string even though the Shader didn't compile.

I am 100% confident that the vertex shader is correct.. here's the fragment shader (not written by me, but I modified it a bit long time ago.. when I had a desktop project - and it worked back then):

                #version 120
                precision mediump float;
                varying vec2 v_texCoords;
                uniform float time;
                uniform float alpha;
                uniform float waveLengthMultiplier;
                uniform sampler2D u_texture;
                void main()
                {
                    vec2 center = vec2(0.5, 0.5);
                    vec2 tc = v_texCoords.xy;
                    vec2 p = -1.0 + 2.0 * (tc - offset);
                    float len = length(p) * waveLengthMultiplier;
                    vec2 uv = tc + (p / len) * cos(len * 12.0 - time * 4.0) * 0.03;
                    vec3 col = texture2D(u_texture, uv).xyz;
                    gl_FragColor = vec4(col, alpha);
                }

I'm still not very well-versed with shaders, as I've used them only a little.. Like I said, getLog() returns an empty string, so I'm hoping someone spots an error in the code.

sentences:
When is Micromanagment in games considered fun/boring? Some players (typically the developer types, but not exclusively) love to control intricate aspects of a game (typically a simulation game) such as how long traffic lights take, how much to tax certain citizens (in sim city style games) when to change gear (in a racing game) exactly what an AI should do etc...

But how far should a developer go to implement micromanagement, when does it stop becoming fun? It would be rather tedious to connect each building to the water, and electrical grid for example in sim city. Whereas issuing city ordinances is considered engaging to the player.

sentences:
Check if the vector is behind another or maybe opposite directions? I'm doing a network game and on the client side, i interpolate the client position with the server sent extrapolated position. The client has its own physics simulation wich is corrected by the server in steps. The problem is when it laggs and i 'kick' the ball, the server gets a delayed message and sends me the position backwards of the client position wich makes the ball goes back and forth. I want to ignore those and maybe compensate that on the server, not sure though. The problem is the clock difference on those case are 0.07ms or 0.10 ms wich isn't that high to ignore the message i guess.

When i get the server position, i extrapolate with the clock interval * serverBallVelocity

Can i check if my new ball server position is behind my actual ball vector position? I tried to use the dot product after normalized the two vectors to check if they are opposite but it ain't working properly.

Any suggestions on checking that?

sentences:
Which works best to describe character, item or dungeon properties: Affix or Trait? I am working on an RPG portion of my game called "The Underground King".

My item generator uses the same properties that also apply to characters, vehicles and racing levels (dungeons for short).

I am torn between using the term "Affix" and the term "Trait" to describe the procedurally generated properties, mainly because English is not my first language, and there may be a clear difference in usage between the two.

Examples of traits:
Hearty: For items, it gives 5 more HP, for characters they have 5 more HP, for vehicles they have 5 more durability, for dungeons, enemies have 5 HP each.
Indomitable: For items, characters and vehicles, it gives the player the ability to ressurect at 100% hp, once dead. For the dungeon, dead enemies remain invulnerable for a few seconds after being dead.

I am open to either opinions or arguments for any of them. Thanks!

sentences:
Penetration Depth into a Planar Polygon I'm working on a self-made physics engine, and I'm wondering about the best way to calculate the penetration depth into a polygon that lies in a plane given that resolution must occur along the polygon's normal.
My current system correctly uses GJK/EPA to detect if a polygon that lies in a plane is intersecting a 3D collider. However, in a case such as the one illustrated below, EPA would not calculate the separating axis to be along the plane normal, but rather outwards parallel to the plane, as that is the direction of minimum penetration.

My first thought was to simply manually alter the resolution direction. After GJK detects a collision, I can calculate the support mapping of the polygon in the opposite direction of the plane's normal, then take its perpendicular distance from the plane as its penetration depth. However, in a case such as the one below, this would yield an incorrect penetration depth, as the support point does not project onto the plane.

What's the best way to go about getting the penetration depth into the polygon, but only considering penetration of points on the polygon that actually project onto the polygon?

sentences:
RenderTarget2D moves with scene I encountered a strange RenderTarget issue, in XNA/Monogame.

I am currently updating my render target at every frame, just to test to see what is happening.  When I move the camera around, the positioning of the drawing inside of my rendertarget moves as well.

Notice in the example, how the image moves inside of my render target:

Here is the code for the Render Target draw:

GraphicsDevice.SetRenderTarget(Render);
RoundLineManager.Draw(Branches.GetAllObjects(), new Color(102, 50, 18), Matrix.Identity * Camera.View * Camera.Projection, RoundLineManager.TechniqueNames[0]);
SpriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, Camera.View);

foreach (Pool<Leaf>.Node l in Leaves.ActiveNodes)
    if (l.Item.Visible)
        l.Item.Draw();

SpriteBatch.End();
GraphicsDevice.SetRenderTarget(null);

Here is the related Camera properties:

public Matrix View
{
    get
    {
        return Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
                Matrix.CreateRotationZ(Rotation) *
                Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
                Matrix.CreateTranslation(new Vector3(ViewportWidth * 0.5f + shakeOffset.X, ViewportHeight * 0.5f + shakeOffset.Y, 0));
    }
}

public Matrix Projection
{
    get
    {
        return Matrix.CreateOrthographicOffCenter(0, Infinidrill.GraphicsDevice.Viewport.Width, Infinidrill.GraphicsDevice.Viewport.Height, 0, 0, 1);
    }
}

sentences:
Move circle inside semi-circle based on external object I have a circle that I'd like to move around in semicircle with it's location following an external object.
I can get the direction the circle should be facing with something like this:
Vector3 targetDir = X.transform.position - circle.transform.position;

How can I stick the movement of the circle inside a semicircle?

sentences:
Best way to draw 2D shapes on a 3D flat object I want to draw shapes (arcs, circles, lines) on a table, which is in 3D space. The table top is at Y=0 level and oriented so it points to (0, 1, 0). There are some other 3D objects on the table, so depth buffer has to be used. What is the best way to do this?

I do it now by drawing triangles or flat models on top of it. But for this I have to draw them at - for example - y = 0.05 This causes problems, because too small value makes z-fighting, especially on Android, and I'm going to have more of these drawings, so I would need to use different Y levels. I want the object to be perceived that they are exactly at the table level.

Some texturing? Some other way? Performance is of course important.

sentences:
Tetris implementing rotation I am currently at the last stage of the Tetris Clone using SDL library, the only thing left is rotation. For each piece I have a separate class, and in order to move the pieces down I use a method:

void PieceZ::movePieceDown()
{
  drawBlock(x1,y1++);
  drawBlock(x2,y3++);
  drawBlock(x3,y3++);
  drawBlock(x4,y4++);
}

This method is called like that: current->movePieceDown(); where current represents a pointer to the current piece. Now to rotate the piece I have another method:

void PieceZ::rotatePiece()
{
  drawBlock(newX1,newY2++);
  drawBlock(x2,y2);
  drawBlock(newX3,newY3++);
  drawBlock(newX4,newY4++);
}

New X and Y coordinates are calculated elsewhere, with x2 and y2 taken as the origin.
My question is how do I swap current->movePieceDown() with current->rotatePiece() while the piece is moving? Taking into acount that I am handling keyboard events in another method.

sentences:
How can I find all shortest paths using A*? It is possible for A* Path Finding to return all the shortest paths given a graph/map?

For example, given the map below:

-----------
--a--X--b--
-----------

The said map can return four (4) distinct path.

-----1-----
--a11X11b--
-----------

-----------
--a22X22b--
-----2-----

----333----
--a3-X-3b--
-----------

-----------
--a4-X-4b--
----444----

The paths follow the Manhattan Heuristic and a Eight (8) directional transition with a default G-value of 1.0f for testing.

The question given the Pseudocode of A* will only return me one (1) of the four (4) distinct paths which I wish to return all four (4) paths instead.

sentences: [ C# ]xna to monogame I'm thinking of going back to xna and c# because I have used java 2d, slick 2d and some other libraries. I started off with xna and c# but ignored it for java. I'm thinking of going back, but I see xna isn't being developed anymore. I read there is away to convert it to monogame but seems very complicated. XNA look fairly easy, yet I havn't toyed with monogame yet. So what I want to know , is monogame related to xna or close in coding? Would it be easy to understand if you're good with xna?

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:
Level design algorithm/pattern for Linerunner etc I am wondering: how does someone make levels for a game like Linerunner or any other game that uses similar patterns?

About Linerunner (game)
You are a stick man running, you have to jump or crawl without hitting boxes. Google Play is very illustrative.

The algorithm I am looking for
How does the game engine know that if it places a box here and here and here, the user will be able to make it without hitting any of the boxes? Two possible solutions came to mind, but neither of them seem very good.

Design the entire level.
Create an array of small patterns the user can win in and then join the patterns to create a level.

I hope someone understands what I am talking about, otherwise I am willing to explain in depth what I want to accomplish.

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:
Reading messages from a certain client in Lidgren I'm setting up a game with Lidgren, and I was wondering if there was a way to read a message from a certain client instead of just from the server as a whole, such as-

//Why doesn't this exist?
NetIncomingMessage message = server.Connections[0].ReadMessage();

This way I would be able to split up reading data from each client into it's own thread and have a separate thread for sending data to each client. Currently there is only one loop in my server, which reads packets and I fear is favoring one client more than others, as some movements made by players take a while to be received by other players. I believe reading messages separately from each client would solve this issue. With simple TcpClients, you can read from each client's stream instead of the server as a whole, and I like this functionality but also rely on the simplicity of sending packets through Lidgren and was wondering if there was a similar functionality with Lidgren.

sentences:
Should widgets be part of a scene in a 2D game? I'm in the middle of separating logic and drawing of a 2D game, i.e. I'm moving from scenes/entities that draw themselves to scenes/entities that merely store and update data, getting drawn by a renderer.

This works pretty well for scenes and entities, but I can't figure out how the UI fits in. Right now, I draw widgets in the draw routines of some scenes. Scenes can currently also handle input, so it's relatively close to how UI toolkits do things. There are even scenes with nothing but UI, e.g. the main menu. But with the new approach where scenes don't draw themselves anymore, I need a new approach.

How could I do this? Are widgets even supposed to live in scenes, alongside entities? Or should they be in their own kind of scene, e.g. windows or dialogs?

sentences:
Choosing an Audio API Possible Duplicate:
  Cross-Platform Audio API Suggestions

I have gone down this road a few times, and always decided to put it off. I am finally to the point I need to choose an Audio library and stick with it. I switched physics engines 3 times which caused quite a bit of wasted time, so I would like to be set when I pick an Audio lib. I will be falling into the "indie" section as far as licensing goes. Here is what I have so far..

FMOD - Quality Middleware, success has gone to their heads and it seems they did away with the indie license recently. Price range seems to go from Free - 3000$ - 6000$ which pretty much excludes this.

BASS - So far this is what I am leaning towards. Simple API, great feature list, and quite a bit more. The pricing structure looks somewhat similar to FMOD, but I will need to pull out the Euro to Dollar calculator, and figure out if the Shareware license would be applicable to Digitally Distributed Content.

IrrKlang - Pricing looks fair, features seem generic. Pretty much coming down to a battle between this and BASS. I have heard good and bad things.

The other libraries such as OpenAL, PortAudio, Audiere, etc. were considered, but I am looking for something more drag and drop rather than something I am going to be basically writing my own front-end for. I am curious though, I remember stumbling across another library or two a few months ago on par with FMOD/BASS/etc that were fairly new. No matter how hard I look now, I cannot find them. Hopefully someone here knows what they might be called.

Anyways, basically just looking for feedback from other member's experiences, thoughts, and so on.

sentences:
Depth testing before fragment shader Accoring to this, depth testing is usually performed after the fragment shader stage. Why is that? I thought that a fragment is sent with its depth value to the FS, then the depth test happens before the FS executes, so the gpu can avoid a spare FS execution if the pixel is covered by a closer one.

Why is it not like that?

sentences:
Prismatic Joint causes a crash-Box2D(cocos2d) tried to set up a prismatic joint, but I get this error upon run time: Assertion failed: (IsLocked() == false), function CreateBody, file /Users/Aether/Developer/JFRecode/JFRecode/libs/Box2D/Dynamics/b2World.cpp, line 109.

Here is the code for the screen boundaries since I am using it as bodyB.

 CGSize s = [CCDirector sharedDirector].winSize;

//define screen boundaries
 // Create edges around the entire screen
 b2BodyDef groundBodyDef;
 groundBodyDef.position.Set(0,0);
 _groundBody = _world->CreateBody(&groundBodyDef);

 b2EdgeShape groundBox;
 b2FixtureDef groundBoxDef;
 groundBoxDef.shape = &groundBox;

 groundBox.Set(b2Vec2(0,0), b2Vec2(s.width/PTM_RATIO, 0));
 _bottomFixture = _groundBody->CreateFixture(&groundBoxDef);

 groundBox.Set(b2Vec2(0,0), b2Vec2(0, s.height/PTM_RATIO));
 _groundBody->CreateFixture(&groundBoxDef);

 groundBox.Set(b2Vec2(0, s.height/PTM_RATIO), b2Vec2(s.width/PTM_RATIO,
 s.height/PTM_RATIO));
 _groundBody->CreateFixture(&groundBoxDef);

 groundBox.Set(b2Vec2(s.width/PTM_RATIO, s.height/PTM_RATIO),
 b2Vec2(s.width/PTM_RATIO, 0));
 _groundBody->CreateFixture(&groundBoxDef);

Here is the code for the prismatic joint itself

b2PrismaticJointDef jointDef;
b2Vec2 worldAxis(1.0f,0.0f);
jointDef.collideConnected = true;
jointDef.Initialize(_shipBody,_groundBody,
                    _shipBody->GetWorldCenter(), worldAxis);
_world->CreateJoint(&jointDef);

sentences: UnityEditor.SyncVS.SyncSolution putting wrong language version in generated files I'm working on getting our Unity projects building in bamboo for our build server. We have a cli step that runs through the Unity commands for creating a build. It works fine on several projects, but for some reason this particular project I'm working on I'm getting an error that states I need to use c# version 7.2 or newer. If I log in to the build server and open the .csproj files in notepad and check the language version, it's setting them to 7.0. However, if I deactivate the cli step so that the build job only clones the project, then manually log in and open unity and go through the process so it generates the .csproj files, then check them, the language version is set to 8.0. The project works fine locally on my own pc. And it works when setup manually on the build server pc, but when ran through the cli step, it generates them at an earlier c# version. This leads me to believe there is a problem with the UnityEditor.SyncVS.SyncSolution step in my commands. I'm just not sure what it could be, or why it's behaving differently for this project as opposed to other projects that are using the same code base (where the problem is said to occur), same Unity version, same build server, etc. Anyone else experience this issue or have any thoughts on a solution?

sentences:
Rotate perspective camera to align screen width to procedural object's width (Unity, C#) I give up. After much trying and searching, I have to say I was unable to achieve the following task, for which I must call for your wise advice.

In my current Unity 5 application (using C#), there is a procedurally generated object (therefore with variable shape) to which the camera should be aligned when players hit a given key. By aligned, please understand it making the width of the screen parallel to the longest part of the object. The idea is represented in the following picture, where in black one can see the irregular object, in yellow is the bounding box.

In other words, it means that I want the camera to be rotated so to align to the longest side of the object's bounding box. I tried that. Still, I was unable to properly calculate the correct angles so to rotate the camera in a way that the horizontal axis of the screen becomes parallel to the width of the objects' bounding box.

Any help would be much appreciated.

sentences:
How to copy FrontBuffer to BackBuffer in DirectX11 I want to render the surface base on the the last surface.
So I try to copy FrontBuffer to BackBuffer, but it does not work:
//Get the BackBuffer(it will be FrontBuffer after SwapChain swapped the BackBuffer and FrontBuffer)
ID3D11Texture2D* backBufferTexture1 = NULL;
swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferTexture1);
D3D11_MAPPED_SUBRESOURCE mapResource1;
HRESULT result1 = m_pID3DContext->Map(backBufferTexture1, 0, D3D11_MAP_READ, 0, &mapResource1);
assert(result1 == S_OK);

swapChain->Present(1,0); //swap the BackBuffer and FrontBuffer

//Get the BackBuffer
ID3D11Texture2D* backBufferTexture2 = NULL;
swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferTexture2);
D3D11_MAPPED_SUBRESOURCE mapResource2;
HRESULT result2 = m_pID3DContext->Map(backBufferTexture2, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapResource2);
assert(result2 == S_OK);

//Copy the FrontBuffer to the BackBuffer
memcpy(mapResource2.pData, mapResource1.pData, sizeof(mapResource1.pData));
m_pID3DContext->Unmap(backBufferTexture1, 0);
m_pID3DContext->Unmap(backBufferTexture2, 0);

The result1 and result2 both return E_INVALIDARG One or more arguments are invalid. How could I get this to work?

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:
Culling And Optimization in a 2D Orthographic Game I'm currently developing a 2D top-down space themed RTS game. I'm building the space procedurally from a seed. At the end of generation of all space objects, if i don't apply any optimizations I end up with following result (all space objects are visible by camera):

There are stars, planets, satellites as Sprite Renderers in the scene. And orbits of stars and planets as Line Renderers. Planets move around stars, satellites move around planets orbitally. Line Renderers of orbits are controlled and updated dynamically by a script to snap belonging object as it moves around parent orbit.

When i apply following logic to each renderer:

        if (MinVisibleDistance > mainCamSize || mainCamSize > MaxVisibleDistance)
        {
            if (renderer.enabled)
            {
                renderer.enabled = false;
            }
        }
        else
        {
            if (!renderer.enabled)
            {
                renderer.enabled = true;
            }
        }

The results are much more happier (again, all space is visible by camera):

You can see a huge amount of saving in tris and verts count. But the problem with this logic is, even though the object is out of camera view, it gets enabled when camera zooms in. I think the "occlusion culling" option of Unity camera handles this problem, but I'm not sure if it has a performance impact either.

The question is; do this optimizations worth efforts? Or do they make performance even worse by if-else checks every frame and enabling-disabling components?

And are there other optimization ideas you can suggest?

Thanks!

sentences:
Game launcher / updater download delta diff I'm making a launcher for my game (using Unity3d).

I want it to have the following features :

Compare game version to latest version and update if necessary
Check files integrity and update if differences are found
Download/patch needed files

So comparing the game version is easy : I just parse a version.txt file and compare it's value to the latest server version.

Checking file integrity sounds easy too : Make a list of all files in the game folder, order the list, get a checksum and check if it corresponds.

Now here's the difficult part : Downloading the required files.

My first idea was : If a file checksum is different, download that file. But unity assets are compressed into large files, so even a simple change will lead to the download of a 2gb file...

So I'm now looking for a way do download only the different parts. I heard about VCDIFF / xdelta, apparently they can be useful to get a "delta patch" of different binaries. Cool. But how can I compare two folders if one of them is distant, without downloading it all before ?

Could torrent be an answer ? How are game/unity devs doing this ?

Maybe rsync can be useful, but is it safe if hundreds of clients are simultaneously updating using rsync ?
I heard about Unity's AssetBundles. Is that useful and is it ok to put ALL my assets in bundles ?
How would I display a progress bar in unity showing the rsync progression ?

sentences:
How do I display same “proportional” text size on different resolutions? I draw some text on screen using ID3DXFont::DrawText. This text should be displayed the same regardless of screen resolution.

For example, if screen resolution is low, text wrapped and when it is higher text is not wrapped. How can I avoid such situation? I want text size to be connected to screen resolution so if resolution is lower I want the text to be relatively smaller so that no wrapping happens. Is there any way?

Thanks in advance

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:
Unity 5.5 - Modify image of a button from an array of images via script - Logic Help Right now i have this:

Is a placeholder for what i want to do. This blue circles are images in different buttons, i have a blue image circle for every letter. I have to display the correct letter image to create a word. For example: word: "DOG" and the word is created by the "D" "O" "G" images.

That is the logic i cannot get my head around.

How can I, via script, select which image to show depending on the word given?

IDEAS:

I have an array of (INDEX, "letter") in my GameController.CS. Maybe i can add a number to the different images name. Separeate the word in characters. Look the position of this character in the Letters[] and that number turn it into a string and find the image with that number in the name.

I really need help to figure this out.

Thanks in advance for any help.

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 can I create a custom List-of-GameObject inspector which works like the default one in Unity? I need to

drag and drop GameObject to ObjectField.
drag and drop a group of GameObjects to list name.

The main problem is either do 1 or 2 work. I need the function same as unity List Inspector for future devolvement. Code as follow.

static SerializedProperty ThisList;
public override void OnInspectorGUI()
{
    ThisList = serializedObject.FindProperty("G");//List name call G
    serializedObject.Update();
    Show(ThisList);
    serializedObject.ApplyModifiedProperties();
}

public static void Show(SerializedProperty list)
{
    EditorGUILayout.PropertyField(list);
    EditorGUI.indentLevel += 1;
    if (list.isExpanded)
    {         EditorGUILayout.PropertyField(list.FindPropertyRelative("Array.size"));
        ShowElements(list);
    }
    EditorGUI.indentLevel -= 1;
}

private static GameObject[] a =new GameObject[50000];
private static void ShowElements(SerializedProperty list)
{
    //This code can drag and drop GameObject to ObjectField.
    for (int i = 0; i < list.arraySize; i++)
    {
        list.GetArrayElementAtIndex(i).objectReferenceValue = EditorGUILayout.ObjectField("OBj", list.GetArrayElementAtIndex(i).objectReferenceValue, typeof(GameObject));
    }

    //This code can drag and drop a group of GameObjects to list name.
    if (Event.current.type == EventType.DragUpdated)
    {
        DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
        Event.current.Use();
    }
    else if (Event.current.type == EventType.DragPerform)
    {
        for (int j = 0; j < DragAndDrop.objectReferences.Length; j++)
        {
            a[j] = (DragAndDrop.objectReferences[j] as GameObject);
        }
        Event.current.Use();
    }
}

However, it not work when both codes together.

If -> EditorGUILayout.PropertyField(list, true);
I can get the same result as the unity function. but I cant Custom the List. (such as add name, change position, add button...)

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:
How can I create a walking zone logic for my player? First I will show a screenshot and explain the logic I think of and what I'm trying to do :

In the diagram the circle is the player the big rectangle is the zone area for increase/decrease speed movement of the player and the small black rectangle is the target.
What I'm trying to do is to add some rules for this case.
I'm controlling the player in third person movement with the keys WSAD and the mouse to rotate around looking around. This is the player structure screenshot in the Hierarchy :

There are few rules I'm trying to set for the player in this specific situation in the game and I want to make it generic so I can add the rules or create this behaviour in any place in the game when I need to.
The idea is when the player is getting inside the green zone rectangle facing the target make the player slow down to stop smooth. The green zone is the distance from the target to start slow down only if the player is facing the target.
If I rotate the player back facing away from the target in the green zone at any time increase the player speed back to normal speed.
The idea is that if in the green zone I rotate the player at any time and move hi he will decrease/increase the movement speed. Facing target decrease slowly to stop facing away from target increase the speed slowly to normal.

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:
Do the lookDirection vector and upVector have to be orthogonal? What happens if they are not? I'm currently starting with DirectX and building a small framework for myself and ran into a problem comprehending the camera vectors (position, lookDir, up).

What they represent exactly is clear, but here's the problem:

For my understanding the lookDirection Vector and the up Vector have to be orthogonal to each other. It this true? What happens if they are not?

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:
Are all referenced sprites loaded into memory for each object? I'm trying to understand how Unity works behind the scenes.  Let's say I have a GameObject that has a large number of sprites attached to it in an array (think a deck of cards).  Each GameObject represents 1 card.

For simplicity, each card has all the sprites for all the card faces.  So it has 52 sprites + 1 for the card back (all in a sprite sheet of course).

If I have all 52 cards placed in the world.  Does this mean I have 53*52=2756 sprites, or is there only one instance of each sprite that's being displayed (ie does it only use the resources of 52 active sprites)?

I guess what i'm asking is if I have a bunch of sprites attached to a GameObject, are they all instantiated when the object is created, or are they only created when they are actually attached to the sprite renderer?

Would it be more efficient to only attach the current cards value sprite (ie just the back and the face for the cards value)?

sentences:
How to implement fisheye effect with a GLSL fragment shader I would like to render my scene with a wide FOV and then apply a fisheye distortion via fragment shader. How would this shader best be implemented?

Update

I try to reproduce a fisheye effect similar to what can be seen through a lense like this one. My first try was to port the fragment shader explained in How do I create a wide-angle / fisheye lens with HLSL? because it seemed to be a good starting point:

#version 120

uniform sampler2D src;

float fov = 2.09;

void main(void)
{
    float z = sqrt(1 - gl_TexCoord[0].s * gl_TexCoord[0].s - gl_TexCoord[0].t * gl_TexCoord[0].t);
    float a = 1.0 / (z * tan(fov * 0.5));
    gl_FragColor = texture2D(src, (gl_TexCoord[0].st - 0.5) * 2.0 * a);
}

unfortunately, the result looks like this:

sentences:
How do I create a game design that can adapt to new platform environments? I'm trying to design a game that can be considered versatile enough to be adapted to different platforms and control schemes without too much difficulty.  I asked this question to try to get a handle on what to expect as far as what technologies to try and plan for, but it was closed (justifiably, I agree) for basically asking others to predict what the future technologies were.

So my question now is, instead of trying to plan a game to suit specific technologies and control methods, what should I consider in my planning if i want to design a game that can easily adapt to new platform environments?

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 make a 2D Sprite bleed/glow colors at a particular spot? I am trying to make a gauge glow over the color it is at.  For example, in the image below, when the needle is pointing at the red, the red is glowing.  When it is pointing at the green, then the green is glowing.  I want to replicate this:

My gauge will be on a gradient, so I cannot just color a particular segment.  (There are no segments.)  I am working with 2D sprites.  I have looked into the Bloom asset as suggested here, but I have been met with nothing but failures.  (Probably because that guide is for 3D.)

How can I take the color at a particular position and make it bleed/glow like in the images above?

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:
Effect only on one object (two cameras) I have a problem. I want a Grayscale effect to be applied ONLY to the chair on the stage. The chair has a layer CurrentItem. And I have two cameras:

Camera_All renders everything except layer CurrentItem (I set this exception in CullingMask)
Camera_CurrentItem

Finally:

I need to apply not just one effect, but a few.

sentences: Storing attributes in static geometry I have a Minecraft like world where I statically create one instance of each tile type, and then place it around the world. However, I don't know how to actually change individual attributes for each tile. For instance, I need to change the lighting per tile, but if I do, it'll change the color of ever single tile. I was thinking about storing two arrays per chunk, one for the tiles and one for the light, and when I want to change the lighting, I can just change the value in the lighting array that coincides with the position in the tile array. However, this will mean I'll have to have store twice as much data per chunk, but is it something I have to accept?

sentences: Did retro pixel artists design with CRT's in mind? There is an often stated claim on discussion boards like Reddit that now retro games of the 8 bit and 16 bit era actually had their art designed with CRT's in mind. I am not talking about video modes or video signals or hardware limitations as a lot of games supported multiple options. I am talking about the final output on the physical device that you observed with your eyes. Did artists really make conscious changes to their art because of this ? (eg. draw the edges of a sprite differently to appear less aliased in a given display)

sentences:
Stencil buffer VS conditional discard in fragment shader I have a continuous height-mapped mesh to represent landscape. I also have 1 to let's say 10 wells on this landscape represented by additional models. What I want to achieve is to create an illusion of an actual hole in landscape at the place where the well sits.

I see the solution in two ways:

Draw holes to stencil buffer an then use it in fragment shader to discard landscape fragments.
Send an array of uniforms (vec2) and then conditionally discard fragments if they are near those hole-points.

The question is what way should I prefer if I'm good with rectangular holes and want to get best performance?

sentences:
changing color of sprite not every frame So I have been trying making this game, which changes color of sprites in it.
It should only happen when OnMouseDown().
but it is executing every frame and cannot go out of the couroutine.
I want the color change to be slower. Please mark the colors should still change.

Please Help,

public class control : MonoBehaviour
{
    public bool startstop = false;
    SpriteRenderer m_SpriteRenderer;
    private void Update()
    {
        StartCoroutine("Changecolor", 3f);
    }
    IEnumerator Changecolor()
    {
        yield return new WaitForSeconds(3);
        if(startstop == true)
        {
            int random = Random.Range(1, 4);
            if (random == 1)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.blue;
            }
            else if(random == 2)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.red;
            }
            else if(random == 3)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.green;
            }
            else
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.yellow;
            }
        }
    }
    private void OnMouseDown()
    {
        startstop = !startstop;
    }
}

sentences: Creating a planet out of an existing terrain I am creating a game that I have created a terrain for. I really like the terrain so I am wanting to keep it but I want to have the game take place on a full planet. Avoiding paying $200 for an asset already made, how would I develop something to allow me to "tile" this terrain to make a full planet and to make it round instead of flat? I know this has to be somewhat possible with the expensive assets on the asset store that are for round terrains. I just need to figure out how and I can't find anything online that is much help.

sentences:
Difference between Arcade, P2 and Ninja physics in Phaser I am a beginner and trying to learn game development using Phaser. Currently Phaser is providing three physics systems namely Arcade, P2 and Ninja. But I don't know the differences between them and I would also like to know in which scenario we should use a particular physics system?

Please give me some insight for these physics systems.

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:
Is it possible to make/translate a 3d engine to ruby on rails? I am looking to make a 3D FPS that runs inside web browsers. I looked into using WebGL, but it didn't seem far enough along into development. I decided on using RoR because Ruby was a language I knew.

I realize this may seem like a ridiculous question, but is there any way I can port/rewrite/whatever a game engine(Say for instance IrrLicht) to run inside Rails? Or for that matter, any other language on the web.

sentences:
How do I get A.I. that follows a list of movement commands to move smoothly in a tilemap based game? This is for a school project so it's not intended to be sold/fun/or a complete game, rather just a demonstration of stuff we've learned without resorting to frameworks and stuff.

My ai agents choose a random point in the grid and generate a sequence of actions to take to get there using breadth first search. They do this indefinitely until they're killed (something I haven't gotten to yet).  Each action corresponds to one tile movement so I'm having trouble translating that into smooth movement transitioning from one tile to the next rather than just stuttering to it.  What I have at the moment is limiting how many actions can be taken per second so the agent doesn't just teleport around the game because it's moving so fast.  Can I modify what I have here to achieve smooth movement, or do I need to take a different approach in how to generate my action sequence?

I had smoothish movement when my MAX_VELOCITY = 1 by just rounding down if the time step made the agent move past more than one tile, but it didn't work for higher numbers, like MAX_VELOCITY = 10. The player character moves at MAX_VELOCITY = 10 which I think is perfect.

Edit:  I'm thinking of something now though I don't know if it'll work or if it's the right way to do it.  If I only use enough of the time step to advance to the next square, then I could use the rest of the timestep on the next action, or something like that until I'm out of time.

Edit2:  It seems to work properly.  There's some collision detection issues coming up, but it looks pretty much as smooth as the player character movement.  I'll leave the answer unchosen for now since my solution isn't very good but I'll post what I have here once I figure out the collision detection issues.

@Override
public void move(double dt) {
    this.elapsedTime += dt;
    if (this.actionsIndex == this.actionsToGoal.length() || this.actionsIndex == -1) {
        long startTime = System.nanoTime();
        if (this.goal != null) { //Debugging stuff
            startingPosition = new Point((int) this.posX, (int) this.posY);
            System.out.println("Arrived at goal");
            System.out.println(startingPosition.toString());
            System.out.println(goal.toString());
        }
        chooseGoal();
        this.frontier.clear();
        generateActionSequence();
        double timeTaken = (System.nanoTime() - startTime) / 1000000000.0;
        this.elapsedTime += timeTaken;
    }

    if (this.actionsIndex != -1) {
        while (elapsedTime >= 1.0 / this.actionsPerSecond && this.actionsIndex != this.actionsToGoal.length()) {
            char action = actionsToGoal.charAt(this.actionsIndex++);
            switch (action) {
                case State.LEFT:
                    this.posX -= MAX_VELOCITY;
                    break;
                case State.RIGHT:
                    this.posX += MAX_VELOCITY;
                    break;
                case State.UP:
                    this.posY += MAX_VELOCITY;
                    break;
                case State.DOWN:
                    this.posY -= MAX_VELOCITY;
                    break;
            }
            elapsedTime -= 1.0 / this.actionsPerSecond;
        }
    }

}

sentences:
How to use the BillboardRenderer in Unity? Since version 5 (?) Unity has a new component-type BillboardRenderer. Unfortunately the documentation is quite poor.

It can be added in the inspector by clicking on "Add Component -> Misceallaneous -> Billboard Renderer" but apparently it requires a Billboard Asset to do anything. There doesn't seem to be any way to create one from the Unity interface.

One of the few sentences from the equally poor documentation of BillboardAsset reads:

  imageCount    Number of pre-baked images that can be switched when the billboard is viewed from different angles.

My newest project will have sprite/polygon mix graphics, so a component which renders a billboard with a different sprite depending on the view angle is something I could really make use of. But there doesn't seem to be any method to add such images.

So I wondered if you could post an example how this component is used.

sentences:
Downscaling texture via mipmap Copied from Computer Graphics SE.

I am implementing a post-processing effect in my DirectX 11 pet renderer. The post-processing pass is implemented by rendering a full-screen quad covered with texture containing original rendered image, which works as it should, but I have problems with downscaling the texture.

The non-processed testing scene looks like this (three very bright emmissive spheres):

I see no problem at this stage, but when I run the first post-processing pass, which just down-scales the image by the factor of 8 using the texture sampler, the result is very flickery (up-scaled for clarity):

I expected a mipmap would solve or at least reduce the flickering, but it didn't change a thing. What am I doing wrong?

RenderDoc Update

After investigating the issue using RenderDoc I found that the mipmap is being generated successfully and it's third level looks like this:

However, the output of the down-scaling pass looks like this:

As if the sampler didn't use the mipmap at all. Don't get distracted by coloured object instead almost white ones. I lowered the sphere brightness a bit while investigating the bug.

Even if I choose the mipmap level explicitly

float4 vColor = s0.SampleLevel(LinearSampler, Input.Tex, 3);

it changes nothing :-/

RenderDoc also says "LOD Clamp 0-0" for the used sampler. What is it? Couldn't this be the problem?

DirectX details

Samplers

D3D11_SAMPLER_DESC descSampler;
ZeroMemory(&descSampler, sizeof(descSampler));
descSampler.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
descSampler.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
descSampler.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;

descSampler.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
mDevice->CreateSamplerState(&descSampler, &mSamplerStateLinear);

descSampler.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
hr = mDevice->CreateSamplerState(&descSampler, &mSamplerStatePoint);

...are set right before rendering the screen quad

ID3D11SamplerState* aSamplers[] = { mSamplerStatePoint, mSamplerStateLinear };
mImmediateContext->PSSetSamplers(0, 2, aSamplers);

...and used within the down-scaling PS shader

SamplerState PointSampler  : register (s0);
SamplerState LinearSampler : register (s1);

Texture2D s0 : register(t0);

float4 Pass1PS(QUAD_VS_OUTPUT Input) : SV_TARGET
{
    return s0.Sample(LinearSampler, Input.Tex);
}

Texture

D3D11_TEXTURE2D_DESC descTex;
ZeroMemory(&descTex, sizeof(D3D11_TEXTURE2D_DESC));
descTex.ArraySize = 1;
descTex.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
descTex.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;
descTex.Usage = D3D11_USAGE_DEFAULT;
descTex.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
descTex.Width  = width;
descTex.Height = height;
descTex.MipLevels = 0;
descTex.SampleDesc.Count = 1;
device->CreateTexture2D(&descTex, nullptr, &tex);

...it's render target view

D3D11_RENDER_TARGET_VIEW_DESC descRTV;
descRTV.Format = descTex.Format;
descRTV.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
descRTV.Texture2D.MipSlice = 0;
device->CreateRenderTargetView(tex, &descRTV, &rtv);

...it's shader resource view

D3D11_SHADER_RESOURCE_VIEW_DESC descSRV;
ZeroMemory(&descSRV, sizeof(D3D11_SHADER_RESOURCE_VIEW_DESC));
descSRV.Format = descTex.Format;
descSRV.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
descSRV.Texture2D.MipLevels = (UINT)-1;
descSRV.Texture2D.MostDetailedMip = 0;
device->CreateShaderResourceView(tex, &descSRV, &srv);

Explicit generation of mipmap is called after the scene was rendered into the texture and another texture was set as a render target.

ID3D11RenderTargetView* aRTViews[1] = { mPass1Buff.GetRTV() };
mImmediateContext->OMSetRenderTargets(1, aRTViews, nullptr);

mImmediateContext->GenerateMips(mPass0Buff.GetSRV());

ID3D11ShaderResourceView* aSRViews[1] = { mPass0Buff.GetSRV() };
mImmediateContext->PSSetShaderResources(0, 1, aSRViews);

The code is compiled in debug and the D3D device was created with D3D11_CREATE_DEVICE_DEBUG flag and I get no runtime errors on the console.

sentences:
why command is not executing on local player I am getting very strange behavior, if my player instantiate as host (Server+Player) then my command function runs perfectly and certain object become instantiate but if I join the host then my Command doesn't execute on my local player but runs on all other clients.

void Start()
{
    if (isLocalPlayer)
    {
        Debug.Log("It is VR Player spawn-Start");
        SetVRLocalPlayerSetting();
        //InstantiateMimicVRHeadAndController();
        CmdInstantiateMimicVRHeadAndController();
    }
    else
    {
        Debug.Log("It is not vr Player its not isLocalPlayer");
        DisableSelectedMonobevaiourScripts();
    }
}
[Command]//This function have a problem
public void CmdInstantiateMimicVRHeadAndController() {
    Debug.Log("instantiateing the controller and head object");
    vrHeadCopyObj = (GameObject) Instantiate(vrHeadObjPrefab);
    vrRightCtrlCopyObj = (GameObject) Instantiate(vrRightCtrlPrefab);
    vrLeftCtrlCopyObj = (GameObject) Instantiate(vrLeftCtrlPrefab);

    // spawn the bullet on the clients
    NetworkServer.Spawn(vrHeadCopyObj);
    NetworkServer.Spawn(vrRightCtrlCopyObj);
    NetworkServer.Spawn(vrLeftCtrlCopyObj);
}

sentences:
websockets authentication security Im doing a online game havingclient, js html5, and server, nodejs with websockets.
I've read some blogs about websockets security, and its limitations, but no real implementation or example.

Could JWT tokens in the messages sent to the server, be a good option? Meaning when the clients connect to the server, it gets a token and passes it around on every message? And use wss instead of ws.

Thanks in advance!

sentences:
One Android app, dynamic load several Unity games I'm a newbie in this unity world, exciting about everything in it.

Days ago I came up with this idea:

One day someone finds this android app, naming "Blahblah Game Engine" or anything else. This app has to be very small, containing only some simple activity and Unity runtime, without further resources related to any specific game.
He installs it and sees an android activity, maybe a webview, showing a list of unity games the server currently hosting, produced by the very same Blahblah company.
Then he clicks on one and this "Blahblah Game Engine" loads the game build via network, starts an Unity activity, without prompting an installing dialog.
He can exit the current game whenever he likes, returns to the previous game list, and plays another, all working well in one app's lifetime.

In a word, the user experience is very much like how we play games on www.kongregate.com with pc browsers: light-weight app, mutiple games in one list, all loads via network, playing right away and installing-less.

Any game that listed in this app should not be installed as a standalone android app, it should be part of the "Blahblah Game Engine", stored as a file inside data folder of "Blahblah Game Engine", run as an activity of "Blahblah Game Engine".

Is it possible with Unity 5, both technically and legally? If I were to start this "Blahblah Game Engine" project, should I choose Unity 5 personal or pro licence?

sentences:
Managing cross-platform targets/compatibility with Monogame I recently started using Monogame for the first time because of it's cross platform compatibilities and heavily active development. The first thing I did is installing the whole framework using their provided installer, but as soon as I wanted to make my first Monogame project, I noticed the following:

Although being cross-platform, there is no real 'Monogame' library. The framework ships with multiple assemblies for several platforms, each with their own dependencies. This is reflected both in the Visual Studio project templates as well as for the nugets they provide.

Now I'm wondering: Is there a straightforward way to just develop with the Monogame framework 'itself' in the first place, and then deciding on platform etc. later by using build targets and conditional compilation? Or do I just have to reference every assembly and it will work out of the box? What's your approach when developing with Monogame for different platforms? Making a .NET project for every target platform?

Their documentation unfortunately doesn't describe the different platform assemblies. They are just there, ready to be used with the infomation that Monogame IS cross-platform compatible.

sentences:
GLSL "varying" interpolation: component-wise? Reference in the spec? Probably a dumb question, but I can't find (or am not understanding) a conclusive answer in the spec or in other questions (e.g., this one).

For smoothly-interpolated varying vec and mat vertex shader outputs / fragment shader inputs, is each element of the vector or matrix interpolated individually?

GL spec sec. 13.5.1 (clipping) describes linear clip-space interpolation of the "output values associated with a vertex."  It also says that those are componentwise for vectors, but doesn't mention matrices.

Similarly, sec. 14.5.1 (rasterizing lines) and sec 14.6 (rasterizing polygons) describe interpolation of an "associated datum f for the fragment".  Is each element of a vector or matrix considered an individual "associated datum" and interpolated independently from the other elements of the vector or matrix?

Secs. 11.1.3.10 (shader outputs) and 15.1 (fragment shader variables) mention interpolation but refer elsewhere for the details.

Similarly, in the GLSL spec, sec. 4.5 (interpolation qualifiers) says that interpolation happens but does not distinguish scalars from multi-component variables.

I am looking for a definitive statement about how vecs and mats are interpolated, if there is one.  Or let me know if there isn't!  Thank you!

(Note: answers can be for any OpenGL version.)

sentences:
How to adjust the width of a LineRenderer I wrote a code that draws a line by mouse movement. I am searching for some way to give it pencil style and head and end of the line have thinner width.
As we know the LineRenderer draws the line between points. How can I access first and last point elements to set the width of them and how can I do that?

sentences:
FBX 3ds max export, bad vertices I need to import model in OpenGL via Fbx SdK, and for testing purposes I created a simple box centered in the (0, 0, 0), length 3, in 3ds max. Here's the image:

But when i exported it, and imported in the OpenGL it wasn't in the center. Then I exported it in ASCII format, and opened the file in Notepad, and really Z coordinates were 0, and 3.
When I converted model to editable mesh and checked every vertex in 3ds max it had expected (+-1.5, +-1.5, +-1.5) coordinates. Can anyone help me with this one? I'm really stuck. I tried to change whole bunch of parameters in 3ds max export, but every time it changes Z koordinate.

sentences:
Do I need to obtain a license to use real car brands in a game? We are small team which working on car racing game but we don't know about licensing process for branded cars like Nissan, Lamborghini, Chevrolet and etc.

Do we need to buy any licence for using real car brand names, models, logos,... or we can use them for free?

Second option we think about using not real brand with real models is it possible?
If someone have experience with that, fell free to share it.
Any information about that is welcome.

sentences: Where can I find a free SDK for C#? I need a free and recent SDK for use with C#. I will work first in 2D games with visual effects. Thanks for now.  Can anyone help me?

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:
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:
iOS: controlling size of assets designed in Cinema 4D when importing into Xcode? A designer provided the attached two DAE files created in Cinema 4D. The characters in these DAE files are to be integrated into an iOS game.

Both assets are of comparable size inside of Cinema 4D. Both DAE files were produced with the same export process.

Importing the DAE files into a SceneKit scene, however, produces different results.

Chango.dae imports at a "normal" size with a bounding box of ~3x4x3.

Tiki.dae imports at a huge size with a bounding box of ~155x325x140. Its dimensions inside Cinema 4D is 122x283x142.

Questions:

1) How do you make sure assets "fit" into a SceneKit scene? Are you supposed to scale down assets with the "scale" property of the SCNNode, or are you supposed to ask the designer to make the asset of a certain size? In SpriteKit and UIKit, this is straightforward. The asset size correlates directly to its screen size (e.g., 20x20 icon takes about that much screen space depending on resolution). However, what's the analog for SceneKit? If you want an asset to fit into a 1x1x1 SCNNode, what size do you ask the designer to make the asset?

2) If your asset is too large for a scene, how do you scale it down? In UIKit, for instance, you can scale an image to fit a UIView with something like ScaleAspectFit. There doesn't seem to be an analog for a SCNNode. Using the SCNNode's scale property changes the appearance, but doesn't change the asset's bounding box. And even changing the appearance isn't precise. For instance, with Tiki.dae, the original height of the asset (as shown by the bounding box) is 324.36. If you set the Y-scale to 0.01, however, the height doesn't become ~3.24. It becomes smaller than 3, which you can prove by fitting it comfortably within a sphere of height 3 (radius of 1.5).

sentences:
What is the best way to close dialogs in a platform game controlled by keyboard only I'm developing a flash puzzle platform game in my free time and I got stuck on deciding how to implement a feature. The game will be controlled by keyboard only, no mouse available.

My game will have Dialog boxes, used for story telling, announcing events, tutorial hints etc. I'd really prefer not to dedicate a large portion of the screen allowing the player to play while the dialog is displayed.

So my approach is to pop up the dialog and pause the game until the player closes the dialog. That's because the game has a small resolution (640 x 320) and some of the dialogs are pretty large (up to 5 lines text, talker's thumbnail etc).

EDIT : Another major reason I want to pause the game, is that I want to be 100% sure the player will not miss a dialog. Also, I want her to read it in a certain level area, before visiting another area of the level, or doing something that will advance the plot.

The thing Is that I can't find a way to make this work right. After testing the game with a few friends, I'm not satisfied from the feedback I get.

If I force them to close the dialog with one specific key (ACTION), I see people keep hitting keys randomly (e.g FIRE or JUMP key), while they know that it's closed with ACTION, like they did that 2 minutes before. They eventually get to close the dialog, but I can see they get a bit frustrated. I don't think they adopt the control as fast as I'd expect.

If I let them close the dialog with ANY key, they find themselves closing the dialog by mistake. Some of the dialogs are popping out while they're not expecting it.

So I'm starting to think that the 'Pause for dialog - close it to Resume' might be a bad idea in the first place. Do you think it is ? Or is it OK to have the dialog pause, but I just have to find the way to do it right ? Maybe the problem is not the controls, but something else, like say, I should not pop out the dialogs unexpectedly ?

Do you have any example of some game doing that right ?

sentences:
How to link my weapons with their corresponding ammo supply in the Unity Inspector? In my game I would like to implement a universal ammo and weapon system that would be usable for any kind of weapon. So I declared an ammo class:

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

[System.Serializable]
public class Ammo {

     public int MaxAmmo;
     public int CurrentAmmo;

     public Ammo(int maxAmmo)
     {
         MaxAmmo = maxAmmo;
     }

     public void MaxOutType()
     {
         CurrentAmmo = MaxAmmo;
     }

     public void GetAmmo(int amount)
     {
         CurrentAmmo += amount;
     }

     public void UseAmmo(int numOf)
     {
         CurrentAmmo -= numOf;
     }
 }

Then I created a script to hold different Ammo types:

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

public class AmmoSystem : MonoBehaviour
{
    [SerializeField]
    public Ammo Basic = new Ammo(200);
    public Ammo Rockets = new Ammo(50);
    public Ammo AirRockets = new Ammo(75);
    public Ammo Cells = new Ammo(150);
 }

To organize my project I decided to make two weapon scripts: one for nonphysical(Raycast) projectiles called RaycastingWeapon and an another for physical ones(like a rocket launcher) called PhysicalProjectileWeapon

My plan was to create unique weapons using these two scripts from the inspector.

These would use different kinds of ammo but would share the same script with different properties. The essential aspect here is that I would like to be able to select an ammo type from the inspector using a dropdown menu for example.

Is it possible somehow or are there a better way of doing that?

sentences:
Image Buttons Have Low Resolution Quality I'm using Synfig Animator to draw my animations for my android game
I'm also using Android Studio to write the code for it, However.
On testing, the images that i'm using looks very bad and unfocused even though i made them on a high resolution,
I've tried to change the resolution of it but it didn't work!
and when i change the size it just get bigger and stay the same..
How can i fix this problem? i need to have perfect animations for my game.

sentences:
Voxel blocks world physic I'm making a game like Minecraft. I have a world made of blocks and I'm trying to implement a basic physic system that applies gravity and checks entities colliding with the blocks of the world.

I tried using Bresenham's algorithm, on player move, to get all blocks between, and then get the first solid and set the player on colliding position. That works well if the player is a point, but if it's a complex AABB and the block too, it becomes difficult.

Is there a simple way to make physic in a voxel world like Minecraft?

sentences:
Should Draw method calculate the element's screen location? Should Update take care of calculating the drawing position of element or should it be done exlusively in Draw method?

If I calculate the drawing position of element in Update and then store it as element property then I can reuse it in Draw method. I can only run the update if the element (or camera) moved so it seems it would be good for performance. Is this good approach? Or should I never store the draw position of an element and always calculate it in Draw method?

EDIT:

It seems my question wasn't clear enough. I'm not talking about elements Draw method but the Draw method of manager/renderer that draws them on the screen. The elements themselves do not have Draw method.

sentences:
How to get smoother transition between the surface normals rotation of player in Unity I kinda have a problem that my player is snapping onto the other surface while I wanna move a ramp up. I want to have it rotate smooth to the normals of the ramp. How can I change the code below to a smoother rotation function of the player?

Code:

void NormalsOfGround()
{
    //RAYCASTS THE NORMALS ON THE GROUND THAT THE PLAYER MOVES ALONG SURFACE
    Debug.DrawRay(rayCastNormal.transform.position, -transform.up, Color.blue, 2.5f);
    Ray ray = new Ray (transform.position, -transform.up);
    RaycastHit hit;
    if(Physics.Raycast(ray, out hit, 2.5f, GroundLayer) == true)
    {
        transform.rotation = Quaternion.FromToRotation (transform.up, hit.normal) * transform.rotation;
    }
}

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:
TextField Add in Editor does not display when put under if statement I've been trying to make a custom editor window in Unity and I needed to make an "add TextField" button. When I add a TextField directly (without requiring a button), it works. When I put it under if(GUI.Button()) it does not show up.
Here's my code:
private static List<string> s = new List<string>();
private void OnGUI()
{

    if (GUI.Button("+");)
    {
        s.Add(GUI.TextField(new Rect(0,50,Screen.width,20),"field"));
    }
}

sentences:
how to check if an array element is defined? (Game-maker studio) The code is this:

if is_undefined(A_SA[V_X,V_Y])=false and A_SA[V_X,V_Y]=0
{
//actions from the "if" statement
}

The error message is this:

Push :: Execution Error - Variable Index [0,10] out of range [10,10] - -1.A_SA(100006,10)
 at gml_Object_objt_Canvas_StepNormalEvent_2 (line 25) -         if is_undefined(A_SA[V_X,V_Y])=false and A_SA[V_X,V_Y]=0

Why is this happening and how can I stop game-maker from trying to check the value of a variable outside of an array?

sentences:
Flip sprite vertically AND horizontally? In Microsoft.Xna.Framework.Graphics.SpriteEffects there is the possibility to flip a texture horizontally or vertically before rendering. But can one do both at the same time?

When I use: spriteEffect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; with spriteEffect being a parameter of the particle. The method spriteBatch.Draw(spriteSheet,
                        currentPositionForDraw,
                        sourceRectangle,
                        currentColorMultiplied,
                        currentRotation,
                        currentOriginForDraw,
                        Temp.delta,
                        spriteEffect,
                        0); does not draw the particle flipped on both axis.

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:
How to make a texture appear the same way in a cube? My problem seems so simple, that before asking the question here I did a search on google and this site:

https://forums.unrealengine.com/development-discussion/content-creation/33665-applying-and-manipulating-textures-on-actors
https://www.youtube.com/watch?v=p6O4AgSwTmQ
Trouble applying a texture to a cube
How to produce a texture to represent a vector field
Why do I get a blank material in Unreal Engine 4?
How to create smoke that spreads outward in all directions?

But nothing seemed to be related to my problem.

I imported this image.png:

I created a material and added the image to it:

But I did not get the expected result in the game (I wish this yellow line were under that pink arrow that I drew):

Innocently I thought the solution was obvious, so I added another image.png and added it to the material:

To my surprise, the result was worse, the yellow line did not even appear:

I realized this happens because the floor of my game is a "stretched" cube, so the image I added is appearing correctly on one of its faces, not just the one I want.

I'd like to know how to make it look the same on all faces, or some value that I can change so that it appears correctly on the face I want.

EDIT 1 (attempt using rotator)

I put the input time to see if any value would be compatible with what I want, but none is.

I tried with both texture images, but both presented the same behavior:

See that spinning looks like the shaft rotates around the top left of the floor.

For some moments the yellow line will disappear.

sentences:
Unity animations not transitioning properly I am currently trying to animate transitions between four different directions. I have four total animations for walking, and another four for the idle state. I cannot seem to figure out why when I try to transition from a walking state to another walking state in a different direction (not the direction I am idling in) it must wait for the walking animation to finish, and then play the walking animation in the new direction.

You can see my sprite begin to walk forward, and then when I attempt to turn south the animation it continually plays the north animation until the animation is finished. What I am trying to achieve is a smooth transition that switches immediately.

I know very little about animating and much more about programming. My list of attempted solutions is very short, and limited to only changing the length of each animation.

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:
OpenGL App not setting cursor position appropriately I have written a small application using OpenGL, and have implemented some rudimentary camera controls. Unfortunately, I cannot get the application to set my cursor position correctly. The cursor is never set to where I tell it to go, so my application just reacts to where the cursor is on my entire screen.

I first attempted to use GLFW, and when I saw that I couldn't set the cursor appropriately, I decided to try SFML. Neither one works.

I'm on an Arch Linux install with a Gnome desktop. I've been trying to figure this out for a few days now to no avail.

The relevant code is as follows:

sf::Vector2i cursor_pos = sf::Mouse::getPosition(*window);
sf::Mouse::setPosition(sf::Vector2i(1280/2, 720/2), *window);

This gets called every frame inside a function that messes with some matrices.

I also set the cursor position at initialization.

Any hints or advice would be greatly appreciated.

sentences: 3D Game Engine comparable to UDK that's not GPL'd Are there any good, free 3D game engines similar to UDK that are under open-source licenses without copyleft provisions?

sentences:
What is an acceptable input delay? It is common knowledge that if the framerate of a game is over 25-30 fps, we humans perceive it as running smoothly. More is better, but if it is above that, it at least doesn't lag.

I have been looking for research as to how long  a mouse input can take to reach the screen, and still feel instantaneous to the average person, for example. I'm sure it may vary a little bit, from person to person, but I'm sure we all have a limit on how fast anyone can perceive small time differences between events.

I'm interested in this because I want to try and statically update the data for my game, for example every 0.05 seconds, instead of as soon as I get a new input. This will save computer power, while still not causing delay in the game.

What is an acceptable input delay?

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:
Creating a large ground texture for mobile Does anyone has any insight on creating / texturing a large mesh that will be used for a mobile game's level map?

Specifically, I was wondering how games like Vainglory achieve this.

I am familiar with the idea of splat maps, however this is where my knowledge of the subject ends...

Is the use of splats on mobile a good solution? Should the mesh be broken down into small sections which are UV'd and textured separately? Neither of these things?

sentences:
Shared Object Not saving the level Progress I am making a flash game in which i have a variable levelState that describes the current level in which user has entered I am using SharedObject to save the progress
but it does not do so
first i declred a clas level variable

private var levelState:Number = 1;
private var mySaveData:SharedObject = SharedObject.getLocal("levelSave");

in the Main function i am checking if it is a first run of the game like below

if (mySaveData.data.levelsComplete == null)
    {
        mySaveData.data.levelsComplete = 1;
    }

and in a function where the winning condition is checked so that levelState could be increased i am usin this sharedobject to hold the value of levelState

if (/*winniing condition*/)
    levelState++;
    mySaveData.data.levelsComplete = levelState;
    mySaveData.flush();
    setNewLevel(levelState);
}

but when i play the game clear a level and again run the game it does not start from that level it starts from beginning.

sentences:
Checking if bullet collides with enemy when I know the start X & Y, the angle, the speed and dist traveled of the bullets This is the bullet I create when a player clicks to attack

var angInRadians = Math.atan2(data.y - playerArr[i].y, data.x - playerArr[i].x);//data.y & data.x is mouseY and mouseX
var temp = angInRadians * (180/Math.PI);
        function newBullet() {
          this.attack = temp;
          this.playerX = playerArr[i].x;
          this.playerY = playerArr[i].y;
          this.speed = 10;
          this.traveled = 0;
        }

Then in my game loop I do this

for(var j = 0;j<playerArr[i].bullets.length;j++)
    {
      playerArr[i].bullets[j].traveled += playerArr[i].bullets[j].speed;
    }

Then to draw the bullet I am doing this

ctx.translate(playerArr[i].bullets[j].playerX, playerArr[i].bullets[j].playerY);
        ctx.rotate(playerArr[i].bullets[j].attack * (Math.PI/180));
        ctx.fillStyle = 'black';
        ctx.fillRect(playerArr[i].bullets[j].traveled, 0, 4, 1);

Then for the players I just have a usual player X and Y and I can't figure out how to check if the bullet is within the area of the player, if you need any more code just ask/If you want to see how the game is working here.

sentences:
Calculating Bounding Rect I'm trying to clone space invader of atari and I have problem with bounding rect calculations.. the rect is not correctly bounded.. maybe I have problem with the transformations

void Barrier::Render()
{

    if (mBarrierImage)
    {
        CIwFMat2D Transform;
        // Build transform
        Transform.SetIdentity();
        Transform.SetRot(0);
        Transform.ScaleRot(1);
        Transform.SetTrans(Position);
        Iw2DSetTransformMatrix(Transform);

        Iw2DSetColour(0xffffffff);

    CIwFVec2 pos = Transform.t;
    BoundingRect.x = Position.x;
    BoundingRect.y = Position.y;
    BoundingRect.w = (float)mBarrierImage->GetWidth();
    BoundingRect.h = (float)mBarrierImage->GetHeight();
    Iw2DSetColour(0xff0000ff); // Set red
    Iw2DDrawRect(CIwFVec2(pos.x, pos.y), CIwFVec2(mBarrierImage->GetWidth(), mBarrierImage->GetHeight())); // Draw red outline

sentences: How to get all child with same tag from CCLayer? Actually i am working with cocos2d Game. I am using CCLayer for particular scene. now there are so many buttons means CCMenuitems are available. I want to disable that all menuitems having same tags.

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:
Will a game made with .Net Desktop Development, be able to run on Windows' desktops? I am new to making games (I have experience only with pygame), and I want to start creating with C#. I've found out that Monogame is a very good engine. On my way of setting up, in the part where I install Visual Studio, Monogame's site says:

Before installing Monogame, you'll need to install Visual Studio 2019 or later (any edition, including Community) with the following components, depending on your target platform:

.NET Core cross-platform development - For Desktop OpenGL and DirectX platforms
Mobile Development with .NET - For Android and iOS platforms
Universal Windows Platform development - For Windows 10 and Xbox UWP platforms
.Net Desktop Development - For Desktop OpenGL and DirectX platforms to target normal .NET Framework

I want to create a game to be played on desktops (most preferably, on Windows), and as it writes, Universal Windows seems the most suitable. Is there any difference, if I use .NET Desktop Development? I see that for other type of applications, this is very common.

sentences:
Help with OnTriggerEntered + Canvas UI This seems like it should be incredibly easy and I know there are other posts out there with a similar title, but I promise you I have looked at all of them. All I want is for my canvas that simply says "you win" to appear when I enter an invisible box collider that I have . My canvas is by default set to disabled.

public class YouWin : MonoBehaviour {
public Canvas myCanvas;

private void Start()
{
    myCanvas = GetComponent<Canvas>();

}

void OnTriggerEnter (Collision Collider)
{
    {
        myCanvas.gameObject.SetActive(true);
    }
}

This script seems incredibly simple and straightforward, but for whatever reason, when I enter my box, nothing at all happens. Why might this be? What am I missing?

As per an answer I also tried

public class YouWin : MonoBehaviour {
public GameObject canvas;

void OnTriggerEnter (Collider Collider)
{
    {
        canvas.gameObject.SetActive(true);
    }
}

But had no luck with this either. I've been tinkering to no avail, can you please give me some suggestions?

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: XNA HLSL - what happens if I grab a pixel outside a texture? I'm using the tex2D function of HLSL, and I am wondering what will happen if I try to grab a pixel from a pixel coordinate outside of my texture (as an example 1.1). Will it clamp? Will it repeat the texture and grab something else? Will it return transparent?

sentences:
Unity directional light for a day night cycle on a hex sphere So I am trying to create a Day Night cycle on a sphere but it doesn't work the way I want it to.
As the model is hex tiled, you see the edges of the hex tiles also lit up like below. I am using a directional light source for the same.

I don't want the above effect. I want it to ignore the edges and just be a straight line instead. Something like below

Is there a way inside Unity that I could achieve this effect just using the lights?

sentences:
How do I duplicate the functionality of ugui's onClick (button component) in inspector (Unity)? I'm trying to create the same functionality that occurs when you are working with a button in uGui in Unity. I know that I have to create a custom inspector, but i'm not sure where to go from there.

Essentially the functionality allows you to drag and drop a script to it's on click portion in the inspector, and then it gives you a list of functions for that script to select. This may sound a little confusing, so here are a few pictures demonstrating the functionality i'm trying to replicate.

As you can see above the functionality allows you to drag in a script, select a function to link, and do this for as many or as little scripts as you want by pressing the + or - buttons on the bottom right.

Thanks for any help in advance!

sentences:
Clan, guild, team, faction or group? I don't know if this is the right question for Stackexchange because it is based on opinion, so excuse me if it's not.

I'm currently developing a mobile leisure game in a cartoon style where players build and expand their kingdom, in a medieval setting. Users can be part of a group to help each other, trade goods, communicate together,  and support each other when attacked. The game is NOT a fight game only. Developing and maintaining your city and the citizens is an important aspect, socializing with other players is key, and the target audience are both men and women.

I'm really confused how I should name such groups where you can be part of. Clans, guilds, teams, groups or factions: all of them are possible. When should I use which name? And what would fit my situation the best? It's really important to let users feel they are part of a group. Not just a fighting group, but a group both men and women feel attracted to. A fraction for example would not be the best I think.

I realize this heavily depends on opinions. Buy are there any sources that could help me? What do you feel attracted to? What fits my situation the best?

sentences:
Why would one bind several textures to the same OpenGL texture unit? This OpenGL documentation article says you can bind 4 (=several) textures to texture units 0, 1, etc. This OpenGL documentation article too.
I found in this Stack Overflow answer an example of why it could be useful to use several texture units (each bound to a different texture).
However I do not understand in which case one would need to bind several textures to the same texture unit, and how one could use them then.

sentences:
Should I check SDL_Event for NULL? I have taken as a practice (as many others, I think) to always do this when working with pointers:

void I_take_pointer(some_type* arg1)
{
    if(arg1)
    {
        //safely do stuff with pointer
    }
    //optionally an else statement
}

...in almost all functions, except those where I can be sure arg1 will never be null.

Is it good practice/should I perform this check on the SDL_Event* I get on input when working with SDL2?

sentences: Is resource management a good idea when dealing with animations? New to the Unity environment here and I have a question concerning how to efficiently manage computer resources in a top down 2D game.  I have a large area that looks like a 2d rpg from the 90's and there are many water "tiles" that have an animation that plays constantly.  My question is: would it be a good idea to attach a script to the said water tiles to make them stop animating while the camera is not showing them?  The same question could be applied to any off screen animation that is currently running.  I guess what I'm not sure about is whether the constant testing for visibility is more "expensive" than the actual animation running.

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:
Should I bother with SDL_WaitEvent? When I wrote my first application in SDL, it looked like this:
while (!quit)
{
    SDL_PollEvent(&event);

    switch (event)
    {
         // ...
    }
}

But then one time I left my app running while I went to do something else, and when I came back my laptop was boiling hot. I checked the system monitor and one of my cores was maxed out by my program! So I did some research, and now my loop looks like this:
while (!quit)
{
    SDL_WaitEvent(&event);

    switch (event)
    {
         // ...
    }
}

Great, so now my program doesn't max the CPU. But now I need to introduce rendering, and the problem is, currently this loop runs one iteration per event. If input and other events don't occur, my program won't render the next frame, no matter where the rendering code goes in the loop. So that's no good.
I could have threads, but that seems like a lot of extra complexity when I could just do:
while (!quit)
{
    SDL_PollEvent(&event);

    switch (event)
    {
         // ...
    }

    SDL_Delay(10)
}

This won't melt the CPU, and I can render at about 100 frames per second.
My questions are:

Which approach "should" I use? I don't see any reason to not just use (3).

What's the point of SDL_WaitEvent, if you can't use it the moment you want to do anything other than handle events in your game loop?

I assume SDL_WaitEvent does something like approach (3) under the hood, so even though ostensibly approach (3) should introduce more latency, in practice it won't. Is this correct? How low should the integer passed to SDL_Delay be to get a responsive app?

sentences:
How to detect a touch on transparent area of an image in a (libgdx) stage? Can some one please help to detect a touch on an image which I am using as an actor in a stage. The image is actually a long diagnol brush which has plenty of transparent area. The problem is when I touche the transparent area of the brush image it is also triggering the clicklistener of the image. I need the click listener should only be called when the finger actually touched the visible image not the area which is empty.

I am using libgdx-0.9.4 libraries. Here is my simple piece of code.

import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.ClickListener;

Image brushImg = new Image(ImageCache.getTexture("brush"));
brushImg.width = mStage.width()*0.75f;
brushImg.height = mStage.height()*0.75f;

brushImg.setClickListener(new ClickListener() {

@Override
public void click(Actor actor, float x, float y) {
    SoundFactory.play("brush");
}

sentences:
How to properly give Image source for multiple sources? I'm writing a script to change the image on the button based on previous selection.
Another script is giving the CurrentAvatar variable once previous button is pressed.

My problem is i can't seem to load an image for the button using:

AvatarSprite = Resources.Load<Sprite>("Assets/Images/FireMonsters/Lamor_Icon");

Could someone please enlighten me on the proper code?

All from assets, or is it even possible?

Also looking to have multiple options in if statements, don't know a better method.

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

public class SelectedAvatar : MonoBehaviour {

    Button CurrentHeroSprite;
    static Sprite AvatarSprite;
    public static string CurrentAvatar;

    // Use this for initialization
    void Start () {
        CurrentHeroSprite = GetComponent<Button>();
    }

    // Update is called once per frame
    void Update () {
        if (CurrentAvatar == "Lamor") {
            AvatarSprite = Resources.Load<Sprite>("Assets/Images/FireMonsters/Lamor_Icon");
            CurrentHeroSprite.image.sprite = AvatarSprite;
            Debug.Log ("loaded sprite for Lamor");
        }
        //if etc etc etc
    }
}

sentences:
How do I create a CPU read/write buffer in SlimDX (what are the legal combinations of Usage and CPUAccess flags)? Currently, I create a vertex buffer in SlimDX like so:

SlimDX.Direct3D11.BufferDescription Description = new SlimDX.Direct3D11.BufferDescription();

Description.BindFlags = SlimDX.Direct3D11.BindFlags.VertexBuffer;
Description.CpuAccessFlags = SlimDX.Direct3D11.CpuAccessFlags.Write;
Description.OptionFlags = SlimDX.Direct3D11.ResourceOptionFlags.None;
Description.SizeInBytes = _BufferSize;
Description.StructureByteStride = 0;
Description.Usage = SlimDX.Direct3D11.ResourceUsage.Dynamic;

_Buffer = new SlimDX.Direct3D11.Buffer(Parent.Device, Description);

Which I can update:

DataBox box = _Parent.Context.MapSubresource(_Buffer, 0, _BufferSize, SlimDX.Direct3D11.MapMode.WriteDiscard, SlimDX.Direct3D11.MapFlags.None);
box.Data.Position = destStartPosition * _VertexStride;
/* Where T is my vertex structure type */
box.Data.WriteRange<T>(data);
_Parent.Context.UnmapSubresource(_Buffer, 0);

My first question is about the MapSubresource parameter MapMode.WriteDiscard: when the documentation says

  "the previous contents of the resource will be undefined"

, does that mean that if I only update part of the buffer, when it is unmapped the remainder could become anything? Or simply that if I read from the DataStream there is no guarantee what I am reading will be valid?

Second, if I specify MapMode.Write, SlimDX will throw an exception (E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809)). Why is this? The documentation says that I only need to have a writeable buffer for this to be valid, which I do, because that is the same requirement for WriteDiscard which I can pass successfully.

One last question, if I specify:

Description.CpuAccessFlags = (SlimDX.Direct3D11.CpuAccessFlags.Write | SlimDX.Direct3D11.CpuAccessFlags.Read);
Description.Usage = (SlimDX.Direct3D11.ResourceUsage.Dynamic | SlimDX.Direct3D11.ResourceUsage.Staging);

The same exception is thrown, but this is the only combination of flags I can see that would give me a ReadWrite buffer, how can I create one?

sentences:
Using PlayerPrefs to save audio volume throughout scenes in Unity I have game that plays music. I have a mute toggle button that will mute my game music when you press on it, it will also un-mute it when you press it again. I'm having problems with saving the audio volume when a scene is loaded. (I tried using DontDestoryOnLoad but my mute script is attach to my main menu canvas so its saving the canvas as well, which I do not want. I find using playerprefs a lot easier). For example, when I click on my mute button, it mutes my game, I play the game, die, restart the game and the volume is being restarted as well. Even though I used playerprefs to try and solve the problem it didn't work, it still did the same thing. Anyway this is my script:

public bool mute;
public static Vector3 target;

void Start ()
{
    PlayerPrefs.GetFloat("mute");
}

void  Update()
{
    PlayerPrefs.GetFloat("mute");
}

private void Muted ()
{
    mute = !mute;
    if (mute) {
        gameObject.GetComponent<AudioSource> ().volume = 0;
        PlayerPrefs.SetFloat("mute", 0);
    }
    else
    {
        gameObject.GetComponent<AudioSource> ().volume = 1;
        PlayerPrefs.SetFloat("mute", 1);
    }
}

sentences:
How do I determine how far to move an object in the client when using client-prediction? I have a game server which, for testing purposes, is updating once per second, or 1hz so I can correctly implement client-side prediction. Everything is running locally at the moment so there is no lag issues to deal with, but this setup replicates potential packet loss, or if the server somehow is behind on processing.

I am using Unity for the client. I have a tunnel where the position is updated on the server and then broadcast to each client each tick (once per second). The client simply then lerps between its current position, and the new position received from the server, and this seems to work nicely.

However, as I have set the tick to 1hz, there are unexpected results where the position seems to pulse, rather than smoothly transition. An example can be seen below.

It can perhaps be seen more clearly without lerping

I have tried constantly increasing the tunnel's position in the client, but if it's moved too far in the client, once the server's position is received, it is snapped back to that position which creates some weird rubber-banding like effects even though there is no lag.

How can I determine how much to move the tunnel in the client to create some seamless movement, even when the tick rate is so low? Baring in mind this movement is variable, so it can move faster/slower at times so the movement in the client cannot be a fixed number.

Yes, I can just increase the tick rate which gives smooth movement, however, there is no lag to account for as it's all local so I am just preparing for when I move the server to actual hosting.

Instead of lerping between the current position and the received position, should I be trying to lerp between the current position and the next received position?

Lerp:

        Vector3 currentPosition = transform.position;
        Vector3 newPosition = new Vector3(currentPosition.x, currentPosition.y, tunnelPositionZ);

        transform.position = Vector3.Lerp(currentPosition, newPosition, Time.deltaTime);

DMGregory's solution attempt:

If I decrease the 1.0f for the blend variable, the tunnel will move very slowly and then jolt forward when a snapshot is received. Decreasing the 1.0f to around 0.1f seems to align the speeds but there is still a noticeable jolt.

I'm using the same velocity for the currentPosition and newPosition because the velocity never changes.

    float dT = Time.time - latestSnapshot.arrivalTime;
    float blend = Mathf.Clamp01(dT / 1.0f);

    Vector3 currentPosition = transform.position;
    Vector3 currentVelocity = rigidbody.velocity;

    Vector3 newPosition = new Vector3(currentPosition.x, currentPosition.y, latestSnapshot.tunnelPositionZ);
    Vector3 newVelocity = new Vector3(currentVelocity.x, currentVelocity.y, latestSnapshot.tunnelVelocityZ);

    Vector3 velocity = Vector3.Lerp(currentVelocity, newVelocity, blend);

    Vector3 position = Vector3.Lerp(
               currentPosition + velocity * dT,
               newPosition + velocity * dT,
               blend);

    transform.position = position;

sentences:
Unity using "as" vs "GetComponent()" Hello im new to unity and im learning raycast right now , after checking the documentation here https://docs.unity3d.com/ScriptReference/RaycastHit-triangleIndex.html , i got something that's confusing me , what is the difference between :

 MeshCollider themeshhit = thehit.collider as MeshCollider;
 //
 if (themeshhit == null) {
 Debug.Log (" | themeshhit == null ! | ");
 }
 //

and :

 MeshCollider themeshhittwo =  thehit.collider.gameObject.GetComponent<MeshCollider> ();
 //
 if (themeshhittwo == null) {
 Debug.Log (" | themeshhittwo == null ! | ");
 }
 //

Both method is working correctly , but i want to know what is the difference between them , and i also want to know which one is better if comparing against speed , compatibility , and ability .

Edit : variable thehit is look similar to this

 RaycastHit thehit;

sentences:
Java Thread.sleep() VS Get last and current time I am creating a simple game using Java. I'm not using any game library. I just want to know if it is okay to call Thread.sleep(40) before calling repaint().

public void run() {
    while(isGameRunning) {
        try {
            Thread.sleep(40);
            repaint();
        }
        catch(Exception e) {
        }
    }
}

or should I use:

private long last_time = System.nanoTime();
private double ns = 1000000000/25D;
private double delta = 0;
@Override
public void run() {
    while(Universe.IsGameRunning) {
        long time  = System.nanoTime();
        delta += (int)(time - last_time)/ns;
        last_time = time;
        System.out.println(delta);
        if(delta>=1) {
            repaint();
            delta--;
        }
    }
}

The code below has more CPU and RAM usage than the first one. Can you explain to me how 'Delta Timing' actually works?

sentences:
Restrict camera movements I'm making a game with target (orbit camera). I want to limit camera movements when in room. So that camera don't go through walls when moving around target and along the ground.
What are common approaches? Any good links with tutorials? I use Unity3D, nevertheless I'm good with a general solution to the problem

sentences:
How to properly pass sprites to a std::vector without destroying the sprite's texture in SFML? From the official SFML tutorials, The White Box Problem:-

"When you set the texture of a sprite, all it does internally is store a pointer to the texture instance. Therefore, if the texture is destroyed or moves elsewhere in memory, the sprite ends up with an invalid texture pointer." Thus you will see a sprite without a texture.

I have a class called World. In this class I made a 2d integer array called level and a vector of type Block called blocks. Now I wanted to store the 'Block' objects inside the vector whenever level[ i ][ j ] = 1.

header file of the 'World' class:-

#ifndef WORLD_H
#define WORLD_H
#include <vector>
#include "Block.h"
#include "Grass.h"
#include <SFML/Graphics.hpp>

using namespace std;

class World
{
    public:
        World();
        void draw(sf::RenderWindow *window);
        vector<Block> blocks;

    private:
        int level[12][16];
        int wd;
        int hi;
};

#endif // WORLD_H

cpp file of the 'World' class :-

#include "World.h"
#include "Grass.h"
#include "Block.h"
#include <iostream>
#include <SFML/Graphics.hpp>

using namespace std;

World::World() : level{
        {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, 0, 0, 0, 0, 1},
        {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1},
        {1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1},
        {1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1},
        {1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 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, 1}
    }
{
    wd = 16;
    hi = 12;
    int count = 1;
    //make a 'Block' object and pass it in the vector when level[ i ][ j ] = 1.
    for(int i = 0; i<hi; i++)
    {
        for(int j = 0; j<wd; j++)
        {
            if(level[i][j] == 1)
            {
                Block block(j*50, i*50);
                blocks.push_back(block);
            }
        }
    }
}
void World::draw(sf::RenderWindow *window)
{
    for(unsigned int i = 0; i<blocks.size(); i++)
    {
        blocks[i].draw(window);
    }
}

The 'Block' class has two members - sf::Texture blockT and sf::Sprite block. It also has a draw(RenderWindow *window) method. This is how the 'Block' class is made :-

header file for block class

#ifndef BLOCK_H
#define BLOCK_H
#include <iostream>
#include <SFML/Graphics.hpp>

using namespace std;

class Block
{
    public:
        Block(float x, float y);
        void draw(sf::RenderWindow *window);

    private:
        sf::Texture blockT;
        sf::Sprite block;
};

#endif // BLOCK_H

cpp file for 'Block' class

#include "Block.h"
#include <iostream>
#include <SFML/Graphics.hpp>

using namespace std;

Block::Block(float px, float py)
{
    if(!(blockT.loadFromFile("textures/block.png")))
    {
        cout<<"Could not load block texture."<<endl;
    }
    block.setTexture(blockT);
    block.setPosition(sf::Vector2f(px, py));
    cout<<px<<endl;
    cout<<py<<endl;
}

void Block::draw(sf::RenderWindow *window)
{
    window->draw(block);
}

When I run the program, in place of blocks, only white box is shown. I don't understand how the texture is getting destroyed. This is what the output looks like :-

As you can see, the white places are sprites each of size 50*50 without any texture.

Edit: The Main Function :-

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "Untitled game");
    window.setVerticalSyncEnabled(true);
    Player player;
    World world;

    //variables

    while(window.isOpen())
    {
        //event handling

        //updating

        //drawing
        window.clear(sf::Color::Black);
        world.draw(&window);
        window.display();
    }

    return 0;
}

sentences:
When the motion button is pressed, the shape of the character changes and always goes to the left direction good day. When the motion button is pressed, the shape of the character changes and always goes to the left direction.

Why is this happening and what is the solution?

Pressing two buttons moves to the left and the shape changes.

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

public class PlayerKontrol : MonoBehaviour {

public float karakterHizi = 8f, maxSurat = 4f;
private Rigidbody2D myRigidbody;
private Animator myAnimator;

private bool solaGit, sagaGit;

void Awake () {
    myRigidbody = GetComponent<Rigidbody2D> ();
    myAnimator = GetComponent<Animator> ();

}

void FixedUpdate () {
    if (solaGit) {

        SolaGit ();
    }

    if (sagaGit) {

        SagaGit ();
    }
}

public void AyarlaSolaGit (bool solaGit)
{
    this.solaGit = solaGit;
    this.sagaGit = !solaGit;
}

public void HareketiDurdur () {
    solaGit = sagaGit = false;
    myAnimator.SetBool ("run", false);
}

void SolaGit (){

    float Xdurdur = 0f;
    float surat = Mathf.Abs (myRigidbody.velocity.x);

    if (surat < maxSurat)
        Xdurdur = -karakterHizi;

    Vector3 yon = transform.localScale;
    yon.x = -0.3f;
    transform.localScale = yon;

    myAnimator.SetBool ("run", true);

    myRigidbody.AddForce (new Vector2 (Xdurdur, 0));

}

void SagaGit () {

    float Xdurdur = 0f;
    float surat = Mathf.Abs (myRigidbody.velocity.x);

    if (surat < maxSurat)
        Xdurdur = -karakterHizi;

    Vector3 yon = transform.localScale;
    yon.x = 0.3f;
    transform.localScale = yon;

    myAnimator.SetBool ("run", true);

    myRigidbody.AddForce (new Vector2 (Xdurdur, 0));

}

}

sentences:
What are the implications of releasing without a trademark? I've been working on a video game for almost a year now and with release looming I'm starting to panic cause I don't have a trademark (but I do have a company).

I really don't want to have to push release back a year to wait for the trademark process... Can I get around this and just release (safely) somehow?

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: 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: Web Card Game , MySQL vs SQLite performance wise Been thinking of creating a js/PHP/MySQL game, with multiple players / games happening concurrently. Is there any chance SQLite might be faster for something like this than MySQL? Keep in mind that I'll propably test this on a shared hosting server...

sentences:
How do I implement Pokemon-style moves? I'm developing a Pokémon/classic Final Fantasy inspired game, in the sense that game play consists in many creatures, possessing many moves with different effects (attacking, healing, buffing, debuffing, etc) taking turns fighting each other.

I'm having some doubts on how to implement the movement system, especially the part of how to organize the code responsible for the effects of the move.

Some important characteristics of the system:

Creatures should be able to learn and forget moves
All moves can be learned by more than one creature

I have come up with some ideas, but none seem very good. Is there any known standard in the industry for doing this, or any known optimal solutions?

Here are the ideas I had:

Every move inherits from an abstract class Move, overriding an execute() method.
A MoveProcessor class, containing a method executeMove(), called every time any move is made, receiving the move id code. Something like:

switch(moveCode){
     case 1: //Attack code
     break;
     case 2: //Heal code
     break;
     //...
}

I am developing in Unity and C#, but answers need not be specific to said platform and language.

Please note that this is not a duplicate of Modeling what moves a pokemon can learn or Storing data for a pokemon-like game, since those questions ask about storing move information, not implementation.

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:
Instantiated Prefab Facing Wrong Way Here's a Youtube video of my problem in action ((in the video I am clicking in various directions, yet the fireball is always created facing down in some direction.))

I've been having a lot of trouble wrapping my brain around Quaternion rotations in Unity2D.

What I'm trying to do is so simple, yet it keeps beating me. I simply want to instantiate a prefab of fireball when I click the button. The problem is that I want the fireball to be facing in the direction of the mouse before firing along. I haven't gotten to the fire and velocity part because I can't get it face the right direction when it's created.

In my playercontrollerscript attached to the player Object I have this (In C#)

        if (Input.GetMouseButtonDown (0) && anim.GetBool ("canAtk")) { //Basic attack controls

        curTarget = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        if(classState == "Cutter"){
            anim.SetTrigger ("attacking");
            anim.SetBool ("canAtk", false);
            StartCoroutine (AttackTiming ());
            anim.SetFloat ("animCombo", playerCombo);
        }
        else if(classState == "Flame"){
            Debug.Log (curTarget);
            var worldTarget = Input.mousePosition;
            Quaternion rot = Quaternion.LookRotation(transform.position - curTarget, Vector3.right);
            Rigidbody2D fballClone = (Rigidbody2D) Instantiate(fireBallz, transform.position, rot);

(You can safely ignore the cutter class part. The problem is when I'm in Flame class. I also have a script attached to the prefab object, but at this moment all it does is control Euler angles so it doesn't rotate along the weirdness axis.

Anyways, each time I hit the button it creates a fireball, but it's like they are 90 degrees behind where they should be. I say "like" because that's not always the case. If I click under my character, then the fireball is pointing up. If I click sort of "Down/right" it points "up/right".

This would be easier if I could visually wrap my head around how the rotations work. Any advice would be appreciated. If you need any more information or screenshots let me know as well. Thanks again.

Update: so previously I had left a line setting curTarget.z to 1 because it was returning -10 for the camera Z and I thought that was related to the problem. Oddly, when I removed that line it halfway fixed the problem. Now, if I click in the down/right or down/left or down it will create the fireball facing correct direction, but if it's "up" any, then it will pretty much face the opposite direction. Also, directly left or directly right causes the fireball to face down.

New Update: (Sort of just updating as I try to work it out.) I turned on Debug.Log(rot) just so I could see the rotation values when I create the fireball.

If I click bottom right I get (0.0, -0.6, -0.4, 0.7) the fireball is facing the correct position as it does always as long as I'm clicking in the "downish" area. When I click top right I get (-0.6, 0.0, 0.7, -0.3) and the fireball is facing Bottom-Left. So I click in the bottom-left direction and I get (0.6, 0.1, 0.7, -0.4) and it's facing bottom-left. My brain is so fried I'm not piecing it together correctly. Something I'm missing.

sentences:
How to make colliders for a darts board in Unity? I was wondering how to make a darts board in Unity?

Of course it doesn't make triangular objects, or non symmetrical boxes as far as I know, so I would make the board mesh in Blender or something like this.

But how would I be able to detect where a dart had hit the certain area? Until now I have only used box, sphere and capsule colliders

sentences:
How can I turn an open world into a fixed-size array? I am developing a little game, where I need an A* path-finding algorithm for enemies who follow the player. I have already learned and tested a path-finding algorithm, but it only works with fixed-size array.

How can I turn an open world into a fixed-size array? I am developing with Irrlicht engine 1.6 version. I know that it is a quite old, but it is the only engine which works for me, on Windows XP.

Here is my A star path-finding code that works on a 2D grid. Additionally , if needed, Here there is a link to a walking person I have created with Irrlicht. You must place the media folder in your local drive.

sentences: Nvidia RTX ray tracing OpenGL extension I can't seem to find any OpenGL headers for the RTX ray tracing extension, seems like they only want you to use Vulkan and optix with RTX

sentences: Converting Cube Maps I have cube maps in lat/long format, and i need to convert them to Horizontal/Vertical Cross, and individual cross images, is there an utility to do that?

sentences:
How can I mass-duplicate or "paint" Unity objects? Let's say I have a basic map with a single box on it.

I want to make many, many more of these cubes, so they can cover a large portion of the map, like this:

Each box needs to be exactly one unit away from the adjacent boxes, so there is no overlap.

My idea was to clone the first box so the entire blue map is covered, then manually delete some of them to make the path.

In other software, there are ways to clone/duplicate large numbers of objects so that they fill an area, or follow a certain set of transformations. I cannot figure out how to do this in Unity.

I have tried manually duplicating the box and setting its location (so I have two properly-positioned boxes), then selected both of those and duplicating (so I have four boxes total), duplicating those, etc, but as soon as I select multiple boxes, I can't type in a location without all the selected boxes going there (so if I type a y-location of 12, every single selected box will be crammed on top of each other on y=12).

sentences:
Wavy effect/shader in LibGDX HaxeFlixel has a nifty built-in shader called FlxWaveEffect.

Video
Demo (Flash required) if you start the game and steer the player into an enemy.
Usage (search for FlxWaveEffect)

How does one go about creating a similar effect in LibGDX?

sentences:
Speed needed to make a car jump from a ramp I need to make a car jump from a ramp to another, and I need this to be done using AI so I thought it would be enough to set a fixed speed for my car when near the ramp, in order to let it jump correctly.

It works fine if I input the speed manually but I'd like my game to calculate it since the ramps will be generated by user's input.

Unfortunately my physics knowledge lacks, so I need your help.

The problem is summarized in the picture below.

Basically, what I need to compute is the speed (in m/s) that the car has to have on the highest point of the first ramp, given that all the data in red are user's input.

I had some rough ideas on using the projectile range with x=L, y=h-launchRampHeight but the results weren't as I expected them so I gave up.

Do you have any hints on this?

Please note that both ramps have the same length (50m).

EDIT:

Based on @mklingen here's the C# code that I'm using (where Distance = L)

var speed = (Mathf.Sqrt(g)*Mathf.Sqrt(Distance)*Mathf.Sqrt((1/Mathf.Sin(Theta)))* Mathf.Sqrt((1/Mathf.Cos(Theta))))/Mathf.Sqrt(2);

What happens is quite weird though.

For example, with theta = 19, L = 196, h = 46 my code returns 80.54646 which seems to work if I input it to the car. However running the expression in WolframAlpha leads to 55.8 which is wrong.

It may seem that the code is correct but with theta = 35, L = 261, h = 39 my code returns NaN while WolframAlpha shows 52.17 which made the jump happen.

So, tu summarize, I have 2 different cases in which my result is different from WolframAlpha's one and none of them is the correct one both the times.

What's going on?

sentences: What is the technical definition of "sprite batching?" Platform and language agnostically, how is sprite batching defined? It seems as though there are many different techniques for lessening the amount of work when drawing, and that they are often lumped with "batching". It occurs to me that there may not be a real answer, but perhaps someone here has found something I have not.

sentences:
How can I get GetMouseButtonDown two positions on two clicks? private void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                Vector3 pos1 = Input.mousePosition;
            }
        }

Like two points. I click once and the click one on another position so I will have two positions and now I will be able to draw a line between them. I want to get and store two positions.

sentences:
How can I move two couple of objects? Now it will move all the objects of allLines and instancesToMove at the same time.
But I want to take each time one object from the allLines and one from the instancestoMove and move this two together then the next two objects and so on.

if (animateLines)
        {
            counter++;
            for (int i = 0; i < allLines.Count; i++)
            {

                endPos = allLines[i].GetComponent<EndHolder>().EndVector;
                Vector3 startPos = allLines[i].GetComponent<LineRenderer>().GetPosition(0);
                Vector3 tempPos = Vector3.Lerp(startPos, endPos, counter / 500f * speed);

                allLines[i].GetComponent<LineRenderer>().SetPosition(1, tempPos);

                instancesToMove[i].transform.position =
                    Vector3.MoveTowards(startPos, endPos, counter / 25f * speed);

                if (Vector3.Distance(instancesToMove[i].transform.position, endPos) < 0.1f)
                {
                    DestroyImmediate(instancesToMove[i]);
                    instancesToMove.RemoveAt(i);
                    DestroyImmediate(allLines[i]);
                    allLines.RemoveAt(i);
                }
            }
        }

Both allLines and instancesToMove are List

sentences:
Game states and events I'm writting a game in C++ and I'm struggling with getting events and game states work together.

By game states I mean something like this

class GameState
{
public:
    virtual void onPause();
    virtual void draw();
    virtual void update();
};

class PauseScreen : public GameState
{
     //stuff
};

class Game : public GameState
{
     //stuff
};

And I've created dope event observer based system where I have simple EventObserver class which has register function to what Event I want to subscribe and EventManager where I have map of vectors of all possible EventObservers (everything made with templates) and callback functions. No pointers, no inheritance - everything works like charm.

So there is my problem - how to connect these? In my main loop I'm getting current active game state - and then updating and drawing it. But for example when state is not active its still receiving event. This is pretty bad beacuse if I have MainMenu gamestate and for example if escape key is pressed it would just exit the game even if I'm currently in Game.

I could only came with some bool checking - if current state is not more active it would disable all EventListeners but I would need to manually call EventListener::disable in all game states for every EventListeners I have in onPause() methods and I don't like this solution (and since it's my hobby project I would like things that I like). I could store EventListeners in vector in GameState interface class so I wouldn't need to disable it manually and just iterate thought it and disable it 'automatically' but I would have to deal with A LOT of templates and naaah I don't wanna do it (just keep it simple).

On the other hand I could add method to GameState handleEvent(Event* event) (well since this is now dynamic memory I would probably prefer to use smart pointers so I don't need to worry when I have to delete event) but then I would have giant switch statement for every game state that I have and this also doesn't seems like good solution. Now I'm just binding one method per one event so everything is nice divided and simple.

So any tips how to design this? Can event observers (or subscribers) work with game states?

sentences: Slick2D: Initializing graphics object before game loop I'm using the Slick2D Java game library and I want to set the scale of the graphics object that gets passed to the render method in my game loop.  I'd like to do this outside the render method, so that I would only have to call the setScale() method once.  I am implementing my game as StateBasedGame, so I'd to like to initialize my graphics object in my StateBasedGame class.  Where would be the appropriate place to do this?

sentences:
physics model simulation I am building a game for which I want to simulate certain rigid body dynamics.Could someone suggest me some engines which work on Ubuntu.Also as I have dont have much time to implement it,so it would be helpful if it is a easy one to work with.
I have some across one namely ODE.Am looking for others which would help me simulate collisions and angular movements.

sentences:
GluUnproject works, but only when the camera is not rotated I am working on a very basic 3D program, my first one using OpenGL.  What I am trying to do is trace a ray from the mouse's location on click which works, but only when the camera is not rotated. When the camera is rotated, the unproject treats it as if it was not.

What am I doing wrong?

The code for unproject:

Coord3<GLdouble> Display::GetOGLPos(uint16_t x, uint16_t y)
{
    GLint viewport[4];
    GLdouble modelview[16];
    GLdouble projection[16];

    Coord2<GLfloat> window_location;
    Coord3<GLdouble> resultant_ray;

    glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
    glGetDoublev(GL_PROJECTION_MATRIX, projection);
    glGetIntegerv(GL_VIEWPORT, viewport);

    window_location.x = (float)x;
    window_location.y = viewport[3] - (float)y;

    gluUnProject(window_location.x , window_location.y, 1.0f, modelview, projection, viewport, &resultant_ray.x, &resultant_ray.y, &resultant_ray.z);

    return resultant_ray;
}

The display code:

void Display::Render()
{
    if(!dirty)
    {
        return;
    }

    glTranslatef(camera.location.x ,camera.location.y, camera.location.z);

    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

    glRotatef(camera.angle.y, 1, 0, 0);
    glRotatef(camera.angle.x, 0, 1, 0);

    glCallList(cube);

    glColor3ub(0, 0, 255);

    glBegin(GL_LINES);
    glVertex3f(0,0,0);
    glVertex3f(mouse_click.x, mouse_click.y, mouse_click.z);
    glEnd();

    glLoadIdentity();

    SDL_GL_SwapBuffers();

    dirty = 0;

    SDL_Delay(33);
}

sentences:
Bukkit shoot tnt where player is looking Possible Duplicate:
  Bukkit shoot tnt & help with vectors

Hello. I want to shoot a piece of tnt from the players face and then let it explode when it hits the target block.

I set it up so where the player looks and type in /tnt [power] /cannon [power] or /t [power] it will blow up at the target block:

        if (cmd.getName().equalsIgnoreCase("cannon")) {
        if(!perrmissionCheck(sender, "Needs.cannon", "cannon")){
            return true;
        }
        if (!(sender instanceof Player)){
            sender.sendMessage(nameC+"You must be a player to preform this command.");
            return true;
        }
        Block block = ((Player) sender).getTargetBlock(null, 50);
        Location location = block.getLocation();
        float power = 4;
        if (args.length == 1){
            power = Float.parseFloat(args[0]);
        }
        sender.sendMessage(name+"BOOM!");
        block.getWorld().createExplosion(location, power);
        return true;
    }

That's all fine and dandy but I want it to appear in front of the user then start to move away towards the target block. And NOT blow up before it reaches the target block. Any help is greatly appreciated.

EDIT: I think it may have something to do with vectors but I have no idea how to use them.

Thanks.

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:
Converting Euler rotation angles from Z up to Y up (Max to OpenGL) I'm working on pulling geometry and it's transformation from a 3DS Max exported FBX (Z-up) to an OpenGL model format (Y-up). The main problem is I intend to keep the transformations as Translation and XYZ rotations.

Right now I pull all position transforms simply going from (x y z) to (x z -y) and everything looks good. However the geometry rotation comes in as Euler angle rotations ( X Y Z ). Rotating these has turned into a nightmare. I know I can get a matrix and just multiply it by the RotX-90 mat but pulling those Eulers back is not reliable.

What seems to almost work is this, and it's what seemed to give correct results most of the time. It jut seems bad for the case ( 92.83, -89.41, 53.53) for example when it looks like it's loosing a 90 deg rotation on X.

Matrix rot90 ( 1,  0, 0, 0,
               0,  0, 1, 0,
               0, -1, 0, 0,
               0,  0, 0, 1);

RotMat = RotX * RotY * RotZ
RotMat = Rot90X * RotMat
Quaternion = Convert from RotMat
NewX = Quaternion.Pitch
NewY = Quaternion.Yaw
NewZ = Quaternion.Roll

I know the god of bit shifting must have some civil way of doing this. Any tips/suggestions would be greatly appreciated.

ps. exporting the FBX with Y up won't work as it just seems to apply a transformation on the root node, not to actually swap vertices y-z positions.

sentences:
Tween animation with Universal Tween Engine LIbGDX Let me preface by saying that I'm new to libgdx...

I have an animation that I'm currently drawing to the screen using:

game.batch.draw(flyAnimation2.getKeyFrame(elapsedTime, true), 200,200,0, 0, 124, 90, 1.0f, 1.0f, 90);

Where flyAnimation2 is:
   Animation flyAnimation2;

This works correctly.  I now want to use UniversalTweenEngine to tween it from one side of the screen to the other.

I can't find any decent documentation on how to achieve this affect using an Animation.  Any help would be appreciated!!

sentences:
Platformer collision detection problems I'm having a few problems with collision detection in my game (written in C# with SDL.Net). Detecting the floor and roof is fine, as does detecting sides of tiles when not jumping/falling. My problem comes when the player jumps and hits one of the sides of a tile.

Sometimes the player (blue) enters the tile, like this:
http://i.stack.imgur.com/SSjtR.png
At first I thought this was because it was checking for a collision then moving the player then drawing, but changing it has no effect.

Other times it will randomly move from the overlapping position above to here:
http://i.stack.imgur.com/0esSw.png

    public void PlayerCollision2 (ref Player player)
    {
        Rectangle rectLeft = new Rectangle (new Point ((int)player.x, (int)player.y), new Size (1, Player.HEIGHT));
        Rectangle rectRight = new Rectangle (new Point ((int)(player.x + Player.WIDTH), (int)player.y), new Size (1, Player.HEIGHT));
        Rectangle rectTop = new Rectangle (new Point ((int)player.x, (int)player.y), new Size (Player.WIDTH, 1));
        Rectangle rectBot = new Rectangle (new Point ((int)player.x, (int)(player.y + Player.HEIGHT + 1)), new Size (Player.WIDTH, 1));

        List<TileDirectionRelPlayer > lst = new List<TileDirectionRelPlayer> ();
        foreach (List<Tile> r in map) {
            foreach (Tile c in r) {
                if (c.tileType == TileType.Air)
                    continue;
                TileDirectionRelPlayer t = new TileDirectionRelPlayer ();
                t.tile = c;
                if (c.rect.IntersectsWith (rectBot)) {
                    t.below = true;
                    lst.Add (t);
                } if (c.rect.IntersectsWith (rectTop)) {
                    t.above = true;
                    lst.Add (t);
                } if (c.rect.IntersectsWith (rectLeft)) {
                    t.left = true;
                    lst.Add (t);
                } if (c.rect.IntersectsWith (rectRight)) {
                    t.right = true;
                    lst.Add (t);
                }
            }
        }

        if (lst.Count == 0 && !player.jumping) {
            player.falling = true;
        } else {
            foreach (TileDirectionRelPlayer t in lst) {
                MovePlayer (ref player, t, new Rectangle[] {rectLeft, rectRight, rectTop, rectBot});
            }
        }
    }

    private void MovePlayer (ref Player player, TileDirectionRelPlayer tile, Rectangle[] rectangles)
    {
        if (tile.above && rectangles[2].IntersectsWith(new Rectangle(new Point((int)tile.tile.x,(int)tile.tile.y+Tile.HEIGHT), new Size(Tile.WIDTH,7)))) {
            player.falling = true;
            player.jumping = false;
            player.ySpeed = 0;
            player.y = tile.tile.y + Tile.HEIGHT + 1;
        }
        if (tile.left && tile.tile.y < player.y) {
            player.x = tile.tile.x + Tile.WIDTH;
        }
        if (tile.below && !player.jumping && rectangles[3].IntersectsWith(new Rectangle(new Point((int)tile.tile.x,(int)tile.tile.y), new Size(Tile.WIDTH,7)))) {
            player.y = tile.tile.y - Player.HEIGHT - 1;
            player.falling = false;
            player.ySpeed = 0;
        }
        if (tile.right && tile.tile.y < player.y) {
            player.x = tile.tile.x - Player.WIDTH - 1;
        }
    }

I have no idea why this is happening or how to fix it, can someone point me in the right direction please?

EDIT: There is a video here if it helps

sentences:
Algorithm for creating spheres? Does anyone have an algorithm for creating a sphere proceduraly with la amount of latitude lines, lo amount of longitude lines, and a radius of r? I need it to work with Unity, so the vertex positions need to be defined and then, the triangles defined via indexes (more info).

EDIT

I managed to get the code working in unity. But I think I might have done something wrong. When I turn up the detailLevel, All it does is add more vertices and polygons without moving them around. Did I forget something?

EDIT 2

I tried scaling the mesh along its normals. This is what I got. I think I'm missing something. Am I supposed to only scale certain normals?

sentences:
How to determine whether the direction of rotating a 2D vector to another one is counter-clockwise or clockwise using the cross product? Vec2 a, b; // some random vector
Vec2 cross = a.Cross(b);
RelativeDirection(a,b,cross); // return true if the direction of
                              // rotating a to b is counter-clockwise

How do I implement the function RelativeDirection()?

I got some suedo code from the textbook:

if a.Cross(b) > 0 then ... else ...

but the cross product is a vector right? how do you compare it with an integer?

sentences:
Simple 2D Flight Physics with Box2D I'm trying to build a simple side scroller with an airplane being the player. As such, I want to build simple flight controls with simple but realistic-feeling physics. I'm making use of cocos2D and Box2D. I have a basic system working, but just can't get the physics feeling correct.

I am applying force to the plane (which is a b2CircleShape) based on the user's input. So, basically, if the user pushes up, body_->ApplyForce(b2Vec2(10,30), body_->GetPosition()) is called. Similarly, for down -30 is used.

This works and the plane flys along with up/down causing it to dive or climb. But it just doesn't feel right. There is no slowdown on climbs, nor speed up during dives. My simple solution is far to simple.

How can I get a better feel for a plane climbing/diving?

Thanks!

sentences:
Events vs Pinging: How should I structure my HUD-updating code? I'm starting to develop a 2D fighting game using C++ and SMFL. I'm relying (at least sort of) on a Entity Design Pattern.

I'm struggling to see how my code should update and manage a heads-up-display (HUD).

I think there are two main possibilities:

The HUD object has references to the players. It periodically updates itself by querying them.
The different systems (input, physics, ...) update the HUD anytime by sending it new information.

The first seems costly because the information might not have changed as often as the HUD queries for it. The second one seems less automatic because the systems NEEDS to specifically call to update the HUD (plus the HUD needs to provide various methods).

What should I do?

sentences:
Android NDK - moving .so files from one project to another I have a small project I've coded for Android that uses a small about of NDK/JNI code. I'd like to share this code between two projects but I'm having little luck so far. First off, I've tried to refactor off the NDK specific code into a library which I think link to both projects using

'project->java build path->source->link source'

and specifying the native library in there. Sounds good but it's wrong. The project from which I refactored the code still requires the .so library file in

MyOriginalProject\libs\armeabi\MyNativeLibrary.so

Removing that from the original project whilst still linking the source of the refactored library fails.

Secondly, creating a new project and attempting to use the NDK library I wrote by both including the source of the library and copying over the .so files from 'obj' and 'libs' into the root directory of the new project fails. It seems to pass

System.loadLibrary("MyNativeLibrary")

At least, it didn't assert.

The code gets as far as my first NDK call and then crashes without being caught by my exception handler.

Any hints would be welcome - such as foolproof ways to get NDK to load a library, typical gotchas and NDK debugging techniques.

Thanks in advance,

Tim.

sentences:
Are there benefits to stage selections where only the appearance changes (i.e. Street fighter, King of fighters etc.)? I'm not really sure if it's a good value add seeing as it would entail asset generation.

The only value I see in it would be for variance but even that would wear thin really quickly.

Clarification: i.e. Backgrounds that don't add game play related features, just appearance changes.

sentences:
2d Tile Movement and Camera Let's imagine we have a 60x60 grid (where a Tile is 64x64px). Within the viewport there should be 10 tiles. The player object is 32x32px.

To have smooth movement, I have to take delta time in consideration; and do something like:

this.player.x += 5 * dt;

To calculate viewports:

vX = parseInt(this.player.x); - Math.floor(0.5 * 10);
  if (vX < 0) vX = 0;
  if (vX+10 > 40) vX = 60 - 10;

  vY = parseInt(this.player.y); - Math.floor(0.5 * 10);
  if (vY < 0) vY = 0;
  if (vY+10 > 40) vY = 60 - 10;

And to render position of player:

this.context.rect((this.player.x - vX) * 64, (this.player.y - vY) * 64, 32, 32);

However I cannot get the math right.

How can I determine which tiles that should be rendered based on Canvas coordinates, in context to where the Player "actually" is on the tile grid. Basically I want to achieve this: https://stackoverflow.com/questions/11464550/html5-creating-a-viewport-for-canvas

But with smooth movement (and not jumping to one tile at a time).

sentences:
Collision, then what? I know how to check collision for example 2 spheres. But my question is how do I use the collsion response in a good way?

How do I make my character unable to walk in to the Sphere? I've got to the point where my game send a PrintLn when isCollided and it works but my character just walk through it.

How should I do?

Cheers!

sentences:
Console-type interface in game I am currently programming a very simple 2d game in C# with XNA.

I was wondering how to implement a console-type interface in a game or graphical software like there is in Skyrim or Counter-strike or some many more games?

These "consoles" can allow you through various command to change many parameters directly in-game.

I find this very interesting for debugging purposes and I was hoping to implement something similar in my program. Is there a particular way to achieve this?

sentences:
Inserting into the first available inventory slot Hello my inventory system picks up one item but does not pickup any more to fill the other two slots. It is saying the whole inventory is full when it should be one slot is full.
Here is my code for the inventory and this is attached to the player.
public class MedInventory : MonoBehaviour
{
    public bool[] isFull;
    public GameObject[] MedkitSlot;
    public GameObject[] BandageSlot;
    public GameObject[] CoffeeSlot;
}

This next script is attached to the items you pickup.
    public class MedPickup : MonoBehaviour
{
    private MedInventory medInv;
    public GameObject itemButton;
    private void Start()
    {
        medInv = GameObject.FindGameObjectWithTag("Player").GetComponent<MedInventory>();
        itemButton.SetActive(false);
    }

    void OnTriggerStay2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            GameObject[] targetSlot = new GameObject[0];
            bool validItem = true;

            switch (gameObject.tag)
            {
                case "medkit": targetSlot = medInv.MedkitSlot; break;
                case "bandage": targetSlot = medInv.BandageSlot; break;
                case "coffee": targetSlot = medInv.CoffeeSlot; break;
                default: validItem = false; break;
            }

            if (validItem)
            {
                for (int i = 0; i < targetSlot.Length; ++i)
                {
                    if (!medInv.isFull[i])
                    {
                        medInv.isFull[i] = true;
                        itemButton.SetActive(true);
                        Instantiate(itemButton, targetSlot[i].transform, false);
                        Destroy(gameObject);
                        break;
                    }
                }
            }
        }
    }
}

sentences:
MCS character mouth open - is this mo cap animation problem? I have MCS Female Character where I can assigned Mocap to my character. I have downloaded mixamo animation and assigned this to the character but the problem is, the character mouth remains open. I am not 3d artist or animation guy, so here are my question.

How can I solve mouth open problem in unity?
What is the reason that mouth is open? Either mocap data has open the mouth or what else problem?

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:
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:
Tips for communication between JS browser game and node.js server? I am tinkering around with some simple Canvas based cave flyer game and I would like to make it multiplayer eventually. The plan is to use Node.js on the server side.

The data sent over would consists of position of each player, direction, velocity and such. The player movements are simple force physics, so I should be able to extrapolate movements before next update from server.

Any tips or best practices on the communications side? I guess web sockets are the way to go. Should I send information in every pass of the game loop or with specified intervals? Also, I don't mind if it doesn't work with older browsers.

sentences:
How to automatically delete an object in Unity? I am new to unity and the other day I was wondering that it would be useful if I could instantiate some objects in my game scene and, as they get instantiated, make it so that they get automatically deleted after a period of time.

I thought about automatically adding a Destroy script to them so that they could be deleted after a period of time using:

Destroy(Gameobject, time);

I'm not sure that's what I need, and if it is I don't know how I'd go about it.

How could I make it so that my objects get automatically deleted after some time, in the context that I'll have a lot of them?

sentences:
Is it possible to use SFML with the Android NDK? I've started using SFML recently and I absolutely love it. I'd like to make games that could be ported to android, linux, mac and windows, but it seems that SFML lacks portability.

I've searched for a while and I've only found unrelated or unanswered questions on forums.

Does anyone know of any way to use SFML with the android NDK or any plans to support it in the future?

sentences:
What exactly is the "blend factor" t in Color.Lerp? I had a bit of a look around and couldn't see anywhere this was addressed, my apologies if it has been.

In Color.Lerp, I understand that the 3rd parameter t is not in fact the time that it takes to change between the colors but is rather the "blend factor". If the first color is at 0 and the second is at 1, then a blend factor of e.g. 0.2 would indicate it is closer to the first than the second.

My confusion is this - how exactly is it determined how long it takes the lerp to occur? I assume it's something to do with the frames per second? e.g. if the blend factor is 0.001 and frames per second are 50, with lerp in the update function then it should take 0.001 * 50 = 0.05 of a second for the change to occur?

sentences:
Logic to path finding checking I'm a little stuck on the logic to how i use my path finder efficiently in my game.

This is basically how the game works:

Building generates goods "Factory" > AI transports goods to "Warehouse" on path tiles >
  Warehouse receives goods > AI goes back to Factory.

Now im wondering how I use my path finder efficiently so its checking the "Factory" is connected to a warehouse by path.

So heres my logic im wondering if it can be improved:

User places factory down > game checks path.

Result 1: No path found> Keep checking every frame..

Result 2: Path found > Store path stop rechecking every frame.

The two problems i have is: Well checking every frame is going to hurt the game's performance, secondly if I stop rechecking - it won't know when a faster route may become available or unavailable =/

Is my logic correct or is there a better method?

sentences:
How to give depth to a top-down shooter? I'm working on a top-down shooter kind of game, but it lacks the feeling of depth.

When you have a sun, it's a bit easier, because the sun can cast shadows. But it's even harder, when there is no sun, like underground.

How do you simulate an ambient occlusion kind of thing? I think that's what it lacks, but maybe I'm wrong.

(And this could be also applied to levels with sun as well, further enhancing the feel)

Example: I have floors and walls, but even if the walls would be a bit thicker, it would lack depth. How could I fix this? I.e. rendering small shadows at floors' edges which are neighbouring walls?

sentences:
Ideas for 2D Water Simulation I am looking for any input on simulating water in 2D, against a rather large (call it) blocked/not blocked array (viewed from the side). I have come up with the following ideas:

Cell Automata

Do a massively parralel simulation on the CPU, using cell automata. With rules as simple as:

If there is a cell open to the bottom move to it.
Check the left and right cells, choose a random one out of the two and move to it.

Pros

Simple to implement.
Meaningful/deterministic in a multiplayer system.

Cons

Probably really slow.
Not convincing.

Fluid Dynamics on the GPU

Perform a rough approximation of fluid dynamics on the GPU against a texture like the following:

+------+-----+-----+-------+
|R     |G    |B    |A      |
+------+-----+-----+-------+
|vX    |vY   |NULL |Density|
+------+-----+-----+-------+

Pros

Probably really fast.
Could be quite convincing.
A further pixel shader could render it directly.

Cons

Difficult to implement.
Difficult to tweak.
I can't allocate a single texture the size of my level.

I could overlap the grid areas, but this would add further complexity.

Particles

Use particles to simulate the water. During rendering using additive blending and then apply a multiplication function to the alpha channel to give the water crisp edges.

Pros

Will probably look nice.
Easy to implement.
Easy to render.
Meaningful in a multiplayer system, although would require quite a bit of bandwidth to transfer.

Cons

Inter-particle effects will probably be slow (neighborhood lookup).
Could lead to water 'leaking' through solid spaces (because the solid space is small, e.g. 1px).
Could lead to strange holes in the water depending on the particle size.
Both of the above could be mitigated by allowing particles to drift closer together than their real size, however would cause problems with the inter-particle and particle/landscape performance.

Any further ideas?

Note: This is an approximation, I am not looking for physically correct water here - just something that 'is good enough' (bonus points for quick and dirty). The game is multiplayer, so unfortunately the whole level needs to be simulated continuously.

sentences:
Level Selector with possible future levels? [Unity] I have a level select screen which is a simple grid layout of my levels. The level data comes from a scriptable object for each level.

The problem I have is what is the best method for populating the grid of levels that use the scriptable object and is able to add more levels to the grid layout if let's say I add an asset bundle in the future?

My thought was that I use a levelDB which holds a list of all of the scriptable objects. Then when an asset bundle is used then it adds the content to the levelDB. The UI would then just use this levelDB to populate the screen.

NOTE: I have very little to no knowledge of how asset bundles work and what you can, and cannot do with them.

sentences:
Slot machine game Phaser 3 I need an advice on creating a slot machine phaser game.
So it looks like this

I need to plan an approach to do the animation of the reels of the slot machine. I have idea of using tileSprite, are there any other ideas of implementing this game?

sentences:
IDirect3DDevice9Ex and D3DPOOL_MANAGED? So I wanted to switch to IDirect3DDevice9Ex, purely for the SetFrameLatency function, as fullscreen vsynced D3D seemed to produce noticable input lag.

But then it tells me 'ha ha ha! now you can't use D3DPOOL_MANAGED!':

Direct3D9: (ERROR) :D3DPOOL_MANAGED is not valid with IDirect3DDevice9Ex

Is this really as unpleasant as it looks (when you're relying quite heavily on managed resources) - or is there a simple solution?

If it really does mean manual management of everything (reloading all static textures, VBs, and IBs on a device reset), is it worth the hassle, will IDirect3DDevice9Ex bring enough benefit to make it worth writing a new resource manager?

Starting to think I must be doing something wrong, due to this:

Direct3D9: (ERROR) :Lock is not supported for textures allocated with POOL_DEFAULT unless they are marked D3DUSAGE_DYNAMIC.

So if I put my (static) textures in POOL_DEFAULT, they need flagging as D3DUSAGE_DYNAMIC, just because I lock them once to load the data in?

sentences:
How to design a GUI / controls system classes I'm at the stage when I need to develop some kind of GUI with windows, clickable buttons, etc. It's going to be a RPG game so these components will be used extensively so I want them to be as flexible as possible.

I was thinking about something like winform controls funcionality though much simpler, I don't think I'll need anything more than a window/panel, button, label and image controls.

So far I made abstract Component class which basic attributes like position, width/height
and two events - mouseover and click. All controls will be derived from this base class.

public abstract class Component
{

    public event EventHandler MouseOver;
    public void OnMouseOver()
    {
        if(MouseOver != null)
            MouseOver(this, null);
    }

    public event EventHandler Click;
    public void OnClick()
    {
        if (Click != null)
            Click(this, null);
    }

    private Rectangle componentRectangle;
    private bool isVisible;

}

My question is how to integrate my controls with the rest of the game, I was thinking about something like GUIManager class that would contain the list of controls and manage displaying them and firing events. I'll be calling the update method somewhere in the game loop.

public class GUIManager
{
    private List<Component> componenets;

    public void Update(Vector2 mouseLocation)
    {
        foreach (Component component in componenets)
        {
            if (component.IsVisible)
            {   // mouse is over component
                if (component.ComponentRectangle.Contains((int)mouseLocation.X, (int)mouseLocation.Y))
                {
                    component.OnMouseOver();
                }
            }
        }
    }
}

Now lets say I want to show character's inventory screen. Is it a good way to just create the controls, add events and then them to GUIManager's controls list to take care of it? Or maybe you can suggest some entirely diffrent approach?

sentences:
why does Physics.Raycast always return my player game object instead of the object I clicked? I have 3D world. I want to detect when the player clicks on a game object in the world.

In this image, I have 2 objects I want to detect mouse click on. The white sphere does have collider on it. The dumpster does not. The behavior is the same as noted below.

I am getting the mouse down detection.  When I check the RaycastHit, I always get the player game object transform and not the game object I clicked on in the world. If I remove the raycaster checks, then I get mousedown for anything in the game not just mouse down over the game object. I need to be able to distinguish between clicks on different game objects.

I found a post here and added a PhysicsRayCaster, but it didn't change the behavior.  The problem isn't getting the event.  My problem is detecting which game object the player clicked on in the world.

Here's my code:

public class InventoryItemSearchHandler : MonoBehaviour
{
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray ray = UnityEngine.Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                // CompareTo always fails because hit.transform.name is always "Player" and
                // not the name of the object clicked on
                if (0 == hit.transform.name.CompareTo(transform.name))
                {
                    print("mouse down");
                }
            }
        }
    }
}

EDIT:
In the image below (compared to the one above) I do get the correct transform in the RaycastHit type when I click on the white sphere (and when I click on the dumpster I get the player transform as noted above).

So it looks like the player object is getting in the way.  What would be causing that?

sentences:
Client/Server state synchronization for RTS How can I perform state synchronization using client/server networking in an RTS similar to Starcraft 2 and Planetary Annihilation?
I'm assuming the server has to do some sort of rewinding time to apply the updates received by each of the clients. But for an RTS game, that sounds like a lot of separate copies of the game world. How do you resolve interactions between units belonging to different players who have different latencies?
For the clients, do they need to use their latency (RTT) in order to know how far behind the server they are, to apply future updates that arrive from the server at the right time?
How do you keep time in sync when latency could fluctuate and server updates may not arrive at fixed intervals?

sentences:
Unity UNET, problems spawning and then destroying that instantiated prefab I am very new to networking, and have ran into an issue, read below.

I have multiplayer system setup, where players can spawn, they can pick up weapons and drop them, there is an object representing a pickup with network identity component attached and local player authority enable, the player can come up to it and press "E", which will destroy the pickup object, then the player can press I to to "drop" that weapon, which instantiates it infront of the player, now this is what should happen, and it works on single player, but when there's 2 players, for second player(client only) it doesn't work as it should.

I have 1 script weapon manager and another small, Pickup (on pickup object child with trigger).

Below is the code and according description of my attempt so far:

Below is PickUp script (on 1st child of pickup object with trigger enabled)

private void OnTriggerStay(Collider other)
{
    if (other.CompareTag("Player"))
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            //Call pickup function on player, passing the weapon id and parent gameobject
            other.GetComponent<WeaponManager>().PickUpWeapon(weaponID, transform.parent.gameObject);
        }
    }
}

Below is WeaponManager script (on player)

public void PickUpWeapon(int id, GameObject go)
{
    CmdDestroyObj(go);

    //... (other code, not relevent)
}

[Command]
void CmdDestroyObj(GameObject obj)
{
    RpcDestroyObj(obj);
}

[ClientRpc]
void RpcDestroyObj(GameObject obj)
{
    // HERE obj is NULL   (!!ERROR!!)
    Destroy(obj);
}

Above in RpcDestroyObj() obj is null

void Update(){
  if(isLocalPlayer)
  {
    if (Input.GetKeyDown(KeyCode.I))
    {
       if (slots[currentActiveSlot] != null)
       {
          CmdDropWeapon();
       }
    }
  }
}

Then here's CmdDropWeapon() function:

[Command]
void CmdDropWeapon()
{
    RpcDropWeapon();
}

Here's RpcDropWeapon() function:

[ClientRpc]
void RpcDropWeapon()
{
    GameObject _drop = (GameObject)Instantiate(drops[currentGun.GetComponent<WeaponStats>().id], transform.position + transform.forward, Quaternion.identity);
    _drop.GetComponent<Rigidbody>().AddForce(transform.forward * 25000f * Time.deltaTime);

    CmdDestroyWeaponHeld() //Destroy currently held weapon (don't pay attention, not relevent to current problem

    currentGun = null;

    if (isLocalPlayer)
    {
        GetComponent<PlayerSetup>().playerUIInstance.GetComponent<PlayerUI>().SetInventorySlotFill(currentActiveSlot, -1);
        emptyHanded = true;
    }
}

On single player (so host & client), everything works besides destroying the pickup prefab that is Instantiated.

On multiplayer, second player (client only), can pick up and drop weapons as well as the originally spawned weapon is destroyed, but destroying the newly instantiated (so after player drops it) pickup object doesn't work.

(In the console there are no errors when UnityEditor is the Lan host/server, when 2 players are playing and I try picking up and dropping weapons several times from client side)

Why is this not working? I would appreciate any help/assistance in getting this right and sync over network for all players.

My guess is that, rpc function Instantiates the drop prefab but it's kind of different on all clients, so the server or another client doesn't have exactly the same object in the scene which means it will not find it and return null.

Let me know if you need any additional information.

Thanks a lot in advance!

sentences:
UnityEngine.PlayerPrefs corrupts string? I need to use PlayerPrefs to store arrays of bytes for my game. For some reason, the string I save with PlayerPrefs doesn't come out with the same length.

I.e.

byte[] TestArray = new byte[256];
for (byte i = 0; i < 256; i++)
{
    TestArray[i] = i;
}

char[] charBuffer = new char[TestArray.Length];
for (int i = 0; i < TestArray.Length; i++)
{
    charBuffer[i] = (char)TestArray[i];
}

PlayerPrefs.SetString ("Storage", new string(charBuffer));

PlayerPrefs.Save ();

Debug.Log (new String(charBuffer).Length);
Debug.Log (PlayerPrefs.GetString ("Storage").Length);

Log:

256
5

Is this possibly an issue with encoding? How do I fix it?

sentences:
Transform texture coordinates when using shader Assuming I define four vertices of a quad with texture coordinates that cover a whole texture or region of a texture, I can animate these coordinates by setting a transform using

SetTransform( D3DTS_TEXTURE0, &texTrans )

...scaling, translating etc.

If I render using a shader, and still want to animate the coordinates, presumably I can pass in the same transformation matrix and multiply the coordinates in the vertex shader?

Instead of in the vertex shader

Output.TextureUV = vTexCoord0;

do

Output.TextureUV = mul( vTexCoord0, texTrans );

Is this a/the correct way to render an animated sprite with shader?

sentences:
Can't open scripts in Unity 2019.2.11.f1 version I'm using Visual Studio 2017, Unity Hub to 2.1.3 and just created a project using Unity's 2019.2.11.f1 version.

Once trying to open a script in Unity, it doesn't open and then I'm forced to use Task Manager to End Unity's task because can't even close it normally due to not being able to interact with the screen. No errors or warnings, VS doesn't open, can't interact with Unity anymore.

This doesn't block me from working, it just isn't as convenient as before.

sentences:
Spell casting - How to optimize damage per second Imagine we have a wizard that knows a few spells. Each spell has 3 attributes: Damage, cool down time, and a cast time. Pretty standard RPG stuff.

Cooldown time: the amount of time (t) it takes before being able to cast that spell again. A spell goes on "cooldown" the moment it begins casting.

Cast time: the amount of time (t) it takes to use a spell. While the wizard is casting something another spell cannot be cast and it cannot be canceled.

The question is: How would you maximize damage given different sets of spells?

It is easy to calculate the highest damage per cast time. But what about in situations where it is better to wait then to get "stuck" casting a low damage spell when a much higher one is available?

For example,

Fireball: 3000 damage, 3 second cast time, 6 second cool down.
Frostbolt: 20 damage, 4 second cast time, 4 second cool down.
Fireblast: 3 damage, 3 second cast time, 3 second cool down.

In this case your damage per second is higher if you chose to go for the lower DPCT spell (fireblast) instead of the frostbolt. So we must consider consequences of choosing a spell.

In the following example are cases of "over casting" and "waiting".

sentences:
GLFW3 multiple windows I'm trying to use GLFW3 to develop VJing application. So basic idea is use two windows:

1st window for fullscreen projection on secondary monitor (basically projector)

2nd window for (hopefully) fullscreen GUI.

It does not have to share context, as GUI window will be just using libRocket for controlling content, recieving MIDI & OSC commands, etc.

Problem is that so far, when I switch projection window on second monitor to fullscreen, it runs, but as soon as I move mouse to primary monitor and click somewhere, projection window gets minimized. Also, GUI window gets a poor framerate.

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <GLFW/glfw3.h>

using namespace std;

void errorCallback(int error, const char *description){
fputs(description, stderr);
}

static void keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods){
if (key == GLFW_KEY_ESCAPE && action == GLFW_RELEASE)
{
    glfwSetWindowShouldClose(window, GL_TRUE);
}
}

int main(){

glfwSetErrorCallback(errorCallback);
if (!glfwInit())
{
    exit(EXIT_FAILURE);
}

int MonitorCount;
GLFWmonitor ** monitors = glfwGetMonitors(&MonitorCount);

//GLFWvidmode* modes = glfwGetVideoModes(monitors, &MonitorCount);

GLFWwindow *window;
window = glfwCreateWindow(1024, 768,"Projection", monitors[0], NULL);
GLFWwindow *controls;
controls = glfwCreateWindow(1024, 768, "Controls", glfwGetPrimaryMonitor(), NULL);

glfwSetKeyCallback(window, keyCallback);
while(!glfwWindowShouldClose(window)){

     //// PROJECTION WINDOW
    glfwMakeContextCurrent(window);

    float ratio;
    int width, height;
    glfwGetFramebufferSize(window, &width, &height);
    ratio = width / (float) height;
    glViewport(0,0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);

      glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
    glBegin(GL_TRIANGLES);
    glColor3f(1.f, 0.f, 0.f);
    glVertex3f(-0.6f, -0.4f, 0.f);
    glColor3f(0.f, 1.f, 0.f);
    glVertex3f(0.6f, -0.4f, 0.f);
    glColor3f(0.f, 0.f, 1.f);
    glVertex3f(0.f, 0.6f, 0.f);
    glEnd();

    //// ---- CONTROL WINDOW ----
    glfwMakeContextCurrent(controls);
    glfwGetFramebufferSize(controls, &width, &height);
    ratio = width / (float) height;
    glViewport(0,0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);

          glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glRotatef((float) glfwGetTime() * 100.f, 0.f, 0.f, 1.f);
    glBegin(GL_TRIANGLES);
    glColor3f(0.f, 0.f, 0.f);
    glVertex3f(-0.6f, -0.4f, 0.f);
    glColor3f(0.f, 1.f, 0.f);
    glVertex3f(0.6f, -0.4f, 0.f);
    glColor3f(0.f, 0.f, 1.f);
    glVertex3f(0.f, 0.6f, 0.f);
    glEnd();

    glfwSwapBuffers(controls);
    glfwSwapBuffers(window);

    glfwPollEvents();
}

glfwDestroyWindow(controls);
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);

}

I'm on Win7 / VS2012 using nVidia 680m

sentences:
What is Purpose of pIntermediate in UpdateSubresources? DX11 used ID3D11DeviceContext::UpdateSubresource but now DX12 seems to use a new method UpdateSubresources.  I think I can figure out most of the differences between these two functions but the pIntermediate parameter of the new function has me particularly confused.

Can someone help me understand what this new pIntermediate parameter is for?

I noticed the VS2015 Template I'm trying to work from sets up a local variable named vertexBufferUpload in a CreateDeviceDependentResources method which later uses it in an UpdateSubresources call; unfortunately, by the time I want to call the new UpdateSubresources method, the vertexBufferUpload variable is long out of scope.

sentences:
Rendering smooth ground I'm attempting to render terrain made out of a triangle mesh. The problem is that whenever I have a northwest -> southeast ramp in the terrain, I get this diamond pattern:

The issue is that at the top and bottom of the ramp, the terrain is more flat than at the middle, so if the ramp is aligned with the triangles, each triangle will have two light vertices (at the top and bottom), and one dark vertex (at the middle).
How can I fix this effect? Subdividing the mesh helps, but doesn't fix it completely.
Vertex shader:
uniform mat4 projection;
attribute vec3 position;
attribute vec3 normal;
attribute vec4 color;

varying vec3 f_position;
varying vec3 f_normal;
varying vec4 f_color;

void main(void) {
    gl_Position = projection * position;
    f_color = color;
    f_normal = normal;
    f_position = position;
}

Fragment shader:
varying vec3 f_position;
varying vec3 f_normal;
varying vec4 f_color;

uniform vec3 light_position;

void main(void) {
    float light = 0.5 + 0.5 * abs(dot(normalize(f_normal), normalize(light_position - f_position)));
    gl_FragColor = vec4(light, light, light, 1) * f_color;
}

sentences:
Making NavMeshAgent to look the direction it was moving when it stops I'm currently using NavMeshAgent as my player character controlled by keyboard or gamepad input.
Also, I'm flipping my character instead of turning via controlling localScale as below.

        private void FixHeadRotation()
        {
            float dir = (myAgent.velocity.normalized.x > 0) ? 1 : -1;
            transform.localScale = new Vector3(1, 1, dir);
        }

However, since I'm relying on the velocity I'm getting the direction(flip) right when moving, but not when I'm not moving(x should be -1 but 1 since no velocity).

I've noticed the NavMeshAgent has built-in function displaying an arrow gizmo over the agent's head. Perhaps I could use that(don't know how atm)?
or any other suggestions to this?

sentences:
Should FPS exceed ticks/second? I was once told that you should never re-draw a frame if the game logic has not changed since the last draw.

Assuming game logic is updated once every tick, and assuming a game runs at 40 FPS @ 20 ticks/second, does that mean that every two consecutive frames will be exactly the same? If so, is there any visual difference between a game running at 40 FPS @ 20 ticks/second versus a game running at 20 FPS @ 20 ticks/second?

Perhaps I don't understand game loops that well, but it seems to me that ticks/second is a limiting factor of FPS.

sentences:
How'd they do it: Millions of tiles in Terraria I've been working up a game engine similar to Terraria, mostly as a challenge, and while I've figured out most of it, I can't really seem to wrap my head around how they handle the millions of interactable/harvestable tiles the game has at one time. Creating around 500.000 tiles, that is 1/20th of what's possible in Terraria, in my engine causes the frame-rate to drop from 60 to around 20, even tho I'm still only rendering the tiles in view. Mind you, I'm not doing anything with the tiles, only keeping them in memory.

Update: Code added to show how I do things.

This is part of a class, which handles the tiles and draws them. I'm guessing the culprit is the "foreach" part, which iterates everything, even empty indexes.

...
    public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
    {
        foreach (Tile tile in this.Tiles)
        {
            if (tile != null)
            {
                if (tile.Position.X < -this.Offset.X + 32)
                    continue;
                if (tile.Position.X > -this.Offset.X + 1024 - 48)
                    continue;
                if (tile.Position.Y < -this.Offset.Y + 32)
                    continue;
                if (tile.Position.Y > -this.Offset.Y + 768 - 48)
                    continue;
                tile.Draw(spriteBatch, gameTime);
            }
        }
    }
...

Also here is the Tile.Draw method, which could also do with an update, as each Tile uses four calls to the SpriteBatch.Draw method. This is part of my autotiling system, which means drawing each corner depending on neighboring tiles. texture_* are Rectangles, are set once at level creation, not each update.

...
    public virtual void Draw(SpriteBatch spriteBatch, GameTime gameTime)
    {
        if (this.type == TileType.TileSet)
        {
            spriteBatch.Draw(this.texture, this.realm.Offset + this.Position, texture_tl, this.BlendColor);
            spriteBatch.Draw(this.texture, this.realm.Offset + this.Position + new Vector2(8, 0), texture_tr, this.BlendColor);
            spriteBatch.Draw(this.texture, this.realm.Offset + this.Position + new Vector2(0, 8), texture_bl, this.BlendColor);
            spriteBatch.Draw(this.texture, this.realm.Offset + this.Position + new Vector2(8, 8), texture_br, this.BlendColor);
        }
    }
...

Any critique or suggestions to my code is welcome.

Update: Solution added.

Here's the final Level.Draw method. The Level.TileAt method simply checks the inputted values, to avoid OutOfRange exceptions.

...
    public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
    {
        Int32 startx = (Int32)Math.Floor((-this.Offset.X - 32) / 16);
        Int32 endx = (Int32)Math.Ceiling((-this.Offset.X + 1024 + 32) / 16);
        Int32 starty = (Int32)Math.Floor((-this.Offset.Y - 32) / 16);
        Int32 endy = (Int32)Math.Ceiling((-this.Offset.Y + 768 + 32) / 16);

        for (Int32 x = startx; x < endx; x += 1)
        {
            for (Int32 y = starty; y < endy; y += 1)
            {
                Tile tile = this.TileAt(x, y);
                if (tile != null)
                    tile.Draw(spriteBatch, gameTime);

            }
        }
    }
...

sentences:
MobileSingleStickControl Elements Disabled Unity I cloned my Unity project on other system. Elements attached to canvas(a prefab) are disabled and when I select an element in inspector, for example Background (shown in screenshot) it is showing weird stuff.

I suspect that some file has not been pushed that contains data related to assets, since inspector is showing improper values. For example; Rect Transform showing instance ID instead of showing X, Y value (please refer screenshot).

Please suggest what can be missing in project that hasn't been pushed or loaded properly by Unity? Thanks.

Note: I am using Unity v5.0.1. Cloned project made in Windows onto my mac system.

EDIT

I upgraded unity. Now elements are similarly disabled in prefab in my original project with normal inspector mode, displaying correct components and values. See screenshot below. No element is rendering and canvas is showing empty like the first screenshot.

sentences:
What is the name for the technique to use different palettes for different tiles of a screen? I've found the keywords "subpalette" and "PPU palette", but they seem to be NES-specific. Though the idea of using a small palettes table and use 2 bits per pixel in an image (+ few bits reference to a palette per tile) looks like a cool retro compression method with low decompression drawbacks, so I guess it was used more widely.
Does this technique (of using different palettes for different blocks of pixels) have a name? Does it have a usage apart from NES?

sentences:
Creating palette from irregular sprites in Unity I want to create a palette based on a number of PNGs in Unity 2D. I am struggling to understand the slicing logic. Let's say I have a sprite 588x547, and I set PPU to 128. So obviously the sprite cannot be divided into 128-parts:

So the right and the bottom part are not going to appear on my palette.
Now I would like the grid to start in the center. The tiles on the sides are not "full" tiles, but I still want them on my palette in the end, so I kind of want Unity to fill up the border tiles for me with void till they reach the 128x128 size:

Is there a way to achieve this? Or am I conceptually misunderstanding something? Given a bunch of PNGs, all of them different pixel sizes, none dividable by 128, how do you create a palette from them to paint on a 128 PPU grid?
I had a look at external tools like TexturePacker and Showbox, but did't manage to achieve a nice 128-dividable grid from my sprites.

sentences:
Changing Box2D Body from Kinematic to Dynamic after contact What is the correct way to change a Kinematic body into a dynamic body?

context - I have a dynamic body as a projectile which has to be fired at a kinematic body (it is kinematic because i am tweening it around the world in random movements). when the projectile makes contact with the kinematic body I would like it to become a dynamic body and be affected by gravity and I will apply a force to the contact point.

At the moment I am simply changing the type with in a menthod called by the contactListener

body.setType(BodyType.DynamicBody);

my biggest issue is that gravity is not acting on the body once it is changed to dynamic, so I'm pretty certain I'm going about this the wrong way.

sentences:
A comparison of graphics libraries and their respective programming languages A comparison of graphics libraries and their respective programming languages. A.K.A. "Which do I pick? With a twist."

I'm a long time professional programmer who never gave up on programming as a hobby. 3D programming has always appealed to me, but after some trial and error I always came back to (and got stuck on) the same question:

Which to choose?

C# with XNA.
C++ with DirectX.
Java with OpenGL.

All three appeal to me:

XNA, because it's managed, of high quality and very complete.
DirectX, because it's de facto standard for large games.
OpenGL, because it's open. It has a proven track record of high quality games built using it. + Eclipse hotswap functionality is sexy.

Keep in mind here that I will:

Use the above library and language for hobby use.
Will want to develop both 3D games and 3D tooling.
Might seek a job in a 3D programming industry.

For the sake of the argument, assume I am equally well versed in C#, C++ and Java. And have no preference for any of the three mentioned libraries. In reality I have a slight preference for one of those three, but the quality of the code I produce in the languages is the same.

Replies with sources as links are preferred! OGRE and Irrlicht (and similar) are also contenders, but not preferred because it introduces additional depencies on other developers.

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:
Exporting steps/actions with a 3D Studio Max plugin I'm trying to figure out how this plugin works behind the scenes. Do you know if there is any 3ds-max API function (maxscript/c++/python) which allows to record the action history somehow?

You could claim there is the max-recorder... in fact, this one does "almost" what I want... but the idea would be writing a plugin to export the max actions to my own custom format.

Example:

1) I create a cube with certain parameters
2) I select it
3) I apply a modifier with certain parameters

Imaginary output:

output = [
   {"action":"create_cube", "params":{"name":"cube1", "size":10, "tess_x":2, "tess_y":3, ...},
   {"action":"select_mesh", "params":{"name":"select_mesh1" "selection": "cube1", ...},
   {"action":"subdivide", "params": {"name":"subdivide1", "type": "catmull-clark", ...},
   ...
]

Thanks in advance.

PS: I haven't been able to contact that author's plugin to get some info about it, otherwise I wouldn't be asking ;-)

sentences:
How can you use Fractals to perturb an image? I've been playing around with Procedurally Generated World. I've so far managed to create the Height Map, and a translate map, but now i'm attempting to create Caves,
The main idea is to use another Noise map, with values being either 0 or 1, and multiply it with the Height Map.
I've managed to achieve this:

This is currently described with a float[Width, Height], which has value 0 for those points (x,y) such that (x,y) is black, or 1, for those which (x,y) is white.
I want to apply some fractal to this to achieve this:

However, i have no idea how to do this!
(I also apologize for any grammatical errors. I haven't slept in like 18 hours and i can't think straight)

sentences:
libgdx tiledmap rendering optimazation I'm new to game development can anyone show me how to render tiles which were only seen by the camera I cant seem to find straight answer in google.

The game is in 2D and im using tiled

sentences:
Box2D Bicycle Wheels Motor Problem - Flash 2.1a I have made a bicycle with Box2D using several polygons for the frame at different angles connected using weld joints, and I have revolute joints on the wheels with a motor.

I have made some basic terrain (straight ground and a small ramp) and added keyboard input to control the bicycle with torque to balance it. All of this is done in with Box2D's Debug Draw.

When the bicycle is on its back wheel but diagonally forward (kinda like this position -> /) the motors just cause it go spinning backwards over when in reality it should either stay on its back wheel or go down onto both wheels.

Here's my code the revolute joints:

            //Front Wheel Joint

        var frontWheelJointDef:b2RevoluteJointDef = new b2RevoluteJointDef();
        frontWheelJointDef.Initialize(frontWheelBody, secondFrameBody, frontWheelBody.GetWorldCenter());
        frontWheelJointDef.enableMotor=true;
        frontWheelJointDef.maxMotorTorque=10000;
        frontWheelJoint = _world.CreateJoint(frontWheelJointDef) as b2RevoluteJoint;

        //Rear Wheel Joint

        var rearWheelJointDef:b2RevoluteJointDef = new b2RevoluteJointDef();
        rearWheelJointDef.Initialize(rearWheelBody, firstFrameBody, rearWheelBody.GetWorldCenter());
        rearWheelJointDef.enableMotor=true;
        rearWheelJointDef.maxMotorTorque=10000;
        rearWheelJoint = _world.CreateJoint(rearWheelJointDef) as b2RevoluteJoint;

And here's the relevant part of my update function:

            // up and down control wheels motor
        if (up) {
            motorSpeed-=0.5;
        }
        if (down) {
            motorSpeed += 0.5;
        }
        // left and right control cart torque
        if (left) {
            middleCentreFrameBody.ApplyTorque( -3);
            gearBody.ApplyTorque( -3);
            firstFrameBody.ApplyTorque( -3);
            secondFrameBody.ApplyTorque( -3);
            rearWheelToChainBody.ApplyTorque( -3);
            chainToFrontFrameBody.ApplyTorque( -3);
            topMiddleFrameBody.ApplyTorque( -3);
        }
        if (right) {
            middleCentreFrameBody.ApplyTorque( 3);
            gearBody.ApplyTorque( 3);
            firstFrameBody.ApplyTorque( 3);
            secondFrameBody.ApplyTorque( 3);
            rearWheelToChainBody.ApplyTorque( 3);
            chainToFrontFrameBody.ApplyTorque( 3);
            topMiddleFrameBody.ApplyTorque( 3);
        }
        // motor friction
        motorSpeed*=0.99;
        // motor max speed
        if (motorSpeed>100) {
            motorSpeed=100;
        }

        rearWheelJoint.SetMotorSpeed(motorSpeed);
        frontWheelJoint.SetMotorSpeed(motorSpeed);

Any ideas what might be causing this?

Thanks

sentences:
Unity3D : Retry Menu (Scene Management) I'm making a simple 2D game for Android using the Unity3D game engine. I created all the levels and everything but I'm stuck at making the game over/retry menu. So far I've been using new scenes as a game over menu. I used this simple script:

#pragma strict

var level = Application.LoadLevel;

function OnCollisionEnter(Collision : Collision)
{
    if(Collision.collider.tag == "Player")
    {
        Application.LoadLevel("GameOver");
    }
}

And this as a 'menu':

#pragma strict

var myGUISkin : GUISkin;

var btnTexture : Texture;

function OnGUI() {
GUI.skin = myGUISkin;

if (GUI.Button(Rect(Screen.width/2-60,Screen.height/2+30,100,40),"Retry"))
    Application.LoadLevel("Easy1");

if (GUI.Button(Rect(Screen.width/2-90,Screen.height/2+100,170,40),"Main Menu"))
    Application.LoadLevel("MainMenu");
}

The problem stands at the part where I have to create over 200 game over scenes, obstacles (the objects that kill the player) and recreate the same script over 200 times for each level. Is there any other way to make this faster and less painful?

sentences:
How do games have low tick rates without causing input lag? For example, Minecraft. It updates the gamestate at a rate of only 20/second. And from what I've read, these multiplayer games do the same with their network communication, sending updates at that same speed. So it sounds like the entire game is, internally, running very slow (ignoring the render interpolation to not appear slow).

But what I don't understand is how player input doesn't feel laggy as a result. If player input was only being sampled 20/second, you would feel the delay. But that isn't the case in Minecraft, it is extremely responsive. I assume that means player input is being sampled as fast as possible, at renderer speed. But that means the game is gathering input way faster than it can use it. If it updates the gamestate and talks to the server 20 times in a second, but gathers 200 input samples in that same time, how does it handle that?

Is it perhaps just faking it locally, taking the latest player input and interpolating the renderer with it to appear responsive, even though that input isn't actually being used anywhere in the game?

How does it decide which particular input sample to use when it's comes time to do a gamestate/network update without losing information?

I don't understand how to resolve the conflict between having too many input samples to use, and having input feel too slow.

sentences:
How to implement simple shadows on XNA? UPDATE: See photos below the description

I try desperately to implement shadows on my XNA games.
My game is a style of games like Voxel (minecraft).

The problem is that I do not find support / help or example explaining how to add shadows on cubes (vertices and indices) with (BasicEffect).
I just find examples to add shadows with a (HLSL Effect) or a "Model".

Is it possible to create shadows with the class "BasicEffect" on vertices cube ?
I already try with "Matrix.CreateShadow(...)" but no success .

I really hope so.

The logic of my function "DrawWorld":

#region DrawWorld
    // Draw all cubes in the world
    public void DrawWorld(GameTime gameTime)
    {
        effet.TextureEnabled = true;
        Plane lightPlane = new Plane(Vector3.UnitY, 0);
        Vector3 lightPos = new Vector3(-10f, 10f, 10f);

        //Try to initialize shadowMatrix
        Matrix shadowMatrix = Matrix.CreateShadow(Vector3.Normalize(lightPos), lightPlane);

        // Light settings
        effet.LightingEnabled = true;
        effet.DirectionalLight0.Enabled = true;
        effet.DirectionalLight1.Enabled = true;
        effet.DirectionalLight2.Enabled = true;
        effet.DirectionalLight0.DiffuseColor = col.ToVector3();

        effet.SpecularPower = 512f;

        // Fog settings
        effet.FogEnabled = true;
        effet.FogStart = arcadia.camera.NearPlane;
        effet.FogEnd = arcadia.camera.FarPlane;
        effet.FogColor = Microsoft.Xna.Framework.Color.White.ToVector3();

        // Set World with shadow matrice
        effet.World = Matrix.Identity * shadowMatrix  ;
        effet.View = arcadia.camera.View;
        effet.Projection = arcadia.camera.Projection;

        // Set the cube vertexBuffer and indice
        arcadia.Game.GraphicsDevice.SetVertexBuffer(graphicData[regionIndex][a].VertexBuffer);
        arcadia.Game.GraphicsDevice.Indices = graphicData[regionIndex][a].IndexBuffer;

        // Apply the basic effect
        effet.CurrentTechnique.Passes[0].Apply();

        // Draw the cubes vertices
        arcadia.Game.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, graphicData[regionIndex][a].VertexPosition.Length, 0, graphicData[regionIndex][a].Indices.Length / 3);

    }
    // #END OF DRAWWORLD
    #endregion

Without shadow is this :

When i try to add shadow with "Matrix.CreateShadow(...)" i got this bad result:

sentences:
How can I search for players in the same wifi in Unity? I am creating a game in Unity and I would like to create an ability for players to join the game that others have created on the same wifi. I would like it to be as effortless as possible(e.g. players don't have to find out their wifi, etc). The game is cross-platform - you could have one player on PC, other on Android device, etc.

Now I know that there is a game that has similar mechanism to what I would like to achieve: SpaceTeam. Basically you select whether you use BT or wifi, and wait for other players to join.

How can I do this in Unity, or something similar that satisfies my needs?

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:
Back-face culling in 2d OpenGL game I have a 2d game I've made using OpenGL ES. The game contains a large quad that fills the entire screen (as a background image) and many smaller quads that make up a number of balls that bounce across the screen.

To illustrate displaying a ball, I may have a single quad with vertices (0,0),(0,1),(1,1),(1,0). I then fill this quad with a texture (a colored ball).

I am wondering if I need to perform back-face culling (for performance reasons). Given these 4 vertices, I assume a polygon is drawn to connect them. Is it actually the case that two polygons are drawn? One facing forward and another one facing the back? I'm struggling to understand.

I have tried getting face culling working and I think I've succeeded, but I've not really noticed any difference in rendering times.

Not sure if relevant, but here is my environment setup code:

gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glViewport(0, 0, width, height);
gl.glLoadIdentity();
gl.glMatrixMode (GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrthof(0, width, height, 0, 0, 1);
gl.glMatrixMode (GL10.GL_MODELVIEW);

sentences:
Limit/Clamp camera movement using quaternions I'm making a camera object for rendering with OpenGL. However, instead of using the typical "LookAt" method I'm trying to use just a Quaternion for orientation and a Vector3 for position. Instead of messing with euler angles to rotate the Camera I use quaternions directly, like this:

glm::vec3 up = glm::normalize(glm::inverse(cam.Orientation) * glm::vec3(0, 1, 0));
glm::vec3 right = glm::vec3(-1, 0, 0);
cam.Orientation = glm::rotate(cam.Orientation, glm::radians(-xoffset), up);
cam.Orientation = glm::rotate(cam.Orientation, glm::radians(-yoffset), right);

xoffset and yoffset are just the amount the mouse has moved since the last frame.

I create my view matrix from the inverse of the two variables. I've already got FPS style camera movement and rotation working. The problem I have now is that I want to prevent the camera from being able to flip over. I.E. moving the mouse up or down enough that the view becomes upside down. Is there a way to clamp the rotation using purely quaternions to prevent this?

sentences:
Events with Entity Component Systems I'm currently working on an HTML5 top-down simple RPG game, and as a learning experience I'm building my own little engine from scratch. After reading around a little I decided to go with the Entity Component System pattern because I like the flexibility and reusability it brings.

I have a few questions I hope you could help me with:

First, there seems to be some disagreement as to what an ECS actually is - some articles have it that components are just containers for data and subsystems handling all the logic, and other articles have it that components contain methods in them and communicate via some sort of shared memory or messaging system. What's the most widely accepted model of an ECS?

Secondly, I've been wondering about in-game events. I'll explain:

So I started developing an engine that follows the "components are only data containers" rule, and subsystems operate only on the entities that match their requirements (for example, subsystem A takes all entities that have "physics" and "render" components, and subsystem B takes all entities that have "physics" and "health" components).

I'd like the game to be easily scriptable, so that in the yet-to-exist level editor, I could link a particular item (e.g. vase) to another (e.g. mob spawner) and create some sort of correlation (e.g. when vase is broken the spawner spits out a monster). With that in mind, I added the following to my Entity class (which, until now, was just a container for components):

Event Trigger - has a "name" field, "predicate" field, and a "data" field. There would be a special subsystem that goes through all entities that have event triggers, check the predicate, and send the event, along with its data if the predicate evaluates to true, to anyone who's listening.
Event Listener - has a "name" field and a "callback" field. If the
entity receives an event it is listening to, it will invoke the event
listener's callback (which will be able to do something like changing
the "spawner" component to be ready to spawn a monster the next time
the appropriate subsystem looks at it).

This pretty much solves the problem I described above (vase + spawner, also allows for scripting events with relative ease). I don't like, however, that there are two ways to "change" components (subsystems and/or events). I usually like that there's only one way to do things, and that one way should be the best way. What do you guys think?

Now, the next problem deals with a different type of event. Say I have a player swinging his sword at a monster; when the "physics" subsystem recognizes that the sword collided with the monster, it should notify the "health" subsystem and the "sound" subsystem of the event, so that health could be decreased for the monster and so that a hit sound could be played.

So the obvious, brute force solution would be to have subsystems sending events to all other subsystems (which is what some ECS articles suggested). The physics system would send an event "entity-A collided with entity-B" every time two things would collide to all other subsystems. Then the health subsystem would check whether it cares about the event and do something about it.

I'm worried about this approach because it seems very computationally intensive and might be a hit for performance. Also, HTML5 doesn't have threads (except web workers but meh...), which would make this easier. I'm just afraid that the sheer amount of messages going between subsystems would be enormous. Also, this approach makes my engine have two completely distinct type of events (one that is inter-entity and one that is inter-subsystem) which is yucky.

What do you guys think? Any suggestions would be very welcome.

Thanks,
Xaan

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:
NPC daily routines and scene loading I'm making a basic survival RPG in Unity 3d. I'm separating my world into different scenes to save memory but I'm not sure how I'm going to program NPC daily routines.

For example, if the player arrives in a town scene in the morning, how do I ensure that the NPCs are working in appropriate places with the appropriate equipment? I suppose I could hard code it so NPCs are in certain places at certain times. Therefore, if the player arrives at 9:00am then all the NPCs will move to their 9:00am places. I'm just wondering if there is a better way of doing it than that. I can see myself needing to write a lot of code to cover all the possibilities so it could get really messy. I was hoping there was some way I could have the NPC routines continue seamlessly in the background but this would be taxing on memory -if it's even possible.

Any ideas/pointers on this issue would be appreciated.

sentences:
Pygame performance issue for many images I've made a script for generating a game world based off of image pixel data.

Trying to make a python map editor

My progress so far has resulted in a program which loads an image and draws sprites in positions correlating with the map, like this:

Now the problem is that even for small levels, I'm noticing a drop in frame rate. The provided example level will make pygame drop from 100 fps to 80 fps. If the map is 40 x 40 the frame rate will be around 17.

This is concerning, for two reasons. The program is not doing anything else than drawing images right now, how bad will the frame rate be when game logic is also being calculated every frame? Second, the aim is to ultimately make a two-player strategy game, in which the levels would be significantly larger than the example, and in that case 20 frames per second is way below acceptable parameters.

Every sprite in the game is a 48x48 pixel png image with some portion of transparency. Everything except rendering the sprites is done once when the game starts. This is the only code being run on every frame:

    def draw(self):
    self.screen.fill((0,0,0))

    for e in self.map_layout.fixed_list:
        self.screen.blit(e.picture, e.rect)

I'm guessing pygame's method for rendering images does not scale very well. Windows task manager shows my CPU utilisation at 2% with a map of size 40x40.

My question is: What can I do to improve frame rate? I don't mind switching from (or complementing) pygame to something else, so long as the transition is not very difficult for a novice programmer like myself.

sentences:
Creating a voxel world with 3D arrays using threads I am making a voxel game (a bit like Minecraft) in C++(11), and I've come across an issue with creating a world efficiently.

In my program, I have a World class, which holds a 3D array of Region class pointers. When I initialize the world, I give it a width, height, and depth so it knows how large of a world to create. Each Region is split up into a 32x32x32 area of blocks, so as you may guess, it takes a while to initialize the world once the world gets to be above 8x4x8 Regions. In order to alleviate this issue, I thought that using threads to generate different levels of the world concurrently would make it go faster.

Having not used threads much before this, and being still relatively new to C++, I'm not entirely sure how to go about implementing one thread per level (level being a xz plane with a height of 1), when there is a variable number of levels.

I tried this:

for(int i = 0; i < height; i++)
{
    std::thread th(std::bind(&World::load, this, width, height, depth));
    th.join();
}

Where load() just loads all Regions at height "height". But that executes the threads one at a time (which makes sense, looking back), and that of course takes as long as generating all Regions in one loop.

I then tried:

std::thread t1(std::bind(&World::load, this, w, h1, h2 - 1, d));
std::thread t2(std::bind(&World::load, this, w, h2, h3 - 1, d));
std::thread t3(std::bind(&World::load, this, w, h3, h4 - 1, d));
std::thread t4(std::bind(&World::load, this, w, h4, h - 1, d));

t1.join();
t2.join();
t3.join();
t4.join();

This works in that the world loads about 3-3.5 times faster, but this forces the height to be a multiple of 4, and it also gives the same exact VAO object to every single Region, which need individual VAOs in order to render properly. The VAO of each Region is set in the constructor, so I'm assuming that somehow the VAO number is not thread safe or something (again, unfamiliar with threads).

So basically, my question is two one-part:

How to I implement a variable number of threads that all execute at the same time, and force the main thread to wait for them using join() without stopping the other threads?
How do I make the VAO objects thread safe, so when a bunch of Regions are being created at the same time across multiple threads, they don't all get the exact same VAO? Turns out it has to do with GL contexts not working across multiple threads. I moved the VAO/VBO creation back to the main thread. Fixed!

Here is the code for block.h/.cpp, region.h/.cpp, and CVBObject.h/.cpp which controls VBOs and VAOs, in case you need it.

If you need to see anything else just ask.

EDIT: Also, I'd prefer not to have answers that are like "you should have used boost". I'm trying to do this without boost to get used to threads before moving onto other libraries.

sentences:
Interaction using Kinect in XNA So i have written a program to play a sound file when ever my RightHand.Joint touches the 3D model . . It goes like this . . even though the code works somehow but not very accurate  . . for example it will play the sound when my hand is slightly under my 3D object not exactly on my 3D object . How do i make it more accurate?  here is the code . . (HandX & HandY is the values coming from the Skeleton data RightHand.Joint.X etc) and also this calculation doesnt work with Animated Sprites..which i need to do

foreach (_3DModel s in Solar)
{
    float x = (float)Math.Floor(((handX * 0.5f) + 0.5f) * (resolution.X));
    float y = (float)Math.Floor(((handY * -0.5f) + 0.5f) * (resolution.Y));
    float z = (float)Math.Floor((handZ) / 4 * 20000);

    if (Math.Sqrt(Math.Pow(x - s.modelPosition.X, 2) + Math.Pow(y - s.modelPosition.Y, 2)) < 15)
    {
        //Exit();
        PlaySound("hyperspace_activate");

        Console.WriteLine("1" + "handx:" + x + "," + " " + "modelPos.X:" + s.modelPosition.X + "," + " " + "handY:" + y + "modelPos.Y:" + s.modelPosition.Y);
    }

    else
    {
        Console.WriteLine("2" + "handx:" + x + "," + " " + "modelPos.X:" + s.modelPosition.X + "," + " " + "handY:" + y + "modelPos.Y:" + s.modelPosition.Y);
    }
}

sentences:
Game Maker (and others): what data type is colour and how can I compare them? In Game Maker, and I imagine other engines, one can "make colour" by defining either the red-green-blue values of the colour or its hue-value-saturation.

I want to create a program that can compare how similar two given colours are, but without built-in functions that detects the "components" (red-value, saturation etc.) of colours, this is kind of hard.

So, I am asking what data type (compound? integer? real number?) is a colour represented in Game Maker and how I can compare them.

sentences:
How can I model the physics of an air blower? I want to model simple lottery machine, it has got a bottom blower.

Do you know how can I get force applied to object above blower by air from blower, or equations to model this behavior?

Red arrow is blower "wind"

sentences:
SDL 1.2 reports wrong screen size I have a multi-monitor setup with two displays, both 1920x1200. In games, I can only select resolutions > 1920x1200 (like 2560x1200) which makes games unusable.

Full screen doesn't work either because it switches one display to 800x600 which means I can't reach the close button... I have to kill the game and then, I have to restore my desktop because all windows are moved/resized.

How can I force SDL to use any resolution that I want?

sentences:
Character and Weapon animation interaction If I have two models, for example: some character, and a bow, how do I work with them together in 3DS Max to animate them both (for example, when the character shoots an arrow with his bow, the characters pulls his hand out, the bow is scratching etc).

Also, any guidelines on how to port custom weapon models to UDK?

sentences:
How would I process accelerometer data to use it for camera rotation? I'm using Three.js to make a web-based 3D first-person game.  I would like the player to be able to control the camera rotation with their device's accelerometer.

The sensor data is received via the DeviceMotionEvent event listener. Here is an example of what it returns:

How should I proceed with this?

sentences:
Level and Player objects - which should contain which? I've been working on a several simple games, and I've always come to a decision point where I have to choose whether to have the Level object as an attribute of the Player class or the Player as an attribute of the Level class.

I can see arguments for both:

The Level should contain the player because it also contains every other entity. In fact it just makes sense this way: "John is in the room." It makes it a bit more difficult to move the player to a new level, however, because then each level has to pass its player object to an upcoming level.

On the other hand, it makes programming sense to me to leave the player as the top-level object that is persistent between levels, and the environment changes because the player decides to change his level and location. It becomes very easy to change levels, because all I have to do is replace the level variable on the player.

What's the most common practice here? Or better yet, is there a "right" way to architecture this relationship?

sentences:
2D Circular View/Background Wrapping SDL for Game In the games such as Defender (1980 arcade) and Defcon, the player can move/scroll in one direction infinitely because the level/terrain simply wraps over and over again(like if it was wrapped around the side of a cylinder).

I am more interested in the wrapping mechanics of Defcon which wrap(on the x-axis) and zoom the entire level. Here is a link to view the game.

To make images(such as a background) wrap is it a per-pixel approach? Is there a function? What methods are there to achieve the circular wrapping of a level?

sentences:
How to create old-school format music with small file sizes My friend and I have been working on a project recently, and because we are hard coding everything (other than the graphics library, Pygame), the total size for our project is super small. I feel like this is awesome and because the game has a retro feel to it I thought it was fitting. The whole project including art is about half a megabyte, which is pretty good when factoring the art and level design and such.

However one thing that is not accounted for in this size is the music. The music itself (around 6 or so tracks) plus the sound effects (4 or 5 currently) make up about 99% of the file size (not an exaggeration, 60mb / 60.5mb is a little over 99%), which I find a little ridiculous. In the old days when games had ridiculously lower memory and file sizes, how did they pull off music? Our game uses Chiptune music to give it a more retro feel, so using that style of music for small file sizes is perfectly acceptable.

Also I because I'm using Python and PyGame I don't know if this will be possible, but I still would like to know the process used anyways so maybe I can play around with it.

sentences:
Zooming to point of interest I have the following variables:

Point of interest which is the position(x,y) in pixels of the place
to focus.
Screen width,height which are the dimensions of the window.
Zoom level which sets the zoom level of the camera.

And this is the code I have so far.

void Zoom(int pointOfInterestX,int pointOfInterstY,int screenWidth,
   int screenHeight,int zoomLevel)
{
glScalef(1,1,1);
glTranslatef( (pointOfInterestX/2) - (screenWidth/2), (pointOfInterestY/2) - (screenHeight/2),0);

glScalef(zoomLevel,zoomLevel,1);
}

And I want to  do zoom in/out but keep the point of interest in the middle of the screen. but so far all of my attempts have failed and I would like to ask for some help.

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:
Casting a directional line of which an object is coming from I want to create a directional line ( curve / linear ) depending where the direction is coming from.

In some games, similar to Angry Birds, a dotted guideline is shown to provide where the gameObject is going.

I want to create something like that. But not from the starting point.
When i mean starting point, it simply means a dotted guideline from where the gameObject is released.

What i want is a dotted guideline from the end point. However, this end point is fixed.
How i imagine this is, i have a gameObject. When this gameObject is near to land around this end point, it will show the dotted guideline.

Am i asking too much ? Sorry if i am, a structural guideline of how to write this code would be great.

Thanks.

Edit

So this how i want it visual.
In Diagram ( A ) it shows a dotted line through the whole course of the path.

However what i want is shown in Diagram ( B ). It is split into two parts, a orange and red path. I only want the red path. But for a clear understand i included the red path. I only want the object to land or around that spot of Diagram ( B ).

What i dont want is from Diagram ( C ). Because it is not landing in the spot of Diagram ( B ). I dont want it to show anything. I only want the red dotted line from Diagram to appear when it is near or going to land in that spot of Diagram ( B ).

Thanks

sentences: Help with modifying a geometry grass shader to allow removing areas? So I have this geometry grass shader from a roystan tutorial I followed but it applies the grass effect to the entire mesh at once. I need to find a way to only apply grass to set areas much like how the unity painting vegetation tools work. I had an idea of using a "guiding" texture that the shader would follow which would only apply grass onto set areas on the texture e.g areas that are green but I'm not sure how to implement it. I would appreciate any advice!

sentences:
Bloom only colors with at least one value equal to 1, I want to bloom/blur any color that has a 1 in it,

like (1,0,0) and (1,0,1) etc.

The script bellow blooms any color over a threshold,
but what I want blooms only specific colors.

'Selective bloom'

uniform sampler2D bgl_RenderedTexture;
const float BRIGHT_PASS_THRESHOLD = 0.55;
const float BRIGHT_PASS_OFFSET = 0.08;

#define blurclamp 0.002
#define bias 10.8
#define KERNEL_SIZE 6.0

vec2 texcoord = vec2(gl_TexCoord[0]).st;

vec4 bright(vec2 coo)
{
  vec4 color = texture2D(bgl_RenderedTexture, coo);
  color = max(color - BRIGHT_PASS_THRESHOLD, 0.0);
  return color / (color + BRIGHT_PASS_OFFSET);
}

void main(void)
{
  vec2 blur = vec2(clamp( bias, -blurclamp, blurclamp ));

  vec4 col = vec4( 0, 0, 0, 0 );
  for ( float x = -KERNEL_SIZE + 1.0; x < KERNEL_SIZE; x += 1.0 )
  {
    for ( float y = -KERNEL_SIZE + 1.0; y < KERNEL_SIZE; y += 1.0 )
    {
      col += bright( texcoord + vec2( blur.x * x, blur.y * y ) );
    }
  }
  col /= ((KERNEL_SIZE+KERNEL_SIZE)-1.0)*((KERNEL_SIZE+KERNEL_SIZE)-1.0);
  gl_FragColor = col + texture2D(bgl_RenderedTexture, texcoord);
}

is the script I was trying to edit, but I don't know GLSL (I know python)

sentences:
How do I find an object by type and name, in Unity, using C#? I know that in Unity you can find an object of a certain type, using myObject = Object.FindObjectsOfType<MyType>(), but that only returns the first object in the scene it finds of that type.

How do I make it find the object of a certain type and with a certain name?

sentences:
canvas ball physics animation I want to animate ball in html canvas like this.

ctx.beginPath();
ctx.arc(75, 75, 10, 0, Math.PI*2, true);
ctx.closePath();
ctx.fill();

start position is left top corner and ball's maximum height position is always the same

also I don't want to use javascript physics libraries

thanks

sentences: Act on Right Mouse Button click on Button I want to be able to listen for a right mouse click onto a TextButton. Is this possible without removing the default ClickListener of the TextButton? If yes, how? Or should I use a different listener?

sentences:
How do I move a game object instead of the entire scene in Unity? I'm trying to move GameObject between scenes but when I do it moves my whole scene instead of just that one game object. How do I move just the game object and not the whole scene?
I have tried SceneManager.MoveGameObjectToScene(UIRootObject, sceneToLoad); and DontDestroy but it keeps moving my whole scene new scene.

sentences:
Why when a certain boolean variable is true, the Unity editor crashes? In my game I've got a timer script, which counts down unless the game is paused, but whenever the variable for pausing is true, something in the timer script makes the editor itself crash, and I have to pull out the task manager to close unity because it freezes up completely.

Timer.cs

using UnityEngine;
using System.Collections;

public class Timer : MonoBehaviour {

  public LevelManager levelManager;

  // Use this for initialization
  void Start () {
    levelManager = FindObjectOfType<LevelManager>();
    StartCoroutine ("timerUpdate");
  }

  // Update is called once per frame
  void Update () {
  }

  IEnumerator timerUpdate (){
    while (levelManager.levelTimeSeconds>0) {
      if (levelManager.isPause== false){
        yield return new WaitForSeconds(1);
        levelManager.levelTimeSeconds -= 1;
      }
    }
    levelManager.isOver = true;
  }
}

Anyone have any idea what's causing the editor to crash once isPause is true?

sentences:
Unity - how to switch between ratios in a Scene View? I'm complately new to Unity, but I know what's going on, I've made some games with LibGDX earlier.

In GDX, to handle all resolutions perfectly I always create 5 different sets of backgrounds (cause they have to be perfectly sized) and I place UI widgets on percentage for each ratio independantly (hardcoded values). I was just checking what's the ratio on runtime.

As we know, there are only 5 possible aspect ratios for mobile devices (I target mobile only).

Now, when I started using Unity, the first thing I looked up was how devs handle ratios. I found some scripts in the web, which add pillarboxes which in my case is unacceptable.

So I thought - ok, let's do it my way, and make it for all aspect ratios.

And my question is:

Is there any option in Unity, which will allow me to 'switch' in the Unity Editor between ratios and the 'Scene View' will understand this and resize?

What I want to do is to create a 16:9 with the editor, then switch to 5:3, adjust elements for it, and remaining ratios too.

To be clear, I don't mean the 'preview', when you check the desired device and it shows how the game will look like.

Any help and tips are appreciated! :)

sentences:
How can I track a falling ball with a camera? I have been trying to get my camera to follow a falling ball but with no success.

here is the code

        float cameraY = (FrustumHeight / 2)+((ball.getPosition().y) /2) - (FrustumHeight /2);
        if (cameraY <  FrustumHeight/2 )
            cameraY =  FrustumHeight/2;
        camera.position.set(0f,cameraY, 0f);
        Gdx.app.log("test",camera.position.toString());
        camera.update();
        camera.apply(Gdx.gl10);
        batch.setProjectionMatrix(camera.combined);

        batch.begin();
        batch.draw(backgroundRegion, camera.position.x - FrustumWidth / 2,
 -cameraY - (FrustumHeight/2) , 320, 480);
        batch.draw(ballTexture, (camera.position.x - FrustumWidth / 2) + ball.getPosition().x,-cameraY + ball.getPosition().y - (FrustumHeight/2)  ,
                32, 32);

I'm sure I am doing this completely wrong - what is the correct way to do this?

sentences:
LibGDX - How do you load huge spritesheets? As we know, there is a GL_MAX_TEXTURE_SIZE on each mobile phone which makes things really hard. I write an app for all mobile devices and I need to load some huge spritesheets combined with 64 frames when each of them has 512x1024 dimensions.

As I tested and read, I should load spritesheets <= 1024 so it will work on all mobile devices including IPhone3 and some old Androids.

If I have a spritesheet 512x1024 with 64 frames, it's dimensions are really, really large - for ex. if the spritesheet has 64 columns, it's with is ~61000 px.

Of course, I can cut it, but it gives me 64 images and I have no idea if this if efiicient of not.

How do you handle things like this? Scaling the graphics down is not an option - it lowers the quality and my game IS QUALITY.

If someone has any experience I would be grateful!

sentences:
Planck.js (rewritten of Box2D.js) - 8 direction box movement I have a box in Planck.js. I want to move this box with some keys. How can I do that? My code:

planck.testbed("boxworld", function(testbed) {
  var pl = planck,
    Vec2 = pl.Vec2;
  var world = new pl.World(Vec2(0, 0));

  //Box

  var box = world
    .createDynamicBody(Vec2(0.0, 10.0))
    .createFixture(pl.Box(0.5, 0.5), 20.0);
  box.render = { fill: "#FA8072", stroke: "black" };

  return world;
});

sentences:
Renaming Texture 2D nodes in Unity's shader graph? I am new here so thanks for having me. I have a query regarding renaming the Texture 2D nodes I have created in my first Shader graph.
I have setup a shader graph with a normal map, base colour, smoothness and ao. These are showing up as exposed parameters which is just what I wanted so I can drag and drop new texture maps for the other materials easily (please see screen shot attached).
I would love to be able to name each of those Texture 2D maps accordingly so it is clear where each map from the assets folder needs to be dragged.
E.g The Texture node that contains the normal map is simply called 'Normal' instead of 'Texture 2D', the base colour map named 'base colour' etc.
Atm I have 4 exposed parameters all called Texture 2D.
Not the most serious of issues I would agree, but I feel like I must be missing something. No sign of a 'rename' option for those nodes.
Any help very much appreciated.
Cheers
Nick

sentences:
How to create opacity mask from colored bitmap? For the image (bitmap) below,

if I do:

Create a spite with the image in unreal engine.

Create a opacity mask on the spite.

Use this image, choose a specific color, such as blue, make its corresponding region the only opacity region on the mask.

My question is about the implementation of part 2 and part 3 in Unreal engine, they are quite confusing.

If anyone know how to implement it in unity, it would also be helpful.

Thanks a lot.

sentences:
What information would I need to calculate proper placement of my Unity 3D orthographic HUD elements? I have a Unity project and I have managed to create a 3D HUD by creating a separate (orthographic) camera for rendering elements on the UI layer.  I already have some objects appearing in the HUD and rendering correctly.

What I want to do now is calculate the proper position and scale of these elements to make sure they are in the upper left corner and only take up 60% of the vertical space.

I am optimistic the necessary information is available to C# script components, but I have no idea which formulas and which members or methods (probably on the Camera object) can tell me what the X/Y bounds of the orthographic view are (for whatever the current aspect ratio is).

sentences:
I wanted to create a simple mobile online game for me and my mates. How should I handle the networking? I've made a few simple games and one multiplayer game where you connect through LAN but for this one I wanted to learn something new. I have the game concept working on my computer, it's just waiting for the networking.

I was looking to create networking similar to mobile online quiz games, where:
- you use your Store account as the game account
- you are not restricted to LAN or same WiFi network, but rather everything goes through an external server
- you have a Friends list,Recently Played list where you can see who's online right now
- you can invite a random player to a match or search for particular player to play with them/add them to your Friends list

Something like that. I don't know if you can host servers for a match on mobile devices, or how feasible it would be, given mobile internet isn't free, but it would make for a nice addition if the external server was only for handling information about who's online.

I'm working in Unity btw. so any recommendation for package from Asset Store is welcomed

Thanks in advance! :)

sentences:
Unity Change Sceneview to camera view On selecting camera, I get the camera preview.

In Unity, while editing the scene, I wish to switch in such a perspective view that is exactly visible by the main camera.

Is there a short cut to change the view?

sentences:
How can I deal with actor translations and other "noise" in third-party motion capture data? I'm working on a game, and I've run into a problem with motion capture data. My team is using 3DS Max 2011 and trying to put free motion capture files on our models.

The problem we're having is it has become extremely hard to find motion capture data that stays in place. We've found some great motion captures of things like walking and jumping but the actors themselves move within the data, so when we attach these animations to our models and bring them into XNA, the models walk forward even when they should technically be standing still (and then there's also the problem of them resetting at the end of the animation).

How can we clean up, at runtime or asset-processing time, the animation in these motion capture files?

sentences:
Alternative to canvases (unity)? I have a Unity project which requires a bunch of Canvases and, surprise surprise, they're creating a lot of lag. I've already turned off the graphics raycaster for every single one, but they still drop so many frames.

Are there any good alternatives to draw text in the worldspace that are a lot more efficient? (I'm targeting mobile, so this is important).

sentences:
Lights shining through walls I'm currently having a problem with lights in Unity. They shine through walls for some reason.

Point, directional, etc. If a light is next to a wall on one side, you can see it on the floor on the other side. I believe this has something to do with culling masks or light culling.

I was wondering how I could go about culling the lights so they no longer shine through walls. Any help is greatly appreciated.

I'm on Unity 4.x Pro, so I have all the features for that.

Here's a picture of a light on one side of the wall:

And here's it shining through to the other side, which it's not supposed to do:

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:
Unity Player Movement Problem I want to make a little game in Unity, where the player (a ball) jumps up and down and you have to maneuver it through (flappy bird like) obstacles.

My problem is, after I added a simple movement script:

float speed 10f;
Vector3 move = new Vector3(Input.GetAxis ("Horizontal"), Input.GetAxis ("Vertical"), 0);
transform.position = move * speed * time.deltatime;

The ball is stuck and can only be moved a little,before returning to its start position.

My question is how i can fix that? I didnt find any solution

sentences:
How can I make space recognizable and easy to orient in? I'm thinking about making a game set in space, that would feature very large, procedurally-generated game world (many stars, planets and what have you). However, I foresee a big problem: cosmic space is mostly featureless. It's almost the same everywhere - the same black emptiness with stars. This is obviously bad. A large game world must be different in different places, so that the player can understand where she is, and how to get where she needs. What can I do to make different, recognizable places in space?

The game I'm envisioning is 2D (a bit like Space Rangers), with space pictures used only in background. However, I'm interested in any techniques, 2D or 3D.

Clarification
What I need here is not just ability to orient in game space, but rather having different places so that the game feels more interesting. Here's an example: imagine any space-trading game (like Elite or X or whatever). You visit different star systems, but they're all generally alike: a dock to repair/refuel, a shop to trade, a bar to take missions/contracts... Some Tau Ceti III differs from KZ'ish VI mostly by name.

I believe that every place, or at least most places that player visits should be different from each other, and immediately recognizable, so that player has a sense of wonder and discovery as she explores the universe.  Of course, making every star system a full-fledged 3D level with its own visual style would work, but that's prohibitively expensive even for a big-budget game. Are there any other ways to achieve this wonder and discovery?

sentences:
How to Store AI Knowledge about the Game-World for AI Decision Making I have a game-world with a fair amount of AI that have some Senses, like vision, hearing, touch, smell, etc.

But I'm not sure how to put that information in a single place for the individual AI to then iterate over it and make a decision.

For example, each sense (emitter and receiver) currently returns a structure called a Stimulus with information like position, direction, stimulus type (sight, sound, smell, etc), npc type (human, animal, monster, etc), and so on.

And currently, the monster AI just have a hard-coded hierarchy of preference - touch (e.g., damage events) > sight > sound > smell, so if you fire a gun it'll try to follow that noise but if he then sees you, he'll switch to tracking you visually and forget about the noise.

However, this isn't very robust. It doesn't deal with repeated damage events or one player kiting or stale stimuli vs new stimuli very well. Ideally I'd want to use some sort of utility evaluation so that I can get more complex and dynamic behaviour out and I can fix edge cases where it feels like the AI isn't interacting right (e.g., ignoring stimuli that it shouldn't be).

I'm not sure how to approach that implementation. Should I just have an array of every stimulus the AI encounters and loop over that every tick? But then how do I prune that list since it'd get very large very quickly and might contain really old stimuli (currently the AI only has one "target stimuli" and new stimuli go through that hierarchy of preference before being either discarded or replacing the target stimuli).

(As a side note, this GDC Talk about Creating the Living, Breathing World of Hitman has provided some great information about how they deal with Knowledge, but I wasn't able to discern how they store it and iterate through multiple Knowledge fields of a single AI and so on).

(I'd also love any advice on the Knowledge/Stimulus data structure itself; to be modular enough to hold different types of information, instead of having a bunch of unused fields; say how a sound might need only type and direction, but a visual stimulus might only need type and position and so on)

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:
Why does component.GetComponent() return "null", when a rigid body is NOT attached? In the following code, when T is Rigidbody, calling componentToLookIn.GetComponent<T>() returns "null" when there is no rigidbody attached, instead of simply null:

public static class ComponentExtensions
{
    public static bool TryFindComponent<T>(this Component componentToLookIn, out T componentToLookFor)
    {
        componentToLookFor = componentToLookIn.GetComponent<T>();
        return componentToLookFor != null;
    }
}

Here is the debug window:

As a result, componentToLookFor != null ends up being true, which is obviously not what I want.

When I invoke componentToLookIn.GetComponent<T>() where T is NOT Rigidbody, null is returned as expected when there is no component of type T found.

What is so special about components of the Rigidbody type that GetComponent<Rigidbody>() behaves differently?

EDIT:

For contrast, here is the debug window when GetComponent<BoxCollider>() is invoked on a game object that does not have any component of the type BoxCollider:

As you can see, the value of childComponent is simply null, not "null". componentToLookFor != null therefore returns false.

sentences:
Screenshot always returning as a white image on iOS using robovm and libgdx I am trying to take a screenshot for sharing on social media.  This code works on my Desktop project, but when I use it on iOS it always shows up as a white image, I am using the standard libgdx code for the screenshot factory, any suggestions?

public class ScreenShotFactory
{
public static void SaveScreenshot()
{
    try
    {
        Gdx.files.local("shot.png").delete();
        FileHandle fh;
        do
        {
            fh = new FileHandle(Gdx.files.getLocalStoragePath() + "shot.png");
        }
        while (fh.exists());

        Pixmap pixmap = getScreenshot(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);

        PixmapIO.writePNG(fh, pixmap);

        pixmap.dispose();
    }

    catch (Exception e)
    {
    }
}

private static Pixmap getScreenshot(int x, int y, int w, int h, boolean yDown)
{
    final Pixmap pixmap = ScreenUtils.getFrameBufferPixmap(x, y, w, h);

    if (yDown)
    {
        // Flip the pixmap upside downx
        ByteBuffer pixels = pixmap.getPixels();
        int numBytes = w * h * 4;
        byte[] lines = new byte[numBytes];
        int numBytesPerLine = w * 4;
        for (int i = 0; i < h; i++) {
            pixels.position((h - i - 1) * numBytesPerLine);
            pixels.get(lines, i * numBytesPerLine, numBytesPerLine);
        }
        pixels.clear();
        pixels.put(lines);
        pixels.clear();
    }
    Logger.Log("ScreenShot Taken!");
    return pixmap;
 }
}

sentences:
What to consider legally when cloning an old game? Possible Duplicate:
  How closely can a game resemble another game without legal problems

I'm going to make a game in the form of a 100% free Android phone app that will be basically a clone of an old arcade style NES game, but with a few modifications to make it better. Now the game I am inspired by was released in 1985, so I'm not exactly shitting bricks about being sued, but I just thought I'd ask on here first about what kind of legal considerations developers go through when copying others' games.

sentences:
How to detect collision between entities using Ashley? I am developing a game using Libgdx and Ashley, and I would like to know the best way to detect collisions between different entities. Currently I have been using a ContactListener that detects contacts between different types of entities but I think this could negatively affect the performance of the game, especially considering that in a mobile application.

I would like to clarify that the type of contact I am wanting to perform is between the player and coins or entities in which it is not necessary to have a body.

sentences:
Why does Unity ignore normals when calculating backfaces? Here's some code to generate a square mesh.

Vector3[] vertices = new Vector3[]
{
    new Vector3(x1, y1, z),
    new Vector3(x2, y1, z),
    new Vector3(x2, y2, z),
    new Vector3(x1, y2, z)
};

int[] triangles = new int[]
{
    vertexIndex, vertexIndex + 1, vertexIndex + 2,
    vertexIndex, vertexIndex + 2, vertexIndex + 3
};

Vector3[] normals = new Vector3[]
{
    this.normal, this.normal, this.normal, this.normal
};

The resulting mesh looks like this:

The normals have been set to (0, 0, 1), making the square face in the positive Z direction. I would like them to face in the negative Z direction, so the intuitive solution would be to set the normals to (0, 0, -1), but the result looks like this:

Despite the normals facing the opposite direction, the face's front is still in the positive Z direction. When viewed from the negative Z direction, the square is invisible due to backside culling.

Why do my normals not affect the directionality of the faces?

sentences:
Unity: Create a custom editor for Vector2 I'm starting to dig into Unity's editor customization. What I'm looking for is a way to create custom line (or a point at least) which I could move around in SceneView and set a Vector2 value that way.

I might create a child GameObject and then calculate the relative distance, but I'd like to know, if there is any way using the Editor instead of adding other useless GameObjects.

Thanks in advance.

sentences:
How do I test my Octree implementation? I decided to use an Octree subdivision in my game. After implementing it, I do some research (a few tests and comparisons) and came up with several questions about.

The main question:
How to test my Octree implementation?
Are there some points that I must note while coding an octree? Is it possible to decide how my code works (good or not enough good) without actual game? Or it would be better if I test the Octree in real situation? Is it right to compare my C++ Octree with Octree implementation for other engines (as example I found C# one for Unity)?

sentences:
Moving models with a matrix Currently I have a playerWorld matrix which holds the position of my player, just a simple sphere. When I press a key to move the model, it does some crazy thing and flies off the screen really fast, and not even in the direction I want it to go.

    if (kbs.IsKeyDown(Keys.W))
        {
            playerWorld += Matrix.CreateTranslation(playerWorld.Forward * elapsed);
        }

Why is this happening? elapsed  is a float variable:

    float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

Here is the draw code, maybe it's being drawn wrong?

    public void Render(ThirdPersonCam cam)
    {
        foreach (ModelMesh mesh in playerModel.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.View = cam.view;
                effect.Projection = cam.proj;
                effect.World = playerTransforms[mesh.ParentBone.Index] * playerWorld;
            }
            mesh.Draw();
        }
    }

sentences:
Drawing a line from a random coordinate through a given point When the mouse button is clicked, I want to draw a line from (0, random) to (640, y) which goes through the click position.

How would I calculate the y coordinate of the end of the line?

sentences:
How do I correctly project a point behind the camera? I am making a 3D game in which I put an exclamation marker above points of interest.

In order to find out where in the 2D screen should I put my marker, I am manually projecting the 3D point where the marker should be.

It looks like this:

Looks pretty good. When the marker is outside of the screen, I simply clip the coordinates so they fit into the screen. It looks like this:

So far the idea is going pretty well. However, when the points of interest are behind the camera, the resulting X,Y coordinates are inverted (as in positive/negative), and I get the marker to appear on the opposite corner of the screen, like this:

(The projected-then-clamped point is the tip of the marker. Don't mind the rotation of the marker)

It makes sense, since the coordinates behind the frustum are inverted in X and Y. So what I'm doing is to invert the coordinates when they are behind the camera. However, I still don't know what is exactly the condition when the coordinates should be inverted.

This is currently what my projection code looks like (in C# with SharpDX):

    public override PointF ProjectPosition(float viewportWidth, float viewportHeight, float y)
    {
        var projectionMatrix = Matrix.PerspectiveFovRH(GetCalibratedFOV(Camera.FOV, viewportWidth, viewportHeight), viewportWidth / viewportHeight, Camera.Near, Camera.Far);
        var viewMatrix = Matrix.LookAtRH(new Vector3(Camera.PositionX, Camera.PositionY, Camera.PositionZ), new Vector3(Camera.LookAtX, Camera.LookAtY, Camera.LookAtZ), Vector3.UnitY);
        var worldMatrix = Matrix.RotationY(Rotation) * Matrix.Scaling(Scaling) * Matrix.Translation(PositionX, PositionY, PositionZ);
        var worldViewProjectionMatrix = worldMatrix * viewMatrix * projectionMatrix;

        Vector4 targetVector = new Vector4(0, y, 0, 1);
        Vector4 projectedVector = Vector4.Transform(targetVector, worldViewProjectionMatrix);

        float screenX = (((projectedVector.X / projectedVector.W) + 1.0f) / 2.0f) * viewportWidth;
        float screenY = ((1.0f - (projectedVector.Y / projectedVector.W)) / 2.0f) * viewportHeight;
        float screenZ = projectedVector.Z / projectedVector.W;

        // Invert X and Y when behind the camera
        if (projectedVector.Z < 0 ||
            projectedVector.W < 0)
        {
            screenX = -screenX;
            screenY = -screenY;
        }

        return new PointF(screenX, screenY);
    }

As you can see, my current idea is to invert the coordinates when either the Z or W coordinates are negative. It works -most- of the time, but there are still some very specific camera locations where it doesn't work. In particular this point shows one coordinate working and the other one not (the correct location should be the bottom right):

I have tried inverting when:

Z is negative (this is what makes most sense to me)
W is negative (I don't understand the meaning of a negative W value)
Either Z or W is negative (what's currently working most of the time)
Z and W are of different sign, a.k.a.: Z / W < 0 (makes sense to me. doesn't work though)

But have still not found a consistent way with which all my points are correctly projected.

Any ideas?

sentences:
How to change the player character size in monogame? So I made a new project,
Loaded up the player sprite(16x16)
but the player is too small(as compared to the level)
How should I fix this?
Here the code which loads the sprites and the levels(I am using monogame extended)
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonoGame.Extended;
using MonoGame.Extended.Tiled;
using MonoGame.Extended.Tiled.Renderers;
using MonoGame.Extended.ViewportAdapters;

namespace Dungeon
{
    public class Game1 : Game
    {
        private GraphicsDeviceManager _graphics;
        private SpriteBatch _spriteBatch;
        private TiledMap map;
        private TiledMapRenderer mapRenderer;
        private OrthographicCamera cam;
        private Texture2D player;
        private Vector2 playerPos;
        private InputManager manager;
        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            IsMouseVisible = true;
        }

        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            manager = new InputManager();
            playerPos = new Vector2(0,0);
            mapRenderer = new TiledMapRenderer(GraphicsDevice);
            var viewportAdapter = new BoxingViewportAdapter(Window,GraphicsDevice,800,400);
            cam = new OrthographicCamera(viewportAdapter);
            base.Initialize();
        }

        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            map = Content.Load<TiledMap>("Dungeon");
            mapRenderer.LoadMap(map);
            player = Content.Load<Texture2D>("player");
            // TODO: use this.Content to load your game content here
        }

        protected override void Update(GameTime gameTime)
        {

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();
            mapRenderer.Update(gameTime);
            // TODO: Add your update logic here

            float move = 2;

                playerPos =manager.moveVertical(playerPos,move);
            playerPos = manager.moveHorizontal(playerPos,move);

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            mapRenderer.Draw();
            var transformMatrix = cam.GetViewMatrix();

            _spriteBatch.Begin(transformMatrix:transformMatrix);
            _spriteBatch.Draw(player,playerPos,Color.White);
            _spriteBatch.End();
            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
    }
}

and the InputManager(You won't need it probably but just in case)
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using System;

public class InputManager
{
    Vector2 position;
    public InputManager()
    {
        position = new Vector2(0,0);
    }

    public Vector2 moveVertical(Vector2 pos,float move)
    {
        var keyboardState = Keyboard.GetState();
        if(keyboardState.IsKeyDown(Keys.D))
        {
            position.X += move;
        }
        if (keyboardState.IsKeyDown(Keys.A))
        {
            position.X -= move;
        }
        return position;
    }
    public Vector2 moveHorizontal(Vector2 pos, float move)
    {
        var keyboardState = Keyboard.GetState();
        if (keyboardState.IsKeyDown(Keys.S))
        {
            position.Y += move;
        }
        if (keyboardState.IsKeyDown(Keys.W))
        {
            position.Y -= move;
        }
        return position;
    }
}

sentences:
Reading mesh data back from OpenGL vs storing two copies I'm wondering if whether it's a good idea or not to keep a copy of vertex data in the main memory or just read it back via glGetBufferSubData (or glMapBuffer/glMapBufferRange).

The reason why I'd do this is so that I can keep only what's needed in the VRAM (and resource which may be needed very soon in the main memory) but not have to go back and load the resource from the disk again.

The concern that I have is that, with the draw optimized flags (GL_XXXX_DRAW) is that they aren't optimized for reading back (since there's a seperate flag for that). So if it's not very fast, it kinda defeats the whole purpose.

The other option is storing a second copy and just delete the VBO when I'm done (no reading it back), but I dislike this because it requires more memory usage than might be necessary.

Which option is preferred? Is there another way? Maybe something I'm missing?

sentences:
When does DirectX convert a vertex/pixel's depth from range Near-Far to 0-1? When I output a vertex from a vertex shader, it seems to have a world-space-ish mapping. Vertices about 1 unit away have about 1 unit as their Z value.

When we input into the pixel shader, the depth values are mapped from 0..1 as defined in the viewport state.

Where does this conversion occur? It's late and I'm forgetful, but I can't find a place where I told DirectX what my depth range even was (other than implicitly in the projection matrix). How does it know how to convert it?

sentences:
Unity 5 disabling a script I'm using Unity 5 and want to disable a script called Unit based on whether the instance is a client or a server. I have tried using:

GetComponent("Unit").enabled = false;

However I get hit with this error:

  Assets/Scripts/DisablingUnitScriptIfPlayer.cs(14,46): error CS1061: Type UnityEngine.Component' does not contain a definition for 'enabled' and no extension method 'enabled' of type 'UnityEngine.Component' could be found (are you missing a using directive or an assembly reference?)

Looking at some tutorials, this worked in previous versions, but I can't find how to make this work for Unity 5. What do I need to change?

sentences:
In Unity, how can I read the color from _LightColor0 in a shader? I have a scene with a point light and alpha textured (RGBA) triangle strips. I want to apply the point light color with a shader.

Shader "Custom/Test02" {
    Properties {
        _MainTex("Texture (RGBA)", 2D) = "gray" {}
    }
    SubShader {
        Tags { "Queue"="Transparent" "RenderType"="Transparent"  }

        Blend SrcAlpha OneMinusSrcAlpha

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

            uniform sampler2D   _MainTex;
            uniform float4      _LightColor0;

           struct vertexInput {
                float4 vertex   : POSITION;
                float4 texcoord : TEXCOORD0;
             };

            struct vertexOutput {
                float4 position : SV_POSITION;
                float4 color    : COLOR;
                float2 uv       : TEXCOORD0;
            };

            vertexOutput vert(vertexInput input) {
                vertexOutput result;

                result.position = mul(UNITY_MATRIX_MVP, input.vertex);
                result.uv       = input.texcoord;
                result.color    = float4(_LightColor0.rgb, 1.0f);
                // result.color    = float4(1.0, 1.0, 1.0, 1.0);
                return result;
            }

            float4 frag (vertexOutput input) : COLOR {
                float4 color = tex2D(_MainTex, input.uv);
                return color * input.color;
            }
            ENDCG
        }
    }
}

The color in _LightColor0 is always black. How do I get the proper point light color? If the color is set to float4(1.0, 1.0, 1.0, 1.0); everything appears but without color from the point lights.

sentences:
Libgdx drawing a circle with large radius causes exception When drawing a circle using the ShapeRenderer and using a really big radius (in millions, planet/sun size, given in metres) libgdx throws an exception

Exception in thread "LWJGL Application" java.lang.ArrayIndexOutOfBoundsException: 20003
    at com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer20.color(ImmediateModeRenderer20.java:116)
    at com.badlogic.gdx.graphics.glutils.ShapeRenderer.circle(ShapeRenderer.java:880)
    at com.badlogic.gdx.graphics.glutils.ShapeRenderer.circle(ShapeRenderer.java:844)
    at com.kacpr.solar.system.Planet.draw(Planet.java:74)
    at com.kacpr.solar.system.SolarSystem.render(SolarSystem.java:66)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:223)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:124)

This didn't happen when I used smaller values.
The question I have is whether I'm doing something wrong using such high numbers for a radius and should scale this down before drawing (I use this radius for some other calculations) or is this a bug?

sentences: What are some good resources on creating and reading 2D game levels in Java? Could some resources be listed in relation to the creation and management of simplistic, efficient 2D game levels, that are available for use with Java?

sentences:
Unity Quality Reduction only reduces my player sprite quality I created a small map in tiled then imported it into Unity. A small sprite character is controlled by the player to roam about the map. I am experimenting with this for University and wanted to see the effect reducing the graphics quality had on the game and machine. So I created an executable and before playing I chose a lower quality setting. However, choosing a lower setting results in only the character becoming more pixelated, the map graphics is completely unaffected.

I assume this is to do with Tiled?

How could I reduce the quality of the map in Unity? Or does it have to be done in tiled?

**EDIT

The map was imported via Tiled2Unity.

sentences:
Unit selection circle I do not know whether it's called a circle, or whether it's called a halo or whatever.

But, I do know that I want to know what is the game development world term for this.

So, how do we call it?

sentences:
UI and line renderer layer order when using screen space - camera I'm using a canvas with screen space - camera because I needed a line renderer that could work for my UI.

However, I need that line to render behind Image elements on my canvas and I'm not seeing any way to accomplish that.

Every UI element on my canvas behaves like its z:90 and "order in layer": 0 but those aren't really configurable values for a UI object. My line renderer, if z:90, must have a layer order > 0, or a z value < 90. In both cases, it shows on top of my UI.

I essentially have a canvas with a background image, which must be behind everything else, a line renderer (used to connect "dots"), and circle-shaped Images which must be on top.

Here's my hierarchy:

Canvas
  |- Background (Panel, no image, color)
  |- GameBoard
       |- LineRenderer (Layer: default, order: 0)
       |- Circle Clone(1)
       |- Circle Clone(2)
       |- etc...

What's bizarre is that if I turned off (active=false) the Background object, and my LineRenderer is z:90, order: 0, it works fine. It appears behind my UI elements correctly. Yet if this object is active, my LineRenderer appears on top of of the elements, despite no z/order changes.

sentences: What is the purpose of having lives? I think in game design it is incredibly important to ask the question why about everything, especially something that has become so standard as lives. So I am asking, what is the purpose of a game having the concept of lives? Why have lives?

sentences:
How to load and display an image in OpenGL ES 3.0 using C++ I'm trying to make a simple app on Android Studio using the NDK, JNI to call C++ code that load and display an image. I have managed to create the surface and draw a simple Triangle already.

Now, I'm looking for a way to load and display an image in OpenGL ES 3.0 using C++. I have done the search around but all of them is either missing some important function or written in Java. It would be great if someone could guide me with a simple example, thanks in advanced :) .

sentences:
Bilinear filtering by sampling corners of a texel I'm trying to do bilinear filtering in texels to get the convoluted value of a 3x3 block. Implemented as below:

offsetx = 1/width
offsety = 1/height

Fragment shader:

"varying vec2 vTextureCoord;\n" +
"uniform samplerExternalOES sTexture;\n" +
" vec2 scale = vec2(offsetx,offsety);\n" +
" vec4 p00 = texture2D(sTexture, vTextureCoord + 0.5*scale*vec2(-1,-1));\n" +
" vec4 p02 = texture2D(sTexture, vTextureCoord + 0.5*scale*vec2(1,-1));\n" +
" vec4 p20 = texture2D(sTexture, vTextureCoord + 0.5*scale*vec2(-1,1));\n" +
" vec4 p22 = texture2D(sTexture, vTextureCoord + 0.5*scale*vec2(1,1));\n" +
" vec4 pconvolve = 0.25*(p00 + p02 + p20 + p22);\n" +

Vertex shader:

private final String mVertexShader =
            "uniform mat4 uMVPMatrix;\n" +
            "uniform mat4 uSTMatrix;\n" +
            "attribute vec4 aPosition;\n" +
            "attribute vec4 aTextureCoord;\n" +
            "varying vec2 vTextureCoord;\n" +
            "void main() {\n" +
            "  gl_Position = uMVPMatrix * aPosition;\n" +
            "  vTextureCoord = (uSTMatrix * aTextureCoord).xy;\n" +
            "}\n";

where Matrices are unity matrices and position and texture cordinates are :

private final float[] mTriangleVerticesData = {
            // X, Y, Z, U, V
            -1.0f, -1.0f, 0, 0.f, 0.f,
            1.0f, -1.0f, 0, 1.f, 0.f,
            -1.0f,  1.0f, 0, 0.f, 1.f,
            1.0f,  1.0f, 0, 1.f, 1.f,
    };

Texture filtering:

GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);

Issue:

I have an original implementation where I calculate a convoluted value of a 3x3 block using a Gaussian-Blur algorithm that uses GL_NEAREST as texture mapping.
For optimization, I thought of replacing the 3x3 Gaussian Blur with sampling on 4 corners of the texel (as that is also having same weightage). Here I used GL_LINEAR.

The expectation was that the results I get from these 2 approaches should not vary by a wide range. But I got a huge difference. Visually both looks almost the same.

I tried changing the first texture mapping to GL_LINEAR and compared. That also resulted in a difference. (A difference in R, G and B component values between 2 approaches up to 5 was acceptable.) I got about 45 in some cases.

Testing methodology:

For the same frame, I used glreadPixels and compared the RGB value for all pixels in both cases. Most of them were same, but some showed huge difference:

Gaussian        9BD6DA

Bilinear        8BC0C3

sentences: What compilers are used in game development? I was kinda wondering what compilers are used in game development, since the game development industry always tries to squeeze every inch of performance out their software, using, among other, (sometimes very aggresive) compiler optimizations and the big boys in compiler technology (llvm, gcc), that excel in such kind optimizations are out of the game in the *Windows operating System*.

sentences:
Have the character automatically slide around obstacle corners Like this:

The player is only holding right, however the character still moves up a bit to go around an obstacle.

My current collision system has access to:

The entity's previous position
The entity's current position
The entity's (axis-aligned) bounding box
All the obstacles and their (also axis-aligned) bounding boxes

Also it proccesses each axis separatelly.

How can I implement this?

sentences:
HLSL - Shore fading in a water shader I am modifying an old water shader for the game "MTA San Andreas" (the multiplayer modification). MTA uses HLSL and comes with some builtin predefined variables and functions. The water shader itself is already modified by me, but now I want to add shore fading to it. Objects slightly below water surface should be visible, but objects deeper in the water should be completely invisible and that effect should be configurable. I found a water shader that has shore fading included, but it was covered within very complex other things in a very large file. I managed to extract most of the necessary information (i think) but I get an error message in the game:
Invalid PS 3_0 input semantic "POSITION" in water.fx 139,23
I know that this line 138 has no errors and the only reason why the game throws this error is actually line 268... Debugging HLSL is a pain, horrible language. And there may be much more wrong stuff. This is the water shader:

https://pastebin.com/VDFxS7RX

I started my modifications in line 268, where objdepth seems to be "wrong" and causes the compile error:

float objdepth = input.position.z/input.position.w;
float nonlinearobjdepth = objdepth;
objdepth = 1.0/max(1.0-objdepth, 0.000000001);
float planardepth = tex2D(SamplerDepth, input.textureCoords.xy).r;
float depth = tex2D(SamplerDepth, input.textureCoords.xy).r;
if (nonlinearobjdepth>depth)
{
    depth = planardepth;
}

float scenedepth = depth;
      planardepth = 1.0/max(1.0-planardepth,0.000000001);
      depth = 1.0/max(1.0-depth,0.000000001);
float depthfact = (depth-objdepth)*WaterParameters1.z;
      depthfact = depthfact*WaterParameters1.x;
      depthfact = depthfact/(depthfact*0.50+1.0);
if (scenedepth>0.99999) depthfact = 1.0;
float backside = saturate(WaterParameters1.w*10.0);
      depthfact*= 1.0-backside;
float shorefade = (planardepth-objdepth);
      shorefade = shorefade*WaterParameters1.x;
      shorefade = saturate(13.40*shorefade*1000.0 - 0.05);
      depthfact*= shorefade;
finalColor.a *= shorefade;

return finalColor;

sentences:
Subsurface Scattering - Transmittance I have a question related to SSS and especially transmittance. I've looked at several papers about that topic, most of them from Jorge Jimenez, which are very interesting and, I admit, a bit hard for me.

Here is one of the papers : http://www.iryoku.com/translucency/

I have some difficulties to understand the way it works and the way it calculates the distance the light traveled through the object. I think that I understand the very big lines but I am also a bit confused as I am trying to integrate this into the Unity engine and I have some difficulties to match Unity engine available values such as the shadows maps, the shadows coords, etc... to make them fit the way they are used in the paper.

So here it is, I am a bit lost in the "in-between" and I hope that somebody might be able to help me.

Thanks a lot.

EDIT : added the shader code from referenced paper

float distance(float3 posW, float3 normalW, int i) {
  // Shrink the position to avoid artifacts on the silhouette:
  posW = posW - 0.005 * normalW;

  // Transform to light space:
  float4 posL = mul(float4(posW, 1.0), lights[i].viewproj);

  // Fetch depth from the shadow map:
  // (Depth from shadow maps is expected to be linear)
  float d1 = shwmaps[i].Sample(sampler, posL.xy / posL.w);
  float d2 = posL.z;

  // Calculate the difference:
  return abs(d1 - d2);
}

// This function can be precomputed for efficiency
float3 T(float s) {
  return float3(0.233, 0.455, 0.649) * exp(-s * s / 0.0064) +
         float3(0.1,   0.336, 0.344) * exp(-s * s / 0.0484) +
         float3(0.118, 0.198, 0.0)   * exp(-s * s / 0.187)  +
         float3(0.113, 0.007, 0.007) * exp(-s * s / 0.567)  +
         float3(0.358, 0.004, 0.0)   * exp(-s * s / 1.99)   +
         float3(0.078, 0.0,   0.0)   * exp(-s * s / 7.41);
}

// The following is done for each light 'i'.

// Calculate the distance traveled by the light inside of the object:
// ('strength' modulates the strength of the effect; 'normalW' is the vertex
//  normal)
float s = distance(posW, normalW, i) / strength;

// Estimate the irradiance on the back:
// ('lightW' is the regular light vector)
float irradiance = max(0.3 + dot(-normalW, lightW), 0.0);

// Calculate transmitted light:
// ('attenuation' and 'spot' are the usual spot light factors, as in regular
//  reflected light):
float3 transmittance = T(s) * lights[i].color *
                       attenuation * spot * albedo.rgb * irradiance;

// Add the contribution of this light:
color += transmittance + reflectance;

sentences:
Detecting if "Wall" To The Left or Right Of Player Unity3D I am working on a 3D Platformer in Unity3D and I need to prevent the player from going through walls. The movement for my player works like this:

(A bird-eye-view representation)The areas the player can move a divided into layers. He can slide into the 2nd, 1st , or 3rd layers. The player is not a rigid-body, and is controlled using a character controller. To move the player into these layers I simply increase his Z-Axis. Currently if my player is behind the wall he will slide directly into it. How can I determine if there is a wall to the left of the player in Unity 3D? If so, I simply wont allow the user to move to the layer until they have steered clear of the obstacle. Does anyone have any suggestions of what I should do?

sentences:
Missing texture after add new actors I want to add two types of characters multiple times but when I add a new actor to stage texture in "old" actors stops render.

I can add multiple KnightActor (without RatActor) or multiple RatActor (without KnightActor). When I try to add multiple KnightActor and RatActor on one stage only textures from newest actors are rendered (one RatActor and one KnightActor)

GameScreen.kt

override fun render(delta: Float) {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)

    actorManager.addNewActors(stage)

    viewPort.camera.update()

    stage.act(delta)
    stage.draw()

    world.step(delta, 8, 3)
    debugger.render(world, viewPort.camera.combined)
}

ActorManager.kt

fun markToAdd(actor: BaseActor<*>) {
    toAdd.add(actor)
}

fun addNewActors(stage: Stage) {
    toAdd.forEach { actor: BaseActor<*> ->
        stage.addActor(actor)
        actor.addToWorld(worldService.getWorld())
        Gdx.app.log("afterAdd", (++charactersOnStage).toString())
    }
    toAdd.clear()
}

KnightActor.kt

override fun draw(batch: Batch, parentAlpha: Float) {
    super.draw(batch, parentAlpha)

    if (isMoving) {
        frameStateTime += Gdx.graphics.deltaTime
    }

    // DRAW TEXTURE
    val frame = animationManager.getFrameAndChangeSpeed(AnimationType.KNIGHT_WALK_RIGHT, frameStateTime, getSpeed())
    val frameX: Float = position.x - (size.width / 2)
    val frameY: Float = position.y - (size.height / 2)

    batch.draw(frame, frameX, frameY, size.width, size.height)

    // END DRAW
}

RatActor.kt

override fun draw(batch: Batch, parentAlpha: Float) {
    super.draw(batch, parentAlpha)

    if (isMoving) {
        frameStateTime += Gdx.graphics.deltaTime
    }

    // DRAW TEXTURE
    val frame = animationManager.getFrameAndChangeSpeed(AnimationType.RAT_WALK_LEFT, frameStateTime, getSpeed())
    val frameX: Float = position.x - (size.width / 2)
    val frameY: Float = position.y - (size.height / 2)

    batch.draw(frame, frameX, frameY, size.width, size.height)

    // END DRAW
}

AnimationManager.kt

fun getAnimation(animationType: AnimationType): Animation<TextureRegion> {
    return AssetsManager.loadSprite(animationType.spriteFile, animationType.alias).getAnimationForSprite(animationType.alias, animationType.width, animationType.height)
}
fun getFrameAndChangeSpeed(animationType: AnimationType, stateTime: Float, speed: Float, looping: Boolean = true): TextureRegion {
    val animation = getAnimation(animationType)
    animation.frameDuration = 1 / speed
    return animation.getKeyFrame(stateTime, looping)
}

sentences: How can I use a bounding sphere for intersection? How can I use a bounding sphere for intersection, like on a statue? Would I use the radius to detect intersection?

sentences:
Voronoi regions of a (convex) polygon I'm looking to add circle-polygon collisions to my Separating Axis Theorem collision detection.

The metanet software tutorial (http://www.metanetsoftware.com/technique/tutorialA.html#section3) on SAT, which I discovered in the answer to a question I found when searching, talks about voronoi regions.

I'm having trouble finding material on how I would calculate these regions for an arbitrary convex polygon and also how I would determine if a point is in one + which.

The tutorial does contain source code but it's a .fla and I don't have Flash unfortunately.

sentences:
XNA Adding Craters (via GPU) with a "Burn" Effect I am currently working on a 2D "Worms" clone in XNA, and one of the features is "deformable" terrain (e.g. when a rocket hits the terrain, there is an explosion and a chunk of the terrain disappears).

How I am currently doing this is by using a texture that has a progressively higher Red value as it approaches the center. I cycle through every pixel of that "Deform" texture, and if the current pixel overlaps a terrain pixel and has a high enough red value, I modify the color array representing the terrain to transparent. If the current pixel does NOT have a high enough Red value, I blacken the terrain color (it gets blacker the closer the Red value is to the threshold). At the end of this operation I use SetData to update my terrain texture.

I realize this is not a good way to do it, not only because I have read about pipeline stalls and such, but also because it can become quite laggy if lots of craters are being added at the same time. I want to remake my Crater Generation on the GPU instead using Render Targets "ping-ponging" between being the target and the texture to modify. That isn't the problem, I know how to do that. the problem is I don't know how to keep my burn effect using this method.

Here's how the burn effect looks right now:

Does anybody have an idea how I would create a similar burn effect (darkening the edges around the formed crater)? I am completely unfamiliar with Shaders but if it requires it I would be really thankful if someone walked me through on how to do it. If there are any other ways that'd be great too.

sentences:
Simulating pressure in a grid based liquid simulation I have a 2D grid based water system in my XNA game, we have a method using cellular automata to simulate water falling and spreading.

Example of water flowing down a slope:

Each tile can contain a mass of 0 to 255 values of liquid, stored in a byte. I do not use floats, the old water system I had did, however it added complications and had a performance hit.

Each water tile updates itself with a simple set of rules:

If the tile below has space in it, move as much as possible from the current tile to the bottom one (Flow Down)
If the 2 sides aren't the same and aren't zero and both are passable, we get the sum of the 3 tiles (left + current + right) and divide it by 3 leaving the rest on the middle (current) tile
If the rule above gave a number of 2 as sum, we should divide the tiles into the two sides (1, 0, 1)
If rule 2 gave 1 as the sum, choose a random side to flow into
If rule 2 failed, we should check if one side is passable and the other isn't. If that is true, we split the current tile in half for the 2 tiles

How can I expand this logic to include pressure? Pressure will make liquids rise over "U-Bends" and fill in air pockets.

Example on how this currently fails:

The water should flow and equalize on each side of the U-Bend. Additionally, I have created methods to find out how far down a water block is, and therefore how much pressure it is experiencing. Now I need to be able to take these numbers and apply them to the other areas to equalize the pressure.

sentences: Does every Entity in an XNA game need it's own BasicEffect instance? From what I see, the position/matrix is stored in the BasicEffect instance, so it makes sense to me that every object has it's own position matrix, but I'm not 100% sure it's correct to let every Entity have it's own BasicEffect instance, so I'm asking here.

sentences:
Best depth sorting method for a Top Down 2D game using a 3D physics engine I've spent many days googling this and still have issues with my game engine I'd like to ask about, which I haven't seen addressed before.  I think the problem is that my game is an unusual combination of a completely 2D graphical approach using XNA's SpriteBatch, and a completely 3D engine (the amazing BEPU physics engine) with rotation mostly disabled.

In essence, my question is similar to this one (the part about "faux 3D"), but the difference is that in my game, the player as well as every other creature is represented by 3D objects, and they can all jump, pick up other objects, and throw them around.

What this means is that sorting by one value, such as a Z position (how far north/south a character is on the screen) won't work, because as soon as a smaller creature jumps on top of a larger creature, or a box, and walks backwards, the moment its z value is less than that other creature, it will appear to be behind the object it is actually standing on.

I actually originally solved this problem by splitting every object in the game into physics boxes which MUST have a Y height equal to their Z depth.  I then based the depth sorting value on the object's y position (how high it is off the ground) PLUS its z position (how far north or south it is on the screen).

The problem with this approach is that it requires all moving objects in the game to be split graphically into chunks which match up with a physical box which has its y dimension equal to its z dimension.  Which is stupid.

So, I got inspired last night to rewrite with a fresh approach.  My new method is a little more complex, but I think a little more sane: every object which needs to be sorted by depth in the game exposes the interface IDepthDrawable and is added to a list owned by the DepthDrawer object.  IDepthDrawable contains:

public interface IDepthDrawable
{
    Rectangle Bounds { get; } //possibly change this to a class if struct copying of the xna Rectangle type becomes an issue
    DepthDrawShape DepthShape { get; }
    void Draw(SpriteBatch spriteBatch);
}

The Bounds Rectangle of each IDepthDrawable object represents the 2D Axis-Aligned Bounding Box it will take up when drawn to the screen.  Anything that doesn't intersect the screen will be culled at this stage and the remaining on-screen IDepthDrawables will be Bounds tested for intersections with each other.  This is where I get a little less sure of what I'm doing.  Each group of collisions will be added to a list or other collection, and each list will sort itself based on its DepthShape property, which will have access to the object-to-be-drawn's physics information.  For starting out, lets assume everything in the game is an axis aligned 3D Box shape.  Boxes are pretty easy to sort.  Something like:

if (depthShape1.Back > depthShape2.Front) //if depthShape1 is in front of depthShape2.
    //depthShape1 goes on top.
else if (depthShape1.Bottom > depthShape2.Top) //if depthShape1 is above depthShape2.
    //depthShape1 goes on top.

//if neither of these are true, depthShape2 must be in front or above.

So, by sorting draw order by several different factors from the physics engine, I believe I can get a really correct draw order.  My question is, is this a good way of going about this, or is there some tried and true, tested way which is completely different and has somehow completely eluded me on the internets?

sentences:
Quickly Converting RenderTexture to Texture2D in Unity3D I have a screenshot preview at the end of the game's level.
When I am loading the screenshot, it makes the game freeze for a moment.
What may I do so there would be no freeze when I am loading that screenshot?
Here is myc ode:

private IEnumerator ShowScreeshotPreview()
        {
    screenshotTexture = new Texture2D(Screen.height, Screen.height, TextureFormat.RGB24, false);
            for (int i = 0; i < 9; i++)
            {
                yield return null;
            }
            RenderTexture.active = Singletons.Get<SpecialEffectsHelper>().MainCharacterScript.GetComponent<GeneratorScript>().screenshotTexture;
            screenshotTexture.ReadPixels(new Rect(0, 0, Screen.height, Screen.height), 0, 0);
    screenshotTexture.Apply();
            RenderTexture.active = null; //Added to avoid errors

            screenshotPrview.mainTexture = screenshotTexture;
    ScreenshotPreviewAnimator.SetBool("visible", true);
            screenshotLoaded = true;

            yield return null;
        }

sentences:
How to change from 60FPS to 30FPS while keeping things smooth? Here is my current game loop:

final int ticksPerSecond = 60;
final int skipTicks = (1000 / ticksPerSecond);
float dt = 1f/ticksPerSecond;

while(System.currentTimeMillis() > nextGameTick && loops < maxFrameskip){
        updateLogic();
        nextGameTick+=skipTicks;
        timeCorrection += (1000d/ticksPerSecond) % 1;
        nextGameTick+=timeCorrection;
        timeCorrection %=1;
        loops++;

On most devices I've tested my game on (this is an Android game BTW) it runs quite nice.

As you can see, I'm using a fixed time-step (defined as my ticks per second).

If I reduce my Ticks Per Second to 30, everything runs at the same speed but is nowhere near as smooth.  I keep hearing people say that 30fps should be OK for mobile games and everything should run great at 30 fps, but that's just not my experience.

Would be grateful if someone could give me some pointers on how to achieve this.

sentences:
What is the point of update independent rendering in a game loop? There are dozens of articles, books and discussions out there on game loops. However, I pretty often come across something like this:

while(running)
{
    processInput();
    while(isTimeForUpdate)
    {
        update();
    }
    render();
}

What basically is bothering me about this approach is the "update-independent" rendering e.g. render a frame when there is no change at all. So my question is why this approach is often taught?

sentences:
Instantiate prefabs at particular vectors using text file (Unity3D game) I need to read a text file containing two pieces of information on each line, and use that information to instantiate a prefab at the correct location in a Unity3D game (c# script). The locations are either North, South, East, or West (each a particular vector).

For example, the first line of the text file might read:
landmark1, North

In a script, I need to instantiate landmark1 and assign it to case North vector.

The below script is what I've got so far. Basically, I can read from the text file but I don't know how to assign that information to different cases. I'm guessing I need to use an array somehow but I'm not sure how to do that here.

Any help would be appreciated. Thanks!

using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
using System.Linq;
using System.IO;
using System;

public class Landmarks : MonoBehaviour {

    //spawnable prefab gameobjects
    public GameObject castle;

    // Use this for initialization
    void Start()
    {

        StreamReader reader = new StreamReader(@"C:/Users/.../landmarks.txt"); //insert full path here
        String textContents = reader.ReadToEnd();

        // string[] dataArray =

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

            //set case if first line = "castle, North" then instantiate object castle at vector 'north';

        }
    }
}

sentences: Detecting Screen Resolution in Android/AndEngine to display high or low quality images I am developing a game with 1024x600 resolution. I can't target smaller resolution devices at this resolution, so I intend to use two graphics for the game. How do I detect which graphics to use for which device?

sentences:
How do I find a component, deferring to the children or parent if there is none? I'm trying to create a function in C# in Unity that will take a GameObject and a Component, and return an attached Component from the base, child, or parent elements.

If the target GameObject does not contain the requested Component, I wish to look to any children. If there are no children, or the children do not contain the requested Component, I wish to look to the parent.

How do I find a component, deferring to the the children or parent if there is none?

sentences:
Add force to objects while inside area I'm currently trying to create an area that would somehow push objects to a specific direction. (and also apply angular drag if possible)

I'm currently new to Unity and Godot. I have already seen this in Unity tutorial and checking if this is also possible in Godot.

I have a RigidBody2D (with gravity) that falls down on an Area2D.

I'm currently stuck at this code..

func _on_Area2D_body_entered(body):
    body.apply_impulse(Vector2(),Vector2(0,-50))

..but it only applied it once after entering the are and not continuously applying force until the object exited the area. I tried using add_force but it gave the object a constant speed and direction and not falling back down.

sentences:
Check collision between instantiated objects? I am using a script to instantiate multiple objects having rigidbody with different velocities at different positions. I want to destroy two or more objects when they collide, but I'm not getting anything inside:

void OnCollisionEnter(Collision collision){}

The details of the object I'm instantiating. http://i.imgur.com/rLnOM.png

The script is attached to an empty GameObject and Instantiated GameObject is stored in a array of GameObjects:

 Block[0] = Instantiate(boxPiece) as GameObject;

where boxPiece is the Object I want to instantiate.
And I'm checking for collisions in this very same script.

sentences:
is there a way to alternate between two state machines? I'm programming an enemy on Unity that has two state machines, one controlling the "normal" behaviour of the enemy (that consists in three states: idle, patrol and chase) and another one controlling the battle behaviour of the enemy (that consists in three more states: attack, dodge and run away). I'm doing these state machines by using enums, like the following code
public enum StateMachines { NORMAL, BATTLE }
public enum NormalStates { IDLE, PATROL, CHASE }
public enum BattleStates { ATTACK, DODGE, RUNAWAY }

I want to loop between the Normal and Battle state machines but I have one problem that is they always get executed at the same time. Is there a way I can alternate between state machines through code in a single script (by conditions)? Thank you!

sentences:
Designing a trade / market system I'm working on an idea for a trading game. Players would be traders buying in place A and selling in place B, hopefully for a profit.

I want prices to be dynamic, based on demand and supply. So if place A produces less food than it consumes, prices for food would he high and getting higher the closer they get to running out, while in place B, which has much more production than supply, prices would be near the production cost (minimum price). But if someone buys up a lot of the supply in B, prices would rise, and if someone sells a lot in place A, prices would drop.

Obviously, there are many ways to game such a system if it's not well-designed. The most easy is to empty the market, wait for the price to adjust, then sell everything back.

How could I design this system? I mean the actual math and functions, not philosophical musings. I searched a lot and haven't found anything specific.

I found this question but it and its answers are a lot more specific to the specific formula the guy uses in his game. I'm looking for a more generic approach (I want different price elasticity for different goods, maybe non-linear price curves, etc.)

sentences:
Setting Krypton Light to Screen Pixels So a few days back, I started playing around with Krypton XNA for 2D lighting in my game.

I noticed in general, that spawning a light at (0,0) with Krypton causes the light to appear in, pretty much, the centre of the game screen. Is there any way to change this so a Krypton light's "starting point" at [0,0] would spawn at the top left of the screen, and thus follow the standard screen co-ordinates for position?

I ask because currently I'm busy working on my game where my spawn point is [512,512]. With hard code, the closest I've got to the light being "central" to this point is the vector position [12,-20], which makes no sense and is impossible to craft, mathematically, if I want the light to move with the camera (the position [480,512] maps roughly to [10,-20]).

So, is there any way to "normalise" the krypton lights to use standard screen co-ordinates?

If you guys can, play around with the demo from the site and please see if you can find anything out about it. Documentation on the engine is rather scarce, so it's difficult to find anything relevant to my "pixel-perfect" need. It might just also be something in the code with regards to the matrices that I'm not fully understanding.

Any help would be useful.

Thanks.

sentences:
How can velocity be normalized after a collision if a projectile needs to maintain its height? I want a thrown disc to travel along the same height, even after collisions. The problem is, there's an edge case that I'm not sure how to deal with.

The lowest-tech solution would probably be to quickly interpolate the rotation of the disc so that it's flat, and also interpolate its height so that it never collides with another object in a way that would impact its height, but that might be a bit heavy-handed. I worry that it would look really bad if you're holding the disc at an angle when releasing it for a throw, and it just suddenly "swooshes" flat mid-flight. Would that seem janky?

If I don't do that, and I simply retain the disc's rotation as it flies along its path, then it might collide with an object's edge in a way where the correct bounce angle would send it upwards or downwards, which I don't want. But if I simply hard-code the y velocity to 0, then in those instances, the lateral velocity becomes very low. Should I just check for a "minimum" speed, and increase it to that if it falls below that? Because the issue is that in the case where it bounces upward, there's a good chance that the correct bounce angle, if the y velocity is ignored, results in the disc continuing in the same direction rather than bouncing.

So I'm honestly leaning towards extending the collision boxes for these objects really far above and below where the disc could possibly be thrown, that way regardless of its orientation, it would always be the side of a cylinder colliding either with the side of a box or one of its vertical edges, and the velocity change should thus (hopefully) always look like it makes sense.

sentences:
NullReferenceException until tile is spawned I have a tile and tile has enemies spawn positions, and spawner script in it. Everything works fine when tile is spawned, my ray hits the collider in tile and enemies get spawned, but my spawn script is in tile my ray script is in my player so im reaching from my PlayerMove script to spawner script, but until my tile is spawned i get this error NullReferenceException: Object reference not set to an instance of an object because tile is not spawned yet after its spawned error stops, but after tile is deleted it starts again how can i get rid of this error.

PlayerScript

private Spawner spawner;
private RaycastHit hit;

private void Update()
{
  spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<Spawner>();
  DrawRay();
}

private void DrawRay()
{

    Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));

    if(Physics.Raycast(ray,out hit))
    {
        if(hit.collider.tag == "SpawnerCollider")
        {
            if(hit.distance < 5)
            {
                Destroy(hit.collider);
                spawner.Spawn();
            }
        }
    }
}

SpawnerScript

public Transform[] spawnPos;
public GameObject fireBall;

public void Spawn()
{
    for (int i = 0; i < spawnPos.Length; i++)
    {
        Instantiate(fireBall, spawnPos[i].position, Quaternion.identity);
    }
}

sentences:
How can I copy or back-calculate definitions for an entire b2World? I'm working on a platformer where I'd like to be able to move or copy bodies between multiple Box2D b2Worlds. The desire has cropped up three times now - moving objects between documents in my editor, moving the player between levels in normal game play, and giving the player a preview of a non-trivial projectile they can shoot in the game, which seems to be most accurately done by simulating the world for a few seconds ahead.

It looks like I can make a parallel world the "long way" - for each body in the world, copy the body data back into a def and re-create it, then copy the fixtures on it in the same way, then do the same for joints; re-set all the velocities; and if it's a "move" rather than a "copy" delete the original one.

I was wondering if someone has already written this code (and if so, was it actually a workable design or not?), or if Box2D has some affordance for doing this within its API which I am missing.

sentences: Does the license of games made with Game Maker need to include the Game Maker part? In the default license generated by Game Maker for your games, some of YoYo Games stuff is mentioned. Are those necessary to be shipped with an application made with GM? Is it legally ok if I remove those and create my own license agreement, not mentioning Game Maker or YoYo Games in it?

sentences:
SDL_CreateTextureFromSurface not working Code:
SDL_Surface* tmpSurface = IMG_Load("Assets/Player.png");
playerTex = SDL_CreateTextureFromSurface(renderer, tmpSurface);
SDL_FreeSurface(tmpSurface);

Rendering the Texture:
SDL_RenderCopy(renderer, playerTex, NULL, NULL);

I did check to see if any of them returned null and playerTex is still null even though it is being set to a texture, im not sure why can anyone help

sentences:
Javascript game engine that can work 'seamlessly' with react-native I have experience with Unity, but I don't like the fact that Unity compiles your game directly into APK (or IOS equivalent). I want to modify the game to provide chat interface for multiplayer mode etc. So, I thought of doing it the other way - create an app and embed a multiplayer game within it. This approach meant that I had to develop for Android and iOS, separately. I then came across the React-Native library, a mobile extension of the popular React framework.

I have decided to create an app using React-Native, but now I am confused as to which game engine I should use. I think, since React-Native is JavaScript, the game engine needs to be in JavaScript for seamless integration. I am planning to use WebView to embed the game in my react-native app.

Can anyone suggest a good JavaScript game engine that can be used along with react-native? I have done some research on Phaser and Pixi, but they use WebGL for rendering and, I read somewhere that WebView doesn't have great support for WébGL or Canvas.

sentences:
What algorithms are used for force dispersal between rigid objects attached by joints? I have in mind a 2d, side-scrolling game which requires the construction of vehicles and/or structures built of conjoined rigid structures, like beams or platforms.  These structures will be impacted from various angles.

What algorithms and data structures are used typically in, say, bridge-building games, to determine the force dispersal between such attached, rigid objects, and at what point the joints bend or break?

sentences:
Is there any game-oriented virtual machine out there? I'm investigating about virtual machines and their use in Games.

I'm looking for something cross-platform (at least win/mac/linux, mobile and consoles are a nice to have but not mandatory) and it would be nice if it could be binded to the usual things that you need for a game, like a graphics and sound lib. If it had any sort of automatic garbage collection, it would be nice, too. And since I want to use it for games, it should be fast and not very memory-consuming.

So far I've found:

Parrot VM
The Lua Virtual Machine (pdf)
V8

I'm leaving the Java Virtual Machine and .net VM out of this list since I feel they are a bit too big for my purposes - but I'm far from an expert on these things. If you think I should include them, please put your reasons below.

Am I missing any important one?

PS: I think this should be a community wiki, but I don't seem to be able to mark it as one.

EDIT: My final objective is creating a scripting language for game development. I've no problem with interpreters (have implemented a couple in the past) but this time I'd like to translate the Abstract Syntax Tree of my language to a VM, for efficiency mostly.

sentences:
Object goes straight through game object without colliding The "shot" is supposed to collide with the left bumper and then be destroyed, but the shot goes right through it. Both objects have a box collider.

The following is the code I am using:

#pragma strict
var speed : int = 2;
var collided_with : GameObject;

function Update () {
    transform.Translate(Vector3(-1 * speed * Time.deltaTime, 0, 0));
}

function OnCollisionEnter (col : Collision) {
    if (collided_with.tag == "Left") {
        Destroy(gameObject);
    }
}

I have made sure that all the tags are assigned correctly and that there are no spelling errors. The variable collided_with is also assigned to the left bumper. What am I doing wrong?

sentences:
How to document processes and concepts for a game? For the sake of generating a documentation and having a reference for my self, I want to formalize some concepts, behaviors and processes in a proper way.
For example: My game has a game server. This server has to do a reset in some situations. These situations or events could be when all players left the game, the game was lost or one player sends a clear reset intent command.

Now I’m wondering how to formalize that. My first thought was to use a UML-process-diagram. But I have no idea how this should look in a case like the described one (since there are more than just one entry point and also async events).

Maybe I’m wrong and there are better way to formally describe the behavior of some concepts?

Can you give me an example please?

sentences:
How do you keep the gameplay and music in sync in a rhythm game? What's the best way to program a rhythm based game in XNA? (Some sort of game like Dance Dance Revolution) Would you use the built in GameTime? What logic would you use to make sure the game constantly stays in sync to the music? Any tips would be much appreciated!

What I am basically asking is how you would keep the gameplay in sync with the music. For example in DDR how would I correctly sync the arrows to the beat of the music?

sentences:
Render imgui on top of existing Java framework I have never done this before, but we need to build game editor, on top of our existing java game SDK.

We want to use java version of imgui. I can easily create imgui window and put UI into it, but how can I also put there our game?

Or run our game and render imgui on top of it?
Basically have scene view like in UI / Unity, but editor and windows on top.

sentences:
Missing any kind of lights? I am trying to make my first 3D game in OpenGL with Shaders (LWJGL3)
I read and follow a lot of tutorials but can't figure it out what kind of light I am missing here? The wall doesn't get any effect from the light

It is supposed to be like this one:

And my point light part in fragment:

vec4 calcLightColour(vec3 light_colour, float light_intensity, vec3 position, vec3 to_light_dir, vec3 normal)
{
    vec4 diffuseColour = vec4(0, 0, 0, 0);
    vec4 specColour = vec4(0, 0, 0, 0);

    // Diffuse Light
    float diffuseFactor = max(dot(normal, to_light_dir), 0.0);
    diffuseColour = diffuseC * vec4(light_colour, 1.0) * light_intensity * diffuseFactor;

    // Specular Light
    vec3 camera_direction = normalize(-position);
    vec3 from_light_dir = -to_light_dir;
    vec3 reflected_light = normalize(reflect(from_light_dir , normal));
    float specularFactor = max( dot(camera_direction, reflected_light), 0.0);
    specularFactor = pow(specularFactor, specularPower);
    specColour = speculrC * light_intensity  * specularFactor * material.reflectance * vec4(light_colour, 1.0);

    return (diffuseColour + specColour);
}

vec4 calcPointLight(PointLight light, vec3 position, vec3 normal)
{
    vec3 light_direction = light.position - position;
    vec3 to_light_dir  = normalize(light_direction);
    vec4 light_colour = calcLightColour(light.colour, light.intensity, position, to_light_dir, normal);

    // Apply Attenuation
    float distance = length(light_direction);
    float attenuationInv = light.att.constant + light.att.linear * distance +
        light.att.exponent * distance * distance;
    return light_colour / attenuationInv;
}

sentences:
How can I selectively update XNA GameComponents? I have a small 2D game I'm working on in XNA. So far, I have a player-controlled ship that operates on vector thrust and is terribly fun to spin around in circles. I've implemented this as a DrawableGameComponent and registered it with the game using game.Components.Add(this) in the Ship object constructor.

How can I implement features like pausing and a menu system with my current implementation? Is it possible to set certain GameComponents to not update?

Is this something for which I should even be using a DrawableGameComponent? If not, what are more appropriate uses for this?

sentences: Make an animation repeat X times I am using Unity Mecanim and I would like an animation ( walking animation about 2 seconds longs ) to repeat X times before moving to the next animation. How can I achieve this?

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: What is a texture atlas? I've heard about this concept, but what is it?

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:
How do music and ambient sound influence gameplay flow? I've been thinking about whether music helps or distracts from achieving "flow" when playing a game. Does it enhance or distract from it?

Angry Birds, Temple Run and Doodle Jump seem to achieve great flow without music (or with ambient/percussion-only music). But then again, some games use music but seem to also achieve flow, such as Tiny wings.

Has this been researched? How can I maximise flow with in-game audio?

sentences:
Is there still a market for 2D games? Do 2D games still sell well? Assume it has nice visuals and good game-play.

I want to make games and want to start with 2D, but I am a bit hesitant, I have more than 8 years experience with 3D applications like Maya and other software, but not games. I'd like to know if it's worth the time investment to make 2D games.

sentences: shake / Vibrate a body in box2d? How do you vibrate or cause a shake effect to a body of type static or dynamic or kinematic. I tried applying forces to a dynamic body in the timeStep, which did not work, as well I tried ApplyLinearImpulse many times a sec within the timeStep, which again did not give me the result. So right now Iam experimenting with adding a static circle body as a hinge point to my rectangular body and create a revolute joint between them. May be then applying a force could result in Tension between the 2 bodies? Does anybody know about this? have any ideas please let me know?

sentences:
Find vector tangent to circle through a point C2 and P1 are known points. Radius of circle C2 is also constant and known. I am trying to find point T to eventually construct line p1-t, which is tangent to circle c2.

I have made an attempt involving bisecting c2-p1 at M, and performing trigonometric operations to find measure of angle TMC2. Then, I found the difference in x and y coordinates from m.x and m.y using a polar form to cartesian (polar: angle tmc2 and length of tm = c2m = 1/2 c2P). After this, I normalized vectors c2P and added the difference in x, normalized the vector perpendicular to c2p and added the difference in y.

This approach seems very convoluted for such a simple task. Are there any basic vector operations to save time and processing power?

Thank you

sentences:
Constant orbit using Rigidbody in Unity I'm trying to make a few game objects (moons) orbit a planet in unity. Basically just picture a planet in the center of the screen, and a few small moons that orbit the planet with a constant velocity. I have gotten this to work nicely using transform.RotateAround(), but I wanted to take advantage of the physics engine that unity provides for realistic "bouncing" of the game objects relative to others as they collide.

I have tried a few things such as Hinge Joints, Configurable Joints, and even just adding forces to try to get it to move in a spherical manner. I can't seem to get it to work correctly though. The configurable joint is the closest that I've come, but it's a bit off and it doesn't stay orbiting. It's likely my lack of knowledge with using rigidbodies in 3d, but I figured someone out there could help get me on the right track. Thanks in advance for any help!

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:
What is adaptive super-sampling? I'm trying to implement anti-aliasing into a raytracer with super-sampling.

What exactly is adaptive super sampling? I'm picturing it as just sampling all of the pixels which are on the edge of each object. Is that a correct explanation?

Also, is adaptive super sampling a type of MSAA? To my understanding, MSAA is essentially an anti-alising process that does not sample every pixel more than needed/is adaptive.

sentences: Moving player in Box2d without forces How do I move player with keyboard without applying forces? If I do playerBody.setLinearVelocity(new B2Vec2(0, 2)) it moves the player but when I release the key for movement, the ball is continuously moving for few seconds.

sentences:
How to make a simple escape the room game? I want to make a very simple "escape the room" game.  I was hoping for something that looks something like this.  You would see images of some room and you click around to move or to add things to inventory.  Then, you can select something in your inventory to use that item with something on the screen.  During the whole game there would be a text box describing what is happening (probably in really broken English instead of Japanese).

I am looking for something that can be quite simple.  I would prefer to have the ability to play sound (probably mp3's) when something happens.  It can be web-based or a downloaded executable or .jar file.  It doesn't have to be perfect, just a proof-of-concept really.

What is the best approach to get this game working with minimal effort?  Are there some libraries that can help?  I have plenty of Java experience and some C++, PHP, and others.  I'd rather avoid Windows-based technology as I primarily run Linux.  I am willing to learn other languages if they have a huge advantage.

Ideally, if someone could point me to an example program that I can modify.  I'm not expecting to sell or distribute this game.

sentences:
Rotation matrix for a 3D vector I have a direction vector on which I have to apply some rotation to align it to positive z-axis.
To use Matrix.CreateRotationX(angle) of XNA, I need the angle for which I'd have to compute cos or tan inverse.

I think this is a complex task to do. Also, eventually those are also converted to sin(angle) and cos(angle) in the matrix.

Is there any inbuilt way to create rotation matrix from a 3D vector?

However, I can write the function but still asking if there is one already there.

sentences:
Game development and research Game development is currently a largely non-academic enterprise.  There are a lot of commercial developers of games, as well as a large hobbyist community.  The academic community focusing on games seems to be small, and new.  [Or so it appears to me].

Having said all that, are there some must read papers/books on game development from academics?

sentences:
BoundingFrustum Performance Issues I have noticed that BoundingFrustum.Intersects() is a rather slow check in XNA. I am doing only 256 checks per frame and it eats up arround 50-60% of availible time when running at 60fps. This is kind of crazy. I would like to know if anyone else has experienced these types of performance problems with the BoundingFrustum class in XNA? Does anyone suggest I make my own boundingfrustum class/struct?

(One pitfall, when using the BoundingFrustum class, is declaring a new instance of it every frame... for some reason it is a class and not a struct. I am not doing this.)

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:
How do I align the matrix used in SpriteBatch and the matrix used in BasicEffect? I'm writing a Windows tool that uses XNA and allows the user to place textures on the screen.
I'm using a 'camera' for the SpriteBatch used to draw the textures, e.g:
Matrix matrixForSpriteBatch = Matrix.CreateTranslation(
    -_cameraPosition.X, -_cameraPosition.Y, 0.0f) *
Matrix.CreateRotationZ(_rotation) *
Matrix.CreateScale(_scale) *
Matrix.CreateTranslation(
     GraphicsDevice.Viewport.Width / 2,
     GraphicsDevice.Viewport.Height / 2, 0.0f);

This is working fine - the user can drop a texture onto the canvas and move, rotate and size it. They can also move the camera around to see more things.
What I now want to do is let the users click around to define points of a polygon.  These points are then sent to my DrawPolygonFilled method:
public void DrawPolygonFilled( SpriteBatch spriteBatch,
        Vector2[ ] worldPoints,
        Color color )
{
    Matrix matrixForVertices =
        Matrix.CreateTranslation( _cameraPosition.X, -_cameraPosition.Y, 0.0f ) *
            Matrix.CreateRotationZ( -rotation ) *
                Matrix.CreateScale( camera.Scale ) ;

    Vector2[] transformedPoints = worldPoints.Transform( matrixForVertices ) ;

    var vertices = new VertexPositionColor[ transformedPoints.Length ] ;

    for (int i = 0; i < transformedPoints.Length; i++)
    {
        vertices[ i ] = new VertexPositionColor( new Vector3( transformedPoints[ i ], 0 ), color ) ;
    }

    Vector2[ ] outputVertices ;
    short[ ] outputIndicies ;
    Vertices.Triangulate( transformedPoints, Vertices.WindingOrder.Clockwise, out outputVertices, out outputIndicies ) ;

    if (outputIndicies.Length > 0)
    {
        foreach( EffectPass pass in _basicEffect.CurrentTechnique.Passes )
        {
            pass.Apply( ) ;

            spriteBatch.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionColor>(
                Microsoft.Xna.Framework.Graphics.PrimitiveType.TriangleList,
                vertices,
                0,
                vertices.Length,
                outputIndicies,
                0,
                outputIndicies.Length /3 ) ;
        }
    }
}

This isn't displaying anything as the client space for BasicEffect is 0,0 at top-left, and 1-1 at bottom-right.
So I added this to BasicEffect:
_basicEffect = new BasicEffect( GraphicsDevice )
    {
        VertexColorEnabled = true
    } ;

_viewMatrix = Matrix.CreateLookAt(
    new Vector3( 0, 0, GraphicsDevice.Viewport.Width ),
    Vector3.Zero,
    Vector3.Up
    ) ;

_projectionMatrix = Matrix.CreateOrthographic(
    GraphicsDevice.Viewport.Width,
    GraphicsDevice.Viewport.Height,
    .1f,
    GraphicsDevice.Viewport.Width ) ;

_basicEffect.Projection = _projectionMatrix ;
_basicEffect.View = _viewMatrix ;

With this, the polygon is displayed but it's upside-down.  Also, when the position of the polygon changes (the user can drag the polygon around with the mouse), the polygon goes up when the user moves the mouse down!
I'm a bit thick (but trying to become less thick) when it comes to matrices and geometry.  Am I missing something?  I tried changing Down to Up in CreateLookAt but it still didn't draw correctly and now when the user mouses left, then polygon goes right!
Here's a screen-shot when drawing a polygon at 0,0:

The points on the white path are where the user clicked (and are drawn with SpriteBatch) and the yellow polygon is what's drawn by my method above.
Here's another screen-shot that show what happens when I move the polygon to 20,20:

The white path is drawn starting from 20,20, but the filled polygon is starting from 20,-20 and is drawn upside-down
I think this is a matrix issue between the matrix used by the SpriteBatch (to draw the white paths) and the matrix used by the BasicEffect (to draw the filled polygon).

sentences:
How can I make an instantiation random? I'm trying to do it so when I have an instantiated an item upon the game starting, it is random as to whether it actually instantiates or not. Here's the code I have so far:

public GameObject anyItem;
void Start()
{
    Instantiate(anyItem, new Vector3(0, 0, 0), Quaternion.identity);
    Instantiate(anyItem, new Vector3(11, 0, 0), Quaternion.identity);
}

How can I do it so these items (individually, not both together) are decided randomly as to whether they will actually be instantiated or not?

sentences:
Unrealscript splitting a string Note, this is repost from stackoverflow - I have only just discovered this site :)

I need to split a string in Unrealscript, in the same way that Java's split function works.

For instance - return the string "foo" as an array of char.

I have tried to use the SplitString function:

  array SplitString( string Source, optional string Delimiter=",", optional bool bCullEmpty ) Wrapper for splitting a string into an array of strings using a single expression.

as found at http://udn.epicgames.com/Three/UnrealScriptFunctions.html but it returns the entire String.

simulated function wordDraw() {

local String inputString;
inputString = "trolls";
local string whatwillitbe;
local int b;
local int x;
local array<String> letterArray;

letterArray = SplitString(inputString,, false);
for (x = 0; x < letterArray.Length; x++)
{
        whatwillitbe = letterArray[x];
        `log('it will be '@whatwillitbe);
        b = letterarray.Length;
        `log('letterarray length is '@b);
        `log('letter number '@x);
}

}

Output is:

b returns:

  1

whatwillitbe returns:

  trolls

However I would like b to return 6 and whatwillitbe to return each character individually.

I have had a few answers proposed, however, I would still like to properly understand how the SplitString function works. For instance, if the Delimiter parameter is optional, what does the function use as a delimiter by default?

sentences:
UE4: "Ignore Move Input" Does not get Set back on I have the following issue:

I have some logic which I call to Set Ignore Move Input on for a specific player character, based on a boolean. However, after half a second, I set it back on.

Everything works great, I can not move my character while it kicks.. However, if I press the "kick" input twice in succession.. the Set Ignore Move Input breaks and never gets turned off, even if I "Kick" again later.

Here is the blueprint .. Any help is greatly appreciated (and yes I realize that to somebody more experienced this blueprint makes little to no sense, but I'm just starting out... My core issue as a software developer here is I don't understand what locks me out of the logic that would reset Ignore Move Input back off).

Thank you for your time!

sentences:
The right way to start out in game development/design I'm a 19 year old student looking for some help in the field of game development.

This question may or may not seem a bit overused, but the fact is that game development has been my life long dream, and after several hours of search I've realized that I've been going in circles for the past three or four months whilst doing such research on how to really get down and dirty with game development, therefor I decided to ask you guys if you could help me out at all.

Let me start off with some information about me and things i've already learned about GameDev which might help you out on helping me out (wordplay!):

I'm not an expert programmer, but I do have knowledge on how to program in several languages including C and Java (Currently learning Java in my degree in Computer Engineering), but my methodology might not be most correct in terms of syntax (hence my difficulty in starting out, i'm afraid that the starting point might not be the most correct, and it would deploy a wrongful development methodology that would be to corrected later on, in terms of game development or other projects).
I have yet to work in a project as large as a game, never in my learning curve of programming I've done a project to the scale of a video game, only very small software (PHP Front-ends and Back-ends, with some basic JQuery and CSS knowledge).
I'm not the biggest mathematician or physicist, but I already know that is not a problem, because there are several game engines already available for use and integration with home-made projects (Box2D, etc).
I've also learned about some libraries that could be included in said projects, to ease out some process in game development, like SDL for example.
I do not know how sprites, states, particles or any specific game-related techniques work.

With that being said, you can see that I have some ideas on game development, but I have absolutely no clue on how to design and produce a game, or even how game-like mechanics work. It does not have to be a complex game just to start out, I'd rather learn the basic of game design (Like 2D drawing, tiling, object collision) and test that out in a language that I feel comfortable in which could be later on migrated to other platforms, as long that what I've learned is the correct way to do things, and not just something that I've learned from some guy on Youtube by replicating that code on the video.

I'm sorry if my question is not in the best format possible, but I've got so many questions on my mind that are still un-answered that I don't know were to start!

Thank you for reading.

sentences:
How to get the directional vector (for IrrKlang) from pitch and yaw? Currently my game engine allows the player/camera to pitch and yaw, so there's no roll.

The pitch angle starts at 0°, which means the camera is facing straight ahead. From here it can go up to +85° (looking almost straight up) or down to -85° (looking almost straight down).

The yaw angle starts at 0°, which means the camera is facing east. The rotation is clockwise so 90° is south, 180° is west and 270° north. What would be 360° is 0° again obviously.

How do I get from this to the direction vector (lookdir) IrrKlang's SetListenerPosition requires to get directional audio working?

PS: x and z are my horizontal axis, y is the vertical one.

sentences:
Altering Animation Playback Given Terrain Information Say my character has a jog animation.  Assuming Y is vertical, his feet leave the ground at Y=0 and hit the ground again at Y=0.  This works fine in a world like that of Minecraft, where every surface the player could traverse is flat.

Now say the character is jogging through hilly terrain.  Without any transformations, the animation would break through the ground at certain points.  (As the character's foot is lifted and moved forwards, it would go straight through the hill.)

How do I remove this artifact?  Do I ask the artists to create separate animations depending on the grade of the terrain?  Is there a standard system to resolve animation-world collisions that I'm unfamiliar with?  Or is there another more logical approach I haven't thought of yet?

sentences:
Combined Mesh and Lightmap I am using Unity 2017.

The left picture is the original state. Light map applied.

On the right is the state after all meshes are made into Combined Mesh.

Same lightmap settings as left.

As you can see, it is filled with dirty black dots.

What should I do?

sentences:
Is using the applet class in a Java game a wise thing to do? I am making an 2D multiplayer game in Java project, by using Java sockets and simple  java.applet.*

Our teacher told us to use J2EE concepts in the project. Do I have to use JSP? Is it better or more employable in game development?

Am I doing the correct thing?

sentences:
In some games, we just let the main() loop be the Player object or Table object? I was thinking that let's say if there is a game of Blackjack or MasterMind, then we should have a class called Dealer or ComputerPal, which is how the computer interact with us (as a dealer for Blackjack or as the person giving hints for MasterMind).

And then there should be a Player object, and the way to play one game is

aPlayer.playGame

but I noticed that a book was just using the main() loop to act as the player (or as the Controller of the game), calling the Dealer methods to dealer the cards, ask for player's action, etc...

1) Is this just a lazy way to model all the proper objects?

2) If more objects are to be added, who should call the aDealer.dealCards and then ask for aPlayer.askForAction?  (because it is strange to let the Player handle all the logical steps).  Should there be a Table object that handle all these logic and then to play one round of game, use aTable.playGame?  What is a good object design for such game?

sentences:
Is my StatisticManager idea overkill? I'm writing a shmup and I'm working on implementing things like level design and achievements. I have a trigger system that I've implemented which allows me to do basic things and can assist the basic level workflow. However, as it is, this isn't really flexible enough to recognize some other things, such as:

Determine when an enemy is killed vs. removed from the game
Not taking damage during some period of time
Killing enemies using a particular weapon
Killing enemies in a particular order

Whereas the triggers I have available now basically poll for information, these need to look through a series of events to understand whether the condition is met. So I've conceived a StatisticManager class which would be able to take and store all these events, and provide queries so that new triggers could be written to test for these things. For example, a trigger might ask for an ordered list of enemies killed during some time period, and then determine whether a particular sequence of kills is met.

The design raises a lot of concerns, though, such as determining when to discard / archive data, and how to get statistical data from previous game sessions. Certainly efficiency is a concern.

So my question is: Does my StatisticManager idea seem appropriate for my needs? What other designs should I consider?

sentences:
How do you rotate all the objects around the camera? If I'm correct, the way that you can "look around" in an environment is that you rotate all the objects around the camera. This is the code that I've created using JavaFX 3D. So what's the algorithm?

package com.rtek.main;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Box;
import javafx.scene.transform.Rotate;
import javafx.stage.Stage;

public class Walk extends Application {
    private Group root = new Group();
    private PerspectiveCamera camera = new PerspectiveCamera();
    private CameraGroup cameraX = new CameraGroup();
    private CameraGroup cameraY = new CameraGroup();
    private CameraGroup cameraZ = new CameraGroup();
    private static final double CAMERA_INITIAL_DISTANCE = -450;
    private static final double CAMERA_NEAR_CLIP = 0.1;
    private static final double CAMERA_FAR_CLIP = 10000.0;

    public void start(Stage primaryStage) throws Exception {

        Scene scene = new Scene(root, 800, 600, true);

        buildScene();
        buildMouse();

        loadMouse(scene);

        primaryStage.setTitle("Walk Around");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    private void loadMouse(Scene scene) {
        scene.setOnMouseMoved(event -> {
           ???
        });
    }

    private void buildMouse() {
        root.getChildren().add(cameraX);
        cameraX.getChildren().add(cameraY);
        cameraY.getChildren().add(cameraZ);
        cameraZ.getChildren().add(camera);

        camera.setNearClip(CAMERA_NEAR_CLIP);
        camera.setFarClip(CAMERA_FAR_CLIP);
        camera.setTranslateZ(CAMERA_INITIAL_DISTANCE);
    }

    private void buildScene() {
        PhongMaterial material = new PhongMaterial();
        material.setDiffuseColor(Color.RED);
        material.setDiffuseColor(Color.GREEN);

        Box cube = new Box(100, 100, 100);
        cube.setMaterial(material);

        root.getChildren().add(cube);
    }

    private class CameraGroup extends Group {
        private Rotate x = new Rotate();
        private Rotate y = new Rotate();
        private Rotate z = new Rotate();

        public CameraGroup(){
            x.setAxis(Rotate.X_AXIS);
            y.setAxis(Rotate.Y_AXIS);
            z.setAxis(Rotate.Z_AXIS);

            getTransforms().addAll(x, y, z);
        }
    }
}

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:
How to go from Texture2DContent to Texture2D in a content processor? I'm using reflection to create a manifest of all assets, strongly typed.

It's working fine for my own types: I get the type of the asset, if a processor is ran on it I get the output type. Then I check to see if there's a ContentSerializerRuntimeTypeAttribute applied to the type. If so, then I get the RuntimeType value and do a Type.GetType() to get the type back.

The problem I have is if the type is Texture2DContent (for example) as that doesn't have the ContentSerializerRuntimeTypeAttribute.

How can I go from a Type representing Texture2DContent to a Type representing Texture2D?

I know I can just check for EndsWith("Content") as a last resort, but how to I get the namespace qualified type so I can get my Type object?

sentences:
Android OpenGL and non premultiplied textures As I understand it; by default all bitmaps will will get the alpha channel premultiplied in Android if loaded using BitmapFactory.

My setup:
I have a 32bit bitmap(.bmp) where the alpha channel has a gloss map and the rgb is a specular map.

Issue:
I found out that I can load the bitmap without being premultiplied using the bitmap option:

opts.inPremultiplied = false;

Result:
When I render the alpha channel of the texture like this in the shader:

gl_FragColor.rgb = vec3(texture.a);

The resulting mesh is all white and not shades of gray as expected.

I upload the texture with this method:

GLUtils.texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image, 0);

I have also tried using this approach

GLES20.glteximage

as well with the same result although I might have done something wrong there.

Can anyone spot where I have gone wrong or what else I need to do?

sentences:
How to zoom image on Unity UI to particular point where mouse cursor is located? I have some RectTransform on Unity UI. I have already implemented some Zoom functionality but now I need it to zoom to the area where the mouse cursor is located. Currently, it zooms to the anchor point. How can I zoom to the mouse cursor?

Here are some screenshots from a hierarchy.

I have already implemented zoom itself.

public class ZoomableRect : MonoBehaviour
{
    [SerializeField] private RectTransform rectToZoom;

[SerializeField] private ZoomConfigs zoomConfigs;

private bool onObj = false;

[SerializeField] private ScrollRect scrollRect;
public ScrollRect ScrollRect
{
    get { return scrollRect; }
    set { scrollRect = value; }
}

private bool isZoomAllowed;
public bool IsZoomAllowed
{
    get { return isZoomAllowed; }
    set { isZoomAllowed = value; }
}

private bool isFullScreen;
public bool IsFullScreen
{
    get { return isFullScreen; }
    set { isFullScreen = value; }
}

void Start()
{
    if (!rectToZoom)
        rectToZoom = GetComponent<RectTransform>();

}

void Update()
{
    float scrollWheel = -Input.GetAxis("Mouse ScrollWheel");

    if (isZoomAllowed && scrollWheel != 0)
    {
        ChangeZoom(scrollWheel);
        SetPosition(Input.mousePosition);
    }
}

private void ChangeZoom(float scrollWheel)
{
    float rate = 1 + zoomConfigs.zoomRate * Time.unscaledDeltaTime;

    if (scrollWheel > 0)
    {
        SetZoom(Mathf.Clamp(transform.localScale.y / rate,
         zoomConfigs.minSize, zoomConfigs.maxSize));
    }
    else
    {
        SetZoom(Mathf.Clamp(transform.localScale.y * rate,
         zoomConfigs.minSize, zoomConfigs.maxSize));
    }
}

private void SetZoom(float targetSize)
{
    transform.localScale = new Vector3(targetSize, targetSize, 1);
}

public void SetPosition(Vector2 mouseInput)
{
    float rectWidth = rectToZoom.rect.width;
    float rectHeight = rectToZoom.rect.height;

    float mousePosX = mouseInput.x;
    float mousePosY = mouseInput.y;

    float widthPivot = mousePosX / rectWidth;
    float heightPivot = mousePosY / rectHeight;

    Debug.Log("widthPivot = " + widthPivot + " heightPivot = " + heightPivot);

    rectToZoom.anchorMin = new Vector2(widthPivot, heightPivot);
    rectToZoom.anchorMax = new Vector2(widthPivot, heightPivot);

    rectToZoom.transform.position = new Vector2(mousePosX, mousePosY);
    Debug.Log("MousePosX = " + mousePosX + " MousePosY = " + mousePosY);
}

public void SetAnchors(bool isFullScreen)
{
    if (!isFullScreen)
    {
        rectToZoom.anchorMin = new Vector2(1, 1);
        rectToZoom.anchorMax = new Vector2(1, 1);
    }
}

}

But anchors always snap to the bottom left corner. And widthPivot and heigtPivot values are always bigger than 1.

Actually, after testing, I see that anchors are less than 1 when the cursor is located in the bottom left part of the screen. And bigger than 1 when the cursor is in the top right part of the screen.

When zooming it always snaps to the bottom left corner.

It seems that mouse position connected to the current resolution at the same time canvas on which zoomableRect is potisioned has reference resolution of 1920 x 1080.

Changing a pivot in the same way instead of anchors doesn't have any effect. Same result.

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 to do game dev without downloading binaries? I am trying to start a student club for game development. My initial plan was to have students start by modifying an existing Open Source game, such as Sauerbraten, Tux Racer, or SuperTux. The students all have Windows computers, the problem is they're locked from installing any binaries such as these games, which would be needed to get started. So is there some option for creating a collaborative project that wouldn't require downloading of binaries to do?

sentences:
Setting Anchor Point I want to set anchor point for the sprite like cocos2d has done for their implementation. I do not found any thing like that in andengine so please provide guidance on that. I want to move the sprite on touch so I use following code but that does not work for me.

super.setPosition(pX - this.getWidthScaled() / 2,
            pY - this.getHeightScaled() / 2);

Because I touch on the corner of the image but automatically it comes at center of the image because of above code. I want to remain the touch at desire position and drag it. For me the anchor point became useful. But I don't found anything in andengine.

sentences:
How do I set up a bullet to fire towards the mouse pointer? I am making an FPS, in Unity. I have a player with a gun, and I have a bullet prefab. I changed the mouse pointer to look like a crosshair, but I don't know how to place the bullet where the crosshair is aiming.

The player movement is on the x and z axis. I have done lots of research on the Internet, and couldn't find anything suitable; most of what I found, I could not understand enough to change it according to my needs.

How do I set up a bullet to fire towards the mouse pointer?

sentences:
Libgdx Scene2D Table background not showing up I am using Libgdx's Scene2D API to build my UI and everything has been working as expected until now. I created a Skin and a TextureAtlas and linked them as so:

Skin skin = new Skin();
TextureAtlas uiElements1 = new TextureAtlas("skins/uielements1.txt");
skin.addRegions(uiElements1);
skin.load(Gdx.files.internal("skins/uiskin.json"));

And then I tried to create a Table:

Table table = new Table(skin);
table.setWidth(stage.getWidth());
table.align(Align.center|Align.top);
table.setPosition(0, Gdx.graphics.getHeight());
table.padTop(30);
table.setBackground("grey_button02");

Finally, I added a Label to the Table:

Label gameTitle = new Label("Nameless Project", skin, "title");
table.add(gameTitle).padBottom(10).row();

Once I added the Table to my Stage, only the elements in it would show up and not the background image. I tried using background(String s), setBackground(String s), background(Drawable d), and setBackground(Drawable d). None of those seemed to work for me.

I also tried calling pack() and setFillParent(true) but both of those made my table disappear. I have gone through just about every Google result and I can't find anyone else with my issue.

Here is my uiskin.json file

{
  com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: fonts/FutureThin.fnt } },
  com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
   default: { down: blue_button03, up: blue_button04, font: default-font },
  },
  com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
    default:  {
      titleFont: default-font
     }
   },
   com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
    title: {
        font: default-font
     }
   }
}

And the entire class rendering the stage:

public class MainMenu implements Screen {

    GameClass myGame;

    Stage stage;
    Skin skin;

    Table table;
    TextButton singlePlayer;
    TextButton multiPlayer;
    Label gameTitle;

    public MainMenu(GameClass g) {
        myGame = g;

        // Create Skin, load texture Atlas, load skin
        skin = new Skin();
        TextureAtlas uiElements1 = new TextureAtlas("skins/uielements1.txt");
        skin.addRegions(uiElements1);
        skin.load(Gdx.files.internal("skins/uiskin.json"));

        // Create stage
        stage = new Stage(new ScreenViewport());

        // Create Table
        table = new Table(skin);
        table.setWidth(stage.getWidth());
        table.align(Align.center|Align.top);
        table.setPosition(0, Gdx.graphics.getHeight());
        table.padTop(30);
        table.setBackground("grey_button02");

        // Game Title
        gameTitle = new Label("Nameless Project", skin, "title");
        table.add(gameTitle).padBottom(30).row();

        // Single Player button
        singlePlayer = new TextButton("Single Player", skin, "default");
        singlePlayer.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent e, float x, float y) {
                myGame.setScreen(new WorldTesting(myGame));
            }
        });
        table.add(singlePlayer).width(300).padBottom(30).row();

        // Multiplayer Button
        multiPlayer = new TextButton("Multiplayer", skin, "default");
        multiPlayer.setWidth(350);
        multiPlayer.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent e, float x, float y) {
                // Change Scenes
            }
        });
        table.add(multiPlayer).width(300).padBottom(30).row();

        stage.addActor(table);
        Gdx.input.setInputProcessor(stage);
    }

    public void show() {

    }

    public void render(float delta) {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
    }

    public void hide(){

    }
    public void resize(int x, int y) {

    }
    public void pause() {

    }
    public void resume() {

    }
    public void dispose() {

    }

}

sentences:
Bullets Stop when Shooting Unity 2D using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Makarov : MonoBehaviour
{
    public GameObject Bullet;

    public float BulletSpeed;

    public Transform ShootPoint;

    // Update is called once per frame
    void Update()
    {
        if(Input.GetMouseButtonDown(0))
        {
            shoot();
        }
    }

    void shoot()
    {
        GameObject BulletIns = Instantiate(Bullet, ShootPoint.position, ShootPoint.rotation);
        BulletIns.GetComponent<Rigidbody2D>().AddForce(BulletIns.transform.forward * BulletSpeed);
    }
}

When I shoot the bullets just stop right in front if the gun.
This is for a top down shooting.

sentences:
Sprite sheet textures picking up edges of adjacent texture I have a custom sprite routine (openGL 2.0) which uses a simple sprite sheet (my textures are arranged horizontally next to each other).
So, for example, here is a test sprite sheet with 2 simple textures:

Now, what I do when creating my openGL sprite object is specify the total number of frames in its atlas and when drawing, specify which frame I want to draw.
It then works out where to grab the texture from by:
Dividing the required frame number by the total number of frames (to get the left coordinate)
And then diving 1 by the total number of frames and adding the result to the left hand coordinate calculated above.
This does seem to work but sometimes I get problems.  Say for example, I want to draw the X below and I get...........

I've heard about putting a 'padding' of 1 px between each texture but could someone explain exactly how this works?  I mean if I do this it will surely throw off the calculations for getting the texture.
If I simple include the padding in texture picked up (so the sprite is drawn with a blank border), then surely this will cause problem with collision detection? (ie sprites may appear to collide when using bounding boxes when the transparent parts collide).
Would appreciate if someone could explain.

sentences:
Bounding Box in Monogame for mouse picking - Ray perspective My mouse ray is screwing up precision. I don't really know how to fix it, maybe you guys can help.

problem :
(5.6mg gif)
https://www.dropbox.com/s/v0z67afso88hsd1/perspective_ray.gif

how i create the mouse ray:

 private Ray GetMouseRay(GraphicsDevice gd, ref Matrix view, ref Matrix proj)
    {
        //create source positions
        // i dont really understand why the 0 and the 1, since the near/far clip plane are totaly diferent, but from experimentation, this is a must
        Vector3 nearsource = new Vector3((float)MousePosition.Value.X, (float)MousePosition.Value.Y, 0.0f);
        Vector3 farsource = new Vector3((float)MousePosition.Value.X, (float)MousePosition.Value.Y, 1.0f);
        //Console.WriteLine("nearsource :" + nearsource.ToString() + " farsource :" + farsource.ToString());
        //Matrices needed are the view proj and this world
        //we are positioning the mouse ray in the origin(model origin, its a 3Dspace ray)
        Matrix world = Matrix.CreateTranslation(0, 0, 0);

        //unproject mouseposition in the clipping planes
        Vector3 nearPoint = gd.Viewport.Unproject(nearsource, proj, view, world);
        Vector3 farPoint = gd.Viewport.Unproject(farsource, proj, view, world);
        //Console.WriteLine("nearPoint :" + nearPoint.ToString() + " farpoint :" + farPoint.ToString());
        // Create a ray from the near clip plane to the far clip plane.
        Vector3 direction = farPoint - nearPoint;
        direction.Normalize();
        return new Ray(nearPoint, direction);
    }

How i am drawing the ray:
 CDebugShapeRenderer.AddLine(mouseRay.Position, mouseRay.Position * mouseRay.Direction * 1000, Color.Red);

how i am calculating the Obb:

Bounding Box in Monogame for mouse picking

How i am calculating the collision:
Line: 349
https://github.com/CartBlanche/MonoGame-Samples/blob/master/CollisionSample/BoundingOrientedBox.cs#L349

So how can i create a mouse ray that is accurate? or remove that perspective somehow.

Roger.

Edit:
I forgot to add the matrices used

 proj = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, this.GraphicsDevice.Viewport.AspectRatio, 1.0f, 1000.0f);
 view = Matrix.Identity;

sentences:
unity apply item animation to character I'm trying to change the attack animation of my player in relation to the attack animation for the item he has in his hand.

For example, the default attack animation of my player is puching and once he picked up a sword I want his attack animation to be sword attack, for a hammer a hammer attack, etc ..

I searched a lot on the internet but didn't find much, I saw a few post talking about AnimatorOverrideController but I'm not sure if it's what I need because it overrides every animation clip of the AnimatorController. In my case I just want to change the attack Animation Clip.

So if you cloud give me some tips about the right way to do it, I would really appreciate because I'm a bit confused.

Thanks

Edit : BTW, I'm in Unity 3d

sentences:
Export UnityProject inside Android Studio's existing project I am new to the Unity3D, but I have made a small Unity project with a humanoid gameobject. I can move this humanoid with the demo data but I want to move it with the quaternion data which I am already getting inside the android app.

I have searched on the internet, but everyone just tells about the android plugin that we have to make for the unity, and that way we can use the JNI to send or receive the data (I need to access the c# scripts from the android).

But, I wanted to import the unity project inside the android project so that I can(access the c# scripts from android and send the quaternion data to the Quaternion variable of the gameObject and make it move) make changes to the android app and test it instantly!! (Also I don't need to make further changes inside the unity project but I need to make further improvements to the data inside the android project).

Please help and provide a guide for the android studio.
Thanks.

sentences:
Accelerated movement in a specific time to a specific point I am trying to move my sprite in a specific time to a specific position while using frame-independent or time-dependent movement. My sprite is also accelerated every frame to simulate gravity. I know the acceleration, the distance and the needed time. So i used the formula for acceleration based movement: s = 0,5 · a · t2 + v₀ · t + s₀ which is equivalent v₀ = (s-s₀) / t - a · t / 2. However, in my implementation the sprite does not move to the specified y-coordinate. The lower the starting y-coordinate is the higher is the resulting y-coordinate. For the time I used a quarter second. Here is my implementation:

    float resultY = viewport.getWorldHeight() / 6f * 5f;
    float time = 0.25f;
    velocity.y = (resultY - circle.getY()) / time - (-25f * time / 2f);

and these are called every frame:

    velocity.y -= 25f;
    circle.translate(velocity.x * delta, velocity.y * delta);`

What did I do wrong or is there a better method to move an accelerated sprite to a specific position in a specific time?

EDIT: I didn't mention that I want the sprite to stop at that specific point. I figured out that using my formula the sprite moves to the specified point in the specified time but it keeps moving and does not stop there. Is there a formula to solve that problem?

EDIT2: Ok, I realize that my last question is nonsense because stopping the sprite at a specified position and a specified time with a given acceleration is impossible. Thanks for all the answers.

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:
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: How much memory does a texture take up on the GPU? A large png on disk may only take up a couple megabytes but I imagine that on the gpu the same png is stored in an uncompressed format which takes up much more space. Is this true? If it is true, how much space?

sentences:
Jagged Edges Even With Anti Aliasing 8x Multi Sampling I have an interior scene where I have imported a model for the apartment and many of the interior objects such as lamps, windows, etc. Unfortunately I have a lot of jagged edges on almost all the objects in my scene even on Fantastic Quality settings with Anti Aliasing pushed to its maximum. What else can I do to reduce the jaggies seen here:

Here are my quality settings:

And here are my model import settings:

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:
2D to 3D perlin noise, I'm not sure I get it I've been using 2d perlin noise to generate height maps for a little isometric terrain experiment. The noise value is directly related to the z-layer a tile will appear in: Math.floor(noise * 10). Perlin is great but height is now always linear and I'm not sure how to change this.

One thing I tried was making the height value go up exponentially, producing a map akin to the image attached. Now my maintains are larger and more interesting looking, but this obviously produces gaps. I'm not sure how to "pad" or 3D-ify those layers. Any pointers?

    var diff = .04;
    var zz = Math.random() * 100;
    var x, y, xx, yy;

    for (var y = 0; y < maxY; y++) {
        this.grid[y] = new Array(maxX);
        for (var x = 0; x < maxX; x++) {
            xx = 0 + x * diff;
            yy = 0 + y * diff;

            this.grid[y][x] = Math.floor(Math.pow(simplex.noise(xx, yy, zz) * 4), 2.3));
        }
    }
    return this.grid;

edit:
i'm sorry i'm not more clear. i'm not entirely sure what i'm asking because i'm not entirely understanding the maths. the terrain i've been trying to make starts at the base level with water. then some layers of grassy types, going into mountains. i'm not building minecraft here, i don't intend to dig around in it, but i would like to be able to rotate it sometime (replacing the tiles with cubes). right now, simplified, i'm expressing x and y as a 2d grid, with the value representing z, like so. z is really just my tile height.

var grid = [
    [1,1,1],
    [1,3,1],
    [1,1,1]
]

in this example i will draw 9 tiles, with the middle one at a height of 3 creating the gaps you see in the image. i was thinking the image would be more complete if this was a 3d grid.

var grid = [
    [
        [1,1,1],
        [1,1,1],
        [1,1,1],
    ],
    [
        [ , , ],
        [ ,2, ],
        [ , , ],
    ],
    [
        [ , , ],
        [ ,3, ],
        [ , , ],
    ]
]

blanks in this case will not be drawn. the values in the array could represent the type of tile for instance. i tried this with 3D noise but i'm very unsure how to interpret the density values (from -1 to 1). Drawing all density values under 0 (as the same tile) got me the image below which is cool, but not what i was hoping for. So far everything i've read about this does not explain what the values actually mean. translating the density values into into 'types' of terrain generates mostly nonsense, with random bits of water all over the place. the whole thing just looks like a giant cube with holes in it.

maybe i'm not making sense because what i want does not make sense, this is entirely possible. the internets is letting me down and i'm hoping some smart people can point me in the right direction.

sentences:
Tangents face the same direction on opposite sides of mesh I have noticed that the tangent vectors that I am calculating are not always facing the correct direction. The tangents on the left and right of the mesh both face the same direction. Here is a screenshot showing this:

I've mapped the XYZ value of the tangent vectors to RGB values in the fragment shader. +Z is towards the camera. As you can see, both sides of the teapot have tangents facing towards the camera instead of only the left as I'd excepted.

Also, the UVs for the mesh are correct and increase smoothly across the surface (I used blender's default sphere mapping to generate the UV coordinates):

The tangents are correct even over the seams.

I am using the following piece of code to compute my tangents:

for (size_t i = 0; i < mesh.face_list.size(); ++i)
{
    const Face& face = mesh.face_list[i];

    const size_t& i1 = face.vertex_indices[0];
    const size_t& i2 = face.vertex_indices[1];
    const size_t& i3 = face.vertex_indices[2];

    const Vec3& p1 = mesh.vertex_list[i1-1];
    const Vec3& p2 = mesh.vertex_list[i2-1];
    const Vec3& p3 = mesh.vertex_list[i3-1];

    // Compute edges.
    Vec3 e1 = p2 - p1;
    Vec3 e2 = p3 - p1;

    const size_t& txi1 = face.texcoord_indices[0];
    const size_t& txi2 = face.texcoord_indices[1];
    const size_t& txi3 = face.texcoord_indices[2];

    Vec2 texcoordDelta1 = mesh.texcoord_list[txi2-1] - mesh.texcoord_list[txi1-1];
    Vec2 texcoordDelta2 = mesh.texcoord_list[txi3-1] - mesh.texcoord_list[txi1-1];

    float coefficient = 1.0f / (texcoordDelta1.x * texcoordDelta2.y - texcoordDelta2.x * texcoordDelta1.y);
    Vec3 faceTangent = coefficient * (texcoordDelta2.y * e1 - texcoordDelta1.y * e2);

    const size_t& ti1 = face.normal_indices[0];
    const size_t& ti2 = face.normal_indices[1];
    const size_t& ti3 = face.normal_indices[2];

    // Add tangent to all vertices making up the face.
    mesh.tangent_list[ti1-1] += faceTangent;
    mesh.tangent_list[ti2-1] += faceTangent;
    mesh.tangent_list[ti3-1] += faceTangent;
}

// Normalise and orthogonalise all tangents.
for (size_t i = 0; i < mesh.tangent_list.size(); ++i)
{
    mesh.tangent_list[i] = normalise(mesh.tangent_list[i] - (mesh.normal_list[i] * dot(mesh.normal_list[i], mesh.tangent_list[i])));
}

As far as I can tell, the main part of the calculation seems correct compared to things I've found online:

float coefficient = 1.0f / (texcoordDelta1.x * texcoordDelta2.y - texcoordDelta2.x * texcoordDelta1.y);
Vec3 faceTangent = coefficient * (texcoordDelta2.y * e1 - texcoordDelta1.y * e2);

Generally, normal mapping works great, but there are subtle lighting errors on parts of the mesh after the incorrect tangent space transformation. Hopefully this is all of the information needed to get to the bottom of this.

sentences:
How should I control leveling up in a knowledge/skill testing game? I have developed a game that  tests the knowledge and skills in a series of short quiz-like games.
Players have to move from Level 1 to Level 16 (with Level 4, 8 and 12 as major milestones~BANDS). The Difficulty level of game/questions increases at each level.
The level progression is currently based on 'POINTS'. Points in turn are based on Correct responses, faster responses, Wins, Completion etc.
Points continue to increase for a user irrespective of Win / Loss (the duration of completing the levels varies)
The challenge I foresee is 'every user can progress to Level 16' if he keeps on playing the game long enough (irrespective of whether he has acquired the skill/knowledge for the next level).

I am looking for a simple to understand progression rule(s) that would make lower-skilled players remain longer in that BAND before progressing to the next level and BAND. What are some best practices in Level progression that I can refer to for overcoming this issue.

Thanks,

sentences:
How to load textures at other times than startup in XNA using vb.net? I've encountered a problem with my game project lately. When I load more than a certain number of textures (around 1000) at startup I recieve an error regarding memory, because I have to use 32-bit in XNA. I am self-taught and so have only basic knowledge of the "correct" ways to program a game. The project itself is getting very big and although I try to compress images together etc, I will have to use more than 1000 textures throughout the project.

My question is this: How can I load textures at other points of time than at startup in XNA, using vb.net? (I'm not using classes at all that I'm aware of, so I hope to stay away from that if possible)

sentences:
Struggling to get AI to repeat infinitely I am following this as a guideline to help me figure out a simple AI for an enemy as I am new to java.

https://www.javacodegeeks.com/2014/08/game-ai-an-introduction-to-behaviour-trees.html

https://github.com/obviam/behavior-trees/tree/master/src/net/obviam/bt

I am calling this function:

AI goombaBrain = Routines.selector(Routines.repeatInfinite(Routines.wander(Board.board, InitObject.goomba)));

InitObject.goomba.setRoutine(goombaBrain);

But once it finishes wandering to a random location once it doesn't automatically reset. Any ideas? if you need any more information let me know. (InitObject.goomba is the enemy)

sentences:
How do game designers create vibration patterns? I am curious about creating and implementing vibration patterns for console controllers (for the PS4 controller, if it makes a difference).

There is a delay and motor speed parameter right? But also we can fade from left motor to right, or make them work together....

Is there a standardized way to create those patterns?

For example I thought about creating them with stereo wav audio in an audio editor and reading the wav file in my code to convert them to delays and speeds.

How is this done in the gaming industry?

sentences:
Is there a way to create multi-resolution graphics for game with createjs? I'm on a advanced development for a game made with createjs framework. However it's time to export it to some platforms. The graphics are made for the iPad 3 resolution.

I would like to export them to devices with less processing power, like iPhone 4 or low end Androids. But hi-definition assets drains the little processor of them.

Resizing all the files is not a solution. There must be some "scale factor" on image loader or another mechanism to get images in correct sizes.

If my game canvas has virtual 1000px wide, and my asset has 1000px wide, the canvas will be filled by the asset. If I resize it to half size, it will be 500px wide, and the canvas will be just half filled. There should be a scale factor that should get the displayObject (not the asset) and set its sizeX and sizeY to double size to fill the screen again. I can be done manually for every one, but I'm looking for a better solution.

sentences: multiply matrix by vector: what to do if need to change y-up to z-up? I multiply a matrix with a position vector to get a new position, however, now I need to change my matrix from y-up coordinate space to z-up. Changing only the matrix won't work: how to apply the change to the vector (change position vector from y-up to z-up)?

sentences:
Combine all animation state into one clip (.anim) file in unity I have an animation controller where different animation states(clips) are available. Like this:

Now my aim is to convert all this states animation into a single clip (.anim file). Is this possible. ?
I am able to copy one animation clips frame using this. But it very time consuming.

sentences:
Displacement map to create terrain I am trying to figure out the best way to create a procedurally generated terrain at runtime in Unreal Engine 4. For the moment, my idea is to generate a heightmap and apply it to a plane as a displacement map, since it sounds a lot simpler than trying to procedurally generate a mesh.

Is it how it is generally done? And if not, will I run into issues by doing it this way?

sentences:
How should we approach publishing our game from India? Me and my friends are developing a game using Java for Windows operating system. We have nearly completed our game. As we feel that the game can make money, we wish to sell it. But in India we don't know any game publishing company.
We want to know the following if possible.
Will game publishers like BigFishGames.com publish our game even though we are not in USA?
We are just students in college. Is it required that we can sell only after we start a company?
Is it possible to sign contracts if the publisher wishes to publish our game, while the publisher and developer are in different countries?
Thank you

sentences:
Why my dynamically generated Sprites overlap? I'm trying to dynamically generate scene representing chess board made from sprites. I'm using two textures for these:
 - pieces.png (taken from here: http://opengameart.org/sites/default/files/chess_2.png)
 - tiles.png (drawn by hand, consists of two 128x128 squares filled with different colors)

The best result I achieved so far is a board with overlapping tiles:

The sprite mode for these textures is "Single" and pixels per unit are set to "128" (unsure whether I should've done this or not)

The textures are being sliced to sprites in my MonoBehavior.Start:

            var tiles = new Dictionary<int, Tile> ();
            var sprites = new Dictionary<int, Sprite> ();

            // Load all tilesets
            foreach (var externalTileset in map.tilesets) {
                    var tilesetAsset = (TextAsset)Resources.Load ("Boards/" + externalTileset.source);
                    var tileset = (Tileset)tilesetSerializer.Deserialize (new StringReader (tilesetAsset.text));

                    Texture2D texture = (Texture2D)Resources.Load ("Boards/" + tileset.image.source.Replace (".png", ""), typeof(Texture2D));
                    Debug.Log ("Texture for " + tileset.image.source + " loaded: " + texture.width + 'x' + texture.height);

                    int tilesPerRow = tileset.image.width / tileset.tilewidth;
                    int totalTiles = (tileset.image.width / tileset.tilewidth) * (tileset.image.height / tileset.tileheight);
                    for (int tileId = 0; tileId < totalTiles; tileId++) {
                            float x = tileset.tilewidth * (tileId % tilesPerRow);
                            float y = (tileId / tilesPerRow + 1) * tileset.tileheight;
                            sprites [externalTileset.firstgid + tileId] = Sprite.Create (texture, new Rect (x, texture.height - y, tileset.tilewidth, tileset.tileheight), new Vector2 (0.5f, 0.5f));
                    }

                    if (tileset.tiles != null) {
                            foreach (var tile in tileset.tiles) {
                                    tiles.Add (externalTileset.firstgid + tile.id, tile);
                            }
                    }
            }

And when sprites are added to newly created game objects:

        float minX = -4;
        float maxX = 4;
        float minY = -4;
        float maxY = 4;

        for (int i = 0; i < map.height; i++) {
                float y = minY + i * (maxY - minY) / map.height;
                for (int j = 0; j < map.width; j++) {
                        float x = minX + j * (maxX - minX) / map.height;
                        if (pieces [i, j] != null) {
                                GameObject piece = new GameObject (pieces [i, j].properties ["Color"] + ' ' + pieces [i, j].properties ["Type"]);
                                SpriteRenderer renderer = piece.AddComponent<SpriteRenderer> ();
                                renderer.sprite = piecesSprites [i, j];
                                piece.transform.position = new Vector2 (x, y);

                        }
                        if (tileSprites [i, j] != null) {
                                GameObject tile = new GameObject ("Tile");
                                SpriteRenderer renderer = tile.AddComponent<SpriteRenderer> ();
                                renderer.sprite = tileSprites [i, j];
                                tile.transform.position = new Vector2 (x, y);
                        }
                }
        }

I believe I can hack something to make this work, but I want to know how to do it properly
What's wrong with my code or scene/resources setup?

sentences:
Common way of animating 'motion' for walk cycle animations I've just posted this at the Blender artists' forums before realising I would probably get a better response from a more game development-specific audience, so apologies for cross-posting! It's for the right reasons :)

I'm a programmer trying to animate a character walking for a game project, using Ogre. I've made a very simple walk cycle in Blender and exported it to Ogre, and it plays just fine. By fine, I mean it works, but there's terrible foot sliding. This is because I just animated the walk in-place (at the origin) in Blender, and of course I don't know what "speed of walk" that corresponds to, so when I move the character in-game the motion doesn't necessarily match up with the movement of the feet in the animation.

So my question is: what's the normal approach for this kind of thing? At work we use Maya, and the animators either animate a special 'moveTrans' node that represents the "position" of the character (or have the exporter generate it for them from the movement of the root node), then the game can read this to know how fast the animation moves the character. So in the Maya file, the character will walk forward for one cycle and this extra node will follow along with them by their feet. I've not seen anything like this in open-source land, and there's certainly no provision for that in the Ogre Exporter script. What do you chaps normally do for this?

sentences:
Blur just one object in Unity I've recently encountered a problem where I needed to blur an object that is inside another object. I've tried several methods to fix this but none of them works properly. In the screenshot below, renders have to happen in order so that the shape is preserved but the middle portion is blurred.

My current setup is this: 3 Cameras each rendering different objects (one object per camera), the white one below is actually a depth mask and only the camera that renders it is clearing the depth mask. The others aren't clearing anything.

When I apply a blur mask on the camera that has the middle portion (Object in the blurmask layer), everything else gets blurred too (there's a background off screen which shouldn't get blurred, that's the reason for Vuforia tag). How do I solve this? Frankly, I'm absolutely stumped at this point and willing to try anything (comments are welcome too).

This is what I have right now (The longer cylinder had a depth-shader in its material which clears any 3D object parts behind it):

sentences:
Game Rooms Server Architecture - ENet CSharp My team and I are working on an upcoming online fighting game using ENet-CSharp (A C# ENet implementation created by nxrighthere), and we're currently designing the architecture of the server. We would be very glad to hear your suggestions concerning a couple of issues we have been struggling with.
Our current plan is to host a dedicated server for the game, which will handle the logic and game loop of each game instance, and the MonoGame clients will simply deliver the user's commands to the server, and present the updated game state received from it. However, we are not sure how to correctly use ENet with our division of independent game rooms.
Let's say, I have 100 concurrent users connected to the server, and 10 independent game rooms, consisting of 10 players each. At first, we thought that we should have a single ENet Host which will handle all of them, and a single independent ENet thread that will simply receive packets from all ends, alerting the corresponding game room to handle it within its game logic. However, it seems a bit unsafe to have one I/O thread shared by multiple different and parallel instances of the game, so our plan is as such:

For each game room (10 players for that matter), a unique ENet Host will be created, and 2 independent threads will run - one for the game loop, and one for the ENet event polling.
The ENet thread will call the Service method with a small timeout, expecting to poll one "Receive" event at each iteration, and will queue the commands received from the players.
The game loop, at the start of each iteration, will dequeue the commands that have been collected since the last iteration, apply them within the game logic, and so on.

Would you guys say this is a good solution to go by?
A question that rose with that:
Correct me if I'm wrong, but as far as I understand, the send rate of the outcoming packets corresponds to the rate of calls to either the "Service" or the "Flush" methods. How can I ensure that at the end of each game loop, the new game state will be broadcasted immediately to the clients? Calling the "Flush" method at the end of each iteration seems logically appropriate, but unsafe at the same time (since it will be called outside the ENet dedicated thread).
Any piece of advice would be more than welcome. Thanks in advance!

sentences:
OpenGL ES respecting alpha for background but not for objects I have a problem with the alpha of my game, maybe it is solved in another post but as I am new in OpenGl and Game developemnt I dont understand most of the vocabulary and cant find a solution.

The problem is I have enemies with alpha and coins with alpha that works great, but when an enemy pass through the coin it take seem the background instead of the coin(same with shoots)

there is a image explaining it

There is the code to draw enemys and coins

public void drawEnemy(GL10 gl)
{
    gl.glFrontFace(GL10.GL_CCW); // Front face in counter-clockwise
                                    // orientation
    gl.glEnable(GL10.GL_CULL_FACE); // Enable cull face
    gl.glCullFace(GL10.GL_BACK); // Cull the back face (don't display)

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Enable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glTexCoordPointer(3, GL10.GL_FLOAT, 0, texBuffer); // Define
                                                            // texture-coords
                                                            // buffer (NEW)

    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    // front
    switch (type)
    {
        case 0:
            gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.textureIDs[0]);
            break;
        case 1:
            gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.naveEnemigaIDs[0]);
            break;
        case 2:
            gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.naveEnemigaIDs2[0]);
            break;
    }

    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);

    gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Disable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_BLEND);
}

public void drawCoin(GL10 gl)
{
    gl.glFrontFace(GL10.GL_CCW); // Front face in counter-clockwise
                                    // orientation
    gl.glEnable(GL10.GL_CULL_FACE); // Enable cull face
    gl.glCullFace(GL10.GL_BACK); // Cull the back face (don't display)

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Enable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glTexCoordPointer(3, GL10.GL_FLOAT, 0, texBuffer); // Define
                                                            // texture-coords
                                                            // buffer (NEW)

    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    // front
    gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.CointextureIDs[0]);
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);

    gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Disable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_BLEND);
}

sentences:
How do I make dialogue only appear once? So I made it so when I walk over a NPC it brings up 12 lines of dialogue, and you press E to get to the next line. When the dialogue is over you can keep pressing E and it will bring the dialogue up every time. I want it so it only brings the dialogue up once. How do I do that?

This is my script for it:

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

public class dialogHolder : MonoBehaviour
{
    public string dialogue;
    private DialogueManager dMan;

    public string[] dialogueLines;

    public float questComplete;

    // Use this for initialization
    void Start()
    {
        dMan = FindObjectOfType<DialogueManager>();
    }

    // Update is called once per frame
    void Update()
    {
    }

    private void OnTriggerStay2D(Collider2D other)
    {
        if (other.gameObject.name == "Shrump")
        {
            if (Input.GetKeyUp(KeyCode.E))
            {
                //dMan.ShowBox(dialogue);
                if (!dMan.dialogActive)
                {
                    dMan.dialogLines = dialogueLines;
                    dMan.currentLine = 0;
                    dMan.ShowDialogue();
                }
            }
        }
    }
}

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:
Ini files only work on my computer. How to create ini files in a directory on another computer? I am creating a game that requires the use of ini files.
The game works perfectly on my computer.
When I create and executable, the executable even uses the ini files when I am programming/testing the game on the engine.
Directory where the ini files are located:
D:\Users\BonecoSinforoso\AppData\Local\Brasmotor_1

The problem occurs when a person from another computer tries to play. The game does not create any ini files.
Even placing the ini files in the zipped file that I put the game on, it gives an error. Because the ini files don't go to a directory that the game can read.
I would like to know how to make my executable create or move the ini files to a directory where the files can be read.

EDIT 1
How do I create the ini files:
ini_open("config.ini");
    arkivoIdioma=ini_read_string("jogoIdioma","arkivoIdioma","");
    dadosNum=ini_read_real("dadosNum","dadosNum",1);
    paradaModo=ini_read_string("paradaModo","modo","automatico");
    paradaPorcAutomatico=ini_read_real("paradaPorcAutomatico","porcentagem",10);
    paradaPorcAviso=ini_read_real("paradaPorcAviso","porcentagem",10);
ini_close();

Searching about, I found something explanatory about the directory:

The ini files get created. Probably you are not looking in the right
place for it. The ini file get created in
%AppData%/Local/"YourGameNameHere" folder, that's where you'll find
all the files you save.

BY JM DG.
LINK:
https://www.reddit.com/r/gamemaker/comments/5d6pf0/how_do_i_create_a_new_ini_file/
Error obtained by a user:

A little earlier, I made a change to the line of this script. I will wait for this user to test again to see if the error has been resolved.

sentences:
Rotating a group of sprites - How to calculate origin I am rotating a group of sprites in XNA, which I developed with the help of the following example:  http://msdn.microsoft.com/en-us/library/bb194912%28v=xnagamestudio.10%29.aspx

It all works very well, however, the rotations rely on a point of origin, which it will rotate around.  The problem is that I do not know how to calculate the point of origin, so that it is exactly in the center of the sprite group.

I am able to set the point of origin to where I want it, but as soon as the sprite group changes, the origin is typically off, and it doesn't rotate from the center of the group.

My main question, is there a way to calculate the center of a group of sprites?  My original idea was to calc the boundaries (left, right, top, bottom), and place the origin the the center, but this doesn't work properly.

sentences:
Dynamic model interactions I am just curious as to how in many games (namely games like arkham asylum/city, manhunt, hitman) do they make it so that your character can "grab" a character in front of you and do stuff to them. I know this may sound very confusing but for an example go to youtube and search "hitman executions", and the first video is an example of what i'm asking.

Basically I'm wondering how they make your model dynamically interact with whatever other model you come across, so in hitman when you come up behind some one with the fibre wire you strangle the other character or if you have the anesthetic you come up behind some person and put your hand over there mouth while they struggle and slowly go to the floor where you lay them down.  I am confused as to whether it was animated to use two models using specific bone/skeletal identifiers, if it is just two completely separate animations that are played at the correct time to make it look like they are actually interacting or something else all together.

I am not an animator so i assume most of what i just said is not right but i hope that some one can understand what i mean and provide an answer.

PS) I am a programmer and I am in the process of building a hitmanesque game, just because i love that style of game and I want to increase my skills on something fun, so if you do know what i'm talking about have some examples with involving both models and programming (i use c++ and mainly Ogre3D at the moment but i am getting into unity and XNA) i would greatly appreciate it.

Thanks.

sentences:
Rotate about a skybox I'm a beginner with OpenGl so please discount my ignorance. I've managed to create a skybox (with a texture mapped cube) and would like to rotate the view (eye) around the center of the box, so I can admire the view :). By changing the X/Y coordinates of eye/camera in GLM.LookAt() I'm able to see most of the faces of the skybox but I'm not able to see the top and bottom faces though I'm sure that they are rendered. In any case what's the best way to rotate around the skybox? What I want to do is exactly shown in this video

Thanks!

EDIT: Sorry for the lack of relevant information.

I'm using OpenGL version 3.3.
Not using immediate mode. Everything is via shaders and VBO/VAO
I have already setup the projection, view and model matrices which I pass to the vertex shader, and obviously have the texture loading also working as I can render the skybox. At the moment i've set the projection and model matrices to Identity for simplicity.
I'm deriving the view matrix from GLM.LookAt(), So initially i thought that to rotate around the view box, I'd just have to change the viewMatrix
I'm working on C# using SharpGL
To draw the skybox, I've set up a VAO to draw a cube with vertices in the range (-1,-1,-1) and (1,1,1). Then I load 6 textures for each cube face to 6 Texture Units. During the rendering I draw the cube and update the texture for each face using a sampler variable. All of this seems to be working OK. I verified this my scaling down the size of the cube and checking if all 6 faces were being rendered properly by rotating the ModelMatrix

I suspect one problem is that I'm not positioning the camera in the center of the cube. At the moment it seems to be viewing the cube from outside. I'm still trying to grasp the usage of GLM.LookAt().

This is how I'm rendering the skybox at the moment. And I can see the front face of the cube, but how do I go about placing the camera in the center of the box and rotating it?

 viewMatrix = mat4.identity();
 projectionMatrix = mat4.identity();
 modelMatrix = mat4.identity();
 viewMatrix = glm.lookAt(new vec3(0f, 0f, 1f), new vec3(0f, 0f, 0f), new vec3(0.0f, 1.0f, 0.0f));

        shaderProgram.Bind(GL);
        shaderProgram.SetUniformMatrix4(GL, "projectionMatrix", projectionMatrix.to_array());
        shaderProgram.SetUniformMatrix4(GL, "viewMatrix", viewMatrix.to_array());
        shaderProgram.SetUniformMatrix4(GL, "modelMatrix", modelMatrix.to_array());

skyBox.renderSkybox(GL);

EDIT #2
I managed to figure out my error. I was trying to look at the Top and Bottom faces by doing
viewMatrix = glm.lookAt(new vec3(0f,-1f, 0f), new vec3(0f, 0f, 0f), new vec3(0.0f,1f, 0f)); and
viewMatrix = glm.lookAt(new vec3(0f, 1f, 0f), new vec3(0f, 0f, 0f), new vec3(0.0f,1f, 0f)); which was giving me a blank screen. The reason being that (0,1,0) is collinear with my up-vector and LookAt() couldn't generate the viewMatrix in this case. Changing the UpVector makes it OK!

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:
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: Is C++ being replaced by C# in industry games? In industry games I mean like Quake, CoD etc.

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:
Game data structure in node.js I am building a simple turn-based game in node.js using sockets.io. My web experience with node.js has typically involved saving everything to a relational database. I set this up for my game. I am using sqlite3 for development and I might use something like PostgreSQL or MySQL for production. I will be doing this for account information regardless of what I set up for handling the actual game.

My concern is that, every time an event is emitted from the socket the whole game-state is loaded into memory from the server. I feel that in practice this will be less efficient than just keeping all of the gamestate data in memory. Events will probably be emitted every 5 seconds or so. A gamestate consists of a set of about 120 groups of small strings and integers (about 10 per group but subject to change).

Is it good practice to keep this type of data in memory?

Should I stick with relational databases?

Should I switch to a third option like a file-based storage structure?

Should I not load the whole gamestate in for every event even though that will lead to a lot more read/writes (at least triple)?

Edit* Clarification: Even though the game is turn based I want the player to be able to see what the opponent is doing on their turn in real time and give the player real time feedback about illegal actions.

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:
Creating a path including loops and spirals I have a paper airplane that I would like to take a "random" path towards its destination based on the game layouts size. I want it to include spirals and loops and gliding a little back and forth.

How would I go on about creating those random movements?

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:
OpenGL ES Framebuffer creation problem I'm having some problems porting my D3D code to OpenGL ES. I have a Graphics Device class that encapsulates all rendering commands. The code below is in an ObjC++ file.

The problem code is the called to get the render buffer width and height. It doesn't actually return any value in the w or h GLints.

It should be noted that the code below is from an older iPhone project, and it works there. Am I missing something really stupid?

Checking the framebuffer status returns a value of complete, since OpenGL ES seems quite happy to initialize a depth buffer with the garbage w and h values I pass to it!

bool GraphicsDevice::Initialize(id<EAGLDrawable> eaglLayer)
{
   EAGLContext *context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
   if(context == nil)
   {
      return false;
   }

   [EAGLContext setCurrentContext:context];

   this->eaglContext = context;

   glGenFramebuffers(1, &frameBuffer);
   glBindBuffer(GL_FRAMEBUFFER, frameBuffer);
   glGenRenderbuffers(1, &renderBuffer);
   glBindBuffer(GL_RENDERBUFFER, renderBuffer);
   [eaglContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:eaglLayer];

   GLint w, h;
   glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &w);
   glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &h);

   SetWidth(static_cast<unsigned int>(w));
   SetHeight(static_cast<unsigned int>(h));

  glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,    renderBuffer);

   glGenRenderbuffers(1, &depthBuffer);
   glBindBuffer(GL_RENDERBUFFER, depthBuffer);
   glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, w, h);

   glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBuffer);

   GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
   if(status != GL_FRAMEBUFFER_COMPLETE)
   {
      System::Log("Framebuffer not complete");
      return false;
   }

   return true;
}

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:
What kind of data structure should I use for a resource container? I am curious what kind of container would be the best choice for a resource container.
BTree, binary search tree or something else?
What like is the priority of the operations over it?
So best inserting performance or best searching performance or between them?

Are there any open source implementation over the net?

sentences:
Animation is slow on iOS Device and fast in Unity editor? I had made a Settings popup in the game and animated it like scale animation (from 0 to 1) values.
It is appearing very smooth and works good in the unity Editor, but after building to the device it appears laggy and jerky.

I have also changed targetFrameRate to 60 but it does not works.
My Game is running at 60 fps but why my animation is running slow and jerky on Device?

Can anyone tell me what i am doing wrong..

Here is my Code:

public void ShowSettings()
{

    settingsAnim.SetBool ("isHidden",false);

}
public void CloseSettings()
{

    settingsAnim.SetBool ("isHidden",true);
}

sentences:
how to set volume of sound depending on the impulse a body receives in Libgdx / Box2d? I am trying to set the volume of a bouncing sound of a ball depending on how hard the ball hits something. so the harder the ball hits a wall or a ground the more loud the bounce sound.
I couldn't find anyway to get the impulse of a body other than the postSolve(Contact contact, ContactImpulse impulse)  method inContactListner class.
But i then realized that unlike the beginContact(Contact contact) method, postSolve(Contact contact, ContactImpulse impulse)  gets called repeatedly until the contact ends. so it repeatedly plays the bouncing sound making it sound stalked and buggy.
I cant use the beginContact(Contact contact) method because there is no way to get the impulse that the ball is receiving from this method. I tried to to use the velocity of the ball instead of impulse inside beginContact(Contact contact)but that didnt yield good results and found it very complicated as i had to consider both horizontal and vertical speeds.
so my question is how can I make the sound play only once if i am using the postSolve(Contact contact, ContactImpulse impulse)  method or is there any other solution to achieve what i am trying to do here?

sentences:
Java Reversi/Othello - Checking if Valid move I've written a gameBoard class for a Reversi/Othello which is the following:

import java.io.Serializable;

public class GameBoard implements Serializable {

private static final long serialVersionUID = 1034285059488509251L;
public char[][] board;

public GameBoard(){
    board = new char[8][8];
    setUpBoard();
}

  public void printBoard() {

      //prints numbers at the top of the board
        System.out.print("  ");
        for(int i = 0; i < board.length; ++i){
            System.out.print(i +  "   ");
        }

        //prints column icons and numbers and side of board
        System.out.println();
        for (int i = 0; i < board.length; i++) {
            System.out.print("| ");
            for (int j = 0; j < board.length; j++) {

                System.out.print(board[i][j] + " | ");
            }
                System.out.print(i);
                System.out.println();
        }

    }

public void setUpBoard(){

      // Loop through rows
    for (int i = 0; i < 8; i++) {

        // Loop through columns
        for (int j = 0; j < 8; j++) {
            board[i][j] = '-';
            System.out.println();
        }
    }

    //sets the default piece positions;
    board[3][3] = 'W';
    board[3][4] =  'B';
    board[4][3] = 'B';
    board[4][4] = 'W';

}

public String toString(){
    StringBuilder b = new StringBuilder();
    for(int i = 0; i < board.length; ++i){
        b.append(i +  "   ");
    }

    b.append("\r\n");
    for (int i = 0; i < board.length; i++) {
        b.append("| ");
        for (int j = 0; j < board.length; j++) {

            b.append(board[i][j] + " | ");
        }
        b.append(i);
        b.append("\r\n");
    }
    return b.toString();
 }
}

This class as you can see handles basics of the game board. Such as printing the board and setting up the default positions. It is also serializable and I have a saving and loading method to store the game state and an overriden toString method so that I can print the board again.

I have another class called boardLogic and I've been messing around in this class for about 4 hours now trying to figure out how to check what is a valid move in Reversi/Othello or not.

The simple rules are:
-You cannot place a piece on any random place
-If you are to place a piece it must me adjacent to another piece of your color Horizontally, vertically or diagonally and it doesn't matter how many pieces are in between.

So, can anyone help me out on how I would go about checking if the player had made a valid move or not.

sentences:
Calculate animation weights based on two variables I am working on a custom engine and have been tinkering with animations using the Cal3D library. My previous experience with animations was based on prototyping a bit with Unity's Mecanim.

Right now, I'm trying to implement a character that can be idle, walk or run and is also able to point it's gun straight, up or down while doing any of the previous animations. As far as I know, this would require two different variables from which to calculate the weights of each animation, these are, the aiming angle and the speed of the player.

At first I thought about separating the hands and head of the player as a partial animation and do a 1DBlender (like the one in Unity) based on the aiming angle to interpolate between three different animations of the arms and head pointing up, straight or down. Then, for the rest of the body, interpolate with another 1DBlender based on the speed. While the solution works, I'm still not completely okay with it, as I cannot have blended animations for the arms and head based not only on the aiming angle but also on the speed (which would allo me to have things like having the head of the character slightly bobbing while pointing down and running and then having the head mostly still while idle).

My idea was to try to implement something similar to one of the 2DBlenders found in unity in such a way that I could have 9 animations (IdlePointingDown, IdlePointingUp, IdlePointingStraight, WalkingPointingUp, ...) and calculate the weight for each animations based on the two variables I have. The issue is that I don't have any idea on how to implement such blender. Could anybody give me any tips on what the pseudocode or general idea would be like, or recommend me a different solution?

Thank you very much.

sentences:
Game Loop: Should resources be initialized in the game loop or in the respective classes? (both?) For example, lets say we have an enemy class in my Android game project. I am initializing the enemy bitmap to be used with certain sprites in my game loops init. I am then calling the respective classes init, which is passed this loaded bitmap.

What is the process associated with initializing resources and classes in the game loop?

If I am totally off course just point me in the right direction.

Thanks! :D

sentences:
Box platform collision I'm working on a platform game and my collision code is to picky. I can't exactly do aabb(?) because the map is represented as metatiles. (23-24 16x16 tiles make up a 300ish pixel resolution.) My game thus far simply takes the player's x/y coords and divides them by 16 to check the current tile the player is in. Thus far the only thing I have managed is a very picky collision by simply checking the divided values against weather the tile in the map is solid or not and setting a bool to the player being blocked in that direction. It works, but not solid as the x and y velocity of the player changes so much the hit point of the collision does as well. For example going left at a small speed seems pixel perfect yet full speed results in the collision taking place 5 pixels before the actual collision.

Can anyone point me in the right direction on this?

sentences:
Pathfinder is making my NPC follow my oldest position only I am trying to make a maze/horror game. I used an online template in the Roblox library as my enemy. I used pathfinder as you will see in the code below. It's finding me like it's supposed to, except it only goes for my LAST position. As you can see in the image below, it completely skipped me, went to my LAST position, then started chasing me. I don't know why it only goes for my last position, and not my current position.
local PathFindingS = game:GetService("PathfindingService")
local humanoid = script.Parent:WaitForChild("Humanoid")
local rootPart = script.Parent:WaitForChild("HumanoidRootPart")
local Players = game:GetService("Players")
game.Workspace.Fruity.Humanoid.WalkSpeed = 60

--To calculate the path
while wait() do

    for i, player in pairs(game.Players:GetPlayers()) do
        local character = game.Workspace:WaitForChild(player.Name)
        local characterPos = character.PrimaryPart.Position
        local path = PathFindingS:CreatePath()
        path:ComputeAsync(rootPart.Position, characterPos)
        game.Workspace.Fruity.HumanoidRootPart:SetNetworkOwner(nil)

        local waypoints = path:GetWaypoints()

        for i, waypoint in pairs(waypoints) do
            local part = Instance.new("Part")
            part.Shape = "Ball"
            part.Material = "Neon"
            part.Size = Vector3.new(0.6,0.6,0.6)
            part.Position = waypoint.Position + Vector3.new(0,2,0)
            part.Anchored = true
            part.CanCollide = false
            part.Parent = game.Workspace
            humanoid:MoveTo(waypoint.Position)
            humanoid.MoveToFinished:Wait()
        end
    end
end

sentences:
Define a circle from a point on its circumference and an angle I'm working on a 2D, top-down driving game with some basic AI vehicles.
The AI Vehicles move along a bidirected graph of positions. Each vehicle has a current position (from the graph) and a target position, but instead of linearly interpolating directly between the positions, the vehicles each have a maximum steering angle, and so must steer their way to the next point.

The vehicle is defined geometrically as follows:

The vehicle itself is a rectangle, comprising a center point (O), a width and a height.
The vehicle has both a front (F) and rear (R)
'axis' from which the wheels are extruded.
The vehicle is steered from the front axis, by an angle defined as (a). The vehicle's
The current heading is (A).
The current steering heading is (B).
The desired target is (T).

The vehicle's heading is only changed when both the steering angle is set and there is some forward motion (i.e. the vehicle cannot turn when standing still).

As long as the target T is sufficiently far enough away, over time the vehicles can be correctly steered towards the targets.

The problem is, when the target is defined too close to the front axis, the vehicle can never reach the target, as the turning arc is too large (they drive around the target indefinitely).

I think the solution is to first detect if the target is 'too close', and if so, the vehicle needs to reverse a little first, and then begin driving forwards again. I think this would be achivable by defining a circle adjacent to the vehicle to detect if the target point can be reached based on the maximum turning angle and current position - but I don't know how to create such a circle. Something like:

How can I create a circle (the origin and radius) from the current vehicle position and max turn angle?
Is there a different, potentially better solution?

Thanks a lot

edit
The following is how I update the position of the vehicle. In a nutshell, the positions of the front and rear wheels are first calculated, and their positions are independently updated. Then the new position of the car is worked out from there. I cut a little for brevity, but it should be enough to see how it works:

private void updateVehicle(BaseVehicle pCar) {

    final float lAccelerationAmt = 30;
    final float lWheelBase = 32;

    pCar.speed += lAccelerationAmt ;

    // Extrude front and rear axels
    pCar.frontWheels.x = pCar.x + lWheelBase / 2 * cos(pCar.rotation);
    pCar.frontWheels.y = pCar.y + lWheelBase / 2 * sin(pCar.rotation);

    pCar.rearWheels.x = pCar.x - lWheelBase / 2 * cos(pCar.rotation);
    pCar.rearWheels.y = pCar.y - lWheelBase / 2 * sin(pCar.rotation);

    // Move the vehicle
    pCar.rearWheels.x += pCar.speed * delta * cos(pCar.rotation);
    pCar.rearWheels.y += pCar.speed * delta * sin(pCar.rotation);

    pCar.frontWheels.x += pCar.speed * delta * cos(pCar.rotation + pCar.steerAngle);
    pCar.frontWheels.y += pCar.speed * delta * sin(pCar.rotation + pCar.steerAngle);

    // Extrapolate the new car location
    pCar.x = (pCar.frontWheels.x + pCar.rearWheels.x) / 2;
    pCar.y = (pCar.frontWheels.y + pCar.rearWheels.y) / 2;

    // update the vehicle heading
    pCar.rotation = atan2(pCar.frontWheels.y - pCar.rearWheels.y, pCar.frontWheels.x - pCar.rearWheels.x);

}

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:
How do I use the DirectX Extension-Library in Windows 8? I need to use the extended DirectX-Library (D3DX...), but I am programming
on Windows 8 (VS), so the DirectX 11-SDK is already included. However, it's included without the extension-library.

Do I have to download the June 2010 SDK? If so, how do I set up VS to work with the extended library?

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: How should I structure a design document? Should the design document be a continuous line of text, with real sentences, more like a description of the entire game, or should I structure it in simple points? What are the benefits, and are there more ways of structuring it?

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:
Delay/Pause game while displaying countdown 3,2,1 go I have already a running script of countdown and it works fine , the problem is that I want to pause or delay the game while the countdown is displaying, the moment countdown finished the player is already dead. Here is my code

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

public class jb : MonoBehaviour {
    private string countdown = "";
    private bool showCountdown = false;
    public AudioSource noise1;
    public AudioSource noise2;
    public Sprite sprite2;
    public Vector2 jump = new Vector2 (0,300);
    private SpriteRenderer spriteRenderer;
    void Start () {
        //GetComponent<Rigidbody2D>().velocity = Vector2.right * speed;
        StartCoroutine(getReady());

        spriteRenderer = GetComponent<SpriteRenderer>();
        noise1.GetComponent<AudioSource>().Play();

    }

    // Update is called once per frame
    void Update () {

        if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
        {
           Vector2 touchPosition = Input.GetTouch(0).position;
            GetComponent<Rigidbody2D>().AddForce(jump);
            //noise1.GetComponent<AudioSource>().Play();
        }

        Vector2 screen_position = Camera.main.WorldToScreenPoint (transform.position);
        if(screen_position.y > Screen.height || screen_position.y < 0)
        {
            noise1.GetComponent<AudioSource>().Stop();
            noise2.GetComponent<AudioSource>().Play();
            StartCoroutine(Die());
        }

    }

    void OnCollisionEnter2D(Collision2D det)
    {
        noise1.GetComponent<AudioSource>().Stop();
        noise2.GetComponent<AudioSource>().Play();
        StartCoroutine(Die());

    }

    IEnumerator Die(){
        PlayerPrefs.SetString( "previousLevel", SceneManager.GetActiveScene().name );
        spriteRenderer.sprite = sprite2;
        yield return new WaitForSeconds (2);
        SceneManager.LoadScene("score");
     }

    IEnumerator getReady()
    {
        showCountdown = true;

        countdown = "3";
        yield return new WaitForSeconds (1);

        countdown = "2";
        yield return new WaitForSeconds (1);

        countdown = "1";
        yield return new WaitForSeconds (1);

        countdown = "GO";
        yield return new WaitForSeconds (1);

        showCountdown = true;
        countdown = "";
    }

    void OnGUI ()
    {
        if (showCountdown)
        {
            GUI.color = Color.red;
            GUI.Box ( new Rect (Screen.width / 2 - 100, 50, 200, 175), "GET READY");

            // display countdown
            GUI.color = Color.white;
            GUI.Box (new Rect (Screen.width / 2 - 90, 75, 180, 140), countdown);
        }
    }
}

what can I do to pause the game? I tried invoke (by creating another function and copying everything over there) in update call but it didn't work.

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:
How do I implement a racing clock that shows elapsed time? I'm wanting to make a old school timer like the picture below. How would I go about doing this in VD? I have tried it doing it with code bellow. The problem with this is that it starts with just seconds only adds the minutes section when you reach 1 minute.

Dim StartTime As DateTime
Dim PlayTime As TimeSpan

 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    StartTime = Now()
    End Sub

  Private Sub tmrCountUp_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrCountUp.Tick

    PlayTime = Now() - StartTime

    lblTime.Text = PlayTime.Hours & PlayTime.Minutes & PlayTime.Seconds

    lblTime.Text = lblTime.Text + 1
End Sub

sentences: Unity, interior poly always missing in clothing I've modeled interior polygons but for some reason they do not show up in Unity. I've tried changing import settings for normals to both calculate and import... How do you have a tshirt's interior poly show up?

sentences: How to apply fast & slow camera transition I know there is a lerp function there that smoothens the camera but I wanted it to work the other way around. Lets say starting position of the player is at the left side of the camera/screen and when the players goes around the right edge (or as long as more than half width) screen travelled I want to camera to snap to the player but with smooth transition and this is the hard part I wanted to make the camera move fast as long as it is less than half of the players distance travelled and apply a slow speed as the camera travels more than half the distance of player.

sentences: Is HTML5 and Canvas good for rapid prototyping of games? Are there frameworks and processes for HTMl5 that can be used for the rapid prototyping of 2D games?

sentences:
Options for 2D Web/iPhone/Android, with Test Framework I would like to make a 2D game with one codebase that runs on iPhone, Android, and web (any flavour of web -- HTML5, Flash, Silverlight, etc.)

What are my options? I should be able to write my code once, and run it anywhere. I also absolutely need the ability to write unit tests (or write a unit-testing framework) -- I cannot make sizable games without testing.

Unity is good, but unity is 3d; even with hacks, the graphical assets will still be 3d. I'm after 2d, not 3d.

(If you need a Mac or separate licensing for the Mac part, that's okay.)

sentences:
XNA and HLSL shaders - Instancing using World Matrix array I have posted this question on StackOverflow and was directed here, so I'll just copy the question:

I am attempting to improvise some sort of hardware instancing in my game. I wish to draw multiple trees with only one Draw Call.

So far, I have set up a class which holds the model, texture, and an array of Matrices. Each matrix corresponds to a location of one tree in the game world.

I have determined to use 50 copies of object as hard coded limit within my class and my shader.

I am sure that the matrices generated are correct ones. Using Basic effect with multiple draw calls and switching out World matrices between them does yield in correct number of trees on their correct locations.

I have tried a shot-in-the dark approach:

float4x4 View;
float4x4 Projection;
float4x4 World[50];

...

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output[50];

    for (int i=0; i<50; i++)
    {
        float4 worldPosition = mul(input.Position, World[i]);
        float4 viewPosition = mul(worldPosition, View);
        output[i].Position = mul(viewPosition, Projection);
        output[i].texCoord = input.texCoord;

        return output[i];
    }

}

To my surprise, this actually did compile, and to even greater surprise, didn't melt my GPU.

To not so big of a surprise, this draws only one tree, the first one, as the loop ends as soon as it hits the "return" keyword as any sane mind would expect it to.

I have tried my google-fu skills with googling this kind of problem, but majority of the results deal with C++ code (I'm using C# + XNA), and their approach to the problem is basically to collect all needed model's vertices and forward all that, as one huge model drawn with one World matrix position.

Is there a reliable way to draw one model using an array of World matrices on a shader, or must I collect all vertex data and batch it that way?

P.S. I am attempting to toy around with nested structures, like these:

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 texCoord : TEXCOORD0;
};

struct VSOUT
{
    VertexShaderOutput output[50];
};

VSOUT VertexShaderFunction(VertexShaderInput input)
{
    VSOUT output;

    for (int i=0; i<50; i++)
    {
        float4 worldPosition = mul(input.Position, World[i]);
        float4 viewPosition = mul(worldPosition, View);
        output.output[i].Position = mul(viewPosition, Projection);
        output.output[i].texCoord = input.texCoord;

    }

    return output;
}

But, of course, as the loop gets unrolled, the very next instance of Output gives an overlapping semantic error. I am pretty sure there are no POSITION50 and TEXCOORD50 semantics :p So, how would I go about solving this problem?

Thank you in advance!

sentences:
Error in DRAW GUI event on android. (GameMaker) Image of the game on a mobile phone:

As you can see the maze (draw event) has been resized correctly.

But the yellow post-it (draw GUI event) has not been scaled or displayed in the correct location (center of the screen). Same thing with GUI layout (draw GUI event).

Because this is a small stage/room (size) I do not use the artifice of views, I thought that could be because of that the problem, but I enabled the views and did not get any different result.

Picture of the game on a computer (like it should be on the phone):

OBS - One information that can help you to help me solve the problem, is that to draw the post- it I use the following code: draw GUI event draw_sprite(spr_Post,0,640,360);.

640 is the half screen width of the game and also the room, 360 is half the height of the game screen and also the room.

It seems that somehow the room on the cell phone is different size than 1280x720.

I do not put the following code: draw GUI event draw_sprite(spr_Post,0,room_width/2,room_height/2), because there are much larger phases that need views, so the post-it needs to be in the center of the screen of the player, and with this code it ends up being in the center of the phase.

I tested the game on Bluestacks and it did not happen the same as on the phone.

sentences:
RPG like hit points growth algorithms help I am currently making an XNA game in C#. I want to increase health as the player level up. I am currently using this equation.

  MaxHealth = Convert.ToInt32(100 * Math.Pow(1.17, level - 1));

Its fine before the first 20 levels, but afterwards the health starts to increase extremely fast:

  Level 1: 100 Hp.

  Level 20: 1.975 Hp.

  Level 30: 9.493 Hp.

  Level 40: 45.630 Hp.

  Level 100: 658.546.089 Hp.

  Level 109: Crash: value too big for an integer.

How should i create these growth algorithms, so that the growth of hit points pr. level, will increase slowly. This is just an example, if you know a better growth rate, I will be happy to know that too.

  level 2: Hp = base health + 60 (Base health = 100)

  level 3: Hp = base helath + 60 + 120

  level 4: Hp = base helath + 60 + 120 + 180.

But the max health formular will run on every update/tick, so all this should happen in the same calculation.

Edit:

Thank you all for your input, I really appreciate it. But while away from the question, I found a solution myself. Thank you very much. The solution:

if (level < 35)
    this.baseMaxHealth = Convert.ToInt32((vitality * 10) + Math.Pow(level, 2) * 4);
else
    this.baseMaxHealth = Convert.ToInt32((vitality * (level - 25)) + Math.Pow(level, 2) * 4);

I added vitality as an upgrade you can spend skill points or something on

EDIT 2:

I improved the code a bit

        if (level < 35)
            this.baseMaxHealth = Convert.ToInt32((vitality * 10) + Math.Pow(level, 2) * 4);
        else if (level > 125)
            this.baseMaxHealth = Convert.ToInt32((vitality * 100) + Math.Pow(level, 2) * 4);
        else
            this.baseMaxHealth = Convert.ToInt32((vitality * (level - 25)) + Math.Pow(level, 2) * 4);

sentences:
Unity gravity not effecting everyone like it should so My problem is a bit weird. I have a model that will not fall at the correct speed. She falls incredibly slowly. This is the only script attached to her, and I did the "Scale to large" test by placing a box next to her and letting them drop at the same time. The box fell instantly to the ground and she just kind floats taking her time.

Gravity is on kinematic is off, I'm out of ideas and could use some help. :D!

Thank you.

This is unity in c#.

using UnityEngine;

using System.Collections;

public class PlayerController : MonoBehaviour {

// public variables
public float speed = 1.5f;
public float JumpH = 1.5f;
public float RotateSpeed = 30f;

//pivate component checks
private Animator animr;
private Rigidbody LillyRB;

//private generic bits.
private bool checker;
private float movever;
private float movehor;
private float turn;

void Start (){
    LillyRB = GetComponent<Rigidbody> ();
    animr = GetComponent<Animator> ();

}

void FixedUpdate () {

    // movevertical and move horizontal check for player input wasd
    // jump checks for jump/spacebar.

    movever = Input.GetAxisRaw ("Vertical");
    movehor = Input.GetAxisRaw ("Horizontal");
    turn = Input.GetAxisRaw ("mouse x");
    Quaternion rot = LillyRB.rotation;

    Quaternion Exturn = Quaternion.Euler (0.0f, RotateSpeed * Time.deltaTime *  turn + rot.eulerAngles.y, 0.0f);

    if (movehor != 0 || movever != 0) {
        checker = true;
    }
    else {
        checker = false;
    }

    animr.SetBool ("IsMoving", checker);
    LillyRB.MoveRotation (Exturn);
    LillyRB.MovePosition (LillyRB.position + (transform.forward * movever));
    LillyRB.MovePosition (LillyRB.position + (transform.right * movehor));

}

}

sentences:
Tiled map seen from an angle I have working code to display a tiled map. It's composed of a OrthogonalTiledMapRenderer and an OrthoGraphicCamera :

camera.setToOrtho(false, WORLD_WINDOW_SIZE.x,
            WORLD_WINDOW_SIZE.y);

renderer = new OrthogonalTiledMapRenderer(tiledmap, 1 / TILE_WIDTH);

renderer.setView(camera);

So far so good. The map is rendered as seen from above:

My question is, how do I render it with the camera not facing right down to the floor?

Like this:

[Thanks to all GIMP developers :) ]

Is it possible? I tried Camera.rotate(45) but it rotates in the wrong axis. I can't set Camera.direction because of this  - taken from OrthogonalTiledMapRenderer.setView(camera) documentation :

  Sets the projection matrix and viewbounds from the given camera. If
  the camera changes, you have to call this method again. The viewbounds
     are taken from the camera's position and viewport size as well as
  the    scale. This method will only work if the camera's direction
  vector     is (0,0,-1) and its up vector is (0, 1, 0), which are the
  defaults.

If I change the camera direction, the renders are weird or non-existant.

Is it possible to do so with the standard LibGDX api? If not, how can I do this? If not are there any workarounds to get the same effect?

sentences:
How do I position a mesh just outside the camera view? I want to slide in an object into view, coming from the right of the screen.

In order to achieve this, I need to position the object next to the camera view, so that it is still not visible, but close enough for a quick slide in.

For example, placing the object at X=1000000 (so that it is surely outside the camera view) for safety wouldn't work as it couldn't slide in quickly enough. For a reasonable slide, I would need to have it really close next to the camera view.

How could I calculate the object's position for that?

Thank you.

Edit:

Here is the script that I'm now using and which I'm still having problems with:

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

public class NewBehaviourScript : MonoBehaviour
{
    void Update()
    {
        float fDist = Mathf.Abs(Camera.main.transform.position.z - this.transform.position.z);
        Bounds b = BoundsFromTransform(this.transform);

        this.transform.position = GetPointLeftOfCamera(Camera.main, fDist, b.size.magnitude / 2);
    }

    public static Bounds BoundsFromTransform(Transform uTransform)
    {

        Bounds bounds = new Bounds(uTransform.position, Vector3.zero);

        foreach (Renderer renderer in uTransform.GetComponentsInChildren<Renderer>())
        {
            bounds.Encapsulate(renderer.bounds);
        }

        Vector3 nOff = bounds.center - uTransform.position;

        return new Bounds(nOff, bounds.size);
    }
    public static Vector3 GetPointLeftOfCamera(Camera camera, float distance, float goDiameter)
    {
        // 1.
        var ray = camera.ScreenPointToRay(new Vector3(0, camera.pixelHeight / 2f, 0));

        // 2.
        var borderPoint = ray.GetPoint(distance);

        // 3.
        var leftPlane = GeometryUtility.CalculateFrustumPlanes(camera)[0];
        var frustumLeft = leftPlane.normal;

        // 4.
        var halfDiameter = goDiameter / 2f;
        return borderPoint + frustumLeft * halfDiameter;
    }
    public static Vector3 GetPointRightOfCamera(Camera camera, float distance, float goDiameter)
    {
        var ray = camera.ScreenPointToRay(new Vector3(camera.pixelWidth - 1, camera.pixelHeight / 2f, 0));
        var borderPoint = ray.GetPoint(distance);

        var rightPlane = GeometryUtility.CalculateFrustumPlanes(camera)[1];
        var frustumRight = rightPlane.normal;

        var halfDiameter = goDiameter / 2f;
        return borderPoint + frustumRight * halfDiameter;
    }
}

sentences:
How to stop all character movement when jumping against the side of a platform? My Sprite is Moving against a platform.

I have a script and an unusual one (that's what one of the member said.) My isGrounded isn't using any rayCasting. I didn't have any problem with it but when I created a platform and jump against it:

My character would fall down slowly.
If I try to move against the platform, I would be able to move and it would appear as if the character was flying.

So question is, how can I stop all my movements, jumping everything, when I collide like this with a platform?

My Code is:

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

public class pScript : MonoBehaviour {
    public Rigidbody2D rb;
    [SerializeField]
    public Transform[] Points;
    [SerializeField]
    public float radius;
    [SerializeField]
    public LayerMask layer;
    public bool jump;
    public bool isgrounded = false;
    [SerializeField]
    public float MoveSpeed;
    [SerializeField ]
    public float jumpHigh;
    public bool facingRight;
    public Animator animator;
    public Object CallfPanel;
    public Object CallfText;
    public float Move = 8f;
    public Vector3 Dir;
    public Vector3 tart;
    // Use this for initialization
    void Start () {
        rb = GetComponent<Rigidbody2D> ();
        animator = GetComponent<Animator> ();
        CallfPanel = GameObject.Find ("Panel");
        CallfText = GameObject.Find ("Text");
    }

    // Update is called once per frame
    void Update () {
        RaycastHit hit;
        Debug.DrawRay (transform.position, Vector3.right, Color.white, Move);
        tart = new Vector3 (200, 300, transform.position.z);
        Dir = Vector3.right;
        if (jump == true) {
            if (Physics.Raycast (tart, Dir, out hit, Move)) {
                jump = false;
            }
        }

        float horizontal = Input.GetAxis ("Horizontal");
        animator.SetFloat ("speed", Mathf.Abs (horizontal));

        isgrounded = isGrounded ();
        rb.velocity = new Vector2 (horizontal * MoveSpeed, rb.velocity.y);
        if (Input.GetKeyDown (KeyCode.Space)) {
            jump = true;
        }
        if (isgrounded && jump == true) {
            isgrounded = false;
            rb.velocity = new Vector2 (0, jumpHigh);
        }
        if (isgrounded == false) {
            jump = false;
        }
        changeDirections ();
    }
    private bool isGrounded(){

        if (rb.velocity.y <= 0) {
            foreach (Transform points in Points) {
                Collider2D[] collider = Physics2D.OverlapCircleAll (points.position, radius, layer);
                for (int i = 0; i < collider.Length; i++) {
                    if (collider [i].gameObject != gameObject) {
                        return true;
                    }

                }

            }

        }return false;
    }
    public void changeDirections(){
        float horizontal = Input.GetAxis("Horizontal");
        Vector3 theScale = transform.localScale;
        if (theScale.x == 1) {
            facingRight = true;
        } else {
            facingRight = false;
        }

        if (horizontal > 0 && !facingRight || horizontal < 0 && facingRight) {
            theScale.x *= -1;
            transform.localScale = theScale;
        }
}
    public void showTextDuration(){
        float lifetime = 4.0f;
        Destroy (CallfPanel, lifetime);

}
}

sentences:
How can I change the rotatearound radius in real time when the game is running? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TargetBehaviour : MonoBehaviour
{
    // Add this script to Cube(2)
    [Header("Add your turret")]
    public GameObject Turret;//to get the position in worldspace to which this gameObject will rotate around.

    [Header("The axis by which it will rotate around")]
    public Vector3 axis;//by which axis it will rotate. x,y or z.

    [Header("Angle covered per update")]
    public float angle; //or the speed of rotation.

    public float upperLimit, lowerLimit, delay;// upperLimit & lowerLimit: heighest & lowest height;
    private float height, prevHeight, time;//height:height it is trying to reach(randomly generated); prevHeight:stores last value of height;delay in radomness;

    [Range(0, 50)]
    public float xradius = 5;
    [Range(0, 50)]
    public float yradius = 5;

    private void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        //Gets the position of your 'Turret' and rotates this gameObject around it by the 'axis' provided at speed 'angle' in degrees per update
        transform.RotateAround(Turret.transform.position, axis.normalized, angle);
        time += Time.deltaTime;
        //Sets value of 'height' randomly within 'upperLimit' & 'lowerLimit' after delay
        if (time > delay)
        {
            prevHeight = height;
            height = Random.Range(lowerLimit, upperLimit);
            time = 0;
        }
        //Mathf.Lerp changes height from 'prevHeight' to 'height' gradually (smooth transition)
        transform.position = new Vector3(transform.position.x, Mathf.Lerp(prevHeight, height, time), transform.position.z);
    }
}

Using the xradius and yradius sliders I want to change the transform.RotateAround radius in real time.

UPDATE:

I added this to the Update:

if (radius > 0)
        {
            var newPos = (transform.position - Turret.transform.position).normalized * radius;
            newPos += Turret.transform.position;
            transform.position = newPos;
        }

The problem is now that some times when the radius the distance from the Turret is small for example 20 or less some times the transform is getting right above the turret not sure why. I want it to rotate around the turret at the fixed set distance(radius) but not to be above the turret. Can't figure out why sometimes it's moving right above the turret then after some time it's getting back to the set distance.

sentences:
What is the math behind the light effect in krakatoa? I'd like to know the math behind the light effect in krakatoa (click here for an example).

Light source is traveling with particles, but how is shading done? Is it something simple, like Phong shading? Is it possible to implement such effect in real time on GPU?

sentences:
Heightmap, Voxel, Polygon (geometry) terrains In relation to Heightmap, Voxel and Polygon (geometry) terrains:

What are the main differences between all these three?
Can you form a "smooth" terrain with Voxels, I mean, can you for example get a smooth mountain with Voxels, or Voxels are limited to cubes?
Performance wise, a world 2000x2000 units, what would be faster Heightmap terrain, Voxel terrain or Polygon based, geometry terrain? (Assuming that there is "reasonable" performance gains/optimization done for rendering for every of possibilities)
Are there any more techniques used for terrain creation?
Any good titles representing each of types?

P.S. Polygon based terrain should be fully traingulated, no squareish stuff.

sentences:
Distributed C++ game server which use database My C++ turn-based game server (which uses database) does not stand against current average amount of clients (players), so I want to expand it to multiple (more then one) amount of computers and databases where all clients still will remain within single game world (servers will must communicate with each other and use multiple databases).

Is there some tutorials/books/common standards which explain how to do it in a best way?

sentences:
Game numbers and meaning Each game has it's own "maximum number". One question that comes into mind every time I play a(nother) game is how are these maximums determined and how do these affect gameplay? To explain, here's some rough references from games and anime.

Numbers on Levels

One instance is the "level cap". In some games, it's 100 - which I can easily understand to be like percentage. But other games have weird level caps. I remember Fallout (3?) having a level cap of 30. The anime Log Horizon has a level cap of 90 (and increased to 100 after "the apocalypse"). Ragnarok Online once had 99, then increased (to 120?) for Renewal servers.

Numbers on Attributes

Another instance is attributes (Strength, Agility, Intelligence etc.). Ragnarok Online starts you at 5 a piece and level up in small increments. Skyrim starts you at ~15-25 depending on race. In the anime Sword Art Online, they have this scale of 1000.

Numbers on Damage

Then there's attack power. In Yu-Gi-Oh card game, the attack power comes in the thousands. MTG on the other hand is as small as 0-10, with the 1-6 range as very common numbers. DotA damage starts <100 and reach as high as 2000 on critical strikes.

Exceeding caps

Then there's this Skyrim mod that makes you level up in excess of the cap. Why would they make something like that? Is there something beyond the level cap that the regular game doesn't address? Is the system not enough?

In summary, here's my questions:

How are these scales and maximums determined? Is there some magical formula or a generic guideline (like from a game)?
How does these number affect overall gameplay? I mean I can have a 100-scale that does the same thing as 1000-scale or 10000-scale. But why do they opt for these numbers? Why go for smaller ones or the insanely huge ones?
Why is there a level cap? And what does it mean when the level cap is broken or increased?

sentences:
Unity: How to make input field respond to only double taps in Android? I am using Unity in my Android project. There are input fields in my app. As soon as I click on the field the keyboard pops up. I want the keyboard to only show up when there is a double-tap on the field. But I am not able to get it to work and I have tried several ways.

Requirement 1: Single tap shouldn't open keyboard

Requirement 2: Double tap should open keyboard

I tried OnPointerClick method of IPointerClickHandler but this doesn't seem to work. I used this code in one of the scripts attached to input field with IPointerClickHandler.

public void OnPointerClick(PointerEventData eventData)
{
    if (eventData.clickCount == 2)
    {
        Debug.Log("UNITY - Double click");
    }
    else if (eventData.clickCount == 1)
    {
        Debug.Log("UNITY - Single click");
    }
}

Then there is also the question of how to hide the keyboard or prevent it from opening on single tap. This also I am not able to solve. I started with clicking the Hide Soft Keyboard in control setting of InputField in Unity editor. But surprisingly this starts opening a keyboard which has mobile input.

Can someone help? I have been stuck on this for some time I can't seem to be getting anywhere.

sentences:
Tools for assembling textures into DDS files There are plenty of tools for making images. I'm not looking for one of those; I have many tools for creating an image. I've got tools for compressing images, generating mipmaps, and even for poking at their basic data format.

My issue is with texture assembly. DDS files support cubemaps, array textures, and even cubemap arrays. But I don't know of a tool that can pack a series of images into a cubemap or the like. What tools are available for doing this kind of thing?

sentences:
libgdx, how to check collision of randomly generated actors? I have two groups of randomly generated actors, one is bullets second is enemies. And as of now I have no idea how to check collision of randomly genrated actors and remove the overlaped actors. I'm newby.

At least provide some pseudocode! Thanx in advance!!!

sentences:
Advice on playtester recruiting strategy for closed beta? I am the lead programmer for a small game company working on our first release. A top down turn based historical WWII strategy game. Because our game appeals to WWII buffs and players who enjoy ‘simulation’ levels of detail we started by posting discussions of the game and invitations to the beta on WWII related sites like (WW2 Talk, The Wargamer, Axis History Forum etc.) However, we have had comparatively little response or willingness to participate in a beta from these communities.

What are some successful strategies that others in our position (small houses working on first projects) have used, or would suggest to attract and recruit beta testers?

sentences:
Strange 3D game engine camera with X,Y,Zoom instead of X,Y,Z I'm using a 3D game engine, that uses a 4x4 matrix to modify the camera projection, in this format:

 r r r  x
 r r r  y
 r r r  z
 - - -  zoom

Strangely though, the camera does not respond to the Z translation parameter, and so you're forced to use X, Y, Zoom to move the camera around. Technically this is plausible for isometric-style games such as Age Of Empires III. But this is a 3D engine, and so why would they have designed the camera to ignore Z and respond only to zoom? Am I missing something here? I've tried every method of setting the camera and it really seems to ignore Z.

So currently I have to resort to moving the main object in the scene graph instead of moving the camera in relation to the objects.

My question: Do you have any idea why the engine would use such a scheme? Is it common? Why? Or does it seem like I'm missing something and the SetProjection(Matrix) function is broken and somehow ignores the Z translation in the matrix? (unlikely, but possible) Anyhow, what are the workarounds? Is moving objects around the only way?

Edit: I'm sorry I cannot reveal much about the engine because we're in a binding contract. It's a locally developed engine (Australia) written in managed C# used for data visualizations.

Edit: The default mode of the engine is orthographic, although I've switched it into perspective mode. Its probably more effective to use X, Y, Zoom in orthographic mode, but I need to use perspective mode to render everyday objects as well.

sentences: Unity how do I play an intro only the first time the player starts the game? I have an intro animation scene in my game that I want to play the first time the player hits play from the main menu. How do I do this?

sentences: Unpack the pak file - Unreal Engine So I have the encryption key. This is stressed so much to have it. Well, I have it. Where do I use it? Unrealpak does not seems to offer an option to supply the encryption key, if your pak is encypted - the unpackaging simply fails.

sentences: How to extract a point in LibGdx from Tiled map? Tiled has a feature to insert a point in to an Object layer. But there doesn't seem to be a "PointMapObject" implementation in Libgdx on the doc. currently i am being forced to use a PolylineMap Object with two vertices but all i want is only the x or y of the first vertex.

sentences: Are models on 3D warehouse free of copyright? Are models on sketchup's 3D warehouse free to use for personal or commercial work? I haven't been able to find copyright information on the site.

sentences: SDL2 for hardware accelerated graphics? I am attempting to make a 3d game using SDL2 just to learn and have a bit of fun. I was wondering if there is any way to get SDL2 do calculations on GPU. I have read that SDL2 Textures uses GPU for calculation, but is there any way to get it to do calculations from my functions using GPU? For example, if I have a function multiplyVectorWithMatrix, and there is a bunch of additions going on in that function, how would I get SDL2 to do those additions using GPU rather than CPU?

sentences: Best mobile games resolution ratio What is the best landscape and portrait resolution ratios that will fit the most of the devices out there and the black bars size will be minimum?

sentences:
SDL_Image setup problems on windows / mingw 64 / eclipse I've been a software developer for a while, but I haven't done C++ in a long time and I thought I'd try it out with some game developement.  I'm following the tutorial on youtube for Remaking Cavestory in C++ (great tutorial so far).  I'm on Episode 4.  I liked the sound of doing some 64 bit dev, so after a bunch of struggling I got SDL2 to work, scouring the internet and some trial & error I got it set up using the x86_64 libraries with a MinGW-w64 installation.  I opted not to copy lib and include files into mingw as suggested by some guides.  Instead, I figured I could "point" eclipse at the proper folders and everything should work.  This was true up until trying to integrate the SDL_Image library.  I have everything set up such that SDL.h is found by the compiler, and SDL_image.h is found by the compiler.  That is, the SDL.h and SDL_image.h as referenced by my project code are fine.  The problem is the compiler fails on SDL_image.h because IT references SDL.h and that reference is apparently bad.

Windows 10 64 bit (pro I think, though I doubt it matters)
eclipse Neon.2 (4.6.2)
MinGW-w64 (I think 4.3.0)
SDL2 (2.0.5)
SDL_image (2.0.1)

Here's where all of my files are:

C:\MinGW-w64\mingw64
C:\MinGW-w64\mingw64\bin
C:\MinGW-w64\mingw64\include
C:\MinGW-w64\mingw64\lib
C:\MinGW-w64\mingw64\x86_64-w64-mingw32
C:\MinGW-w64\mingw64\x86_64-w64-mingw32\bin
C:\MinGW-w64\mingw64\x86_64-w64-mingw32\include
C:\MinGW-w64\mingw64\x86_64-w64-mingw32\lib

F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32
F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\bin
F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\include
F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\lib

F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\bin
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\include
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\lib

In eclipse I have the following configured:

Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Includes:

"${workspace_loc:/cavestory-development/source/headers}"
"F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\include"
"F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\include"

Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MinGW C++ Linker -> Libraries:

(top box: Libraries (-l))

SDL2
SDL2main
SDL2_image

(bottom box: Library search path (-L)

"F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\lib"
"F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\lib"

Project -> Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C++:

/cavestorye-development/source/headers
F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\include
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\include

Project -> Properties -> C/C++ General -> Paths and Symbols -> Libraries:

SDL2
SDL2main
SDL2_image

Project -> Properties -> C/C++ General -> Paths and Symbols -> Library Paths:

F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\lib
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\lib

I've also copied all of the DLLs from these two folders into my Debug (where my .exe is created)

F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\bin
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\bin

When I build the project, I get the following error:

F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\include/SDL2/SDL_image.h:27:17: fatal error: SDL.h: No such file or directory

It seems that when the compiler looks at SDL_image.h, it sees that THAT file includes SDL.h, which it can't find.  Again, this worked when I was only including SDL2, and broke when I tried to include SDL2_image because the image library references the normal library in a way that can't be reconciled.

Has anyone dealt with this before?  Let me know if I've left out any pertinent information.

sentences:
How can I determine the extreme color values in a texture? I am looking for a way to determine the most extreme color values for all of the texels in a texture. So for a texture consisting only of black and white texels, the extreme values should be (0,0,0) and (1,1,1) expressed in RGB format. For a color gradient from red to green I should get the values (1,0,0) and (0,1,0).

Now obviously I could do this on the CPU by iterating over all the pixels/texels of the texture and keeping track of the color values found to be most apart from each other, but this is probably relatively slow, so I am looking for a way to do this using the GPU/shaders.

Is this possible using shaders? I am not experienced with GPGPU, so a solution in HLSL/GLSL would be preferred. Or maybe there is a fast algorithm I could use on the CPU?

sentences:
How to do placeable electricity cables that work like the ones in "Prison Architect" I would like to know one (of the probably many) ways to code a (sort of) Prison-Architect-ish electricity cable building system.

Here's a picture of what I mean:

How can I detect that cables are connected?
How can I detect if the block it's connected to is a power source?

And these 2 (above) will all be placed inside a dictionary when they are placed.

That dictionary does not yet have a key type, but the second type is a sprite.

How should I do this?

sentences:
FSM AI design with no accept states I'm new to game development and design, I've been looking forward to doing FSM AI design as it seems interesting to me, but I have a question that I see no answer for in the internet.

I've seen FSM diagrams from, for example, Pac-Man, and I noticed that the FSM has no accept states, it makes sense because the enemies are always active and in their different states (Wandering, chasing Pac-Man, running from Pac-Man, recovering in their house) What obviously stops the FSM of the enemies in Pac-Man is either Pac-Man dying or the level ending, but that seems more like brute force than a design decision.

I can imagine some FSM where the enemy just "dies" and that would be an acceptation state as it ended it's process, but again, in many sources I see that some designs just have no accept states. Could someone explain why is this?

Also, what would you do to prevent no-accept states FSM?

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:
LibGdx animation sequence In my game the character movement animations work fine
but now I'm trying to do a sequence of programmatic animations,
for an enemy character, and it's proving to be a pain.

I'm just doing it on Android.

I have the enemy character doing a walking animation till
it reaches and end position, then I want it to do a three frame
throw animation.  It's walk animation is fine.

Since I only want to do the throw animation frames once, I tried to use
Animation.PlayMode.NORMAL, and try to use isAnimationFinished().

I also tried to get the frame number using getKeyFrameIndex()
to try to detect when it showed the last frame.

But in both cases, when it reaches the end position, either I just
see a flash of one of the throwing frames, or nothing at all,
and it says it's "finished" with the animation, using one of the above
ways to test it.

objectBatch.draw(
    animation.getKeyFrame(throwingSkeletonObject.fStateTime),
    throwingSkeletonObject.position.x,  // x
    throwingSkeletonObject.position.y,  // y
    1,      // width
    1);     // height

I'm using the fStateTime that was passed into the Object from the
update() of the Object.  For the walking animation I use:

 animation.setPlayMode(Animation.PlayMode.LOOP);

and for the throw animation:

 animation.setPlayMode(Animation.PlayMode.NORMAL);

The frameDuration for the walk animation is 0.7f and for the throw 0.3f.

So what do I need to do to be able to actually see
all the frames of the throw animation, and then be able to
tell when that's "finished", so I can go back to the walk
animation going the other way or whatever?

I've tried lots of different combinations of things, including using
a slower throw frameDuration, and nothing seems to really work.

Eventually I want to try to get the Boss animations going
and those are much more complicated, so I want to get
this fairly simple sequence to work.

UPDATE:

In the update() I'm doing:

throwingSkeletonObject.fStateTime += fDeltaTime;

The game is 2D, and I'm not using scene2D.

UPDATE  SOLVED?:

I wrote a smaller test app in hopes of replicating the problem
but it worked pretty well.  When it did the throw animation I reset the
StateTime back to zero, so as a test, I commented that out so it used the
same StateTime as the walking animation and it only showed one
frame of the throwing animation, so I think that was the problem.
But I'm not sure about the throwing animation "end" test, I'm hoping
that that will also work now.

sentences:
Best physics engine for OpenGL ES (different implementations)? Can you recommend a good physics engine which is easily portable between WebGL and other OpenGL ES implementations like in Android and iPhone?

I don't want a game engine. Only the physics part.

sentences:
Box selecting (checking if rect contains selectable objects) I'm trying to get a simple RTS-style box or drag select to work. Right now, the drawing of the rectangle works properly. I'm using OnGUI, and understand why one should generally avoid it, but I'll change it at some point. Currently, I'm interested in how to test to see if there are any selectable objects "contained" in the drawn rectangle using rect.Contains.

I have a simple script that transforms positions from world space to screen space.

public Vector2 screenCoordinates;

void Awake()
{
    screenCoordinates = Camera.main.WorldToScreenPoint(transform.position);
}

Then, here is the script which I want to attach to a Game Manager object.

public class BoxSelection : MonoBehaviour
{
    Vector2 boxStartPos;
    Vector2 boxEndPos;
    Rect selectionArea;
    public Texture texture;

    List<GameObject> selectableObjects;

    void Awake()
    {
        selectableObjects = new List<GameObject>();
    }

    void Update()
    {
        // if left mouse button is being clicked or held down
        if (Input.GetMouseButton(0))
        {
            // called on the first update in which the left mouse button is clicked
            if (Input.GetMouseButtonDown(0))
            {
                boxStartPos = Input.mousePosition;
            }
            // called on all other updates in which the left mouse button is held down
            else
            {
                boxEndPos = Input.mousePosition;
            }

            selectionArea = new Rect(boxStartPos.x, Screen.height - boxStartPos.y,
                                     boxEndPos.x - boxStartPos.x, -1 * ((Screen.height - boxStartPos.y) - (Screen.height - boxEndPos.y)));
        }
        // if left mouse button is neither being clicked nor held down
        else
        {
            // handle unit selection

            //if (selectionArea.Contains(*the screenpoint of selectable object*, true))
            //{
            //  add it to a list, activate that object's selection indicator... etc
            //}

            // Reset box positions
            boxStartPos = Vector2.zero;
            boxEndPos = Vector2.zero;
        }
    }

    void OnGUI()
    {
        // if box positions are not zero
        if (boxStartPos != Vector2.zero && boxEndPos != Vector2.zero)
        {
            Color textureColor = GUI.color;
            textureColor.a = 0.25f;
            GUI.color = textureColor;

            GUI.DrawTexture(selectionArea, texture);
        }
    }
}

The part under which I've commented "handle unit selection" is what I'm struggling with. I've written it in pseudocode I guess, but I'm not sure what the actual code should look like. Each object knows it's screen position since the simple screen point script is attached to them. But, the BoxSelection script doesn't have the references for which objects to test. Should I be doing this on a script attached to the selectable objects?

Thanks

sentences:
How to raycast from a UI element How do I raycast from a UI object?
I have tried

Ray ray;
Camera cam;
Transform obj; //UI object

ray = cam.ViewportPointToRay(obj.position);

AND

ray = new Ray(obj.position, obj.forward);

Neither of these seem to work.

sentences:
How to make a variable remain false after release of a button? left_click = mouse_check_button_pressed (mb_left)

battleMode = true

if (left_click) battleMode = false

if battleMode = false then {
  if (key_right) then {
  x= x+5
  sprite_index= spr_walking
  image_speed = 0.5
  }
}

battleMode becomes true again once left click is not being held. I tried changing mouse_check_button_pressed to mouse_check_button_released and mouse_check_button, but battleMode becomes true again when left_click has done its job.

sentences:
How does Starcraft 2 load its metadata? Lets say you are playing Starcraft 2 melee map. The game loads the map.
Melee maps have the following dependencies:

Liberty (Mod)
Liberty Multi (Mod)

I think the game engine will load the data from Liberty (Mod) first, then from Liberty Multi (Mod). For data that exists in both dependencies, the engine will use the one from
Liberty Multi (Mod). Is this correct?

Liberty Multi (Mod) is updated with each patch of Starcraft 2.
Does the game engine load just the latest version of Liberty Multi (Mod)?
  or
Does the game engine load all the versions and overwrite duplicate data with the latest version?

sentences:
Surface Depth Intersection Shader I recently asked a question about the creating an accurate Depth Intersection Shader.

When creating this in a fragment / vertex shader it could be achieved by the following code

SubShader
{
    Blend SrcAlpha OneMinusSrcAlpha
    ZWrite On

    Tags
    {
        "RenderType" = "Transparent"
        "Queue" = "Transparent"
    }

    Pass
    {
        CGPROGRAM
        #pragma target 3.0
        #pragma vertex vert
        #pragma fragment frag

        #include "UnityCG.cginc"

        struct appdata
        {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
            float3 normal : NORMAL;
        };

        struct v2f
        {
            float2 uv : TEXCOORD0;
        };

        sampler2D _MainTex;
        float4 _MainTex_ST;
        sampler2D _CameraDepthTexture;
        fixed4 _Color;
        fixed4 _GlowColor;
        float _FadeLength;

        v2f vert(appdata v, out float4 vertex : SV_POSITION)
        {
            v2f o;
            vertex = UnityObjectToClipPos(v.vertex);
            o.uv = TRANSFORM_TEX(v.uv, _MainTex);

            return o;
        }

        fixed4 frag (v2f i, UNITY_VPOS_TYPE vpos : VPOS) : SV_Target
        {
            float2 screenuv = vpos.xy / _ScreenParams.xy;
            float screenDepth = Linear01Depth(tex2D(_CameraDepthTexture, screenuv));
            float diff = screenDepth - Linear01Depth(vpos.z);
            float intersect = 0;

            if(diff > 0)
                intersect = 1 - smoothstep(0, _ProjectionParams.w * _FadeLength, diff);

            return fixed4(lerp(tex2D(_MainTex, i.uv) * _Color, _GlowColor, pow(intersect, 4)));
        }
        ENDCG
    }
}

However, when I try to put the same logic into a surface shader, the result does not show any depth intersections.

SubShader {
    Blend SrcAlpha OneMinusSrcAlpha
    ZWrite On

    Tags
    {
        "RenderType" = "Transparent"
        "Queue" = "Transparent"
    }

    CGPROGRAM
    // Physically based Standard lighting model, and enable shadows on all light types
    #pragma surface surf Standard fullforwardshadows alpha:fade

    // Use shader model 3.0 target, to get nicer looking lighting
    #pragma target 3.0

    sampler2D _MainTex;

    struct Input {
        float2 uv_MainTex;
        float4 screenPos;
        float eyeDepth;
    };

    half _Glossiness;
    half _Metallic;
    sampler2D _CameraDepthTexture;
    fixed4 _Color;
    fixed4 _GlowColor;
    float _FadeLength;

    // 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_CBUFFER_START(Props)
        // put more per-instance properties here
    UNITY_INSTANCING_CBUFFER_END

    void surf (Input IN, inout SurfaceOutputStandard o) {
        float2 screenuv = IN.screenPos.xy / _ScreenParams.xy;
        float screenDepth = Linear01Depth(tex2D(_CameraDepthTexture, screenuv));
        float diff = screenDepth - Linear01Depth(IN.screenPos.z);
        float intersect = 0;

        if (diff > 0)
            intersect = 1 - smoothstep(0, _ProjectionParams.w * _FadeLength, diff);

        fixed4 col = fixed4(lerp(tex2D(_MainTex, IN.uv_MainTex) * _Color, _GlowColor, pow(intersect, 4)));
        o.Albedo = col.rgb;
        o.Alpha = col.a;
        o.Metallic = _Metallic;
        o.Smoothness = _Glossiness;
    }
    ENDCG
}

sentences:
Unity using raw mocap data without actually moving the character I play around with animations and unitys raw motion capture data asset pack. My problem is as followed:

I have an idle, walkforward and a runforward animation and play them based on the keyboard input. But i realized when i move my character backwards (using a movement script) but still playing the walkforward animation the character basically moves backward and forward at the same time.

So how can i play the animation but without actually effecting the position of the character?

Thank you

sentences:
Workflow to animate character rig with an already animated model How should I go about animating character rigs (walking, running, ducking, ...) with already animated assets? Do I load the animated asset into the project file of my character rig or do I attach the animated asset to the rig in the engine?

I am using Blender for the models and Unity3D as the engine.

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:
Geometry shader questions? I had some questions on geometry shaders.

Do directx geometry shaders offer anything over the opengl ones?

What advantages does the official geometry shader implementation on opengl 3.2 have over the plug-in for 2.0?  Is the official one faster?

What are the oldest cards which support opengl 3.2 and the geometry shaders on there?

What are the oldest cards which support opengl 2.0 and the geometry shader plugin?

sentences:
What is Vector Projection and what is it's use in games? Couldn't find a clear enough answer on Google.

I know what vectors are. But what does it mean to project a vector onto another, and what is it used for in games?

sentences:
How to apply a force to a wheeled veichle and make wheel rotate ? I've a veichle with 4 wheel and 4 wheel collider.

My veichle is a toy.. so i would like to apply an impulse force (veichle rigidbody.addforce) to that veichle, move it and make wheel rotate...

How can i do ?

Thanks

sentences:
Substance Painter: Jagged edges when painting normals I am painting normals on a normal layer using the Textures tab to make bumps and crevices. But the effect is so jagged. How can I fix this?

INB: Texture Set is already on 4K so it's not a quality issue.

sentences:
Making The Player Stop Bouncing And Stop Sinking In The Ground In A Platformer XNA Heres a problem i've been having. I have a platformer, and whenever my player hits the ground he keeps bounding. Here's the falling code

iceBoy.moveY++;
iceBoy.position.Y += moveY;

Now heres the collision code

if (HitGround())
{

    iceBoy.moveY = -4;

    if (gamepadState.IsButtonDown(Buttons.A))
    {
        iceBoy.moveY = -25;
    }

    touchGround = false;
}

i tried lowering the iceBoy.moveY = -4, or iceBoy.moveY -= 1, but then ice boy just falls through the ground never to be seen again. How to i make it so he stops bouncing and without him falling staright through a block?

UPDATE 1:
At just -4, he bounces little enough too make it look kind of good, but he sinks through the ground first then floats back up and it looks really bad. How can i fix this easily, with just a few lines of code

sentences:
How to instantiate cubes at every given positions I have a list of coordinates in 3D (XYZ)

list = {{226.29, 485.28, 345.396}, {298.292, 108.226, 551.422},
{452.987, 164.874, 416.242}, {562.8, 29.4951, 297.651},{-610.087, -99.9056, -156.377},
{470.804, 12.3284, 428.671}, {590.609, 197.615, -137.146}}

I want to instantiate cubes at every given positions,
how to define given list correctly in C# and use it as a vector3 ?
I tried something like that..
    for (int i = 0; i < 7; i++)
    {
        Instantiate(prefab, new Vector3(list[i]), Quaternion.identity);
    }

sentences:
How to use GameManager to get GameOver() from another script? I'm trying to make a gameover-text show when the player is leaving the plane-area. In GameManager.cs I've written:

public void GameOver()
{
    gameOverText.gameObject.SetActive(true);
}

And in PlayerController.cs I've used the following code:

private GameManager gameManager;

and:

void Update()
{
    float horizontalInput = Input.GetAxis("Horizontal");
    float verticalInput = Input.GetAxis("Vertical");

    playerRb.AddForce(Vector3.right * speed * horizontalInput);
    playerRb.AddForce(Vector3.forward * speed * verticalInput);

    if (transform.position.y < -4)
    {
        gameManager.GameOver();
    }
}

But this doesn't really work, and the console is giving me this message:

  Assets/Scripts/PlayerController.cs(8,25): warning CS0649: Field 'PlayerController.gameManager' is never assigned to, and will always have its default value null

I've already used the OnTriggerEnter (for powerups) and OnCollisionEnter (for enemies). How can I get the GameOver-text to show when the player leaves the "Plane"?

sentences:
What resources are available to read and share pyglet code? I am a Python programmer (I know the ins and outs decently well), and I have dabbled with Pygame. I want to make 3D applications and games, and so naturally I've been looking at OpenGL.

pyglet uses OpenGL, and the programming website and documentation is up there with the best I've seen as far as libraries and APIs go.

Is there a place on the net where other pyglet programmers go to share projects and source code, like there is for Pygame?

I would love to see how other people are combining game logic and OpenGL graphical code to create a simple game (it really helps the learning process).

sentences:
Architecture of "doodle jump" type gameplay infinite looping background I am planning make a doodle jump type game, character jumping on platforms. A scrolling or doodle jump like background which ll appear to move when character moves upward and appear moving (just like in doodle jump) so, my thoughts are for this kind of background is

to take a large image i.e of 2048x2048, make 2 planes, set this texture to them, when first image ends other ll move its position on top of first, when second ends first ll move on top of second and so on.
Other approch could be a "Instantiate" and "Destroy" of small images having textures on them according to jumping character position ( which i doubt ll b expensive )

They are my thoughts, I want to go for best approach and would like to listen the best one. Is there any more appropriae way to achieve moveable background, I ll appreciate your suggestions. Thanks.

sentences:
Hidden Loading with UDK I was wondering, how would I go about creating hidden loading scenes with UDK? For example, a character walks in to an elevator, the elevator fakes movement, whilst the previous floor is destroyed and the next floor is loaded on top.

I assume it's possible with UDK, since it's supposedly rather flexible, but I've never used UDK before (I decided to ask this question first to save me learning it all, finding out it isn't possible, then giving up).

So yeah, is hiding the loading process possible? And if so, how would I go about doing it?

sentences:
How would I go about updating my electronic circuit simulator's 'electricity'? I have made an application which allows the user to place down wires, power sources, and inverters on a virtual circuit board. All connections between tiles are automatic, as shown here:

As you can see in the last image, the updating of power throughout this grid is not yet functioning. I think I understand how to do this updating conceptually, but getting it to work in my program is appearing to be much more difficult than I first imagined. My source code can be found here.

Getting tiles to pass on power to their neighbors is quite easy, but the tricky part is getting wires to "unpower" after the removal of a power source. The size of the grid is just 18x18, so efficiency really isn't a factor, for those wondering.

If you have any tips as to how to I might approach this task, please let me know.

sentences:
How can I render a semi transparent model with OpenGL correctly? I'm using OpenGL ES 2 and I want to render a simple model with some level of transparency. I'm just starting out with shaders, and I wrote a simple diffuse shader for the model without any issues but I don't know how to add transparency to it. I tried to set my fragment shader's output (gl_FragColor) to a non opaque alpha value but the results weren't too great. It sort of works, but it looks like certain model triangles are only rendered based on the camera position... It's really hard to describe what's wrong so please watch this short video I recorded:

http://www.youtube.com/watch?v=s0JqA0rZabE

I thought this was a depth testing issue so I tried playing around with enabling/disabling depth testing and back face culling. Enabling back face culling changes the output slightly but the problem in the video is still there. Enabling/disabling depth testing doesn't seem to do anything.

Could anyone explain what I'm seeing and how I can add some simple transparency to my model with the shader? I'm not looking for advanced order independent transparency implementations.

edit:

Vertex Shader:
// color varying for fragment shader
varying mediump vec3 LightIntensity;
varying highp vec3 VertexInModelSpace;

void main()
{
    //
    vec4 LightPosition = vec4(0.0, 0.0, 0.0, 1.0);
    vec3 LightColor = vec3(1.0, 1.0, 1.0);
    vec3 DiffuseColor = vec3(1.0, 0.25, 0.0);

    // find the vector from the given vertex to the light source
    vec4 vertexInWorldSpace = gl_ModelViewMatrix * vec4(gl_Vertex);
    vec3 normalInWorldSpace = normalize(gl_NormalMatrix * gl_Normal);
    vec3 lightDirn = normalize(vec3(LightPosition-vertexInWorldSpace));

    // save vertexInWorldSpace
    VertexInModelSpace = vec3(gl_Vertex);

    // calculate light intensity
    LightIntensity = LightColor * DiffuseColor * max(dot(lightDirn,normalInWorldSpace),0.0);

    // calculate projected vertex position
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

}

Fragment Shader:
// varying to define color
varying vec3 LightIntensity;
varying vec3 VertexInModelSpace;

void main()
{
    gl_FragColor = vec4(LightIntensity,0.5);
}

sentences:
How can I set the radius the object will rotate around the target? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TargetBehaviour : MonoBehaviour
{
    // Add this script to Cube(2)
    [Header("Add your turret")]
    public GameObject Turret;//to get the position in worldspace to which this gameObject will rotate around.

    [Header("The axis by which it will rotate around")]
    public Vector3 axis;//by which axis it will rotate. x,y or z.

    [Header("Angle covered per update")]
    public float angle; //or the speed of rotation.

    public float upperLimit, lowerLimit, delay;// upperLimit & lowerLimit: heighest & lowest height;
    private float height, prevHeight, time;//height:height it is trying to reach(randomly generated); prevHeight:stores last value of height;delay in radomness;

    // Update is called once per frame
    void Update()
    {
        //Gets the position of your 'Turret' and rotates this gameObject around it by the 'axis' provided at speed 'angle' in degrees per update
        transform.RotateAround(Turret.transform.position, axis.normalized, angle);
        time += Time.deltaTime;
        //Sets value of 'height' randomly within 'upperLimit' & 'lowerLimit' after delay
        if (time > delay)
        {
            prevHeight = height;
            height = Random.Range(lowerLimit, upperLimit);
            time = 0;
        }
        //Mathf.Lerp changes height from 'prevHeight' to 'height' gradually (smooth transition)
        transform.position = new Vector3(transform.position.x, Mathf.Lerp(prevHeight, height, time), transform.position.z);
    }
}

Now it's rotating in a constant radius.
I set the variable axis to 0,1,0

But if I want the object to rotate around the turret very close to it or very far ? I want to add a radius variable so I can change and set the radius.

sentences:
Why does 'InvalidCastException: Specified cast is not valid.' occur for ARKitFaceSubsystem? Why does 'InvalidCastException: Specified cast is not valid.' occur for ARKitFaceSubsystem in the snippet below?
    var faceManager = FindObjectOfType<ARFaceManager>();
    if (faceManager != null)
    {
        m_ARKitFaceSubsystem = (ARKitFaceSubsystem)faceManager.subsystem;
    }

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:
How can I show a texture in a separate window in an XNA game? I'm playing around with random map generation and what I want to do is:

Input a command to generate a random map.
A texture will be created resembling the generation, each pixel resembling each tile.
A new window will pop-up, without removing the original one, that will contain the texture.

I know how to do this except for the last part. Would someone please tell me how to create a new window and draw a texture to this window?

sentences:
Best way to create a Chromadepth shader for unity? I'm trying to create a chromadepth environment in unity3D. So the camera sees close objects colored as red, and then farthest objects as blue. And everything in between falls down the color spectrum (Red orange yellow green blue)

I've looked into a few things such as z depth or even using fog for this kind of thing. But I'm not sure what the best way to approach this is; or maybe it's already been done before but I couldn't find it in the asset store.
I
Thanks in advance for your thoughts and time, it is much appreciated.

sentences:
from normal to rotation matrix (i'm on OPENGL)

i have a mesh O (object) and a mesh T (terrain).
i know a single triangle in T and i want to orient O to be aligned to that triangle (torate O to align to T in that point).

i have only the normal in the triangle. how can i achive the roation matrix?

i have thought this algorithm:

// pseudocode
float[] normal2rotation(Vector3D normal) {
    angleX = Vector3D.angleBetween(normal, Vecto3D.Axis3D.X);
    angleY = Vector3D.angleBetween(normal, Vecto3D.Axis3D.Y);
    angleZ = Vector3D.angleBetween(normal, Vecto3D.Axis3D.Z);

    float[] result = {angleX, angleY, angleZ};
    return result
}

but it does not give me the desired result.

sentences:
Handling Block Collisions The title isn't great,  but let me try and explain my problem. I'm working on a little game at the moment the gist of which is that you're an entity in this 2-D world and you have to dodge obstacles. These obstacles approach form all 4 directions and you're stuck in the middle and simply have to survive as long as you can without dying (from hitting the walls, obstacles, etc.) Right now, my problem is this:

The obstacles are randomly generated, so they often collide with obstacles coming from the other directions. I feel like something should happens when they collide, but I don't really know what to do with them. Ideally, I would have the blocks generate such that they never collide, however this as proven to be both mathematically and computationally difficult. I'd still like to get this to happen if possible (if you have any clever tricks let me know) but I'm willing to consider other ideas as well. One thing that sounded cool to me was that upon collision, and explosion happens that abruptly shoves your entity away from the collision and deals a little damage. Conversely, a "black hole" could form and suck you towards the collision possibly dragging you into oncoming obstacles, etc. The problem I have with both of these ideas is that they're random. So there's no guarantee that it'll be consistent between play throughs. Seeing as they could potentially deal damage to the entity, it seems unfair. One person could have a significantly easier time than another because there were no collisions. Am I right to have these concerns? Or does the randomness add to the fun of things? Any ideas on how I could fairly handle such collisions?

Thanks!

sentences:
Marking up 2D polygon perimeter on an image I'm working on a 2D game in JavaScript using the Web canvas. I plan to use AABB proximity detection and then point, line and polygon on polygon collision detection.

Which means I need to define polygon perimeters for each of my potentially colliding objects. I have to come up with a list of pivot-point-relative coordinates for each vertex on the perimeter of the object's sprite.

This is a tedious and laborious task to do manually, and it seems like it's something that lots and lots of game developers must have had to do many many times.

What is a more efficient workflow for marking up collision polygons on an image or sprite?

sentences:
Unity Proximity Warning System Trigger issues I'm trying to set up a proximity warning system but I'm having some trouble.

To simplify things as much as possible:

I have two game objects in a scene (Object1 and Object2). Object1 has a large child object (twice as large as Object1 or Object2) which has no mesh renderer, but has a box collider (with the Is Trigger box ticked). Object 2 has a rigidbody component.

When Object1 gets close enough that it's child's Box Collider overlaps with Object2's rigidbody, a script on Object1 should Debug.Log the name of the object it's close to once a frame until Object1 moves away.

My code is as follows:

public Collider objectCollidedWith;

void OnTriggerStay(Collider other)
{
objectCollidedWith = other.transform.GetComponent<Collider>();
}

void Update()
{
Debug.Log(objectCollidedWith);
}

Unfortunately, something about my setup isn't working. The console just shows "null" once a frame and the objects getting close doesn't change this.

Can you tell me what I'm doing wrong?

Many thanks for your time.

sentences:
What happenes if you leave out buffers for the inputassembler that the vertex shader expects? I'm working through my first attempt at a "graphics engine" (I use the term loosely as I'm not aiming for much more than something that will display a few meshes).  I want to leave my classes as extensible as possible and am currently working on my mesh class.

I want my mesh class to be able to have optional UVs and optional normals, although I generally expect to use these.  As I'm new to Direct3d I'm curious if I still have to define matching "zeroed" buffers for the missing normals and UV data if the vertex shader and input assembler is otherwise expecting this data?  Should I have my mesh class assemble the missing data zeroed out and declare empty buffers or does Direct3d know to pass null arguments for missing data?

EDIT: I guess zeroed normals wouldn't work as any shader expecting normals would produce bad/bizarre results, but the question regarding texture coords still stands.

sentences:
How should I show shared resources during a Shared Resource game in the Galaxy Editor? One of my favorite ways to play the original StarCraft was in a "Team" game.  In this game type, multiple players on the same "team" would share control, resources, supply, and even the same starting location.  It was like playing as 1 player, only 2 humans were controlling it.  It was a lot of fun.

I want to do something very similar in StarCraft 2, but I need to create a custom map in the Galaxy Editor to do it.

I found the editor can quite easily emulate this behavior.  There is a Trigger action "Set Alliance for Player Group" to "...treat each other as Ally With Shared Vision, Control, And Spending."  To use this, I create units for only 1 of the players, and then set all players to be allied with each other in this way.  All the other players get no units and no resources.  This makes it so 1 player is the actual owner of all the units and everyone else is tagging along with full control.

This nearly works! The problem is that if I am not the actual owning player, I can't actually see how many minerals/gas/supply the team has.  This makes it pretty difficult to build stuff.

What would be the best way to display to the other players how many Minerals/Gas/Supply the team has?

sentences:
XNA 4.0 Refresh AudioEngine, WaveBank and Others Not Found I'm going through the Learning XNA 4.0 book, and unfortunately I installed XNA 4.0 refresh. All the code up until now has worked, with the exception of me needing to remove the Framework.Net and Framework.Storage. (As a side question, will this be problematic later?)

The problem I'm having now is that in my Game1.cs file, I have imported all of the XNA.Framework libraries, and when I try and create instances of any of the following classes, an error pops up saying VisualStudio can't find them: AudiEngine, WaveBank, SoundBank, and Cue.

I have googled around for a while, and the only solution I saw was to import Microsoft.Xna.Framework.Xact, but this doesn't seem to exist for me.

Any help is much appreciated,
Thanks
Peter.

sentences:
Game Server Framework / Engine that supports AMF? I am looking for a server technology that supports AMF (because I plan on using an as3/flash front end).

I would like to develop game logic / simulations that run on the server.  Small number of users and logic at first, but that will grow.

I might use this for some simple turn based / simple tests, but I am hoping this will also support some tougher real time (RTS) or even MMO style games and simulations.

So far I have been looking at (in order of what I think is most promising so far):

WebORB - Looks the most promising so far, appears to be well supported and developed, lots of features, yet sells itself as easy.  Looks like they have a community open source/free version

Cubeia Firebase - Looks really good, only thing that worries me is their statement that it does not work well for real time style games, but is ideal for turn-based.  It might be ok for now, but what if I need to scale the game up?   Open Source/Free

BlazeDS - Looks promising, supported by adobe, I should be able to develop game logic in the BlazeDS server and has amf support.   Open Source/Free

Red5 - No release since 2010, some activity though. (has amf)  Open Source/Free - however have not been able to locate any good 'game' examples / tutorials.

FlashMOG - looks interesting, but I am not sure if it is robust enough to act as an actual game server with continuously running logic.  No release since 2010,  Uses PHP as a socket server.  Open Source/Free

RedDwarf (used to be SGS/Project Darkstar) -- no release since 2010, is this active?  Has AS3 library, but it is out of date too?  Open Source/Free

Cirrus,
Wowza,
FMS - these are more of a media server?

SmartFox,
Electroserver - these are nice, but are not open source/free.  I believe they have limited connection versions available and while I am hoping to scale my project above those limitations I do not expect to be drawing an income to pay for the licenses at that point

LCDS (live cycle data services) - similar to blazeDS, not free

Any other options or clarifications??

sentences:
What are interchange formats? I have been told to research up on interchange formats, only comes up with certain interchange formats without actually explaining what they are.

What are interchange formats, specifically in the context of game development?

sentences:
Rotate 3D object relative to the camera I really need the help of an expert. I'm trying to rotate an object in all 3 axes relative to the camera in response to the gamepad sticks. I have succeeded but with an unexpected error, depending on its orientation, the object can rotate in the opposite direction of the stick direction.
For example, if the object is on its back, when I move the stick to the left the object rotates to the left. But, when the object is facing the camera, when I move the stick to the left the object rotates to the right. The same happens in all 3 axes, on each axis I have 180 degrees with the correct stick orientation and 180 degrees with inverted sticks. Also, both the camera and the object can freely move adding more complexity to this problem.
I would like to find a way where the orientation of the rotation always follows the direction of the stick. This is solved with a minus sign applied to the angle according to the object orientation (relative to the camera) but I can't find out how.
This is the code I'm using, it works fine except for the orientation problem. Can anyone find the solution to this problem?
public void ObjectRotate(int dir, float angle) // Object is defined elsewhere
{
    var rotate = 360 * Time.deltaTime * angle;
    var target = Object.transform;

    if(dir == 1) { target.RotateAround(target.transform.position, Camera.main.transform.right,  rotate ); }
    else if(dir == 2) { target.RotateAround(target.transform.position, Camera.main.transform.up, rotate); }
    else if(dir == 3) { target.RotateAround(target.transform.position, Camera.main.transform.forward, rotate); }
}

sentences:
Coins don't show up in game in Unity I have a 2D game I'm making with Unity, and I want the player to be able to collect coins that I place all over the game. I used the coin prefab with a 2D circle collider and an animation to make it spin. The problem is that only the first coin I put into the scene shows up in the game, and when I collect that one coin, the counter shows that all the others have been collected as well. Here's the script I attached to the player for the coins:

private uint tokens = 0;

void OnGUI(){
    GUILayout.Label ("Tokens= " + tokens);
}

void CollectToken(Collider2D tokenCollider){
    tokens++;
    Destroy (tokenCollider.gameObject);
}

void OnTriggerEnter2D(Collider2D col){
    if (col.gameObject.CompareTag ("token")) {
        CollectToken(col);
    }
}

This is my current setup for the object properties:

Thank you for any help!

sentences:
Coins are solid objects and I can't collect them I am just starting out with Unity following along with this video, and I am stuck at roughly 1 hour and 54 minutes in: https://www.youtube.com/watch?v=pwZpJzpE2lQ
It is worth noting that the video uses Unity 2019.4.4f1 whereas I am using Unity 2020.3.2f1.
My issue is that I cannot get my character to pick up coins and they are currently solid, uncollectable objects. The coins are all set to the Coin layer (layer 9) as per the video.
Here is my code (which I looked over a dozen times to see if there were any differences from the video's code and couldn't find any, hence my confusion). Does anyone know where I went wrong?
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
    [SerializeField] private Transform groundCheckTransform = null;
    [SerializeField] private LayerMask playerMask;

    private bool jumpKeyWasPressed;
    private float horizontalInput;
    private Rigidbody rigidbodyComponent;

    // Start is called before the first frame update
    void Start()
    {
        rigidbodyComponent = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        // Check if space key is pressed down
        if (Input.GetKeyDown(KeyCode.Space))
        {
            jumpKeyWasPressed = true;
        }

        horizontalInput = Input.GetAxis("Horizontal");
    }

    // FixedUpdate is called once every physic update
    private void FixedUpdate()
    {
        rigidbodyComponent.velocity = new Vector3(horizontalInput, GetComponent<Rigidbody>().velocity.y, 0);

        if (Physics.OverlapSphere(groundCheckTransform.position, 0.1f, playerMask).Length == 0)
        {
            return;
        }

        if (jumpKeyWasPressed)
        {
            rigidbodyComponent.AddForce(Vector3.up * 7, ForceMode.VelocityChange);
            jumpKeyWasPressed = false;
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.layer == 9)
        {
            Destroy(other.gameObject);
        }
    }
}

sentences:
Libgdx detect when player is outside of screen Im trying to learn libGDX (coming from XNA/MonoDevelop), and I'm making a super simple test game to get to know it better. I was wondering how to detect if the player sprite is outside of the screen and make it so it is impossible to go outside of the screen edges.

In XNA you could do something like this:

// Prevent player from moving off the left edge of the screen
if (player.Position.X < 0)
    player.Position = new Vector2(0, player.Position.Y);

How is this achieved in libgdx? I think it's the Stage that handles the 2D viewport in libgdx?

This is my code so far:

private Texture texture;
private SpriteBatch batch;
private Sprite sprite;

@Override
public void create () {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();
    batch = new SpriteBatch();

    texture = new Texture(Gdx.files.internal("player.png"));
    sprite = new Sprite(texture);
    sprite.setPosition(w/2 -sprite.getWidth()/2, h/2 - sprite.getHeight()/2);
}

@Override
public void render () {
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    if(Gdx.input.isKeyPressed(Input.Keys.LEFT)){
        if(Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT))
            sprite.translateX(-1f);
        else
            sprite.translateX(-10.0f);
    }
    if(Gdx.input.isKeyPressed(Input.Keys.RIGHT)){
        if(Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT))
            sprite.translateX(1f);
        else
            sprite.translateX(10f);
    }

    batch.begin();
    sprite.draw(batch);
    batch.end();
}

sentences:
Downloading 10 images and storing their data with WWW I would like to download 10 images, and store their texture data into my list. I don't really know how to do that - I heard that for this you use the WWW class, so I went:

List<byte[]> StartDownload() {
    List<byte[]> result = new List<byte[]> ();
    for (int i = 0; i < 10; ++i) {
        WWW request = new WWW("http://www.example.com/" + i + ".png");
        result.Add(request.texture);
    }
    return result;
}

Which of course doesn't work, but I'm not sure why.

sentences:
How should I do AABB::contains? Should an AABB "contain" a point when the point is:

Exclusive: Only exactly inside the aabb
Inclusive: Inside the aabb or exactly on the sides
Almost:  Inside the aabb or a little bit outside of the sides

sentences:
how to display current time as a static value in lua/pico8 Pico8 has a function time() that when called displays the current time from start of program.
i.e. print(time(),0,0,14) --prints time at (0,0) with colour 14

However the function doesn't stop and keeps drawing the time each frame. I'm trying to figure out how I would draw the time without it increasing/changing. So If I printed this 5 seconds from the start of the program I'd want it to display 5, but not change from that 5 value.

https://pico-8.fandom.com/wiki/Time
I don't know how to store a static value of this time as a variable. Although according to the wiki, assigning  var=time() will cause time at 0 to be stored.

Another way of phrasing this is...how would I display the time of 10 seconds when the following print is triggered? So after 10 seconds "time's up" is displayed. How would I display the current time 10, as well, as a static? Maybe I don't know what the time is when the event is triggered, so how can I count using time()?

function _init()
  last = time()
end

function _update()
  -- (empty update to use game loop)
end

function _draw()
  cls()
  if (time() - last) > 10 then
    print("time's up!", 44, 60, 7)
  end
end

sentences:
Handling of data sharing between framework module I am currently developping a 3D game using C# / XNA 4.0 and i am currently thinking about how i should structure my game. The actual game is in fact not really important as the framework i am working on right know is pretty generic.

1st layer :

BaseFrameWork : This BaseFrameWork is managing all the different game modules

2nd layer :

ContentProvider : This module is a layer loading all the needed content (texture/sound/models) and providing it when needed
SoundManager : This module is handling all the audio request (music activation, music change, sound activation, ect)
InputEventHandler : This module is handling all the inputs of the player. Some flags are provided to each module to operate (for example there is a flag "toggleMusic" which is turned on when the player is pressing "M" while in game.
ObjectFactory : This module is creating all the different objects when it is needed (for example creating a floor, boxes and other stuff)
Player : This module is exclusively dedicated to the player.
HeadUpDisplay : This module is dedicated to write the HUD (2D) of the game

Currently the 3rd layer is not developped (i have a few different objects for the ObjectFactory but that's all).

My first question is : "Knowing how is structured my game, do you think i should do it differently, and why ? For example, should player be part of the ObjectFactory "

My second question is about the way these different modules should be linked together.

The easiest option, but (i think) the nastiest one, is to provide to each module a reference of the other ones with everything public. Really easy to implement, really easy to use ingame, but really REALLY nasty.
One other option could be to let the BaseFrameWork get the useful informations of a module to give it to an other module.
Other options ?

These questions may seem basic and common sense, but last time i have been part of a game development, it looked nice (http://yapt.free.fr/) but i think we/I could have done better by spending more time into the game architecture beforehand instead of just diving the head in water.

Thanks for your comments/advice

Al_th

sentences:
Making a mobile app from a board game. Copyright infringement? Me and a friend got hooked on a board game and soon realized that we didn't need the board game to play, instead we could play it with pen and paper with extreme ease and satisfaction. The next step was to develop a simple android app to play it.
We have been using this to play and it's fun, and we are interested in publishing it, but we are worried eventual copyright issues. The concept of the game - itself very simple, merely a type of trivia game, where each round has different rules - is the same, the name is different as is all the art.
Does anybody know if we infringe copyrights if we were to publish it?

Thanks

sentences:
What book/guide should I follow for GLSL I searched a lot on the web without coming to a real solution and if I ask this it's because I really have difficulties getting an answer. I need to learn well GLSL 1.20 with OpenGL 2.1.

I have bought beginning OpenGL game programming, 2nd edition, but it talk too little about GLSL. So I'm following some tutorials like this one, but it just makes a lot of examples without explaining the theory.

The problem is that if I want to know something, I have to search a lot, and often the thing that I'm searching doesn't come straightforward. For example I didn't know how to compute the direction between two points, I looked into some example codes and I discovered that it was done with the dot product just by seeing the example code. But with this approach I waste a lot of time. I need a book/guide which tells me how to do basilar stuff and also explains the theory. I just feel like I'm travelling into the fog. What book/guide would you suggest?

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:
Game Asset Size Over Time The size (in bytes) of games have been growing over time. There are probably many factors contributing to this: trailer/cut scene videos being bundled with the game, more and higher-quality audio, multiple levels of detail being used, etc.

What I'd really like to know is how the size of 3D models and textures that games ship with have changed over time. For example, if one were to look at the size of meshes and textures for Quake I (1996), Quake II (1997), Quake III: Arena (1999), Quake 4 (2005), and Enemy Territory: Quake Wars (2007), I'd imagine a steady increase in file size. Does anyone know of a data source for numbers like this?

sentences:
How can I prevent my bullet from influencing other players when colliding with them? So when my bullet which is a Rigidbody is hitting another player which is also a Rigidbody, the bullet is getting destroyed immediately. But it seems that this isn't enough to prevent the physics to be applied. I guess that's why my player is getting pushed backward all the time when he is getting hit. I don't want this behaviour, so I tried to fix it :

I tried to lower the mass of the bullet which didn't help. I also tried to change the bullet behavior to a trigger, but the collision detection failed very often.

sentences:
how to transform the position of an object I am trying to transform the position of an object. I have totally 3 Objects and 2 triggers, objects are 1. Left_Wall, 2. Right_Wall, 3. Obstacles. 1st trigger for transform the position of an objects y = -50, 2nd trigger for transform the position of an objects y = -7. Left wall and Right Wall are placed inside the environment. the environment will instantiate automatically for looping. if the player crossed the first environment previous environment will delete automatically. at that time in second clone environment if the player triggered means it will display a message as

  MissingReferenceException: The object of type 'GameObject' 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.

In first Clone environment its working perfectly. second clone environment its not working.

sentences:
Unity 3D Slow car (wheel colliders) My car is moving very slowly even though I apply high amounts of torque to the wheel colliders. The only thing I found to be helpful was to increase the wheel's friction stiffness, but that really messes up the braking and makes the car shake.
The values I use for setting up the car and torque are realistic (1500 kg car, 20 kg wheels, a realistic torque value accounting for gear ratios etc.), so I don't understand the problem.

sentences:
Unity - "SetDestination" can only be called on an active agent that has been placed on a NavMesh. UnityEngine.NavMeshAgent:SetDestination(Vector3) I'm using Unity5 right now. I got this error when try to setDestination.

"SetDestination" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.NavMeshAgent:SetDestination(Vector3)
CompleteProject.EnemyMovement:Update() (at Assets/_CompletedAssets/Scripts/Enemy/EnemyMovement.cs:30)

My code.

using UnityEngine;
using System.Collections;

namespace CompleteProject
{
    public class EnemyMovement : MonoBehaviour
    {
        Transform player;               // Reference to the player's position.
        PlayerHealth playerHealth;      // Reference to the player's health.
        EnemyHealth enemyHealth;        // Reference to this enemy's health.
        NavMeshAgent nav;               // Reference to the nav mesh agent.

        void Awake ()
        å{
            // Set up the references.
            player = GameObject.FindGameObjectWithTag ("Player").transform;
            playerHealth = player.GetComponent <PlayerHealth> ();
            enemyHealth = GetComponent <EnemyHealth> ();
            nav = GetComponent <NavMeshAgent> ();
        }

        void Update ()
        {
            // If the enemy and the player have health left...
            if(enemyHealth.currentHealth > 0 && playerHealth.currentHealth > 0)
            {
                // ... set the destination of the nav mesh agent to the player.
                nav.SetDestination (player.position);
            }
            // Otherwise...
            else
            {
                // ... disable the nav mesh agent.
                nav.enabled = false;
            }
        }
    }
}

Please advice. Thank you.

sentences:
OpenGL fix objects to camera I'm developing some game in order to learn OpenGL.

I can make an object follow me around when I move forward, backward, left, right, up or down, by setting it's position right infront of the camera.

Problem starts when the camera rotates / tilts (looking up, down, left, right...).

The object is indeed sticks infront of the camera position (because I calculate a vector going out from the camera position and place it there), however I can't make the angle of the object to rotate/tilt along with the camera, so it is just fixed.

I think I might have to set the object coordinate system to correlate with the camera's coordinate system, but I can't figure out how. Maybe I'm wrong and there's another way to do that.

My game implementation

I have 4 vectors for the camera and 4 vectors for each object: origin, x, y and z (to represent the objects coordinate system).

To move the camera, I substract z axis from origin.

Same for other directions.

In order to tilt the camera, for example to the right, I just calculate rotation around Z axis and apply to X,Y axes.

Note: Movement in the world works good, in all directions and angles.

Here's the (the relevant) code I use to position objects in the world. Before drawing them I first put them in their origin (recall: I save an origin and x,y,z axes to all my objects), then do some scale to fit my desired size:

// translate to position
gl.glTranslatef((float)origin.x, (float)origin.y, (float)origin.z);
// scale to size
gl.glScalef((float)size.x, (float)size.y, (float)size.z);

Any ideas?

sentences:
Moving in an arc using Vector3 I'm trying to get this object to move right across the screen until it gets close to the center and arc down smoothly into a straight downward movement. Here's what I've tried:

if (position.X < -5000)
   Velocity = Vector3.Right * speed;
else if (position.X < -1000)
{
   Velocity = new Vector3(
   MathHelper.Lerp(Velocity.X, 0, (float)gameTime.ElapsedGameTime.TotalSeconds),
   MathHelper.Lerp(Velocity.Y, -1, (float)gameTime.ElapsedGameTime.TotalSeconds), 0)
   * speed;
}
else
   Velocity = Vector3.Down * speed;

However, when it gets to where it should be arcing, it just moves to the right at blinding speed and vanishes before it hits the point where it should be going straight down. If I remove the else if, it does a sharp direction shift no problem. What am I doing wrong in that section?

sentences:
Texturing without D3DX Well, i have been online for hours looking for solutions, but i have found none. Im looking for a way to create textures without the function D3DXCreateShaderResourceViewFromFile.
Since D3DX is deprecated i figured that DirectXTK was the way to go since it is supported officially. I found that i could use the function CreateWICTextureFromFile, but whenever i use it i get the following linker errors:
LNK2038 mismatch detected for '_MSC_VER' value 1800 doesnt match value 1900 in

LNK2019 unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base12@std@QAEXXZ referenced in function "public: void __thiscall std::_String_alloc<0,struct std::_String_Base_types>>::_Free_proxy(void)".......

any idea why is this happening? (i have both the header included and the DirectXTK.lib library linked into the project)?
and is there any simpler way to create textures, without the added whole library just for 1 function?

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:
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:
Moving ships between two planets along a bezier, missing some equations for acceleration OK, I already posted this over at math.stackechange.com but didn't get any answers :(

First of here's a picture of my problem, the description follows afterwards:

So I got all the points and values set up.

The ship starts out moving around the left planet P1 with S=0.27 Degrees per gametick, when it reaches Point A it starts following the bezier curve till it reaches Point D, then it travels around the right planet P2 with S=0.42 Degrees per game tick. The difference in S is so that the travel with the same movement speed around the planets.

So far so good, I got that up and running, now my problem.

When S P1 and S P2 differ to much, the ship jumps between the two speeds when it reaches it's destination, which looks pretty bad. So I need to accelerate the ship between Point A and Point D from S P1 to S P2.

The thing I'm missing are in purple, those are:

A way to calculate the ticks it takes the ship to move along the bezier considering the acceleration.
And a way to find a position on the bezier curve based on T, again considering the acceleration.

ATM I calculate the length of the bezier by calculating the distance between N of its points. So what I think I need, is a way to scale the T I need to put into my bezier calculation accordingly to the acceleration.

sentences:
Control the movement space for an object? I want my object not cross the limit of "AiX\AiZ" values. When object cross this limit it faces like walls that block him but not stop him from movement.
public GameObject Player, middleObject;
public float high, upForce, speed;
public float PlayerDistance, AiX, AiZ, PlayerNum;
public Vector3 PlayerPlace,PrediactPlace;

void Update()
{

    Quaternion currentRotation = transform.rotation;
    Quaternion wantedRotation = Quaternion.Euler(0, 90, 0);
    transform.rotation = Quaternion.Lerp(currentRotation, wantedRotation, Time.deltaTime * 10);

    AiX = gameObject.transform.position.x - middleObject.transform.position.x;
    AiZ = gameObject.transform.position.z - middleObject.transform.position.z;

    if (PlayerNum == 0) // control it from inspector
    {
        Player = null;
    }
    else
    {

        Player = GameObject.FindGameObjectWithTag("GPlayer");
        PlayerDistance = Vector3.Distance(gameObject.transform.position, Player.transform.position);
        PrediactPlace = Player.GetComponent<PlayerCtrl>().Point.position;

        if (AiX <= 2 && AiZ >= -2 && AiZ <= 7 && AiZ >= -7)
        {
            transform.position = Vector3.Lerp(transform.position, PrediactPlace, Time.deltaTime * speed);
        }

    }

}

sentences: Is there an alternative to decals that will let me put bullet holes on a complicated object? I'm trying to figure out a way to do "bullet holes" but actually apply the texture at the shader level?  If I'm dealing with a model which doesn't have a "flat" face I'd like to be able to wrap the "decal" across the model.  Anyone point me at a tutorial that will do something similar to this.

sentences:
Issue porting Cocos2d-x to Android I've written a basic game using Cocos2D-x on XCode. It works fine on the iPhone. Now I'm trying to port it to Android. When I run the script ./build_native.sh
inside the proj.android folder, it gives me the following error:

jni/../../Classes/MemoryModeLayer.cpp: In member function 'void MemoryModeLayer::startNewGame()':
jni/../../Classes/MemoryModeLayer.cpp:109:25: error: 'time' is not a member of 'std'
jni/../../Classes/MemoryModeLayer.cpp:109:25: note: suggested alternative:
/Users/abc/android-ndk-r9d/platforms/android-8/arch-arm/usr/include/time.h:40:17: note:   'time'
jni/../../Classes/MemoryModeLayer.cpp:111:5: error: 'random_shuffle' is not a member of 'std'
jni/../../Classes/MemoryModeLayer.cpp:112:5: error: 'random_shuffle' is not a member of 'std'
make: *** [obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/MemoryModeLayer.o] Error 1
make: Leaving directory `/Users/abc/cocos2d-x-2.2.3/projects/Game/proj.android'

In MemoryModeLayer.cpp I have the following:

std::srand(unsigned(std::time(0)));
std::random_shuffle(_xCod, _xCod + _numberOfRows);
std::random_shuffle(_yCod, _yCod + _numberOfColumns);

I've included the following headers as well:

#include <string>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <iomanip>

Also added using namespace std in the header file. Is there anything else that I should do?

sentences:
Libgdx Texture change I have been working for several days to try and figure out how to change a texture whenever a scene2d Table is clicked in libgdx, I am using pixmaps to dynamically change the textures colors instead of changing the texture completely.

everything works fine when i detect key presses so whenever i press 1 the color of the players hair changes to a random color but now i want it to happen when i press a Table.

to change the texture i use this method

public static Texture genDynamicTexture(String path, HashMap<String,Color> colors) {

    //load texture from asset handler
    Texture texture = GameUtils.getGame().manager.get(path,Texture.class);

    //create pixmap from texture
    if(!texture.getTextureData().isPrepared()) {
        texture.getTextureData().prepare();
    }
    //transfer pixel data from gpu to cpu
    Pixmap pixmap = texture.getTextureData().consumePixmap();

    //grey-scale colors
    Color gsHair = toColor(207,31,201);
    Color gsSkin = toColor(207,97,31);
    Color gsShirt1 = toColor(39,207,31);
    Color gsShirt2 = toColor(65,65,160);
    Color gsPants = toColor(90,9,22);
    Color gsShoe1 = toColor(253,255,66);
    Color gsShoe2 = toColor(43,58,50);
    Color black = toColor(0,0,0);

    //loop through pixels in the pixmap
    for(int x = 0; x < pixmap.getWidth(); x++) {
        for(int y = 0; y < pixmap.getHeight(); y++) {
            int pixelColor = pixmap.getPixel(x, y);
            if(pixelColor != 0 && pixelColor != Color.rgba8888(black)) {
                if(pixelColor == Color.rgba8888(gsHair)) {
                    pixmap.setColor(colors.get("hair"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsSkin)) {
                    pixmap.setColor(colors.get("skin"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsShirt1)) {
                    pixmap.setColor(colors.get("shirt1"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsShirt2)) {
                    pixmap.setColor(colors.get("shirt2"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsPants)) {
                    pixmap.setColor(colors.get("pants"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsShoe1)) {
                    pixmap.setColor(colors.get("shoe1"));
                    pixmap.drawPixel(x, y);
                }else if(pixelColor == Color.rgba8888(gsShoe2)) {
                    pixmap.setColor(colors.get("shoe2"));
                    pixmap.drawPixel(x, y);
                }
            }
        }
    }

    //transfer pixel data from cpu to gpu
    Texture tex = new Texture(pixmap);
    pixmap.dispose();
    texture.dispose();
    return tex;

}

like i said everything works fine if it is a key press but when i detect it using a Table it does not work ( i have already added it to the stage and am calling stage.act() and stage.draw() )

color.addListener(new ClickListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return true;
        }
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            characterPack.reloadSpriteSheet("Players/greyscale-player.png", 2, 2, characterPack.colors, "skin");
        }
    });

thanks in advance.

sentences:
How do you make a bullet ricochet off a vertical wall? First things first. I am using C# with XNA. My game is top-down and the player can shoot bullets. I've managed to get the bullets to ricochet correctly off horizontal walls. Yet, despite using similar methods (e.g. https://stackoverflow.com/questions/3203952/mirroring-an-angle) and reading other answered questions about this subject I have not been able to get the bullets to ricochet off a vertical wall correctly. Any method I've tried has failed and sometimes made ricocheting off a horizontal wall buggy.

Here is the collision code that calls the ricochet method:

//Loop through returned tile rectangles from quad tree to test for wall collision. If a collision occurs perform collision logic.
for (int r = 0; r < returnObjects.Count; r++)
    if (Bullets[i].BoundingRectangle.Intersects(returnObjects[r]))
        Bullets[i].doCollision(returnObjects[r]);

Now here is the code for the doCollision method.

    public void doCollision(Rectangle surface)
    {
        if (Ricochet) doRicochet(surface);
        else Trash = true;
    }

Finally, here is the code for the doRicochet method.

    public void doRicochet(Rectangle surface)
    {
        if (Position.X > surface.Left && Position.X < surface.Right)
        {
            //Mirror the bullet's angle.
            Rotation = -1 * Rotation;
            //Moves the bullet in the direction of its rotation by given amount.
            moveFaceDirection(Sprite.Width * BulletScale.X);
        }
        else if (Position.Y > surface.Top && Position.Y < surface.Bottom)
        {
        }
    }

Since I am only dealing with vertical and horizontal walls at the moment, the if statements simply determine if the object is colliding from the right or left, or from the top or bottom. If the object's X position is within the boundaries of the tile's X boundaries (left and right sides), it must be colliding from the top, and vice verse. As you can see, the else if statement is empty and is where the correct code needs to go.

sentences:
Storing voxels for a voxel Engine in C++ I am trying to write a little voxel engine because it's fun, but struggle to find the best way to store the actual voxels. I'm aware I will need chunks of some sort so I don't need to have the entire world in memory, and I'm am aware I need render them with reasonable performance.

I read about octrees and from what I understand it starts with 1 cube, and in that cube can be 8 more cubes, and in all those 8 cubes can be another 8 cubes etc. But I don't think this fits my voxel engine because my voxel cubes/items will all be the exact same size.

So another option is to just create an array of 16*16*16 size and have that be one chunk, and you fill it with items. And parts where there aren't any items will have 0 as value (0 = air). But I'm afraid this is going to waste a lot of memory and won't be very fast.

Then another option is a vector for each chunk, and fill it with cubes. And the cube holds its position in the chunk. This saves memory (no air blocks), but makes looking for a cube at a specific location a lot slower.

So I can't really find a good solution, and I'm hoping someone can help me with that. So what would you use and why?

But another problem is rendering. Just reading each chunk and sending it to the GPU using OpenGL is easy, but very slow. Generating one mesh per chunk would be better, but that means every time I break one block, I have to rebuild the entire chunk which could take a bit of time causing a minor but noticeable hiccup, which I obviously don't want either. So that would be harder. So how would I render the cubes? Just create all the cubes in one vertex buffer per chunk and render that and maybe try to put that in another thread, or is there another way?

Thanks!

sentences:
How to custom UI Slider with Unity UGUI I want to use Unity UGUI to custom a slider and the final looking show be like this:

And the images I use are:

But I found it hard to accomplish:
The handle will be screeched and the fill will not be fully filled with the handle

Can somebody tell me how I could accomplish this?

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:
How can I draw many objects on screen instead of just one? Like many beginner graphics programmers I followed a tutorial which showed me how to set up buffer descriptions and fill out the vertex buffer etc... - the steps involved in drawing a simple indexed cube on the screen. There is a leap however when it comes to drawing more than one of these cubes. My code below is the original cube drawing code, if called more than once, each call overwrites the vertex buffer and only one object is drawn - the last one.

So what are the options for drawing many of these cubes?

Cube::Cube(D3DXCOLOR colour, D3DXVECTOR3 min, D3DXVECTOR3 max)
{
// create eight vertices to represent the corners of the cube
VERTEX OurVertices[] =
{
    {D3DXVECTOR3(min.x, max.y, max.z), colour},
    {D3DXVECTOR3(min.x, max.y, min.z), colour},
    {D3DXVECTOR3(min.x, min.y, max.z), colour},
    {min, colour},
    {max, colour},
    {D3DXVECTOR3(max.x, max.y, min.z), colour},
    {D3DXVECTOR3(max.x, min.y, max.z), colour},
    {D3DXVECTOR3(max.x, min.y, min.z), colour},
};

// create the vertex buffer
D3D10_BUFFER_DESC bd;
bd.Usage = D3D10_USAGE_DYNAMIC;
bd.ByteWidth = sizeof(VERTEX) * 8;
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, OurVertices, sizeof(OurVertices));    // copy the vertices to the buffer
pBuffer->Unmap();

// create the index buffer out of DWORDs
DWORD OurIndices[] =
{
    0, 1, 2,    // side 1
    2, 1, 3,
    4, 0, 6,    // side 2
    6, 0, 2,
    7, 5, 6,    // side 3
    6, 5, 4,
    3, 1, 7,    // side 4
    7, 1, 5,
    4, 5, 0,    // side 5
    0, 5, 1,
    3, 7, 2,    // side 6
    2, 7, 6,
};

// create the index buffer
// D3D10_BUFFER_DESC bd;    // redefinition
bd.Usage = D3D10_USAGE_DYNAMIC;
bd.ByteWidth = sizeof(DWORD) * 36;
bd.BindFlags = D3D10_BIND_INDEX_BUFFER;
bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
bd.MiscFlags = 0;

device->CreateBuffer(&bd, NULL, &iBuffer);

iBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &pVoid);    // map the index buffer
memcpy(pVoid, OurIndices, sizeof(OurIndices));    // copy the indices to the buffer
iBuffer->Unmap();

//this is simply a single call to the update method that sets up the scale, rotation
//and translation matrices, in case the cubes are static and you don't want to have to
//call update every frame
Update(D3DXVECTOR3(1, 1, 1), D3DXVECTOR3(0, 0, 0), D3DXVECTOR3(0, 0, 0));
}

sentences:
Change running tween speed I have words inside a tween and I need to slow down a tween that is already running and I am using updateTweenData to do so. All running tweens are in an array.

updateTweenData works, but the problem is, when I set the slower speed, words become closer together and when I set the normal speed, words space out.

Here's a jsfiddle that demonstrates the problem.
Just click slower/faster buttons and notice how words behave.

I want just the speed to change and everything else to remain the same.
How can I achieve this?

Best regards.

sentences:
In Unity3D, how do I create an efficient scratch card effect? I want to create a scratch-card-like effect in new Unity UI's new Image tag.  I know it's possible with setPixels, but that's prohibitively expensive on mobile devices.

Something like this:

I'd like the user to be able to drag on any part of the image to "scratch off" the top layer and reveal the content underneath it.

How can I do this?

sentences:
Scene graphs vs in-game representation This is a general question which aim is to allow me to start digging on the subject by myself.

As I noticed the general opinion is that scene graphs are good for describing the scene in a level editor (or any editor that the game is using), but the game itself should use some sort of optimized data structure internally and the scene graphs should be somehow "translated" to that data structure before use.

What such internal data structures would be? How one would "translate" a scene graph to such structures.

In general - the more detail you can give me then better. Also references/links are more than welcome. :)

sentences:
Entity Component System - Physics Animation Matrix Calculation? The problem is how many times the matrices representing the bones (for animation and rendering) of an entity get calculated.

If i have these components:

Position
Skeleton (holds matrices for bones)
Physics
Animation

When the physics get's updated, the position is changed to move the entity. This sends a message, that position has changed. The skeleton takes note and updates the matrices for the changed position (and potentially rotation). The animations are then updated in a separate system, the skeleton then gets updated and changed again. So essentially the matrices are being updated twice (unnecessarily) instead of just once.

Am i going about this the wrong way? Is this just the price of having everything disjoint?

sentences:
graphics.IsFullScreen resetting to false after game constructor and graphics.ApplyChanges() This is a MonoGame 3.2 Windows (DirectX) Project.

I've tried setting graphics.IsFullScreen to true in the game's constructor and in the game's initialize function, both times running graphics.ApplyChanges(), but when stepping through the code, I see that it gets set back to false when it leaves the constructor or graphics.ApplyChanges() is called. Here is the code I've tried:

public class Sandbox : Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;

    public Sandbox()
        : base()
    {
        graphics = new GraphicsDeviceManager(this);

        Content.RootDirectory = "Content";

        IsFixedTimeStep = false;
        IsMouseVisible = true;

        graphics.PreferredBackBufferWidth = Config.Screen.Width;
        graphics.PreferredBackBufferHeight = Config.Screen.Height;

        graphics.IsFullScreen = Config.Screen.IsFullScreen; // IsFullScreen reads true
        graphics.ApplyChanges(); // IsFullScreen reads true
    } // IsFullScreen reads FALSE when leaving the constructor

    protected override void Initialize()
    {
        graphics.IsFullScreen = true; // IsFullScreen reads true
        graphics.ApplyChanges(); // IsFullScreen reads FALSE after applying changes

        graphics.ToggleFullScreen(); // this did not do anything

        base.Initialize();
    }
}

sentences:
Exporting .FBX model into XNA - unorthogonal bones I create a butterfly model in 3ds max with some basic animation, however trying to export it to .FBX format I get the following exception.. any idea how i can transform the wings to be orthogonal..

One or more objects in the scene has local axes that are not perpendicular to each other (non-orthogonal).
The FBX plug-in only supports orthogonal (or perpendicular) axes and will not correctly import or export any transformations that involve non-perpendicular local axes.
This can create an inaccurate appearance with the affected objects:
    -Right.Wing

I have attached a picture for reference . . .

sentences:
UnsupportedOperationException: Unsupported format for this image So.. I'm learning lwjgl currently and I stumbled on this weird error caused by slick-util which seems to be incorrectly displayed.

ERROR :

java.lang.UnsupportedOperationException: Unsupported format for this image
at org.newdawn.slick.opengl.PNGDecoder.decode(PNGDecoder.java:272)
at org.newdawn.slick.opengl.PNGImageData.loadImage(PNGImageData.java:97)
at org.newdawn.slick.opengl.CompositeImageData.loadImage (CompositeImageData.java:62)
at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:292)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.
java:200)
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)
at com.saumi.utils.Renderer.loadTexture(Renderer.java:91)
at com.saumi.assets.Assets.<init>(Assets.java:23)
at com.saumi.main.Main.init(Main.java:27)
at com.saumi.main.Main.<init>(Main.java:45)
at com.saumi.main.Main.main(Main.java:71)

The problem is that even though it says unable to read png data, the picture that the error points to is loaded properly and even displayed onto the screen!

I don't know what is is supposed to mean, please help.

EDIT :

My texture loader code :

public static Texture loadTexture(String path , String fileType){
    Texture tex = null;

    InputStream in = ResourceLoader.getResourceAsStream(path);
    try {
        tex = TextureLoader.getTexture(fileType,in);
    } catch (IOException e) {
        e.printStackTrace();
    }

    return tex;
}

My Assets code which loads the textures :

public class Assets {

public static Texture playBtn , tutBtn , quitBtn;

public static Texture background;

public static Texture player , missile;

public Assets(){
    playBtn = Renderer.loadTexture("res/PlayBtn.png", "PNG");
    tutBtn = Renderer.loadTexture("res/TutBtn.png", "PNG");
    quitBtn = Renderer.loadTexture("res/QuitBtn.png", "PNG");

    player = Renderer.loadTexture("res/KillSkull.png", "PNG");
    missile = Renderer.loadTexture("res/Missile.png", "PNG");

    background = Renderer.loadTexture("res/Background.png", "PNG");
}

}

The Error points to the Background Image , and the order in which it is loaded does not matter, it always points to that image.

sentences:
Jumping a sprite while moving in a Bezier action I'm creating a game and I need the sprite to jump (move up and down basically) while it's moving on a bezier path so it moves vertically while it still follows the path. If I do this while it's moving along the bezier path:

[mySprite runAction:[CCJumpBy actionWithDuration:0.1 position:ccp(0,0) height:10 jumps:1]];

It jumps vertically but instantly it returns to the position on the path. What I want is to jump relative to the path.

Does anyone know anything about it?

It would looks something like this:

The curve is a sequence of CCBezierBy's by the way.

Thanks.

sentences:
Discoordinated Chromatic Aberration Effect The game Teleglitch heavily utilizes the CA effect with screen distortion.

I am trying to achieve this effect.

Issue 1. How to not apply the effect onto the floor? (solved)

They render the screen then apply the CA effect.  However, the floor is not rendered with the post processing effect.

Issue 2. How to have discoordinated position for each rendered CA effect?

Currently I have three offsets for each channel: red, green, and blue.  However, I cannot assign different offsets for the channels for certain areas only.  What would be a way to have discoordinated positions?

sentences:
What is a good algorithm for generating a linear regression of positions in 3D space? (for getting the direction of a thrown object in VR) I'm trying to get throwing to feel right in my VR game. I don't plan on actually using physics to do this; my idea is to accurately determine the lateral direction of the throw, then move the object in the intended direction (with a doctored Y value) at a speed dependent on other factors.

The language of the code doesn't matter too much, but I'm using Godot, so something that wouldn't require me to import a bunch of different math libraries (by converting them to Godot's Python-style GDScript) would be ideal. It doesn't need to be robust.

To give you an idea of what I was thinking, my original plan was to save the position of the grabbing controller every frame while an object is being held, removing old positions if the controller is moving backwards, then averaging out the movement deltas over the last 10 or 15 frames or so before letting go (it should be consistent since Godot has a fixed-timestep "update" function available) and normalizing the vector to get the direction the object should travel in.

However, this blog post got me thinking that spending the time learning how to do the linear regression in a more robust way, then applying that to 3D/VR, might be worthwhile. I just wonder if, since I don't need the actual linear or angular velocity, it might be overkill in terms of time spent on the feature.

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:
Unity move arrows along path I am not sure how to go about what might be a simple task. I want directional arrow sprites to move along a curved path in 2d to show the player when to go.

I can use DoTween to create a path. But not sure if I should Instantiate a load of sprites(arrow) and move them along. Its seems wasteful.

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 to "hot-reload" a glsl shader I am wondering if its possible to dynamically change shaders while the code is running. In my game, I want to have a development mode in which users can change the shader source and dynamically see their changes like so:
https://www.youtube.com/watch?v=hlSG_iVC6xc
this is my current reload method:

//Shader is my shader class and shader is the current shader
//delete all resources of previous shader

if (shader->GetProgram() != 0)
    glDeleteProgram(shader->GetProgram());
if (inShader->GetVert() != 0)
    glDeleteShader(inShader->GetVert());
if (inShader->GetGeom() != 0)
    glDeleteShader(inShader->GetGeom());
if (inShader->GetFrag() != 0)
    glDeleteShader(inShader->GetFrag());

GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
GLuint geometry_shader = glCreateShader(GL_GEOMETRY_SHADER);

//create vertex shader
glShaderSource(vertex_shader, 1, (const GLchar**)vertSource, NULL);
glCompileShader(vertex_shader);

//create fragment shader
glShaderSource(fragment_shader, 1, (const GLchar**)fragSource, NULL);
glCompileShader(fragment_shader);

GLuint program = glCreateProgram();

glAttachShader(program, vertex_shader);
glAttachShader(program, fragment_shader);
glLinkProgram(program);

Shader* theResult = new Shader(context);
theResult->SetVertShader(vertex_shader);
theResult->SetFragShader(fragment_shader);
theResult->SetGeomShader(geometry_shader);
theResult->SetProgram(program);

//replace the shader we created with the old one
*shader = *theResult;
delete theResult;
return shader;

The above code does one of two things when called, it either gives some undefined graphical behaviour or doesn't seem to reload the shader and use the previous ones. Is there something I'm missing regarding how I'm linking the new shaders, or is this even the right approach?

As requested i will add the shader class information:

//shader.h

protected:
/// Shader properties
unsigned int m_VertexShader;
unsigned int m_GeometricShader;
unsigned int m_FragmentShader;
unsigned int m_Program;
OpenGL* mContext;

public:
/// Constructor
Shader(OpenGL* context);
~Shader();

/// Getter/setters shader properties
inline unsigned int GetVert() { return m_VertexShader; }
inline unsigned int GetGeom() { return m_GeometricShader; }
inline unsigned int GetFrag() { return m_FragmentShader; }
inline unsigned int GetProgram() { return m_Program; }
inline void SetVertShader(unsigned int inValue) { m_VertexShader = inValue; }
inline void SetGeomShader(unsigned int inValue) { m_GeometricShader = inValue; }
inline void SetFragShader(unsigned int inValue) { m_FragmentShader = inValue; }
inline void SetProgram(unsigned int inValue) { m_Program = inValue; }

//shader.cpp

Shader::Shader(OpenGL* context)
: m_VertexShader(0),
m_GeometricShader(0),
m_FragmentShader(0),
m_Program(0),
mContext(context)
{}

Shader::~Shader()
{
}

sentences:
Efficient dynamic character shadows [SW Rasterizer] I am working on a SW rasterizer for a quarter-century old console (think sub-100 MHz RISC CPU, no dedicated 3D HW, couple megs of RAM) and am approaching a stage where I will be adding dynamic character shadows. It's a next-gen engine for the platform, so there are no known or proven approaches. Basically, render stuff as fast as possible - e.g. in least amount of instructions (and least amount of RAM access).

The biggest performance bottleneck of the platform is memory read / write(e.g. fillrate). The RISC can do almost all instructions in 1-3 cycles (except division), but anything requiring access to main RAM is 10x slower (than from small cache).

I am not looking for some generic shadowing solution (I wrote few for PC/XBOX-using Shadow Volume and Shadow Mapping, so I have an idea how shadowing works). I am alright with writing multiple codepaths for multiple scenarios (e.g. one for characters, another for static objects).

Known limitations:

No Z-Buffer
No Stencil Buffer
Target resolution : 320x200
Shadows can be black (no need for transparent shadows)
A fallback shadowing solution is having pre-rendered shadows from each animation frame into texture and just drawing the texture below character (but it looks too lame). It's possibly the fastest solution, though (rotate shadow bitmap and just blit the texels)

Considering the above limitations, I have chosen the technique of transforming the character mesh (a low-poly version of the original mesh) onto the floor plane (from the position of the light) and drawing the shadow mesh on the floor (with black color). This should result in the desired sharp shadows without any pixelation effects (unlike shadowing methods based on projecting a shadow texture).
But it will provide an effect of shadow being very large initially, and as character walks around, the shadow shrinks (until he is right below the light source) and then the shadow grows again.

Advantage:

Generic : If need be, I can apply it also on the walls, not just the
floor
Fast : Transforms are fast on the RISC

Disadvantage:

Overdraw : I expect a major portion of the floor to be covered by
the shadow (lightpos will be tweaked accordingly, for the sake of
the effect). Since shadow is black, all the expensive lighting
calculations on the floor are wasted, since they are [mostly]
overwritten by the shadow.

The floor (basically one large rectangle) is internally divided into multiple square tiles (anywhere between 10-100 tiles per room). I think I can easily find out which floor tiles will be affected by shadow (I will calculate them during projection of the mesh onto the floor).

Question - how can I easily merge the floor texturing routine with the shadowing ?
Ideally, each texel would be written just once. There are just two choices - either it is a floor texel or black (the shadow).

Anything - that merges the two approaches into one which will be faster than rasterizing a floor and then overdrawing majority of it with black shadow- is a win. Ideas ?

The most amount, I could theoretically spare, from the tiny cache (10x faster access than from main RAM) is about 1-2 KB for a temp buffer. Obviously, it is not enough to cover all shadow texels at given resolution, but it could perhaps prove useful for some other algorithm.

As of right now, I can only think of span buffers as the best solution for the overdraw. The spans would be short (e.g. easily fit into 1-2 KB), I just would have to rewrite the floor texturing algorithm - but if it was a faster solution, I could do that.

Any other ideas ?

sentences:
Find the coordinates between two points based on third You can see two points in this picture. Points are surrounded by collider which is set to trigger. Points can either be Vector3 or Vector2, shouldn't make any difference.

I need to get the coords on gray line if mouse enters the trigger, at the exact point where mouse and gray line form 90 degree angle. Gray line is just an straight line between 2 points.

All the data:

left point coords
right point coords
mouse coords

Is it possible with the data I have and how?

sentences:
How do you write an unlit shader which supports Ambient Occlusion? For performance reasons, a scene might use Unlit shaders only.
Is there an Unlit shader which supports Ambient Occlusion?
What is the best way to achieve this look, for moving and static objects, while prioritising performance?

sentences:
How to know when graphics driver or card changes I'm about to start work on implementing GLSL binary shader compilation and I was curious how to handle the cases when the shaders need to be recompiled, such as when the driver (or perhaps even the graphics card itself) changes. Are there any mechanisms out there to do these types of things, or is this just a "delete the shader cache folder if you update your driver" type of thing? I did a quick search on here and Google and didn't see anything that looked promising.

Edit: or am I just ignorant and GL will let me know when a recompile is necessary?

sentences:
Impact of variable-length loops on GPU shaders Its popular to render procedural content inside the GPU e.g. in the demoscene (drawing a single quad to fill the screen and letting the GPU compute the pixels).

Ray marching is popular:

This means the GPU is executing some unknown number of loop iterations per pixel (although you can have an upper bound like maxIterations).

How does having a variable-length loop affect shader performance?

Imagine the simple ray-marching psuedocode:

t = 0.f;
while(t < maxDist) {
    p = rayStart + rayDir * t;
    d = DistanceFunc(p);
    t += d;
    if(d < epsilon) {
       ... emit p
       return;
    }
}

How are the various mainstream GPU families (Nvidia, ATI, PowerVR, Mali, Intel, etc) affected?  Vertex shaders, but particularly fragment shaders?

How can it be optimised?

sentences:
How to demo Advanced Game AI as a portfolio piece? Basically every Game company wants to see a portfolio that exhibits your skill set.  If you're specializing in AI though, what and how should you show off your skills.
Some thoughts

Is nice graphics in an AI demo a must(get past nontechnical HR that don't understand AI, think 3d verse 2d)?
Demo multi-featured AI or a single focused example.
Fundamental skills like path-finding, hfsm, planning, etc are critical AI components but does it really impress as a portfolio piece?
Single AI entity, multiple entities, or large populations, is more always better?
Also as a portfolio piece ideally there would be an executable, and videos which should show off whatever is trying to be shown off within only a few minutes.

Examples
I would say any of the skills exhibited in this video would make for a great portfolio piece but are game companies really expecting this from a single person.

Autodesk Kynapse

AI Sandbox is another great example but this was made from the work of many many people.

AI Sandbox

Any examples of good AI portfolios would be great.

sentences:
How to instantiate a sprite from a sprite sheet using script in unity? We are creating a 2D top down rpg, and we have multiple textures, and we need to be able to change which sprite sheet its reading from in order to change the look of the walls and floor in each room. It has the same basic tiles just they need to look different. Like the corner of a cabin, to the corner of an office building.

At the moment we are taking the sprite sheet, splitting it up, and making prefabs out of it for placement by script in the game. Is there a way to do this automatically because we have a lot of textures, and its too many to make into prefabs.

sentences:
Bullet is not instantiating properly in Unity So I'm trying to make a simple weapon where I just instantiate a bullet at the Shoot Point's gameobject position. For some reason when I press down on my mouse the bullet just flies up. Any ideas on why this could happen?

Vector3 velocity = bullet.transform.forward * 1000 GameObject bulletGameObject = Instantiate(bullet, shootPoint.transform.position, Quaternion.identity);
Rigidbody bulletBody = bullet.GetComponent<Rigidbody>();
bulletBody.velocity = velocity;
Destroy(bulletGameObject, 4f);

sentences:
How to unload/remove body components in Box2D? I want to know how to release/clear/remove a variable. (specifically b2BodyDef, b2Body, b2FixtureDef, b2PolygonShape types.)

I've heard there's a keyword called delete, guessing by it's name it may have something to do with this subject?

I'm totally new to these things and I've just heard that there's a way to do this.

I might be wrong and there isn't a way to do this at all.

Which also means that I have no idea if I should include code or what information I should include at all :P

sentences:
Scrolling Text in jMonkey I am looking for a way to include scrolling text boxes in a jMonkey game.  I have, of course, looked around online and could not find any examples or libraries that fit.

My goal is to have "quests" pop up for the user in small graphical boxes, containing quest text.  The quest text might be longer than the quest box (which was easy enough to generate in jMonkey), so I am left with the problem of generating scrolling text boxes.

Before I set off on a long venture to properly adjust, indent, and scroll text inside boxes, I was wondering if any knew of existing examples or libraries. I have a hard time believing I'm the first person to using jMonkey that needed scrolling text or quest functionality.

sentences:
Difference between #DEBUG and #DEVELOPMENT_BUILD in Unity? I've seen these two special compilation macros in our code base, What's the difference between #Debug and #DEVELOPEMENT_BUILD in Unity? What's the main purpose of using each?

#if DEBUG
Debug.Log("DEBUG");
#endif

#if DEVELOPMENT_BUILD
Debug.Log("DEVELOPMENT_BUILD");
#endif

sentences:
How can I compute the distance between two actors in Stencyl? How do U use the "distance" behavior in Stencyl?

I need to know the distance between two actors in order to start a timer.

sentences:
Particle Effect Completion In my game I use particle effect for various purposes. In that I detect the completion of the particle effect. Basically I want to do something after completion of the particle effect. But the problem is that I didn't able to find the particle effect completion. So any community member please help me.

EDIT : I was creating particle effect using following code

    pointParticleEmtitter = new PointParticleEmitter(pX, pY);

    particleSystem = new ParticleSystem(pointParticleEmtitter, maxRate,
            minRate, maxParticles, mParticleTextureRegion.deepCopy());

    particleSystem.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
    particleSystem.addParticleInitializer(new ColorInitializer(0f, 0f, 1f));
    particleSystem.addParticleModifier(new AlphaModifier(1, 0, 0, 0.5f));
    particleSystem.addParticleModifier(new ExpireModifier(0.5f));
    gameObject.getScene().attachChild(particleSystem);

Using above code the particle effect was started but when finished that I want to detect. After finishing effect I want to remove the object from the scene.

sentences:
In Unity, why does DrawProceduralNow work in OnRenderObject but DrawProcedural does not? In Unity, if I call DrawProcedural (or one of its variants) from Update() it works fine, but if I make the exact same call from OnRenderObject() it draws nothing.  (It also doesn't work from OnPreRender or OnPostRender).
HOWEVER, DrawProceduralNow() works fine from all of these functions.
Why is that so? Is it documented somewhere? What can I do to make DrawProcedural and variants work in OnRenderObject? What is different about DrawProceduralNow that makes it work?  (Yes, I have tried using material.SetPass(0) in the DrawProcedural version and it still renders nothing.
I understand that the OnRender functions are called later in the frame and some graphics state is different at that point, but it seems like DrawProcedural is exactly the kind of thing we should be doing in OnRenderObject. I feel like there is some fundamental thing about the Unity rendering pipeline that I am misunderstanding that would clarify all this. (Tested in 2019 LTS and 2020.2.3)
For example:
C#
public class TestRender : MonoBehaviour {

  public Material material ;
  private ComputeBuffer vertexBuffer;
  private GraphicsBuffer indexBuffer;
  private ComputeBuffer paramsBuffer;

  private Bounds _bounds;

  void Start () {
    material = new Material(material);

    // Copy geometry from MeshFilter (you can just use a cube for testing)
    Mesh mesh = GetComponent<MeshFilter>().sharedMesh;
    vertexBuffer = new ComputeBuffer(mesh.vertices.Length, Marshal.SizeOf<Vector3>());
    indexBuffer = new GraphicsBuffer(GraphicsBuffer.Target.Index, mesh.triangles.Length, Marshal.SizeOf<int>());

    vertexBuffer.SetData(mesh.vertices);
    indexBuffer.SetData(mesh.triangles);

    paramsBuffer = new ComputeBuffer(5, sizeof(int), ComputeBufferType.IndirectArguments);
    paramsBuffer.SetData(new int[] { mesh.triangles.Length, 1, 0, 0, 0 });

    material.SetBuffer("_VertexBuffer", vertexBuffer);

    _bounds = new Bounds(transform.position, new Vector3(5, 5, 5));
  }

  private void Update() {
    // This works!
    Graphics.DrawProcedural(material, _bounds, MeshTopology.Triangles, indexBuffer, indexBuffer.count);

    // So does this!
    material.SetPass(0);
    Graphics.DrawProceduralNow(MeshTopology.Triangles, indexBuffer, indexBuffer.count);
  }

  private void OnRenderObject() {
    // This does NOT work
    Graphics.DrawProcedural(material, _bounds, MeshTopology.Triangles, indexBuffer, indexBuffer.count);

    // But this does!
    material.SetPass(0);
    Graphics.DrawProceduralNow(MeshTopology.Triangles, indexBuffer, indexBuffer.count);
  }
}

Simple shader:
Shader "Test Render" {
     SubShader {

         Pass {
         CGPROGRAM
         #include "UnityCG.cginc"
         #pragma target 4.5
         #pragma vertex vertex_shader
         #pragma fragment fragment_shader

         StructuredBuffer<float3> _VertexBuffer;

         struct v2f {
             float4 pos : SV_POSITION;
         };

         v2f vertex_shader (uint id : SV_VertexID, uint inst : SV_InstanceID)
         {
             v2f o;
             float4 vertex_position =  float4(_VertexBuffer[id],1.0f);
             o.pos = UnityObjectToClipPos(vertex_position);
             return o;
         }

         fixed4 fragment_shader (v2f i) : SV_Target
         {
            fixed4 final = fixed4(0, 0, 1, 1);
            return final;
         }

         ENDCG
     }
     }
}

sentences:
Problem when trying to use rb.MoveRotation in Unity OK so I learned that rb.MoveRotation is different from rb.transform.Rotate(). But I am having trouble using it and hoping you can help me.

I usually use transform.translate(Vector3.forward)  (after using transform.Rotate(x,y,z)) , so that I know that will always make object move in the direction its facing. But this isnt working when I use rb.MovePosition. The object rotates when i remove the MovePosition line, but then for some reason doesn't when its there. I've tried multiple things as you'll see in the code.

I cant understand also why, if I use the bottom commented attempt in my code, and then press D in game, it will go in the direction its facing and then get
stuck. I've commented in my code to try to explain whats happening.

What is the correct way to move the position of the player now I am using MoveRotation? I want to base my movement of the direction that the object is facing and not in world coordinates.

Thanks

    void HandleKeys()
{
    if (Input.GetKey(KeyCode.A))
    {
        if (!facingLeft)
        {
            rb.MoveRotation(Quaternion.Euler(0,-90,0));
            facingLeft = true;
        }
        //rb.transform.Translate(Vector3.forward * speed * Time.deltaTime); // if I remove this line, the character does turn and face left . But when its in he doesn't and both keys make him move right (and face right)
        // also tried:
        //rb.MovePosition(transform.position += Vector3.forward * speed * Time.deltaTime); // this results in it going Vector3.forward in world coords
        //**rb.MovePosition(transform.position += rb.transform.forward * speed * Time.deltaTime); // this makes him go RIGHT>?? and the objects facing RIGHT why????
    }
    if (Input.GetKey(KeyCode.D))
    {
        if (facingLeft)
        {
            rb.MoveRotation(Quaternion.Euler(0f, 90f, 0f));
            facingLeft = false;
        }
        rb.transform.Translate(Vector3.forward * speed * Time.deltaTime); // if i leave this in, and the one marked * above, then it works but only once, so if I press A then, D he heads right but wont turn round, if I press D first he just goes right
    }
    if (Input.GetKeyDown(KeyCode.Space) && IsGrounded())
    {
        rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
    }

}

sentences:
How to set a Label position after a timer ends, in a repetitive structure? I have this fragment of code. It moves a pawn on a board.

while(i<end)
{
    try
    {
        Thread.sleep(1000);
    }
    catch (Exception e)
    {
       System.out.println(e);
    }
    Label.setBounds(x+i, y, xsize, ysize);
    i++;
}

My problem:
The Label gets set only once, after all the time(end seconds) passes.

Also tried:
1:

while(i<end)
{
    for(int v;v<9999999;v++);
    Label.setBounds(x+i, y, xsize, ysize);
    i++;
}

2:

while(i<end)
{
    for(int v;v<9999999;v++)
    {
        Label.setBounds(x+i, y, xsize, ysize);
    }
    i++;
}

With same result.

sentences:
How to avoid movement speed stacking when multiple keys are pressed? I've started a new game which requires no mouse, thus leaving the movement up to the keyboard. I have tried to incorporate 8 directions; up, left, right, up-right and so on. However when I press more than one arrow key, the movement speed stacks (http://gfycat.com/CircularBewitchedBarebirdbat). How could I counteract this?

Here is relevant part of my code:

var speed : int = 5;

function Update () {
    if (Input.GetKey(KeyCode.UpArrow)) {
        transform.Translate(Vector3.forward * speed * Time.deltaTime);
    } else if (Input.GetKey(KeyCode.UpArrow) && Input.GetKey(KeyCode.RightArrow)) {
        transform.Translate(Vector3.forward * speed * Time.deltaTime);
    } else if (Input.GetKey(KeyCode.UpArrow) && Input.GetKey(KeyCode.LeftArrow)) {
        transform.rotation = Quaternion.AngleAxis(315, Vector3.up);
    }
    if (Input.GetKey(KeyCode.DownArrow)) {
        transform.Translate(Vector3.forward * speed * Time.deltaTime);
    }
}

sentences:
Simple openGL code paradox I'm trying to create the most basic application that will draw a cube using indices and textures for starters, but nothing about it makes any sense whatsoever.

I ran it on my machine with an nVidia card and the display driver (latest, not that it matters) crashes (null ref), along with the program on the glDrawElements(...) command (Renderer.cpp). Fine. Then I sent it to a friend of mine who has an AMD card to try to debug it because I was unable to find the bug in the code, and the program worked (didn't crash) on his machine.

That surprised me since I only did the most basic openGL stuff, no way it was vendor specific. To get to the bottom of this, I downloaded APItrace (http://apitrace.github.io/) to try to see what's going on under the hood of my machine and why does my driver crash.

Once I dumped the trace after I ran the program, it said that the shader program linker failed because I didn't write to gl_Position (which I have).

The problem is that the program links just fine in VS debugger and no error is returned there. So it just keeps getting weirder.

If you want to mess with this, you can get the code (commit with issue linked) at https://github.com/Karlovsky120/7DaysWorldEditor/commit/e86b8be40c81511c4416dc5e253b90e42a5a8ec0

I don't think you'd see the bug if I just pasted the code here, there must be a mistake with the setup somewhere.

I really made an effort to make this as hassle free as possible, it's just one click install: clone it, build it, and you're good to go, no additional setup required. You will need to open it with VS2017 though.

There's a lot of classes in the code, but all of the relevant code is in Scene.cpp and any of the classes it references.

Thank you for any help you give, even if it's just a guess at what might be wrong because I'm at my wits end here.

sentences:
Make a background Image to fit multiple objects? In the Hierarchy, I have a GameObject named "Buttons" to which I added an  Image component.

I would like that the ok sprite to cover (be background of) all the buttons: START GAME, OPTIONS, CREDIT and EXIT.

But the ok sprite is somewhere in the top left corner behind the START GAME button on its left side and is very small.
This happened when I clicked in the Inspector in Image on Set Native Size.

I want to make it big enough to cover all the buttons but I'm not sure how.

sentences:
Can I remove the systems from a component entity system? After reading a lot about entity-component based engines, I feel like there is no real definition for this kind of engine. Reading this question, and the linked articles, made me think a lot. I do not feel that comfortable using the system concept, so I'll write something else that is inspired by this pattern. I'd like to know if it is a good way to organize game code, and what improvements can be made.

Regarding a more strict implementation of the entity-component based engine, is my solution viable? Do I risk getting stuck, at any point, due to the lack of flexibility of this implementation, or anything else?

My engine, as for entity-component patterns, has entities and components, but no systems, since the game logic is handled by components. I also think the main difference is the fact that my engine will use inheritance and object-orientated programming concepts, in general. I don't try to minimize them.

Entity: an entity is an abstract class. It holds a position, width, height, scale and a list of linked components. Every frame, the entity will be updated (i.e. all the components linked to this entity will be updated), and rendered, if a render component is specified.
Component: like for entity, a component is an abstract class that must be extended to create new components. The behavior of an entity is created through the components collection. Components are updated when the owning entity is updated, or for only one specific component (render component), rendered.

sentences:
Property replication vs RPC: Communication directions I have an UParticleSystemComponent attached to ACharacter. Its activation is controlled by user input, so it receives several updates per second.

For replicating the activation state of the particle system, the user input triggers an update of the value of a replicated variable (UPROPERTY(Replicated)) on the ACharacter. This works fine for the direction

Listen server -> Clients,

however not for the directions

Client -> Listen Server
Client -> Client.

I assume this is the case b/c "Property updates only come from the server (i.e., the client will never send property updates to the server)".

So for Client -> Client replication I have to rely on RPCs and can't use property replication at all?

sentences:
What are atan and atan2 used for in games? I am having some trouble understanding Math.tan() and Math.atan() and Math.atan2().

I have basic knowledge of trigonmetry but the usage of SIN, COS, and TAN etc for game development is very new to me.

I am reading on some tutorials and I see that by using tangent we can get the angle in which one object needs to be rotated by how much to face another object for example my mouse. So why do we still need to use atan or atan2?

sentences:
Peer to Peer world download I am creating a multiplayer JavaScript game with a PHP central server. Each user will be able to move around in a 3D world, with other users and NPCs. It came to my attention that SQL is not going to handle all the requests being made in a reasonable time. So I cut down on SQL requests being made as often, using RAM when I can, but each user that logs into my world, or switches worlds requires a lot of data to be filtered from the server (So the client does not get any information it should not have, and so I don't have to distribute the entire world for every logon) and then uploaded to the client. So I had an idea: What if I can get the World data from the users near to the player(In the 3D world), like a BitTorrent? How to resolve syncing issues? What are my options to prevent Hacking? My ideas were: check with more than one user, get a hash from a server(will probably have syncing problems), have bots who request worlds from clients: then checks with server to see if they are being honest, how ever they all seem to have their problems, and am not sure which one(s) I should incorporate, or if there is a better way I could get correct world data from peers, with minimal server interaction.

Note: Peer to Peer is only used to get the world, block/world updates are still handled between the server and each client

sentences:
Unity: Smoothing between two floats which are continuously changing I'm looking for some help with smoothing between an original float and a target float, where the original float is consistently changing (potentially interfering with interpolation techniques and or Mathf.SmoothDamp)

I tried Mathf.SmoothDamp with the below:

(float rocketBoostPower is a global variable)

float yVelocity = 0.0F;
float tempForce = rocketBoostPower + Input.GetAxis("Mouse Y") * shiftSpeed / 5f;
rocketBoostPower = Mathf.SmoothDamp(rocketBoostPower , tempForce, ref yVelocity, 0.5f);

This doesn't change the force at all however, it just stays locked in place.

I'm currently using the below to change my power, however I want to smoothly change the power instead of just incrementing sharply on each Update frame:

rocketBoostPower += Input.GetAxis("Mouse Y") * shiftSpeed / 5f;

Please can someone help? I need the assumption that every update will receive a new rocketBoostPower value, whilst still smoothing its previous value.

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 force playing attack animation until the end? I rework the code to make it more easier to manage. How can I force the player cannot change the sprite animation by pressing any keys until the attack animation completely ends?

class Player
{
    Animation playerIdle;
    Animation playerRun;
    Animation playerAtk;

    public void Load(ContentManager content)
    {
        playerIdle = new Animation(content, "idle", 144, 128, 8, 30);
        playerRun = new Animation(content, "run", 160, 112, 8, 30);
        playerAtk = new Animation(content, "atk", 154, 131, 2, 30);

        playerIdle.EnableRepeating();
        playerRun.EnableRepeating();
        playerAtk.EnableRepeating();
    }

    public void Update(GameTime gameTime)
    {
        playerIdle.Update(gameTime);
        UpdateControl(gameTime);
    }

    #region Update Control
    string selectSpriteSheet;

    KeyboardState mPreviousKeyboardState;
    SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally;

    Vector2 feetPosition = new Vector2(0, 350);
    Vector2 mSpeed = Vector2.Zero;
    Vector2 mDirection = Vector2.Zero;
    Vector2 mStartingPosition = Vector2.Zero;

    int CHARACTER_SPEED = 50;
    int MOVE_LEFT = -5;
    int MOVE_RIGHT = 5;
    int MOVE_UP = -5;
    int MOVE_DOWN = 5;

    enum State
    {
        Running,
        Jumping,
        Attacking,
    }

    State mCurrentState = State.Running;

    public void UpdateControl(GameTime gameTime)
    {
        KeyboardState aCurrentKeyboardState = Keyboard.GetState();

        feetPosition += mDirection * mSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        selectSpriteSheet = "idle";
        UpdateMovement(aCurrentKeyboardState, gameTime);
        //UpdateJump(aCurrentKeyboardState, gameTime);

        mPreviousKeyboardState = aCurrentKeyboardState;
    }

    private void UpdateMovement(KeyboardState aCurrentKeyboardState, GameTime gameTime)
    {
        if (mCurrentState == State.Running)
        {
            mSpeed = Vector2.Zero;
            mDirection = Vector2.Zero;

            if (aCurrentKeyboardState.IsKeyDown(Keys.Left) && !aCurrentKeyboardState.IsKeyDown(Keys.Right))
            {
                playerRun.Update(gameTime);

                selectSpriteSheet = "run";
                spriteEffects = SpriteEffects.None;
                mSpeed.X = CHARACTER_SPEED;
                mDirection.X = MOVE_LEFT;

            }
            else if (aCurrentKeyboardState.IsKeyDown(Keys.Right) && !aCurrentKeyboardState.IsKeyDown(Keys.Left))
            {
                playerRun.Update(gameTime);

                selectSpriteSheet = "run";
                spriteEffects = SpriteEffects.FlipHorizontally;
                mSpeed.X = CHARACTER_SPEED;
                mDirection.X = MOVE_RIGHT;
            }

            if (aCurrentKeyboardState.IsKeyDown(Keys.Z) && mPreviousKeyboardState.IsKeyUp(Keys.Z))
            {
                mCurrentState = State.Attacking;
            }
        }

        if (mCurrentState == State.Attacking)
        {
            playerAtk.Update(gameTime);

            selectSpriteSheet = "hit";
            mCurrentState = State.Running;
        }
    }
    #endregion

    public void Draw(SpriteBatch spriteBatch)
    {
        //playerIdle.Draw(spriteBatch, feetPosition, (float)MathHelper.ToRadians(0), 1.0f);
        if (selectSpriteSheet == "idle")
            playerIdle.Draw(spriteBatch, feetPosition, spriteEffects, (float)MathHelper.ToRadians(0),1.0f);
        else if (selectSpriteSheet == "run")
            playerRun.Draw(spriteBatch, feetPosition, spriteEffects, (float)MathHelper.ToRadians(0),1.0f);
        else if (selectSpriteSheet == "hit")
            playerAtk.Draw(spriteBatch, feetPosition, spriteEffects, (float)MathHelper.ToRadians(0), 1.0f);
    }
}

sentences:
HTML5 Jump and Run Game Performance issues we're developing a HTML5/Javascript jump and run game and therefore we have developed our own gameframework.
It consists of following most important structures:

Stage/Scene/Layer: divs
ObjectEntites/Rectangle/Sprite: canvas

In the gameloop things get moved by calculating an offset value: e.g. if we place a coin and this coin moves through the screen, it gets a new offset in each gameloop-call. The dirty area of the coin is cleared in the canvas and the coin is repainted. We pay attention that we just draw at int-values (no floating point).

Unfortunately we have some performance issues now and can't figure out why our macbook pro's are running hot while playing the game.

Are the drawing operations so crucial? We have layered Canvas, so just moving stuff gets repainted and even not the whole canvas but just dirty-areas get cleared.

IStat shows following values while playing the game:
Memory module A1 and Heatsink B get up to 60° and the rpm-Value of the Fans increases up to 3000-4000.
In firefox we see these values:

And chrome shows us this, where we also see how cpu increases:

Do you have any idea how to check performance of our game, how to find bottlenecks or general tips? We have searched for canvas performance, used firebug profiler...
We'd be grateful for any advice!

sentences:
Explicit resource loading in Ogre (Mogre) I am just starting to learn Mogre and what I would like to do is to be able to load resources 'explicitly' (i.e. I just provide an absolute path instead of using a resource group tied to a directory).

This is very different to manually loading resources, which I believe in Ogre has a very specific meaning, to build up the object using Ogres methods. I want to use Ogres resource management system/resource loading code, but to have finer control over which files are loaded and in what groups they are.

I remember reading how to do this but cannot find the page again; I think its possible to do something like:

Declare a resource group
Declare the resource(s) (this is when the actual resource file name is provided)
Initialise the resource group to actually load the resource(s)

Is this the correct procedure? If so, is there any example code showing how to do this?

sentences:
How can i port my OpenGL game to linux? I made a game with OpenGL 4.3(core profile) and C++. I used GLFW3 for window and context management. I am also using bunch of third party library which are also available for linux.

What things do i need to consider if i want to port the game and how can i make it support all windows and linux?

sentences:
Why am I experiencing weird texture warping? I'm using cubemaps to render a skybox, in my game. Thinking this would be a simple task, I threw some stuff together using the tutorials I found online, particularly this one. Taking all of this together, I then adjusted the program to compensate for my particularly junky Linux laptop, by converting the GLSL to 120. However, this turned sour when I discovered that the texture I was loading, which is just a straight black line meant to test this very issue, is being horribly bent by my program. A short clip of my problem is shown on Youtube, here. In desperation, I asked this question on gamedev.net, without much success.

My Shader code looks like this:

Vertex Shader

#version 120
attribute vec3 verPos;

uniform mat4 MVP;
uniform vec3 camPos;
varying vec3 texCoord;
void main(){

    vec4 vertexPosition = vec4(verPos, 1.0);
    texCoord = verPos;
    gl_Position = MVP * vertexPosition;

}

Fragment Shader

#version 120

varying vec3 texCoord;
uniform samplerCube CubeMap;

void main()
{
    gl_FragColor = textureCube(CubeMap, texCoord);
}

Rendering Code

To avoid being spammy, I'll just assume that I loaded the images correctly, and not show off that particular mess. I'm using IMAGE_Load from SDL2 to handle the texture loading, and I made the cube map clamp to edge and such.

void SkyBox::Draw(){
    if(!loadedCheck) return;
    glUseProgram(myProgID);
    glDisable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    glm::mat4 perspect = glm::perspective(45.0f, float(640) / float(480), 0.1f, 3000.0f);
    vector3f playerPos = player.myNPC.myEnt.myObject.getPosition();
    float playerAngY = player.myNPC.myEnt.myObject.myAngle.y;

    camPos = glm::vec3(-15.0f * float(cos(-playerAngY + 1.62)), 0,
        -15.0f *   float(sin(-playerAngY + 1.62)));

    //Convert my vector3f class to glm::vec3
    glm::vec3 playerGLM = glm::vec3(playerPos.x, playerPos.y, playerPos.z);
    float playerAngX = player.myNPC.myEnt.myObject.myAngle.x;

    //camPos is the position of the camera relative to the player's position
    glm::mat4 view = glm::lookAt(camPos + playerGLM, playerGLM, glm::vec3(0,1,0));
   // view = glm::mat4(glm::mat3(view));
   //To get rid of the translation matrix
    view[3][0] = 0;
    view[3][1] = 0;
    view[3][2] = 0;
    //comb is equivalent to an MVP matrix
    glm::mat4 comb = perspect * view;

    GLuint matrixID = glGetUniformLocation(myProgID, "MVP");
    glUniformMatrix4fv(matrixID, 1, GL_FALSE, glm::value_ptr(comb));

    GLuint camID = glGetUniformLocation(myProgID, "camPos");
    GLuint sampler = glGetUniformLocation(myProgID, "CubeMap");
    float camP[3] = {camPos.x, camPos.y, camPos.z};
    glUniform3fv(camID, 3, camP);

    glActiveTexture(GL_TEXTURE0 + 0);

    glBindTexture(GL_TEXTURE_CUBE_MAP, myTexture);

    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
    glEnableVertexAttribArray(verAttrib);
    glVertexAttribPointer(
        verAttrib,
        3,
        GL_FLOAT,
        GL_FALSE,
        0,
        (void*)0
    );

    glDrawArrays(GL_TRIANGLES, 0, 36);

    glDepthFunc(GL_LESS);
    glEnable(GL_DEPTH_TEST);

}

All in all, I feel like this should be working. Why am I experiencing weird texture warping?

sentences:
LOVE Physics - Joint Stretching After asking a similar question yesterday I've come across another problem with using joints in box2D / LOVE and trying to create a weighted chain.

Everything is set up as follows, I've tried to remove most of the fluff:

Each link is created as a body/shape pair then joined together and added to a links table.

    for i = 1, segments, 1 do

        link = {}

        link.body = love.physics.newBody(world, xpos, ypos, "dynamic")

        if (i == segments) then
            link.shape = love.physics.newCircleShape(endlink_radius) --Ending link
        else
            link.shape = love.physics.newCircleShape(link_radius)
        end

        link.fixture = love.physics.newFixture(link.body, link.shape) --Fix bodies to shapes

        table.insert(links,link)

        ypos = ypos + link_distance

    end

Links are joined together using rope joints to allow for some springy-ness:

    for i = 2, #links, 1 do

        x1,y1 = links[i-1].body:getPosition()
        x2,y2 = links[i].body:getPosition()
        links[i-1].join = love.physics.newRopeJoint(links[i-1].body, links[i].body, x1, y1, x2, y2, link_distance, true )

    end

The player controls the first element of the chain and holds the table of links, its created as follows:

local body = love.physics.newBody(world, 300, 100, "kinematic")
local shape = love.physics.newCircleShape(3)
local fixture = love.physics.newFixture(body, shape)
local chain = _chain.new(world)

Joined to the chain:

x1,y1 = body:getPosition()
x2,y2 = links[1].body:getPosition()
join = love.physics.newRevoluteJoint(body, links[1].body, x1, y1, x2, y2, true )

The player tracks the mouse cursor, determines a velocity and moves towards it by setting the linear velocity of the first chain element:

    body:setLinearVelocity(velocity.x, velocity.y)

And this very nearly works, you can pull the chain around quite nicely using the mouse (directing the top pink element), however if you keep spinning the chain it begins to stretch and pull away from the first element:

Any ideas on how to solve this?

I've tried using different joints and parameters, adding a reinforcing joint from the first link to the last, adjusting body weights and altering the update iterations but can't seem to find anything effective.

Many thanks.

sentences:
How can I insert a prefab instance programmatically inside the Canvas, in the bottom-left corner of the Canvas? I am trying to create the Snake game in Unity, based on this video tutorial. I have also viewed this tutorial.

I have created the new project with the 3D template and manually added the Canvas. I created a prefab from an Image which loads a texture from the Assets. I have this code:

using UnityEngine;
using UnityEngine.UI;
public class GameManager : MonoBehaviour
{
    public GameObject whiteCellPrefab;
    int N = 30, M = 20, size = 16;

    // Start is called before the first frame update
    void Start()
    {
        Transform p = GameObject.Find("Canvas").transform;
        for (int i = 1; i <= N; ++i)
        {
            for (int j = 1; j <= M; ++j)
            {
                GameObject g = Instantiate(whiteCellPrefab, p);
                g.transform.localPosition = new Vector3(i * size, j * size);
            }
        }
    }

    // Update is called once per frame
    void Update()
    {

    }
}

If I manually add a prefab instance to the Canvas, it is positioned as I want: in the bottom-left corner. But the script above, attached to the Main Camera object, creates the Image objects starting from the center point of the Canvas towards the top-right corner of the Canvas.

In the example shown here, I also added a new prefab instance to the Canvas in the Unity editor. It is positioned correctly even when play testing but the ones added with the script are shown somewhere else.

Screenshots

Download my example

I tried to explain all the steps involved in my problem above, but here is the repo with my problem.

Thank you.

sentences:
Child transform's position not updated as parent moves I have a parent game object Object1. It has a child, which is simply an empty game object called ReferencePoint. ReferencePoint can be any arbitrary point on Object1 itself.

I have another game object Object2. It has a public field called RotationReference, of type Transform. In the inspector, the ReferencePoint on Object1 is assigned to the RotationReference field on  Object2.

As Object1 moves, I expect ReferencePoint to change its position as well. Object2 is supposed to change its rotation to face its RotationReference -- in this case, the ReferencePoint on Object1:

public override void Rotate()
{
    Vector3 relativeRotationReferencePosition =
        this.RotationReference.position - this.transform.position;

    this.transform.rotation = Quaternion.LookRotation(relativeRotationReferencePosition);
}

However, I noticed that Object2 is not rotating at all, even when Object1 is moving. When I step through the call stack multiple times, I discover that this.RotationReference.position always has the same value, even though Object1 is moving.

What am I missing here?

sentences: Conversion of a C++ library to DLL I'm developing an augmented reality application and I'm supposed to use the ALVAR library for AR marker detection. I use Unity as the game engine and unfortunately it doesn't support C++. Is there any possible way to use the C++ library as a DLL?

sentences:
Unity mailchimp / Klaviyo subscription form Hey everyone so i want to add a subscription form on my game. so far i can send data to a database and display them on a leaderboard, i found a similar question here but its a bit outdated. Ideally i would like to use klaviyo but since this is the only lead i have i might want to get familiar with how it works!
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class MailingScript : MonoBehaviour
{

    public InputField emailField;
    public InputField nameField;

    public void onClick()
    {
        StartCoroutine(SendToMailChimp());
    }

    private IEnumerator SendToMailChimp()
    {
        WWWForm form = new WWWForm();
        form.AddField("EMAIL", emailField.text);
        form.AddField("b_0f079b7af1cef143021ff4236_6cd74c0a6a", nameField.text);
        //form.AddField("subscribe", "Subscribe");
        UnityWebRequest www = UnityWebRequest.Post("https://slaga-games.us1.list-manage.com/subscribe/post?u=0f079b7af1cef143021ff4236&amp;id=6cd74c0a6a", form);
        yield return www.SendWebRequest();

        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
        }
        else
        {
            Debug.Log("Registered");
        }
    }
}

this is my code so far but it wont do anything. i have a same code for the database which works!

sentences:
How do I work out what resolution my backgrounds should be? I'm working on a game that's 1200 x 800. The pixels per meter ratio is 1:20. When I add my background texture that is 400 x 225. It fits well in the zone however the lines on the image are pixelated. How can I work out what resolution my background should be in order for it to not look pixelated?

Here's what I have so far:

@Override
public void show() {
   ...
   b1 = new Texture(Gdx.files.internal("backgrounds/spr_stars01.png"), true);
   b1.setFilter(TextureFilter.Linear, TextureFilter.Linear);
   ...
}

@Override
public void render(float delta) { //(43, 55, 61)
   ...
   Gdx.gl.glClearColor(132/255f, 0/255f, 35/255f, 1f);
   Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
   world.step(TIMESTEP, VELOCITYITERATIONS, POSITIONITERATIONS);
   world.getBodies(bodies);

   camera.position.set(player.getPosition().x, player.getPosition().y, 0);
   camera.update();

   timer += (delta*1.25f);
   batch.setProjectionMatrix(camera.combined);

   batch.begin();
   batch.draw(b1, player.getPosition().x/20, player.getPosition().y/20);
   batch.end();
   ...
}

@Override
public void resize(int width, int height) {
    camera.viewportWidth = 1200 / 20; //60m
    camera.viewportHeight = 800 / 20; //40m
    hud.getViewport().update(width, height);
}

The result:

The original background:

edit: my windows resolutions is 1200x800

edit2: Both answers have helped greatly in understanding background scaling. I have decided to create reusable polygon textures, much smaller than my original background, that I can scale with my box2d world. Thanks for the help!

sentences: PUZZLE MAZE using probability - HOW TO is there an easier way to do this? perhaps a formula?

sentences:
How can I make the objects to move at the same speed as the lines? void Update()
    {
        if (animateLines)
        {
            counter++;
            for (int i = 0; i < allLines.Length; i++)
            {
                Vector3 endPos = allLines[i].GetComponent<EndHolder>().EndVector;
                Vector3 startPos = allLines[i].GetComponent<LineRenderer>().GetPosition(0);
                Vector3 tempPos = Vector3.Lerp(startPos, endPos, counter / 500f * speed);

                allLines[i].GetComponent<LineRenderer>().SetPosition(1, tempPos);

                instancesToMove[i].transform.position =
                    Vector3.MoveTowards(endPos, startPos, counter / 500f * speed);
            }
        }
        else
        {
            counter = 0;
            foreach (GameObject thisline in allLines)
            {
                thisline.GetComponent<LineRenderer>().SetPosition(1, thisline.GetComponent<LineRenderer>().GetPosition(0));
            }
        }
    }

The lines are LineRenderer.

void SpawnLineGenerator(Vector3 start, Vector3 end, Color color)
    {
        GameObject myLine = new GameObject();

        myLine.tag = "FrameLine";
        myLine.name = "FrameLine";

        myLine.AddComponent<LineRenderer>();
        myLine.AddComponent<EndHolder>();
        myLine.GetComponent<EndHolder>().EndVector = end;
        LineRenderer lr = myLine.GetComponent<LineRenderer>();
        lr.material = new Material(Shader.Find("Particles/Alpha Blended Premultiply"));
        lr.startColor = color;
        lr.useWorldSpace = false;
        lr.endColor = color;
        lr.startWidth = 0.1f;//0.03f;
        lr.endWidth = 0.1f;//0.03f;
        lr.SetPosition(0, start);
        lr.SetPosition(1, start);
    }

So I have lines each new gameobject have a LineRenderer component and inside Update I'm animating the lines with some speed.

Now I want to move the instancesToMove (GameObject[] ) with the same speed as the lines but the instancesToMove are moving much slower then the lines.

I tried:

instancesToMove[i].transform.position =
                        Vector3.MoveTowards(endPos, startPos, speed);

Then

instancesToMove[i].transform.position =
                        Vector3.MoveTowards(endPos, startPos, speed * Time.deltaTime);

But it's never moving with the same lines speed.

sentences:
is it possible to make a MMO starting with scalable hosting? I made a really basic 2D RPG. I want to know whether I can turn it into a free to play MMO.

I cannot afford to rent a server with enough capacity to serve a big number of players but I'm wondering whether I could get a hosting plan that starts cheap but scales enough to eventually handle a big numer of users so I have minimum fixed costs and I can cover expenses on the go with ads or whatever.

Is there such a thing? Thanks

sentences:
Copy unaligned XMVECTOR and use the copy? I know XMVECTOR has to be 16-byte-aligned and therefore shouldn't be a member of a class (unless I ensure the alignment). However, can I do sth like this?

class A
{
    public:
    XMVECTOR vect;
};

void fun(void)
{
    A a;
    XMVECTOR localVect = a.vect;
    // can I now use localVect correctly?
}

Edit:
My question isn't "Can I use XMVECTOR as a member variable?". It's "Can I copy an XMVECTOR instance that's not guaranteed to be 16-byte aligned into one that is and then use the latter one without any problems?".

sentences: Bike game - following a road path I am writing a game in java which has a bike riding down a road. I intend to add some obstacles on the road which are structures having a slope, which the biker must negotiate. In other words, the bike must climb and run along the slope whenever it encounters one so obviously it must be aligned accurately with the slopy path. Im currently doing this using trig functions to find the angle of rotation, x y coordinates for the bike when it is climbing, descending etc. Can someone suggest a better algorithm to achieve this please ?

sentences:
2D side scroller - How to implement X/Y movement? I'm currently writing a small 2D, side-scroller-ish kind of game.

I have a simple camera that follows the player around and the physics are ready.

I'm using 32x32 tiles that build out the world, they are all stored in a 2D array, something along this:

[ 0, 0, 0, 0,
  0, 0, 0, 0,
  1, 1, 0, 1,
  1, 1, 1, 1  ]

The 1s are land and 0s are air.

Now the world is dynamic and I want it to be quite large (1 big world) around 1000x800 tiles total.

My biggest issue atm is how to implement the "scrolling effect".
Also keep in mind that the player can go in any direction (up/right/left/right).

Thanks

sentences:
Array textures on Pixel shader I'm developing on D3D11 and D3D12 in parallel. D3D12 is really difficult, but I learn it gradually. I faced a problem such as passing an array of textures to a vertex Shader. The method Textures2DArray was interesting in D3D11 , but it had disadvantages (size of texture, width and height must be the same, the same levels of MipMaps etc). As a result: I'm looking for a way to transfer a dimensionless ( if it is possible ) texture array, or at least an array of fixed size, but with different textures (*.dds (mipmaps, *.jpg etc). Why is it so necessary? Let's imagine that a model has been loaded. It has 50 textures. I loaded all 50 textures on the CPU, built an array from it, created the necessary descriptors and sent it to the Shader. I get the right texture in the Shader using the index. Thus, there will be one call to the GPU, instead of multiple calls = = number of textures in the model. Thank you for any information.

P.S.: I know about texture atlases, but in ordinary geometry I do not see any benefit from it

sentences:
How can I remove Godot's splash screen? I started using Godot lately (mostly because the editor supports Linux).

There is one thing that bothers me: the Godot splash screen. I know that I can (somehow) remove it and I saw something about C but I'm not sure.

Is there any way to remove it? Or maybe it is only in the editor and once you export the game it'll disappear?

sentences:
How can I emulate Diablo 3's Isometric view using Perspective? Using DX11, SimpleMath I am building a isometric game like Diablo 3 in 3D and I want to use a perspective camera that emulates their top down view.

Projection Matrix: CreatePerspectiveFieldOfView(1, width/height, 0.1f, 100.0f);

But after this I am a bit unsure how I am suppose to rotate the camera. I assume I could just do p - Vector3(10, 10, 10) to get a 45 degree angle at any given p.

How do I properly position, and rotate the camera and point it at position p, to mimic Diablo 3 view?

sentences:
How to draw an OpenGL object in another on Android? -> Eyes and Eyeballs As i allready wrote in another question:

  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.
  -> How to change/modify or animate an existing OpenGL object on Android?

So this is a further question.

My Tamagotchi is haveing to eyes. Like this:

To make it look real i want the eyes to blink and the eyeballs to move arround.
But the question here is what happens with the eyeball when the eyes are closed.
In my Situation you woud not see the eyeballs because they are the same color then the body of the Tamagotchi.
But i want the eyeballs to be a part of the eye. So if the Eye is closing the eyeballs shoud disapear where the eyes are closed whereever the eyeball is at the moment.

Here you can see the eye closed (down scaled y) but the eyeball is still visible....

I want the eyeball to be cut of or not shown where the eye is closed like this:

But i have no idear how to solve this.

Edit
Here is my Code for someone who want to look at it.
But i think it is not necessary.

public class GLEyes {

private int points = 1000;
private float vertices[]={0.0f,0.0f,0.0f};
private FloatBuffer vertBuff;

//Der Kreis wird von der Mitte der Fläche gezeichnet

public GLEyes(){

    vertices = new float[points * 2];
    for(int i=0; i< (points+3); i+=3)
    {
      double rad = 2*(Math.PI *i) / points; //Berechnung des radius

      vertices[i]=(float)Math.cos(rad);     //X Achsen Abschnitt
      vertices[i+1]=(float)Math.sin(rad);   //Y Achsen Abschnitt
      vertices[i+2]=0;                      //Z Achsen Abschnitt wird nur für 3D gebraucht
    }

    ByteBuffer bBuff=ByteBuffer.allocateDirect(vertices.length*4);
    bBuff.order(ByteOrder.nativeOrder());
    vertBuff=bBuff.asFloatBuffer();
    vertBuff.put(vertices);
    vertBuff.position(0);
}

public void draw(GL10 gl){

    lefteye(gl);
    righteye(gl);

}

private void lefteye (GL10 gl){
    gl.glPushMatrix();
    gl.glTranslatef(1, 1, 0);
    gl.glScalef(0.5f, 0.45f, 1.0f); //Skalierung einstellen
    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(1, 1, 0);
    gl.glScalef(0.1f, 0.1f, 1.0f); //Skalierung einstellen
    gl.glColor4f(1.0f,1.0f,1.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();
}

private void righteye (GL10 gl){
    gl.glPushMatrix();
    gl.glTranslatef(-1, 1, 0);
    gl.glScalef(0.5f, 0.45f, 1.0f); //Skalierung einstellen
    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(-1, 1, 0);
    gl.glScalef(0.1f, 0.1f, 1.0f); //Skalierung einstellen
    gl.glColor4f(1.0f,1.0f,1.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();

}

}

sentences:
What physics settings do I need to apply to make the pool game realistic? I want to create a pool game using Unity.

I added the spheres as playballs and cubes as the walls.
I added a rigidbody to all objects and Im able to do some basic collisions like in a pool game.

My Question is:

What physics settings do I need to apply to make the pool game realistic?

Right now, it's a bit weird. The ball does not bounce off the walls realistically and also the ball to ball collisions are not ok.

Any suggestions?

sentences:
Projectile Aim Prediction with Acceleration I'm trying to solve the classic shoot moving object problem but with acceleration attached to that changes it from a quadratic to quartic formula but my math skills are not this good sadly as i prefer to speak in code and not formulas.

i found this https://wiki.beyondunreal.com/Legacy:Projectile_Aiming. i ported it and it's almost what i'm looking for but missing control over the acceleration as its only made for gravity or no gravity and even this i got working only with tricks and modifying it without knowing what i'm doing is getting me only that far.

I made myself a Prototype Interface for the minimum of what i'm trying to get out of it

public class PredictionResult {
    public bool IsInRange; // can we even hit the target?
    public Vector3[] ShotVelocity; // should be up to 4 possible values
    public float[] ShotImpactTime; // how long each shot takes to arrive at the predicted target
    public Vector3[] ShotImpactLocation; // somewhat redundant yet still useful if available
}
// only really the delta between start and target matter but its up to the function
// same for startVel and targetVel where startVel is the shooters speed that gets added to the bullet
// the bullet and target can have different accelerations (standing on ground => no gravity or bullet is not affect by gravity)
public PredictionResult ShootAtTarget(Vector3 start, Vector3 target, Vector3 startVel, Vector3 targetVel, Vector3 bulletAccel, Vector3 targetAccel, float bulletSpeed);

any help solving this would be great

sentences:
Smoothing the scrolling path in 2D I have the following problem:

In a 2D game the screen can scroll in any of the 4 directions. Basically, the center of the screen during scrolling moves from (x1,y1) to (x2, y2) whereby (x1,y1) is the current focus and (x2, y2) is the desired focus. The latter changes frequently depending on what happens in the game.

At the moment, I only scroll if the distance d between (x1,y1) and (x2, y2) is above a certain threshold and also I am scrolling the faster the larger d is.

This already results in a quite smooth movement of the screen but I am still not completely happy with it. I was wondering if there are any standard or best-practice approaches to the problem of smoothing the path of the screen? I can imagine something with b-splines but I have no concrete idea of how to approach this.

sentences:
OpenGL Colour Issues I am using a single VBO to store vertices in the follow format:

v1X, v1Y, v1Z, v1R, v1G, v1B, v2A,
v2X, ...

Vertex positioning is fine, shapes show up where expected, however instead of using the colour provided, all shapes show up red.

The code given below simply draws two triangles to form one square ground shape.

Buffer data preparation method

public void prepare(float[] data) {
    glBindBuffer(GL_ARRAY_BUFFER, vboID);
    FloatBuffer dataBuffer = RenderUtils.fArrayToBuffer(data);
    if(dataLength != data.length) {
        glBufferData(GL_ARRAY_BUFFER, dataBuffer, GL_STATIC_DRAW);
        dataLength = data.length;
    } else {
        glBufferSubData(GL_ARRAY_BUFFER, 0, dataBuffer);
    }
    glVertexAttribPointer(0, 3, GL_FLOAT, false, 7*4, 0);
    glVertexAttribPointer(3, 4, GL_FLOAT, false, 7*4, 3*4);
}

Render code

floorObj.prepare(new float[]{
    -5, 0, -5,   1, 0, 0, 1,
    5, 0, -5,   0, 1, 0, 1,
    -5, 0, 5,   0, 0, 1, 1,

    5, 0, -5,   1, 0, 0, 1,
    5, 0, 5,   0, 1, 0, 1,
    -5, 0, 5,   0, 0, 1, 1,
});
glDrawArrays(GL_TRIANGLES, 0, 6);

Vertex shader

#version 330 core

in vec3 position;
in vec4 i_color;
out vec4 color;

uniform mat4 transform;

void main(){
    gl_Position = transform * vec4(position, 1);
    color = i_color;
}

Fragment shader

#version 330 core

in vec4 color;
out vec4 f_color;

void main(){
    f_color = color;
}

As previously stated, vertex positions work fine, however colour does not.
Just ask if any other code would be useful to determine the problem.

Thanks, - Jasper

sentences:
MSAA/ CSAA / FXAA How to set the mode in OpenGL? I'm learning OpenGL and something I am stuck with is AA. Specially when I want to turn it on and off at runtime. I know that I can set the samplecount when I create a FBO and blit it over to the final window. When I want to change the mode I switch the FBO and everything is fine. The question I am completely stuck with is, how do I change the mode and also important, how do I query the modes that the card supports. With mode I mean CSAA,MSAA,.. .I can't find a lot. At least I know that it is vendor specific.
Hope anyone can point me in the right direction. Thanks

sentences:
Reference a single 2d Rectangle in an array What I am attempting to do probably has a very simple answer but I can't make heads or tails of it no matter how hard I try.  Provided I'm a newb.

What I am trying to do is after I create a grid of rectangles, when the cursor moves into the grid, it changes the color of the rectangle the cursor is currently in (or highlights it), then changes back when the cursor leaves.  Here's what I've coded so far:

namespace MapGenie
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        Rectangle[,] gameGrid;

        MouseState currentMouseState;
        MouseState previousMouseState;

        bool colorChange = false;

        Color color;
        Color previousColor;

    protected override void Initialize()
    {
        //Creates the array
        gameGrid = new Rectangle[10, 10];

        color = Color.Black;

        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        this.IsMouseVisible = true;

        int Gridsize = 20;

        //Creates the grid
        for(int x = 0;x <10;x++)
            for (int y = 0; y < 10; y++)
            {
                gameGrid[x, y] = new Rectangle(x * Gridsize, y * Gridsize, Gridsize, Gridsize);
            }
    }

    protected override void Update(GameTime gameTime)
    {
        currentMouseState = Mouse.GetState();
        var mousePoint = new Point(currentMouseState.X, currentMouseState.Y);
        previousMouseState = currentMouseState;

        //Checks each rectangle in the gameGrid array to see if cursor is there?
        foreach (Rectangle grid in gameGrid)
        {
            if (grid.Contains(mousePoint))
            {
                previousColor = color;
                color = Color.Blue;
                colorChange = true;
            }
            if (colorChange == true)
                color = previousColor;
        }

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();

        var t = new Texture2D(GraphicsDevice, 1, 1);
        t.SetData(new[] { Color.White });

        foreach (Rectangle grid in gameGrid)
            spriteBatch.Draw(t, grid, color);

        spriteBatch.End();

        base.Draw(gameTime);
    }
}
}

Before I added the else statement (Which I am also aware does not work, but I am working to fix that after asking this), the entire grid would turn blue.  So, I am not sure if it is the right question or not, but how do you get just the one the cursor is in to change color?

sentences:
Controlling player and camera movement in a 3rd person game with keyboard and mouse In many action games with a third person view, joystick controls typically map the left joystick for player movement and the right joystick for camera movement (or more precisely camera's direction towards the character). With first-person games, mapping to mouse/keyboard is easy because the camera is directly influenced by the player's movement.  The player has to be able to look at any direction to point where he should go. Here is where the mouse comes in to provide this movement.

But the challenge I see is having separate camera and player controls with this setup. With a mouse/keyboard setup, it seems like I have to settle with a compromise, because the mouse is usually the only source for analog-like movement, whereas modern game pads have two sources, as separate joysticks.

One control scheme I had in mind is using A and D to change the player's heading as he travels through the world, leaving W and S to move forward/backward and the mouse free to move the camera. This still has a disadvantage, because you lack some degree to control how fast to change heading with the keyboard, unless you momentarily punch at the keys instead of holding them.

Is it possible to map the mouse and keyboard controls more intuitively for independent third person player and camera control?

sentences:
How to handle circle penetration I've been working on circle to circle collision and have gotten the intersection method working correctly, but I'm having problems using the returned values to actually separate the circles from one another.

This is the method which calculates the depth of the circle collision

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;
}

This is where I'm trying to apply the values to actually seperate the circles.

Vector2 depth = Vector2.Zero;
for (int i = 0; i < circlePositions.Count; i++)
{
    for (int j = 0; j < circlePositions.Count; j++)
    {
        Circle bounds1 = new Circle(circlePositions[i], circle.Width / 2);
        Circle bounds2 = new Circle(circlePositions[j], circle.Width / 2);

        if(i != j)
            depth = CircleToCircleIntersection.GetIntersectionDepth(bounds1, bounds2);

        if (depth != Vector2.Zero)
        {
            circlePositions[i] = new Vector2(circlePositions[i].X + depth.X, circlePositions[i].Y + depth.Y);
        }
    }
}

sentences:
How to give a Jerk Effect when the player is moving left of right float amttomove = Input.GetAxis("Horizontal") * playerspeed * Time.deltaTime;
            transform.Translate (Vector3.right * amttomove);

Currently, I have above script in Update function to move the object to left or right.But this movement is way smoother.To give it more realistic feel, I want it to have a slight jerk when it stops moving to left or right and not just stop right there and then.

What exactly needs to be done to have that effect?

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:
Looking for a dirty pseudo 3D trick To be specific I want to do bad sprite scaling like in Operation Thunderbolt. For some reason I'm getting it all wrong so far.

I started over from scratch and I've literally got a sprite that follows the mouse and scales larger as the Y position increases. I've got a horizon line at y128. I don't want the sprite to start scaling until it passes the horizon. I've been through countless examples of pseudo 3d but I want to start simple, one thing at a time so I can get the maths right in my head :S

Right now the code is:

set scale: Sprite.Y / Scalerate

Which keeps the scaling even as I move the mouse up and down but now I want to limit it to only growing after the horizon at 128.  As if a person is walking down the road at you, or maybe an equation that let's you set a start and end point on the y axis.

I'm totally new at the sprite scaling stuff!

sentences:
Level progression grid/chart What I'd like to do is create a sheet where I can track character XP/level progression.

I created this by hand:

It's sloppy, but in the realm of what I'd like to generate on a computer. Each bar represents XP needed to level up, with each square on the grid representing a set number of XP.

Any ideas how I could go about doing this in a more standardized/repeatable/printable?

sentences: How do I shuffle cards for a card game? I am trying to develop an card game for Android Can anyone suggest me how to write code for effectively shuffling the playing cards?

sentences:
Modifying z axis position of a canvas and adapting it to camera I have a camera with y rotation of 0.

And i have a canvas with position value of (0f,76.29f,41.82f).
The size value of the canvas is (194.1f,307.8f).
I want to modify the z value of the canvas to -10.

public Canvas textcanvas;
void Start () {
textcanvas.anchoredPosition = new Vector3 (0f, 24.5f, -10f);
}

But i get an error "error CS1061: Type UnityEngine.Canvas' does not contain a definition foranchoredPosition' and no extension method anchoredPosition' of typeUnityEngine.Canvas' could be found. Are you missing an assembly reference?"

Also, when i succeed moving the canvas, does the size of it adapting to the camera automatically?

sentences:
Calling Functions from Other Scripts Say I have three different gameObjevcts, each representing rock, paper or scissors. These objects all have a Player script attached to them. The Player script has two functions i want to use, MoveSelected(), MoveNotSeleccted(). When the function CPUMove() is called, I want the program to randomly choose one of the three moves. My question is, how do I call a either of the functions fro another script RPS_Game? I thought of using Invoke() somehow but after trying couple of things with it, I got no where. Can someone please help me out?

public class RPS_Game {
    public void CPUMove() {
        int rand = Random.Range(1, 3);

        if(rand == 1) {
          //call MoveSelected() for one of the three Player objects and
            MoveNotSelected() for the other two
        }
        else if(rand == 2) {
          //call MoveSelected() for one of the three Player objects and
            MoveNotSelected() for the other two
        }
        else if(rand == 3) {
          //call MoveSelected() for one of the three Player objects and
            MoveNotSelected() for the other two
        }
    }
}

sentences:
Roguelike game: detect intent of other actors by observing their moves In grid turn-based roguelike game, how can I detect the following scenarios:

other actor is following observing actor
other actor is intentionally moving to block its path

Path blocking can happen if for example player intentionally stops right in front of actor and then when actor moves to avoid player, player moves in front and that keeps repeating as long as player does it. I managed to detect that situation in hackish way and I would like to know if there is a better method for solving things like this.

sentences:
How can I draw dashed or dotted lines with a pixel shader? I am trying to draw the 2D graphics (like line, polyline, polygon etc.) using Direct3D for drawing I am using LINE_LIST. Now I want to make the lines thicker and apply patterns to the line as described here.

I am able to draw the thick lines using a geometry shader to draw a quad but to apply patterns I need to write a pixel shader that will do all the stylization of line that is which fragment should be drawn and which fragment of line should be left behind.

I would really appreciate if, anybody could help in writing the pixel shader or provide me any reference to write it.

sentences:
Clicking on clues and other objects in a 2D cluedo like game I'm a java/android programmer, but I don't have any experience in game programming, I'm already reading proper books, like "Pro Android Games", but my concerns are more about the ideas behind game programming than the techniques themselves.

I'm working on a 2D game, something like Cluedo to let you understand the genre. I would like to know how should I act with the "scenes", for example, a room with a desk, TV, windows and a lamp. I need to make some items tappable and others not. Is it common  to use one image (invisible to the user) with every different item a different color, then call the getColor() method on the image? Or use one image as background, and separate images for all the items? If the latter, how can I set the positioning? and should I use imageView or imageButton?

I'm sorry if those are really low quality questions, but as "outsider" ( I'm 23 and still finishing my university ) it's pretty hard learn alone.

sentences:
How can I stop explodable objects from creating new ones during cleanup? I have a problem with the handling of explosions in my game.

Currently, I have an entity create an explosion when it is destroyed (in the destructor). The issue with this is that when I change states, all my game objects are deleted. This causes explodable objects to create explosions when my EntityManager is already deleted.

I'm still pretty new to game development and I believe my design is very poor. How can I solve this problem?

sentences:
How do I render endless terrain using TerrainGrid? I have started to learn game development, using the jMonkey engine. I am able to create single tile of terrain using TerrainQuad, but in the next step, I'm stuck at making it infinite. I have gone through the wiki and a tutorial, and want to use the TerrainGrid class, but my code does not seem to work. I have looked around on the web, and searched other forums, but cannot find any other code example to help.

I believe in the below code; ImageTileLoader returns an image, which is the height map for that tile. I have modified it to return the same image, every time, but all I see is a black window. The Namer method is not even called.

terrain = new TerrainGrid("terrain", patchSize, 513,
    new ImageTileLoader(assetManager, new Namer() {
        public String getName(int x, int y) {
            //return "Scenes/TerrainMountains/terrain_" + x + "_" + y + ".png";
            System.out.println("X = " + x + ", Y = " + y);
            return "Textures/heightmap.png";
        }
    }));

This is the result, when I use TerrainQuad:

This is my full code:

// Sample 10 - How to create fast-rendering terrains from heightmaps, and how to
// use texture splatting to make the terrain look good.
public class HelloTerrain extends SimpleApplication {
    private TerrainQuad terrain;
    Material mat_terrain;
    private float grassScale = 64;
    private float dirtScale = 32;
    private float rockScale = 64;

    public static void main(String[] args) {
        HelloTerrain app = new HelloTerrain();
        app.start();
    }

    private FractalSum base;
    private PerturbFilter perturb;
    private OptimizedErode therm;
    private SmoothFilter smooth;
    private IterativeFilter iterate;

    @Override
    public void simpleInitApp() {
        flyCam.setMoveSpeed(200);

        initMaterial();

        AbstractHeightMap heightmap = null;
        Texture heightMapImage = assetManager.loadTexture("Textures/heightmap.png");
        heightmap = new ImageBasedHeightMap(heightMapImage.getImage());
        heightmap.load();

        int patchSize = 65;

        terrain = new TerrainGrid("terrain", patchSize, 513,
            new ImageTileLoader(assetManager, new Namer() {
            public String getName(int x, int y) {
                System.out.println("X = " + x + ", Y = " + y);
                return "Textures/heightmap.png";
                // set to return the same height map image.
            }
        }));

        terrain.setMaterial(mat_terrain);
        terrain.setLocalTranslation(0,-100, 0);
        terrain.setLocalScale(2f, 1f, 2f);
        rootNode.attachChild(terrain);

        TerrainLodControl control = new TerrainLodControl(terrain, getCamera());
        terrain.addControl(control);
    }

    public void initMaterial() {
        // TERRAIN TEXTURE material
        this.mat_terrain = new Material(this.assetManager,
            "Common/MatDefs/Terrain/HeightBasedTerrain.j3md");

        // GRASS texture
        Texture grass = this.assetManager.loadTexture("Textures/white.png");
        grass.setWrap(WrapMode.Repeat);
        this.mat_terrain.setTexture("region1ColorMap", grass);
        this.mat_terrain.setVector3("region1", new Vector3f(-10, 0, this.grassScale));

        // DIRT texture
        Texture dirt = this.assetManager.loadTexture("Textures/white.png");
        dirt.setWrap(WrapMode.Repeat);
        this.mat_terrain.setTexture("region2ColorMap", dirt);
        this.mat_terrain.setVector3("region2", new Vector3f(0, 900, this.dirtScale));

        Texture building = this.assetManager.loadTexture("Textures/building.png");
        building.setWrap(WrapMode.Repeat);

        this.mat_terrain.setTexture("slopeColorMap", building);
        this.mat_terrain.setFloat("slopeTileFactor", 32);
        this.mat_terrain.setFloat("terrainSize", 513);
    }
}

sentences: Why don't top selling mobile games have localization? For example: Plants vs Zombies 2, Angry Birds, Bad Piggies, Candy Crush Saga, Temple Run 2 and so on. These games are available in English only. These companies have huge resources; why don't they localize their games?

sentences:
Android LibGDX game: Choosing starting activity I am making a Android game with LibGDX (using ADT eclipse bundle). How do I choose the default activity to launch when the user opens the app. I set the project up with the LibGDX setup GUI, and I can't find the main activity.
I want a main menu to open before the game starts, is there something I should change in the manifest?
Thanks in advance.

sentences:
Volume that encompasses the whole scene? I'm thinking that the straight-forward way would be to just iterate through the objects and just find the maximum and minimum coordinates on each axis, but this seems a little bit unoptimal.

Is there a faster, more efficient way of doing this?

sentences:
SmothStop Function doesn't work as expected i'm trying to create a smothstop function i need it to control time variable on my lerp function used to move character and so on...what i have is this

    private float SmothStop(float t)
{
    return  1 - (1 - t * t * t * t * t);

}

problem here is that will start slow then accelerate... same as smothstart function.. that i already tested and work on that way.. so.. what i'm missing up?

sentences:
Terrain shadows not rendered to additional camera with Unity3D URP I'm running into problems with a project using several cameras rendering to different monitors.
The first Camera (a VR camera) renders the foliage and the terrain correctly.
However, in the second camera view, I see the objects are receiving light, but are not casting shadows on the terrain.

Culling mask of both Cameras is set to "Everything"
Trees and other objects have shadow casting enabled (and render correctly to the main Camera)
I tried changing the shadow distance, without any result
I tried different terrain light modes, which didn't help
I tried using the same renderer for both cameras, and a different renderer for each camera, without success
I tried putting all the cameras and lights on the same object layer, without any success

Any hint about how to solve this issue?

sentences: Apply force to a specific point on a rigid body In unity I have a rigid body object and would like to apply force to a specific point. For example say I had a cube, I want to hit just the top right corner so it spins as a result. One idea I had considered is spawn a small sphere and fire it at it, then destroy the sphere. But is there a way to just apply the force?

sentences:
shader tutorial for unity I would like to start developing my own shaders within unity.

For starters I would like to do a screen spaced blur.

Are there any good tutorials to learn shader development besides the official unity documentation, which i find a bit hard to understand?

sentences:
Moving a sprite towards an x and y coordinate Given a sprite with an x and y coordinate, how would I move it toward another sprite with an x and y coordinate?

I've already made it face towards the other sprite, and I've made it move towards the other sprite, however because I'm using sin and cos it's circling the player and slowly moving in on them. Here's the method:

Enemy.prototype.update = function(playerX, playerY) {
    // Rotate us to face the player
    this.rotation = Math.atan2(this.y - playerY, this.x - playerX) - 2.35;

    // Move towards the player
    this.x += Math.sin(this.rotation) * this.speed;
    this.y -= Math.cos(this.rotation) * this.speed;
}

How can I get the sprite to just move towards the player in a straight line rather than a circle? I found a good example but it uses XNA Vector2's so it's not working with x and y positions directly.

sentences:
How can I implement a "horizontal desynced colors" effect in LWJGL? My plan is to achieve analog video effects like RGB channel desynchronisation.

I'd like to have something like this (I hope you get the idea):

Left: White dot; Right: The same dot, but mind the channel offsets (the center should be brighter and white).

sentences:
Is it possible in HLSL to use bitfields? I have in memory a representation of my 2d GameMap (think of a Scorched Earth like landscape).

The map is made up of MapElements, a MapElement is made up of 64 bits defined like

struct MapElement {
 uint Color;  // RGBA Color
 uint Info;   // info flags (collision, material etc)
}

MapElement Map[Height * Width];

Now I'm thinking of doing some effects in HLSL, for example lighting, that need per-pixel collision information.
Is there any way I can just upload the mapdata as I have it in memory, and use it in HLSL ?

So is there a way to in HLSL to sample Uploaded Map to see if (map[y*Height+Width] & CollisionFlag) != 0 ?

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:
Complex system-component dependencies in entity-component-system? I am trying to design a data-oriented ECS engine. The issue I am struggling with is that my rendering system have to rely on two different sets of entities to actually do rendering.

My current idea is to have (usually one, but possibly more) entities representing cameras (e.g. sets of components describing views and viewports). Then, I can have RenderingSystem that iterates through all CameraComponents and renders everything they 'see' to appropriate viewports.

However, this requires RenderingSystem to query for two non-intersecting sets of components: cameras and renderables. My current approach allows systems to select a set of nodes that have one or several required components. It does not allow for more complex queries, like either CameraComponent or RenderableComponent. This is not the first time when more complex system-component dependencies (using unions of component sets insetead of their intersections) seem useful to me.

Plain old data components have crucial advantages:

They are trivially serializable
Can be changed by game designers without recompilation or coding knowledge
Describe behaviors in purely declarative way

That is why I would like to put cameras among other things in the ECS.

Use case: if we are implementing mirrors, we may put Renderable, Position and Camera components on them, then Renderable's texture will also be a render target for Camera. RenderingSystem then will render them in some efficient way.

So, is defining more complex relations with components (like "this system should receive all nodes that have Camera and Position as 'cameras' collection and all nodes with Renderable and Position as 'renderables') the most flexible solution in this case, or is there a better way?

UPDATE(1): I ended up allowing systems to define their dependencies like this (the word "aspect" is borrowed from Artemis ECS framework):

aspects: {
    renderables: Aspect.all(['Transform', 'Sprite']),
    cameras: Aspect.all(['Transform', 'Camera']),
    emitters: Aspect.all(['Transform', 'ParticleEmitter']),
    ...
}

These lists are gathered, passed to a system, cached and rendered in an efficient way. This actually works quite nicely (in other systems too), as well as cameras being entities. Is this a common way to do it?

UPDATE(2): I have spent some time working with ECS-like architectures and added a conclusion as an answer. I hope it makes clear that the approach I have suggested in the first update is just one of available options.

sentences:
Improving Rigidbody collision between real-time movable object and other Rigidbodies I have a cube that has been scaled to be rectangular (controlled by a remote Raspberry Pi gyro/accelerometer/magnetometer) and am translating its orientation into Unity via calls to transform.localEulerAngles = new Vector3(...). This works wonderfully (the cube object modeled to be a Pi rotates perfectly), however now I'm running into issues with the actual physics.

GIF of successful roll

Initially the ball will land on and roll around the Pi object, however when I start to increase the speed of my movements the ball will sometimes fall through the Pi.

The cube has a Rigidbody (no gravity, is kinematic) and Box collider (not triggered), and the sphere has a Rigidbody (has gravity, not kinematic) and Sphere collider (not triggered) attached.  I've tried varying the collision detection from discrete to continuous on both objects and have noticed similar behaviors.

The intent is to turn this into a marble maze type game, and the issue that I have is similar.  If I roll the ball into the joint between a wall and the floor (both stretched cubes), rotate it down, and then rotate it up, the ball will fall through the joint.  I have the same movement code attached to the GameArea object below.  Again, same issue with various types of collision detection applied.

My assumption is that this is a quickness of movement thing, as the cubes overlap each other (there's not a space for the ball to sneak through).

For reference, in the physics colliders section of the project preferences, all relevant layers are supposed to collide with each other.  I don't mind getting into code-based collision detection, but this seemed fairly trivial for Unity to take care of so I was wondering if I was missing something obvious.

sentences:
how to naturally rotate a ball according to its velocity on a surface, a wall I develop a game on cocos2d-x cpp. There is a ball sprite in my game. I move the ball on a surface(wall) via touch events but it can't naturally rotate according to its velocity.

if i use ballSprite->runAction(..) in update(float dt) method then it doesn't rotate.

i use following code:

void GameLayer::updateBall(float dt)
{
  float deltaRotateX = 360.0f * _ballVelocityX;
  _ballSprite->setRotation(90.0f- CC_RADIANS_TO_DEGREES(deltaRotateX));
}

But the ball doesn't naturally rotate. it discretely rotate.
it can't naturally rotate according to its velocity.

Thanks.

sentences:
XNA 4 game for both profiles I am writing game in XNA 4 and this version have two profiles hi-def and reach. My problem is that I need to have my game code for each of these profiles and is very uncomfortable to have two projects and do all changes in both of them. My idea was to use preprocessor directive (i am not sure about name of this, http://msdn.microsoft.com/en-us/library/ed8yd1ha%28v=vs.71%29.aspx) and use IF statement at places with problems with profile. There is only problem that program needs to be compiled two times (for each profile) and manually changed directive and project settings to another profile.
And my questions are: Is that good way? Is there better and cleaner way how to do this?

sentences:
How do I roll a ball with a Rigidbody? I have a ball in a game that rolls around just fine with Rigidbody.AddForce().  I have other non-physics balls, however, that I control directly with Rigidbody.MovePosition().

It seems that no matter what I do, no matter how interpolation and collision detection are set, the ball does not "roll" when moved with Rigidbody.MovePosition(). It teleports, but IsKinematic is not set , as instructed by the documentation.

How do I get the ball to roll properly with Rigidbody.MovePosition()? Alternatively, if that's not possible, how do I calculate the rotations manually?

sentences:
How is a splash screen that is disposed upon user input meant to be implemented? I'm going through Gustavo Steigert's tutorials on libgdx, but I have a feeling that this is more of a design question, rather than specifically regarding libgdx. My question is regarding the splash screen. I can implement what he has in that tutorial without any errors, but I want to add a little extra. In every game I've ever played, the splash screen goes away when the user left-clicks or presses esc, so I'm trying to add that (strangely, I can't find any tutorials with splashes like that). So, I have this method in my SplashScreen class:

public boolean handleInput() {
    if (Gdx.input.justTouched()) {
        game.setScreen(new MenuScreen(game));
        return true;
    } else {
        return false;
    }
}

At first, I tried to make that method return void and simply call splash.handleInput() in the render() method of the main Game class, Tyrian. However, that doesn't work, because once the splash screen has been moved on from, handleInput() will still be called on every render(), and the game crashes if the user clicks a menu button. So, I made handleInput() return a boolean and used this code in render():

if (onSplash) {
    if (splash.handleInput()) {
        onSplash = false;
    }
}

onSplash is a boolean inside the Tyrian class that is true by default.

Something else odd: when using the void version of handleInput(), the game will only crash if a button on the menu (the menu screen is the next screen) is pressed., and not if the screen is pressed. I am worried that the splash screen is never being disposed of (though my current solution does not seem to show that), because I can see from logging messages being printed to the console that the menu screen is being created upon every screen click, which is what handleInput() does. Also, if I put an else to that code above, with splash.dispose(); as a result, the game will crash.

This is such a common action in games, I would be surprised if there was not a common and cleaner accepted way of implementing it that I have missed.

EDIT: I have changed the handleInput() back to void and have used the instanceof keyword in my main game file. It's a cleaner solution, but I'm not sure if it's the best (it's an extra check on every render!).

SplashScreen.java

public void handleInput() {
    if (Gdx.input.justTouched()  ||  Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) {
        game.setScreen(new MenuScreen(game));
    }
}

Tyrian.java

if (this.getScreen() instanceof SplashScreen) {
    splash.handleInput();
}

sentences: When would I use "scripts" or "scripting" in a game, as opposed to the core language? The terms scripts and scripting appear to be used interchangeably on the Game Development Stack Exchange, but other than reading questions about a scripting language choice, I don't understand the relationship between scripts and scripting, and the core language. What does a script typically do, when would it be used, and are scripts in some contexts (as defined by game programmers) different than a scripting language?

sentences:
What features does D3D have that OpenGL does not (and vice versa)? Are there any feature comparisons on Direct3D 11 and the newest OpenGL versions?

Well, simply put, Direct3D 11 introduced three main features (taken from Wikipedia):

Tessellation
Multithreaded rendering
Compute shaders
Increased texture cache

Now I'm wondering, how does the newest versions of OpenGL cope with these features? And since I have this feeling that there are features that Direct3D lacks from OpenGL's side, what are those?

sentences:
No way to make asset store go online? I was trying to follow a tutorial for my first unity tests and I can't seem to convince unity that I indeed have an internet connection, short of a complete uninstall I tried about everything I could think of or find on google:

Running unity as an admin
Reseting my TCP-IP with a Microsoft tool
Deactivating my firewall
Deactivating windows 10 firewall for real and completelly (Because windows 10 sucks and I'd be using windows  7  if it weren't for docker)
Deactivating my AV software Logging out and   in from unity

The browser will open the asset store no problem, I'm on windows 10

sentences:
What is an animated surface mesh? I am reading the paper Animated Mesh Approximation With Sphere-Meshes . The input of the algorithm mentioned in the paper is an animated surface mesh, but I do not know what an animated surface mesh is. I just learn a little about surface mesh, which may be an .off file on the disk.

What is an animated surface mesh? What kind of file format do animated surface meshes have on the disk?

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:
Unity3D Problem Temporarily Stop Players Movement When Playing a specific Animation This is my first time in Unity3D and programming so forgive me if i'm a bit vague on this. I'm working on my own project in Unity3D but I couldn't get the player to stop moving when I press the key. I avoided using the GetButton since it triggered the animation to play twice. After bout 2 hours, I still can't find any answer to my problem.

Can someone help me please?

Here's part of the code of the the player script.

    if (Input.GetButtonDown("Fire1"))
    {
        animator.SetTrigger("AttackSword");
        Debug.Log("Animation called");
    }

    if(!animator.GetBool("AttackSword"))
    {
        Move(inputDir, running);
    }

If you would like me to add the full code of the script, let me know.

sentences:
Change value of uniform for each VAO I've heard from several sources that it's a better approach to pass the model matrix to a shader via a uniform rather than an attribute.

I also know that the idea of a uniform is, that it has the same value for each frame.

If so, how can i change the uniforms value for each object i have in the scene?

sentences:
Perlin Noise generation always returning zero I am using noise and I can't get Perlin Noise working, only the Simplex Noise.
So far I got this:

import noise

values = list()
string = str()
oct = 1

for y in range(20):
    print("[", end = "")
    for x in range(40):
        i = round(noise.snoise2(x, y, octaves = oct), 5)
        values.append(i)
        if i > 0.3:
            print("#", end = "")
            string = string + "#"
        else:
            print("-", end = "")
            string = string + "-"
    print("]\n", end = "")

When I try to use Perlin noise instead, I get a value of zero for every x & y.

sentences:
Optimize polygons renderization I'm developing a game (in Ogre3D) that, in short, consist in a vehicle that moves along a terrain and leaves a colored trail behind it. The trails are basically quads (a), these quads changes their color accordingly to the vehicle's speed.
My challenge now is that I need to subdivide these quads into 5 (or more) sub-polygons (b) and each one of them should have a different color accordingly to others vehicle's properties. When moving around for a while these quads start to accumulate on screen and the render process starts to heavily lag and thus fps count is sub optimal.

Some considerations:
 - All quads are appended to a single mesh that belongs to a single entity sharing the same material, so batching should be optimal.
- Tried adding LOD for this mesh but I had no luck to make it work in Ogre1.9.

So, my main question is how can I optimize the rendering of this polygons??
Can I delegate this task by somehow to the gpu via shader programming?

Edit: My goal would be to avoid having to draw each one of those sub-quads in (b) (only draw the big quad (a)) but by somehow being able to colorize each  one of those sub-quads.

sentences:
How to test if procedurally generated level for infinite runner can be passed? I have a 2D infinite runner platformer game built in Unity 5, where the level procedurally generates itself. I need to check if it is possible to pass the holes on the level.

How could I do that?

sentences:
Huge input delay although framerate is stable - possibly related to the DirectX Tool Kit? I'm in the process of learning how to use the DirectX 11 API and came upon the following problem:
Although my rendering function executes quite fast at around 150 fps (as one expects considering how little geometry is rendered), the mouse and keyboard input is massivly delayed. Sometimes the "game" reacts several seconds too late or doesn't react at all; looking around is a pain.
When I increase the framerate even further to, let's say, 400 (by reducing the rendering resolution/rendering less objects), the effect vanishes and the every keystroke is detected precisely.

My update() function (see code below) is called by the StepTimer class of the DirectX Tool Kit from the main message handling loop. I tried both fixed and variable timestep mode.

Main loop calling update() and render()

while (msg.message != WM_QUIT)
{
    if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    static DX::StepTimer stepTimer;
    stepTimer.Tick([&]() { update(stepTimer); });
    render();
}

The update() function:

void update(DX::StepTimer const &timer)
{
    static Keyboard::KeyboardStateTracker keyboardTracker;
    static Mouse::ButtonStateTracker mouseTracker;
    Keyboard::State keyboardState = keyboard->GetState();
    Mouse::State mouseState = mouse->GetState();
    keyboardTracker.Update(keyboardState);
    mouseTracker.Update(mouseState);
    fps = timer.GetFramesPerSecond();

    if (keyboardState.Escape) PostQuitMessage(0);

    static float pitch = 0.0f;
    static float yaw = 0.0f;

    if (mouseState.positionMode == Mouse::MODE_RELATIVE)
    {
        pitch = std::max(std::min(pitch - float(mouseState.y) * 0.001f, XM_PI / 2.0f - 0.01f), -XM_PI / 2.0f + 0.01f);
        yaw -= float(mouseState.x) * 0.001f;
        if (yaw < -XM_PI) yaw += XM_PI * 2.0f;
        if (yaw > XM_PI) yaw -= XM_PI * 2.0f;
    }
    if(mouseTracker.leftButton == Mouse::ButtonStateTracker::RELEASED) mouse->SetMode(mouseState.positionMode == Mouse::MODE_ABSOLUTE ? Mouse::MODE_RELATIVE : Mouse::MODE_ABSOLUTE);

    Vector3 cameraDir(-sin(yaw) * cos(pitch), sin(pitch), cos(yaw) * cos(pitch));

    Vector3 motionVec = { 0.0f, 0.0f, 0.0f };
    float speed = 4.2f;
    if (keyboardState.W || keyboardState.Up)
    {
        motionVec.x += cameraDir.x;
        motionVec.z += cameraDir.z;
    }
    if (keyboardState.S || keyboardState.Down)
    {
        motionVec.x -= cameraDir.x;
        motionVec.z -= cameraDir.z;
    }
    if (keyboardState.A || keyboardState.Left)
    {
        motionVec.x -= cameraDir.z;
        motionVec.z += cameraDir.x;
    }
    if (keyboardState.D || keyboardState.Right)
    {
        motionVec.x += cameraDir.z;
        motionVec.z -= cameraDir.x;
    }
    if (keyboardState.Space || keyboardState.PageUp)
    {
        motionVec.y += 1.0f;
    }
    if (keyboardState.LeftShift || keyboardState.PageDown)
    {
        motionVec.y -= 1.0f;
    }
    motionVec *= speed;

    static Vector3 cameraPos = { 0.0f, 2.0f, 0.0f };
    if (keyboardState.R)
    {
        cameraPos = { 0.0f, 2.0f, 0.0f };
        pitch = 0.0f;
        yaw = 0.0f;
    }
    cameraPos += motionVec * float(timer.GetElapsedSeconds());
    matrixCamera = XMMatrixLookToLH(cameraPos.XMVECTOR(), cameraDir.XMVECTOR(), { 0.0f, 1.0f, 0.0f });
}

Is there any hint you can give me? Or might this even by a bug in the StepTimer class?

sentences:
How to store generic data in game database? To clarify things a bit:
I want to create a kind of database for my game, that simply is a class that stores all game-state information like object positions, player scores, etc.

The main problem I am facing, that the whole game is to be scripted, to the level of the (lua)script controlling what members should the database have.

The reason for this is that I want to create a game that gives modders complete access to the game via lua scripting.(its one of the core features)
For this to be viable I need to be able to add custom elements to the
database.

I want to avoid using a 'real' database and roll my own solution.

For example I want to be able to do the following in the script file:

-- In function init...
Engine:AddStateEntry( "Score", TYPE_INT )

-- In function update...
Engine:SetStateEntry( "Score", 12 )

My engine would then synchronize data between players and render things accordingly.

How could I:

Efficiently store arbitrary types of data?(including arrays)
Set up custom interpolation functions

Efficiency and ease of use are my main priorities.(I dont care if the implementation is complex)

TL;DR: How to efficiently store arbitrary data that is defined by lua scripts and stored on the c++ side?

sentences:
How do I split a button graphic into a 9 patch? I understand what a nine patch is but I don't understand how to create one with code. I've made an image with a 1-pixel black border, but how do I turn that into a nine patch?

How do I make a nine patch that is not a cube image?

This is what is happening when I run:

patch = new NinePatch(new Texture(Gdx.files.internal("nineEmpty.9.png")), 4, 4, 13, 28);

I want it cut like this:

sentences:
Which K-factor should be used in case players have different K-factor values I am implementing a ranking system based on the Elo rating and cannot get a point about the K-factor. If two players with different skills and, therefore, different K-factors are playing, which exactly K-factor should be used when changing their ratings?

For example, player A has rating 2500 and K-factor 16 (probability ~75%) while player B has rating 2300 and K-factor 24 (probability ~25%). If player A wins, do I need to use 16 as K-factor for both players or 16 for player A and 24 for player B?

sentences:
Add oceans to an earth model with only continents? I have the following earth model, it only has continents:

I wanted to add water but as you can see, some of the continents are now hidden due to the water sphere being more round than continents:

I tried the following:

downscale water sphere, kinda works but only when it's significantly smaller, overall result is then unconvincing.
change shader and render queue offset, does not do anything actually.

I was hoping that maybe there could be a way to render transparent parts of this earth model as a specific color or eventually another material.

Please do not suggest to use another earth model, I wouldn't have asked the question otherwise :)

sentences:
Turning the camera when the player turns I have a 3rd person view of the player character, and I wish my camera to follow the player both when he moves and when he rotates.

So far I have the movement correct:

    public class CameraController : MonoBehaviour {

    public GameObject player;
    private Vector3 offset;
    // Use this for initialization
    void Start()
    {
        offset = transform.position - player.transform.position;
    }

    // Update is called once per frame
    void LateUpdate()
    {
        transform.position = player.transform.position + offset;
    }
}

However the rotation of the camera does not change when the player looks in either direction. How can this be done?

sentences:
Can't use SFML sprite drawing and OpenGL rendering at the same time I'm using some SFML built in functions to draw sprites and text as an overlay on top of some OpenGL rending in an SFML RenderWindow. The opengl rendering appears fine until I add the code to draw the sprites or text. The sprite or text drawing causes the OpenGL stuff to disappear.

The follow code show what I'm trying to do

sf::RenderWindow window(sf::VideoMode(viewport.width,viewport.height,32), "SFML Window");
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(0,viewport.width,0,viewport.height,0,1);

while (window.pollEvent(Event))
    {
    //event handling...

    //begin drawing
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glBegin(GL_TRIANGLES);
    glColor3f(col.x,col.y,col.z);
    for(int i=0;i<3;i++)
        glVertex2f(pos.x+verts[i].x,pos.y+verts[i].y);
    glEnd();

    // adding this line causes all the  previous opengl triangles not to appear
    window.draw("Sometext");

    window.display();
}

sentences:
How do you calculate a gradient value within multiple colors (gradient stops) In WPF/Silverlight XAML you can have a brush with multiple gradient stops at different points along the color line.

I was able to replicate this behavior with two colors, a single color lerp, from this answer to my previous question: Code to generate a color gradient within a texture using a diagonal line

How do I do the same thing in that question, but with multiple color steps even at different widths from each other.

sentences:
ios screen design -> how to target multiple devices I am writing an IOS Game, landscape only and I am having a conceptual issue with my artwork. The screens are all different sizes. Retina, non-retina as well.

Non Retina ipads + ipad mini is 1024 x 768.

Retina ipads are 2048 x 1536.

So how big do I draw my art? What concept am I messing up? Any screen templates I can download to help me. i.e, learn the boundaries, etc?

sentences:
Get all OffMeshLink objects in Unity What I'm trying to do is to make an edit-mode script that gets all off-mesh links and makes some of them bi-directional(depends whether a jump is possible).

My (obvious) attempt was:

FindObjectsOfType<OffMeshLink>();

However, it returns only the links I have created manually.

My question is the following: how to access the off-mesh links generated by unity in the baked NavMesh?

Any help would be greatly appreciated.

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:
SailsJS + Rotational direction coordinates calculation issue I'm creating a small game to learn how NodeJS & Sails work (and by extension Waterline, Socket.io, Express, and all their components).

I'm using websockets to make the server calculate the coordinates. Everything is handled server-side.
The client only receives serialized data in order to redraw the whole canvas.

For debugging purposes, I decided not to redraw but simply "draw" (leaving the old canvas visible) to show you the result.

See below for situation, issue and code.

The issue

I'm having trouble when calculating coordinates.

What I need is a simple forward/backwards system, and when pressing left or right keys, change the direction angle so the character can move in the canvas.

Kinda like the good'ol Asteroids retro games.

The issue is the following:

The drawn loops you see shouldn't exist. In fact, they should be circles. I drew this by simply pressing either up or down key, combined with one of left or right keys.

I think there is an issue in the calculation system...

This shouldn't be a performance issue because each tick occurs at the same interval, so even if it was a performance issue, it should only be related to delay when redrawing the canvas, not such an offset in coordinates calculation...

Any idea ?

Info about code api

moves contains a javascript object like this:
{ left:false, right: false, up: false, down:  false }
It is used to check whether the user is "pressing" associated arrow keys.
It is updated each time there is a keyUp or keyDown event client-side.
user.pick contains the "physical object" to be rendered in the canvas, which contain x, y coordinates, and information about movement speed and rotation speed.

Here's the code that handles the coordinates calculation.

// Change angle if "left" or "right" is pushed
if (moves.left || moves.right) {
    // let PI2 = 2 * PI;
    let angle = user.pick.angle;

    if (moves.left) {
        angle += user.pick.angleSpeed;
    } else if (moves.right) {
        angle -= user.pick.angleSpeed;
    }

    // Use this to avoid having huge integers to manage
    if (angle < 0) {
        angle = 360 - angle;
    }
    if (angle > 360) {
        angle = angle - 360;
    }

    user.pick.angle = parseInt(angle);
}

// Up and down allow us to move either forwards or backwards.
if (moves.up || moves.down) {

    let moveRatio = moves.up ? 1 : -1;

    let angleRadians = user.pick.angle * (PI / 180);
    let x = user.pick.x + moveRatio * user.pick.speed * Math.sin(angleRadians);
    let y = user.pick.y + moveRatio * user.pick.speed * Math.cos(angleRadians);

    // Avoids collisions with canvas walls
    if (x > 0 && x < user.map.width) {
        user.pick.x = parseInt(x);
    }
    if (y > 0 && y < user.map.height) {
        user.pick.y = parseInt(y);
    }
}

sentences:
Can I create a remix of a song & incorporate it into my game music? DJs frequently remix eachothers work and use as they please. Can I as a programmer do similar - remix a song I like and embed it in a game I create without royalty/copyright issues?

Disclaimer: answers will not be considered legal advice, this is just a hypothetical discussion :)

sentences:
Lighting Objects with Textures - OpenGL I'm trying to get lighting effects on a textured object; I'm using .obj and .mtl files to define them. No matter what I try my object is either invisible, unlit (plain texture), or completely white.

I defined my mtl by having my texture mapped to diffusion (that is, map_Kd texture.png). I found that if I don't set both a Ka and Kd (in addition to the texture) the object is invisible. Also, it seems that the actual ambient values don't change anything - they could be 0 and transparent, as long as they're defined.

If I set my material to have white ambient, diffuse, and specular, then the object is 100% white, no matter what I do with my light source. This is also after I set it to gl_separate_specular_color, as before that, I just got the plain texture. I tried making sure I had a normal defined for at least one face of the model, with no luck. I'm trying to have my texture be dominant, with a little bit of specular lighting on it.

What am I doing wrong? Is the lighting "working" but the all white means I haven't set my shininess properly? Is it being infinitely reflective or something?

Note: I'm using OpenTK and working in C#.

sentences:
How does Texture2D.GetData return coloured pixels? I'm trying to work out how the pixels are stored in the returned array but I'm not having a lot of luck (and thus my calculations don't seem to be working).

I realize that the pixels are stored in one long continuous array but are the pixels grabbed width first or height first? I've tried drawing out the "pixels" of a texture on paper to calculate where the pixels should be based on the single array but I'm not getting expected results.

My assumption is the following:

Assuming I am using i to specify rows and j to specify columns that any given pixel in a 2D texture can be calculated by the sum of i * j or is this incorrect?

sentences:
Copyright and patents on game design and names? We all know that each game has elements from another game but when does one cross the line of copyright? I have a view particular questions about this since this "line" is very vague.

While looking for a name and Googling it usually return some kind of old or unknown game already with the exact same name. Can i use this name? And what about a name like Diablo, since Diablo is the commonly used name for the devil there cannot be a patent on this afaik. So would a different kind of game named Diablo be allowed?
Let's say i want to make a game of mechs like in Mechwarrior. Obviously the mech designs have copyright, the name as well since i suppose. But am i crossing any rights if i make a top down tactical squad game that include mechs of different designs/names and call it Clash of Steel?

I understand there are not much lawyers here, but how could anyone create a game these days that does not cross the lines of copyright. Like the Mechwarrior example, there are plenty of games nowadays even movies that use this concept. For what it matters Mechwarrior could have ripped the idea from the Gundam anime series. With so many titles coming out each week including the indies it is next to impossible not to infringe into someone copyright.

sentences:
How to destroy object after animation I've made an object and when the player has pick it up, rise it up and stop it out of screen. But because you can see the shadow of that object, I will destroy it after the animation has played. But how can I do this whit Unity and C#?

Just destroy is just like this:

Destroy(gameobject);

and start an animation like this:

private Animator _anim;           // global variable
_anim = GetComponent<Animator>(); // in start() methode
_anim.SetTrigger("Picked");       // in other methode

sentences: Removing DefaultBloomKernel.uexp file? My friend is using Unreal Engine 4 v17. His problem is that when he exports to Android, the game is over 100mb in size. He's not using materials or importing anything. He found a (probably) useless file called "DefaultBloomKernel.uexp" and wants to remove it. How can that be done?

sentences:
pygame - avoiding sprite 'jitters' on rotating the image Is there a common trick for getting around sprites that are changing directions 'too quickly' and causing their sprite to display erratically?

In this project, the player moves in 8 directions by determining the abs() distance between the mouse's X and Y coordinates and its own obj.rect.center. If the absolute value is less than obj.speed, it simply moves to that point. If it is greater, it moves the distance its speed allows it to move in that direction. When it's time to draw the sprite, PyGame rotates it in accordance to obj.direction by using a dict called SPINNER with stored default values to pass to pygame.transform.rotate.

def draw(obj):
    drawImg = pygame.rotate.transform(obj.img, SPINNER[obj.direction])
    drawCtr = drawImg.get_rect(center=obj.rect.center)
    DISPLAYSURF.blit(drawImg, drawCtr)

This is fine for the foolish AI characters which typically make very few course corrections - however, small movements of the mouse can cause the player's obj.direction to update very quickly, which looks chaotic.

Is there a simple way to curb this behavior? My first guess is to bog down the player object with values that retain its previous state and then determine the amount of rotation to apply, but I have a feeling the better solution is to assign that responsibility to the 'view' and not the 'model'. I'm not sticking to any hard and fast rules regarding MVC, but I am trying to engage in enough separation of concerns that 'view-like methods' don't make 'controller-like' changes to 'model-like' objects, if that makes sense.

sentences: Help streaming resources (maps, sounds, music, etc) from many files for contiguous world So I'm creating a game and I would like to know how to perform resource streaming (rather than loading the whole file into the buffer) for things such as my maps, sounds, music, etc. I'm using C++ and DirectX9 if in case you need to know.

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:
Issue with multiplayer interpolation In a fast-paced multiplayer game I'm working on, there is an issue with the interpolation algorithm. This interpolation is for a moving object not controlled by the local computer.

The server sends packets with the object's position at a fixed rate. (red markers) The interpolation algorithm is attempting (and failing) to create a smooth path between the red markers.

The results of this interpolation are shown by green and black markers. Green is the local position at the exact time a packet is received, and black is the local position at every frame.

Green: Local position when a packet is received (edited for clarity)

Red: Position received from packet (goal)

Blue: Line from local position to goal when packet is received

Black: Local position every frame

On a network with a realistic amount of lag and packet loss, this is the result:

The local position (green&black lines) seems to oscillate around the goals (red lines) instead of moving between them smoothly.

This is how it looks on a perfect network with the object moving right to left. (0 ping, 0 packet loss, etc.)

The code works like this:

Every x ms, receive a packet with a Vector3 position
Set the goal to that position
Set the positionAtLastPacket to the current local position
Every frame, lerp from positionAtLastPacket to goal, attempting to reach the goal approximately when the next packet should arrive.
If the next packet takes longer than expected, interpolation continues past the goal and becomes extrapolation.

I believe what is happening is the extrapolation overshoots a bit to far. Over several packets, this issue compounds, causing the oscillation.

    // local transform position when the last packet arrived. Will lerp from here to the goal
    private Vector3 positionAtLastPacket;

    // location received from last packet
    private Vector3 goal;

    // time since the last packet arrived
    private float currentTime;

    // estimated time to reach goal (also the expected time of the next packet)
    private float timeToReachGoal;

    private void PacketReceived(Vector3 position, float timeBetweenPackets)
    {
        positionAtLastPacket = transform.position;

        goal = position;

        timeToReachGoal = timeBetweenPackets;
        currentTime = 0;

        Debug.DrawRay(transform.position, Vector3.up, Color.cyan, 5); // current local position
        Debug.DrawLine(transform.position, goal, Color.blue, 5); // path to goal
        Debug.DrawRay(goal, Vector3.up, Color.red, 5); // received goal position
    }

    private void FrameUpdate()
    {
        currentTime += Time.deltaTime;

        float delta = currentTime/timeToReachGoal;
        transform.position = FreeLerp(positionAtLastPacket, goal, currentTime / timeToReachGoal);

        // current local position
        Debug.DrawRay(transform.position, Vector3.up * 0.5f, Color.black, 5);
    }

    /// <summary>
    /// Lerp without being locked to 0-1
    /// </summary>
    Vector3 FreeLerp(Vector3 from, Vector3 to, float t)
    {
        return from + (to - from) * t;
    }

Any idea about what's going on?

sentences:
Min. Distance for Spotlights in Ogre3d? I have a simple scene with only one empty box. Within that box I have the camera attached to a scene node, which the user can move (translate/rotate). Additionally a spotlight is attached to the camera's scene node, facing into the same direction as the camera. So when the camera is moved, then the light moves as well.

m_pCamera = m_pSceneMgr->createCamera("Camera");
m_pCamera->setNearClipDistance(0.01);
m_pCamNode->attachObject(m_pCamera);

Light* spotLight = m_pSceneMgr->createLight("spotLight");
spotLight->setType(Light::LT_SPOTLIGHT);
spotLight->setDiffuseColour(1, 1, 1);
spotLight->setSpecularColour(1, 1, 1);
spotLight->setSpotlightRange(Degree(50), Degree(100));
spotLight->setSpotlightNearClipDistance(0);
spotLight->setDirection(m_pCamera->getDirection());
m_pCamNode->attachObject(spotLight);

So, this basically works fine. There is one problem though: As soon as the user moves the camera very close to a side of the box, then suddenly all is black, I can't see anyting. I am sure the camera is NOT moving through the box's side, it is still within the box.

So the problem seems to be that the light does not "work" when it is too close to an object, as if the object (the box side in my case) is not reflecting the light any more.

Any ideas?

sentences:
Tile based platformer, using larger tiles? So for my tile based platformer, It has a grid of tiles Occupying 1x1 block for each one.

However, What if I want larger tiles? Maybe doors, tables, etc. They wouldnt fit in a 1x1 tile, so what I need is a way to let any method trying to access my tile array, know that a tile could be occupying a larger space.

I can already render larger objects correctly, But I simply am looking for a method to let evrything else know a larger tile is there, So I can perform collision on it, and so other tiles cant be placed on it.

sentences:
XNA realistic water: How to clip along a mesh instead of a plane I hope you can help me with the following problem:

I'm developing a 3d game (in XNA) with an ocean. I want it to look semi-realistic.
So far, I'm rendering 4 things:

The ocean floor (terrain) on the view matrix (refraction)
The terrain above water on the mirrored view matrix (reflection)
The terrain above water on the view matrix (actual terrain)
The water, which is simply a plane, using the refraction and reflection rendertargets, the fresnel term, and a normal map to give the impression of small waves.

Instead of a flat plane, I want to render the water on a mesh, to get some actual waves going. This is where I've been stuck for a while now. It's quite simple to clip the terrain along that plane, but is it possible to clip a mesh along another mesh? Or am I going about this the wrong way?

sentences:
Simulating air pressure I am working on a space orientated game, and I have done some research on the best way to simulate gas with traditional physics technologies (Creating a lots of circles)

The only obstacle I have is how to simulate pressure. For example, if one corner of the room has lots of these little circle physics bodies, how can I make them evenly distribute? If I have a huge vacuum, what is the best way to have the particles get sucked out through the corridors etc of a room into space?

I can't think of any way to do this without iterating over every single particle against every singe other particle. Obviously, I cannot do this in a real-time simulation.

Maybe I could do this on a tile-based level?

The specific technologies I am using are Java and Dyn4j.

Thanks,

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:
I don't think my shaders are working, looking for help Using sharpdx(directx 11) developing on UWP.
This is a link to a previous question of not being able to compile the shader files(written in hlsl) How to compile shader files in UWP Later I have found some method to avoid the original exception(unable to open or find shader files) but still the shaders seem not to be working.
My method to "avoid the original exception" is to change the file path to
System.IO.Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "ProjectName")

If the method works, I would surely post it as an answer to the previous question
The current problem is no display on the screen(all black), while I can check the stored data in the vertex buffer using graphic diagnostics tools built in visual studio.

Here is my code for the shaders, problem may be going from here because this is the first shader file I've written. Please have a look and discuss may things go wrong.
pixel shader file Pixel_PS.fx
struct VertexOut
{
    float4 PosH : SV_POSITION;
    float4 Color : COLOR;
};

float4 PS(VertexOut pin) : SV_Target
{
    return pin.Color;
}

vertes shader file Transf_VS.fx
cbuffer dataBuffer : register(b0)
{
    matrix ViewProjection;
};

struct VertexIn
{
    float3 PosL : POSITION;
    float4 Color : COLOR;
};

struct VertexOut
{
    float4 PosH : SV_POSITION;
    float4 Color : COLOR;
};

VertexOut VS(VertexIn vin)
{
    VertexOut vout;
    // Transform to homogeneous clip space.
    vout.PosH = mul(float4(vin.PosL, 1.0f), ViewProjection);
    // Just pass vertex color into the pixel shader.
    vout.Color = vin.Color;
    return vout;
}

where I compiled them
byte[] vertexShaderByteCode = ShaderBytecode.CompileFromFile(this.path + "\\Transf_VS.fx", "VS", "vs_5_0");
                this.vertexShader = new D3D11.VertexShader(
                    device,
                    vertexShaderByteCode
                    );
                this.inputSignature = new ShaderSignature(vertexShaderByteCode);
                this.pixelShader = new D3D11.PixelShader(
                    device,
                    ShaderBytecode.CompileFromFile(this.path + "\\Pixel_PS.fx", "PS", "ps_5_0")
                    );

data structure definition
public struct ScatterVertex
    {
        SharpDX.Vector3 Position;
        SharpDX.Color4 Color;
    }

inputlayout initialization
this.inputLayout = new D3D11.InputLayout(
                    this.device,
                    inputSignature,
                    new SharpDX.Direct3D11.InputElement[]
                    {
                        new D3D11.InputElement(
                            "Position",
                            0,
                            SharpDX.DXGI.Format.R32G32B32_Float,
                            0
                            ),
                        new D3D11.InputElement(
                            "Color",
                            0,
                            SharpDX.DXGI.Format.R32G32B32A32_Float,//I'm not very sure whether or why I should use this option
                            0
                            )
                    }
                    );

Here's the projection matrix in the camera class, which is later sent to the constant buffer
private Matrix View { get { return Matrix.LookAtLH(this.Eye, this.Target, this.Up); } }
private Matrix Proj { get { return Matrix.PerspectiveFovLH(this.Fov, this.Aspect, this.Near, this.Far); } }
public Matrix WorldViewProject
        {
            get
            {
                Matrix wvp = (this.View * this.Proj);
                wvp.Transpose();
                return wvp;
            }
        }

If you need anything else to solve this, just let me know and I'll manage to get it.
Thank you!

sentences:
Rain Effect generation in a Unity VR project I´m developing a VR project in Unity Engine and I need to implement a Rain Effect. I have considered the following:

A VR game must run at least 90 frames per second.
The Rain must be detailed.
The Rain Drops interact with other objects.

These are the approaches I have considered:

Particles Systems: I think it is expensive since there are two cameras rendering the scene and checking collision per particle could be expensive.
Image Effect on the canvas: I think the result would be unreal, and there would not be interaction with other objects.

I have seen examples of rain effect like in Resident Evil 4, Halo Reach, Crysis, FarCry, Project Cars 2 VR and Batman Arkham Knight.

A last approach I haven´t considered yet is by shading, maybe shading would work for the rain drops in the cameras´ lens.

I would like to know optimal approaches to emulate rain effects without making too much computations.

Thanks for your attention.

sentences:
Separating .js elements/ .js element communication So I have 2 questions regarding the code below:

function goldClick(number){
    gold = gold + number;
    document.getElementById("gold").innerHTML = gold;
};

function buyMiner(){
    var minerCostG = Math.floor(100 * Math.pow(2.1,miner));
 var minerCostW = Math.floor(10 * Math.pow(3.1,miner));
    if(gold >= minerCostG){
  if(wood >= minerCostW){
   miner = miner + 1;
   gold = gold - minerCostG;
   wood = wood - minerCostW;
   document.getElementById('miner').innerHTML = miner;
   document.getElementById('gold').innerHTML = gold;
   document.getElementById('wood').innerHTML = wood;
    }};
    var nextCostMG = Math.floor(100 * Math.pow(2.1,miner));
    document.getElementById('minerCostG').innerHTML = nextCostMG;

 var nextCostMW = Math.floor(10 * Math.pow(3.1,miner));
    document.getElementById('minerCostW').innerHTML = nextCostMW;
};

window.setInterval(function(){

 goldClick(miner);

}, 1000);

Question 1: Is it possible to separate these functions (goldclick, buyminer, window interval,) into their own documents so that if I have say, 50 different XXXXclick functions, and 50 buyXXXX functions and 50 interval functions, I have just 3 .js documents instead of 50.

Question 2: If it is possible to separate them, how would I ensure that they are communicating with each other and variable values are not being confused or sent to the wrong <span> in the displaying html.

sentences:
glVertexAttribPointer normalization glVertexAttribPointer(index,  size,  type, normalized, stride,  pointer);

If I use type=GL_UNSIGNED_BYTE and normalized=GL_TRUE

how is it normalized?
would the data be divided by 256 for normalization? or?
This would mean there is no way to have a normalized value of '1.0f'..

sentences:
How to use a multi-thread OpenGL application to update VBOs and use them at the same time? I have a simple application. It has two threads, each with its own rendering context, but they share one VBO (this is working, I tested it).

Now what I want: One thread is rendering some data from the first half of the VBO and the second thread is updating the second part of the VBO.

When I don't update the VBO, it's working fine.

But I have some weird issues when updating. When I use glMapBuffer to update the VBO (in the second thread), in the first thread, most of the time, it renders nothing—the whole screen is clear (after a glClear call). It looks like it can't touch data from the VBO (this is understandable, because the whole buffer is mapped and so it can be locked somehow).

I tried to use glMapBufferRange, which uses GL_MAP_UNSYNCHRONIZED_BIT. This should mean, "don't wait and use the VBO as you want, I (the program) will synchronize it by myself". Also, when I map a range of VBOs and render data from another part, it shouldn't be waiting, but I'm experiencing the same issues as I am with glMapBuffer.

Can anybody help me fix this or explain why it happens?

sentences:
How can I navigate to a target between bodies moving along fixed paths? The problem: An autonomous ship starts at the outskirts of a solar system, and wants to move to a moving target, which is one of the planets. There are also many other planets moving at the same time, and these should be considered the only obstacles. I want to find the optimal path to the target. To keep it simple, the world is 2D, and the planets are moving in uniform circular motion around the sun as opposed to how planets actually behave.  Also, assume the ship knows pretty much everything about the world. Most importantly, the location, speed, and orbit radius of every planet.

With complete knowledge, this seems conceptually simple. For any planet and any time, you can find its location by doing some fairly simple math. But how would you apply this to pathfinding? Would it be just to pathfind in 3 dimensions: x, y, and t? In theory this makes sense, but I think working that out to an actual solution would involve a lot of complications. Is it really as simple as 'setup a* on a grid with x,y,t values'?

sentences:
SocketException: No connection could be made because the target machine actively refused it I am working on connecting a client to a server using socket connection. I have a button, when I click on the button, it's giving the below exception in Unity.

"SocketException: No connection could be made because the target machine actively refused it.".

What will be the issue? Can anyboady help me out? Below is the code I have written for connecting to the server:

internal Boolean socketReady = false;
NetworkStream theStream;
StreamWriter writer;
StreamReader reader;
try{
        connect = new TcpClient (host, port);
        theStream = connect.GetStream ();
        writer = new StreamWriter (theStream);
        reader = new StreamReader (theStream);
        return true;
        //socketReady = true;
    }
    catch(ObjectDisposedException) {
        return false;
    }

sentences:
How to get button component in Unity 2019.3 I have a simple class attached to a button in Unity Canvas:

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

public class AudioButtonPlay : MonoBehaviour
{
    public Button button;
    void Start()
    {
        button =  gameObject.GetComponent<Button>();
    }
}

But on the line button =  gameObject.GetComponent<Button>(); I get the following message:

GetComponent requires that the requested component 'Button' derives from MonoBehaviour or Component or is an interface

How can I access the "Button" component?

sentences:
Originating direction of shots in an FPS problem Recently I have been asked on the interview about a maybe simple task to solve a problem.

We have a player, that looks in some direction, and a shooter, who already is shooting the player. I must find out whether the shots come from the left or right in the same way Counter Strike does when you get hit: the game shows from which direction and it looks like a red half-circle.

I know the vectors of players and enemies position. I tried different answers f.e. to build a line from the player see's and solve a linear system equation or rotate the player vector and then find out the angle of scalar product, but he says there's a better way to do it. I don't need the answer to this particular question, but a 'way' to find out the answer. F.e. any books related to this problems, some similar problems, etc.

sentences:
In Unity, Meta Files are Tracked but Behaviours Fall Off My team is working on a Unity game, and we are using a mercurial repository on BitBucket. Whenever we update, all of the behaviours 'fall off' of state machines, behaviours, etc. When searching for a solution, I discovered that this information was stored in the meta files. I had previously ignored the meta files, but the are now being tracked. However, the files still 'fall off'. I cannot find any other reason this would be happening.

Any assistance you can give me would be appriciated. Let me know if you need any additional details.

sentences:
How would I create Dynamic LOD with Quad Trees I would like to be able to create something like the following http://www.youtube.com/watch?v=LxZhWrSmrOY&feature=player_embedded how would I create something like it? I understand I will have to use quad trees and cube to sphere projection, but I don't even know how I will structure the program or even create the sphere.

I would like to know how I would structure the program (an interface of the members I would need particularly in the quad-tree class, and the class which holds the quad-treesm etc)
How do I make it so dynamic like that?
How would I create the quad tree structure and how would it work (and interact with other objects)?
Any other information/things you can provide me with :3
How to create the sphere, etc.

Eventually I would like to be able to create something like this: http://www.youtube.com/watch?v=rL8zDgTlXso but I guess creating this (the first thing mentioned) is a part of it?

Anything would be appreciated.

Edit:

I found the source code for the first project at https://github.com/unconed/NFSpace the only problem is, is that it is in C++ and Orge, and I don't really understand any of it, help please! :)

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:
How would I be able to get a game over screen using the pause function? I am having problems with my snake game, when the snake collides with itself it draws a "game over" image in the background, but only while it's colliding with itself. I want it to behave like the pause function, so that as soon as the snake collides with itself it draws an image on the screen and stops the game play. And then how would you be able to restart or to quit the game?

I just have this for the detection at the moment:

if (snakeHeadRectangle.Intersects(snakeBodyRectangleArray[bodyNumber]))
            {

              spriteBatch.Draw(textureGameOver, gameOverPosition, Color.White);
            }

Thanks

sentences:
Unity 2D Following player on the x-axis only, at a constant speed This following code does work, but I have one issue with it. Once the gameobject starts getting close to the player that it is chasing it slows down and does not continue going at a constant speed to the target. Is there another way I can code this to keep the speed constant even if the gameobject is close to the target?

Vector3 followXonly = new Vector3(target_position.x, transform.position.y, transform.position.z);
transform.position = Vector3.Lerp(transform.position, followXonly, speed * Time.deltaTime);

sentences:
Unity - Static Camera Perspective, Walls Obscure Player Pretty simple and common problem here.
The world I'm designing is fully explorable, no invisible walls or tricks. It's presented as a single seamless area, a School complex with 9 buildings, some of which have 2 or 3 floors and contain many rooms.

The perspective I've chosen is simple, inspired by topdown RPGs:

A problem arises with walls. They obscure the player.

I've tried some shaders which draw a silhouette of the player ontop but I don't like this approach, other objects and decoration remains obscured behind the wall.
Some kind of dissolve effect allowing you to see through the walls would be preferable, but writing my own shaders is not my forté...

Another problem is with large buildings outside. The camera is at a fixed distance, about 14 metre's away. If the player walks behind a large building (over ~10 metres tall) then the camera cuts off the top of it as it is now within the building.

The only way I can think of fixing this is to adjust the distance between player and camera, but some of the buildings are so tall the zoom-out looks very unusual and impractical.

I suppose this is why you don't see this simplistic camera setup in large explorable games...

While I've been developing games for some years now, I've only come to 3D and Unity fairly recently, so there might be a jaw-droppingly simple solution which I'm not seeing.

Anyway, I'd like to hear some interesting or novel approaches towards fixing these problems, besides the simple ones I've suggested.

I hope that's not asking too much.

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 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:
AS3/Flash Develop - Radial Gravity (character on planet simulation) I am trying to create a program where a character shape will be constantly drawn towards the centre of a planet shape. I have taken on previous advice into using physics equations to generate the desired effect yet I think I am missing some and therefore it does not work (I am only using v^2=u^2+2as). Am I over complicating things? All I need is for the player object to be constantly drawn towards the centre of the planet object; there will be no need for other planet objects to come into play and affect the player's gravity.

edit: To clarify, my question should have been "where did I go wrong?". I have now since solved the problem with the answers posted below, which were present because I wasn't going about trying to achieve what I wanted the right way. I didn't calculate the actual direction to move in as expected, and so the character could not move in the expected direction.

Here is my Main.as:

package
{
import flash.display.InteractiveObject;
import flash.display.Sprite;
import flash.events.Event;
import Math
import flash.display.Bitmap;
import flash.display.DisplayObject;
import flash.events.KeyboardEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.*;

/**
 * ...
 * @author Me
 */
public class Main extends Sprite
{
    public var planet1:Planet;
    public var character1:Character;
    public var initialXVelocity:Number = 0;
    public var initialYVelocity:Number = 0;
    public var finalXVelocity:Number;
    public var finalYVelocity:Number;
    public const gravitationalAcceleration:Number = 3;
    public var xDistance:Number;
    public var yDistance:Number;

    public function Main()
    {
        if (stage) init();
        else addEventListener(Event.ADDED_TO_STAGE, init);
    }

    private function init(e:Event = null):void
    {
        removeEventListener(Event.ADDED_TO_STAGE, init);
        // entry point
        planet1 = new Planet;
        character1 = new Character;

        //place entites in position to test note: planet 1 is 100*100 pixels, character 1 is 10*10 pixels
        planet1.x = 350;
        planet1.y = 250;
        character1.y = 100; //295
        character1.x = 396; //395
        addChild(planet1);
        addChild(character1);

        //Make sure character has gravity applied constantly
        setInterval(playerMove, 1000);

    }

    public function playerMove():void
    {
        //Calculate the distance between the character and the planet in terms of x and y coordinate
        xDistance = (character1.x + 5) - (planet1.x + 50);
        yDistance = (character1.y + 5) - (planet1.y + 50);

        //Make sure this distance is a positive value
        if (xDistance < 0) {
            xDistance = -xDistance;
        }

        if (yDistance < 0) {
            yDistance = -yDistance;
        }

        //Calculate velocity using physics equation v^2=(u^2)+2as
        finalXVelocity = Math.sqrt((initialXVelocity * initialXVelocity) + (2 * gravitationalAcceleration) * xDistance);
        finalYVelocity = Math.sqrt((initialYVelocity * initialYVelocity) + (2 * gravitationalAcceleration) * yDistance);
        /*trace(initialXVelocity);
        trace(gravitationalAcceleration);
        trace(xDistance);
        trace(finalXVelocity);
        trace(initialYVelocity);
        trace(gravitationalAcceleration);
        trace(yDistance);
        trace(finalYVelocity);*/

        //Make sure the character is moving towards the centre of the planet at all times by reversing the appropriate velocity once it passes the axis of the centre of the planet
        if (planet1.x < character1.x) {
            finalXVelocity = -finalXVelocity;
        }

        if (planet1.y < character1.y) {
            finalYVelocity = -finalYVelocity;
        }

        //Update the current velocity before new velocity is calculated
        initialXVelocity = finalXVelocity;
        initialYVelocity = finalYVelocity;

        //Send the character into the correct direction
        character1.x += finalXVelocity;
        character1.y += finalYVelocity;
    }

}

}

sentences:
Spritefont in OpenGL I develop in OpenGL using C# as programming language.
I want to draw some text on the screen. For this i created a texture that contains all the characters.

Now i am not sure how to continue. I can draw now every character like this:

Gl.glBegin(Gl.GL_QUADS);
{
    Gl.glTexCoord2f(posX, posY);
    Gl.glVertex2f(-1, -1);

    Gl.glTexCoord2f(posX + size, posY);
    Gl.glVertex3f(1, -1);

    Gl.glTexCoord2f(posX + size, posY + size);
    Gl.glVertex3f(1, 1);

    Gl.glTexCoord2f(posX, posY + size);
    Gl.glVertex3f(-1, 1);
}
Gl.glEnd();

posX and posY contain the start position of the character in the character-texture. size is the size of the character in the texture.

This method needs a lot of draw calls. I mean i draw lots of quads but i only need one where i can put all the text on it. How can i improve my code?

sentences:
Pygame How To Use Collision? Can someone tell me how to implement collision in Pygame?
For example I have a sprite called A and another one called B.
How do I detect if they collide in Pygame?

sentences:
Why does a UI button that is child to a canvas not appear in game view? I am trying to place a button onto a canvas background using C# script.
I want the button specific to the canvas (i.e., if I move the camera to look at another canvas, I do not want the button visible).

My C# script is below. I have attached it to an empty game object.
When I run the game, the Heirarchy panel of Unity shows that the canvas and button are created OK, and that
the button is a child of the canvas.
The canvas appears in game view at the right size (200 x 200).

But in game view, there is no button!

The button is definitely present ; clicking on its name the Heirarchy panel shows me a location and size in the scene view that are exactly as specified in my C# script.
But nothing happens when I click the region in game view where the button is supposedly present.

Unity's Inspector panel shows that a "Button (Script)" has been attached to my button object, with Rect Transform parameters as specified in my C# code.
I tried messing with the colors, but still no button.
The "On Click()" window contains nothing except the message "List is Empty".

How do I make the button appear in game view?

How do I make the button work (i.e., generate the Console message "button pressed")?

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

public class TestScript : MonoBehaviour {

private GameObject myGO;
private Vector2 buttonSize;
private Vector3 buttonPosition;

void Start () {
// setup a canvas
    myGO = new GameObject ();
    Canvas myCanvas = myGO.GetComponent<Canvas> ();
    myCanvas.renderMode = RenderMode.WorldSpace;
    RectTransform parentRectTransform = myGO.GetComponent<RectTransform> ();
    parentRectTransform.sizeDelta = new Vector2 (200, 200); // set size of parent rectangle

// create and place the button
    Vector2 buttonSize = new Vector2 (10, 10);
    Vector3 buttonPosition = new Vector3 (150, -70, 1);

    CreateButton (myGO.transform, buttonPosition, buttonSize);
}  // end Start()

public void CreateButton(Transform panel ,Vector3 position, Vector2 size)
{
    GameObject button = new GameObject();
    button.name = "Button";
    button.transform.parent = panel;
    button.AddComponent<RectTransform>();
    button.AddComponent<Button>().onClick.AddListener (handleButton);
    button.transform.position = position;
}

void handleButton() {
    Debug.Log("Button pressed!");
}

} //  end class TestScript

sentences:
What are the most common splines you will find in game development? List here the most common splines found in game development, how many points the method needs to interpolate a curve, and how can you build a data type that allows you to get an interpolation of the curve points. Examples: Bezier curves, B-Splines, Cubic Splines, etc.

P.S.: I'm putting this as a community wiki so we can list all kinds of spline interpolation.

sentences: In Gamemaker Studio 2 how can I find out in code whether the platform is HTML5 or not? I want to be able to run or not run code depending on which platform I am building for. Some code should only run for the HTML5 platform. How can I find out whether the platform being run is HTML5 inside my gamemaker events?

sentences:
Random generated text not working I'm trying to make a game which requires a random generation of sentence upon pressing spacebar. I've never done anything like this and wanted to give it a shot with whatever knowledge I had.

Whenever spacebar is pressed, "Be something in something." appears. I want the somethings to be randomized.

This what I wrote in the Create event -

global.profession = irandom(2);
global.situation = irandom(2);

And this in the Space event -

draw_set_colour($777777);
draw_set_font(fnt_rpl);

if global.profession = 0{
  global.profession = "a nurse"
}

if global.profession = 1{
  global.profession = "a driver"
}

if global.profession = 2{
  global.profession = "a police officer"
}

if global.situation = 0{
  global.situation = "in a hospital."
}

if global.situation = 1{
  global.situation = "in a car."
}

if global.situation = 2{
  global.situation = "in a police station."
}

draw_text_ext_transformed(200, 500, "Be" + global.profession + global.situation, 20, 800, 1, 1, image_angle);

Room is set to be 1920x1080 and I've added the object in the room. I'm getting no result, not even an error, when I press space.

sentences:
Is it possible to create custom functions in Twine 2's Harlowe format? I'm starting to learn Twine and I'm putting together a little framework for making a game.

I'd like to be able to store functions or procedures somehow so that I can use them over and over again without having to write the whole thing each time.

Example[Something like this]: (set: $incrementItemsAmount to (set: _item's amount to it + 1))

I've looked at lambda macros, but they look like they're more for looped procedures.

sentences:
How do I make a quake-style camera tilt in Unity? I want to make a retro-styled game with a modern look to it, and to do so I wish to make a quake-styled camera tilt. By that I mean when moving sideways the FPS Camera tilts a little bit, and the returns to default when letting go of the key. I have little to no scripting knowledge.

https://www.youtube.com/watch?v=scSea_v7JHA

Notice how in the video when moving to the side the camera tilts a little-bit.

sentences:
How do I fix "Invalid character '' in input string at LitJson.Lexer.NextToken ()" when trying to use JSON from URL? When trying to use a Json file served by a url I am getting the error

JsonException: Invalid character '' in input string

it happens when I use this method:

IEnumerator GetText()
{
   UnityWebRequest webjson = UnityWebRequest.Get("http://awebsite.com/Art_.json");

    yield return webjson.SendWebRequest();

    if (webjson.isNetworkError || webjson.isHttpError)
    {
        Debug.Log(webjson.error);
    }
    else
    {
        // The following line is giving me the error:
        // ItemDatabase_+<GetText>d__3.MoveNext () (at Assets/Version2.0/Scripts/ItemDatabase_.cs:38)
        itemData = JsonMapper.ToObject(webjson.downloadHandler.text);

        Debug.Log(itemData);

        ConstructItemDatabase();

    }
}

I have tried to use Trim()

itemData = JsonMapper.ToObject(webjson.downloadHandler.text.Trim());

But still have the same result.

I have tried what is suggested in this question/answer, but it seems to not fix the issue I have.

sentences:
How to handle collisions without ugly conditionals and type checking? (I asked a similar question, but this one is far more specific).

How can I handle collisions without having to do a lot of type checking and if statements?

People here suggested that when spotting a collision, the collision detector should notify both entities in the collision, and the entities themselves will encapsulate the logic to react to the collision.

I like the idea of having the entities themselves decide how to handle the collisions. However I'm not sure how to avoid doing a lot of type checking and if statements inside the handleCollision methods.

For example (in psuedocode):

class CollisionDetector{
    foreach entity in entities
        foreach otherEntity in entities
            if(collision(entity,otherEntity)) entity.handleCollision(otherEntity);
}

class Entity{
    // .. stuff omitted
    void abstract handleCollision();
}

class Alien extends Entity{
    // .. stuff omitted
    void handleCollision(Entity entity){
        // lots of ugly conditionals and type checking
        if(entity instanceof Missile) die();
        if(entity instanceof Alien) lifePoints -= ((Alien)entity).getDamagePoints();
        if(entity instanceof Wall) setVelocity(0,0);
        // .. etc
    }
}

In OOP we should try to avoid type checking and employ Polymorphism. But I don't see how this can be done in this case.

Is there a way to avoid the ugly type checking and lots of conditionals? Or should I just make my peace with it? How is this most commonly done?

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:
Workaround for Texture2D.GetData I’m converting a game from XNA to iOS with Monogame.
In the code snippet below, smallDeform is a Texture2D on which I call the GetData method.

smallDeform = Game.Content.Load<Texture2D>("Terrain/...");
smallDeform.GetData(smallDeformData, 0, smallDeform.Width * smallDeform.Height);

I’m having some problem with Monogame because the feature in iOS has not been implemented yet because it returns this exception.

#if IOS
   throw new NotImplementedException();
#elif ANDROID

I tried to serialize the data in a XML file from Windows to load the whole file from iOS. The serialized files weight more than 100MB each, that is quite unacceptable to parse.

Basically, I’m looking for a workaround to get the data (for instance a uint[] or Color[]) from a texture without using the GetData method.

PS: I'm on Mac, so I can't use the Monogame SharpDX library.

Thanks in advance.

sentences:
How to make the camera follow the mouse in first or third person camera I currently I have a game made of a few small scripts, the PlayerController, PlayerStats, and CameraChange (each below).

My question is how do I get the camera to follow the mouse movement? I want the player to be able to switch between each camera and look around with the mouse.

Any idea as to how I'd go about doing this? My current theory is I would some how have to access the current active camera and make it follow the mouse but not sure how to do that.

PlayerController-

using UnityEngine;

public class PlayerContorller : MonoBehaviour

{

    // Update is called once per frame
    void Update ()
    {
        var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;

        var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f;

            transform.Rotate(0, x, 0);
        transform.Translate(0, 0, z);
    }
}

PlayerStats-

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

public class PlayerStats : MonoBehaviour {

    public int Health = 100;
    public int Stamina = 100;
    public int magic = 100;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update ()
    {
        //if ()
        {

        }
    }
}

CameraChange-

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

public class CameraChange : MonoBehaviour {

    public GameObject ThirdCam;
    public GameObject FirstCam;
    public int CamMode;

    // Update is called once per frame
    void Update ()
    {

        if (Input.GetButtonDown("Camera"))
        {
            if (CamMode == 1)
            {
                CamMode = 0;
            }
            else
            {
                CamMode += 1;
            }
            StartCoroutine(CamChange());
        }
    }
    IEnumerator CamChange()
    {
        yield return new WaitForSeconds(0.01f);
        if(CamMode == 0)
        {
            ThirdCam.SetActive(true);
            FirstCam.SetActive(false);
        }
        if(CamMode == 1)
        {
            FirstCam.SetActive(true);
            ThirdCam.SetActive(false);
        }
    }
}

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:
OpenGL Planet Generation - Simple Matrix Issue (Planet “Spins” With Mouse) I originally asked this question on StackOverflow & was directed here by a commenter.

Im currently working on a OpenGL planet rendering. I'm using the Tessellation pipeline. So far things are going very well bar one issue. It's at the stage where I've been banging my head off it for ages and feel like progress isnt happening.

First of all here is a gif of what I'm dealing with. Essentially my problem is that whenever the mouse is moved the planet rotates as if its "looking" at where the camera is pointing.

There are some graphical issues but they are due to me simply repeating the same heightmap across the whole cubemap. Since it doesnt match up on the sides there are clear seams.

Below is my evaluation shader:

void main(void) {
    vec4 p0 = gl_in[0].gl_Position;
    vec4 p1 = gl_in[1].gl_Position;
    vec4 p2 = gl_in[2].gl_Position;
    vec3 p = gl_TessCoord.xyz;

    Normal_FS_in = mat3(transpose(inverse((MV)))) * (p0*p.x + (p1*p.y) + p2*p.z).xyz;

    float displacment = texture(tex1, Normal_FS_in).r * 800;
    gl_Position = MVP*(p0*p.x + (p1*p.y) + p2*p.z) + (vec4(vec3(displacment,displacment,0) * normalize(Normal_FS_in),1));
}

Its pretty simple. The shader calculates a normal for the output vertex. This is then used to grab a displacement value from the heightmap which is a cube map. Then GL_Position is calculated. What I've been trying to work out is if my problem lies in the shaders or in the rest of the package.

My attempts have largely been tinkering. I've moved all normal related stuff into the evaluation shader rather then calculating it in the vertex shader and passing them through to the control and evaluation shaders.

The issue only occurs when the mouse is moved.

Any suggestions would be fantastic - hopefully all I'll need is a pointed in the right direction.

Edit - Doing the inverse transpose of the modelview matrix OR view matrix yields the result in the gif. Using the model matrix leads to distortion of the normals when the camera is moved, such that the terrain bends about the place.

sentences:
Intermediate AI for Java games I want to know how to create good AI for a Java game,  I'm still learning the language and I'm not an expert.
I can do static AI but wanna know about  writing an AI that follows the player and considers how to reach him via pathfinding.

sentences:
Sending an object from one point to another I am working on a simple game in Java and am stuck for now with getting an object to be directed from its current position to a certain point, all at a fixed speed. My problem is that whenever I activate the movement, the object seems to shoot off into a random direction, sometimes towards my target, sometimes away, really any direction it seems, but nothing consistent.

This is what I'm working with:

    else if (key == KeyEvent.VK_SPACE)
    {
        double deltaY = 100 - p.getY();
        double deltaX = 100 - p.getX();
        double angle = Math.atan2(deltaY, deltaX) * 180 / Math.PI;
        System.out.println(angle);
        double dx = (double) (Math.cos(angle) * 3);
        double dy = (double) (Math.sin(angle) * 3);
        p.setVelX(dx);
        p.setVelY(dy);
    }

Here is my SetVel functions as well as the tick method.

public void tick()
{
    x+=velX;
    y+=velY;

    if(x <= 0)
        x = 0;
    if(x >= 640)
        x = 640;
    if(y < 0)
        y = 0;
    if(y >= 480)
        y = 480;
}

public void setVelX(double velX)
{
    this.velX = velX;
}

public void setVelY(double velY)
{
    this.velY = velY;
}

Using the system outs, and positioning my object at 90 degree angles relative to my target I am getting 90 and 180 degrees, so I don't think its a problem with that.

sentences:
Is a game based on a specific cellular automation a copyright infringement? If one creates a game which is based on some cellular automation algorithm like Conway's Game of Life or Langton's Ants would that be a copyright infringement?

Are such famous algorithms protected by intellectual property rights, or as long as they aren't mentioned by their official names, the actual effect they create is free to be used?

sentences:
Platformer movement and collisions I'm working on a platformer but I'm stuck at the player movement and collisions.
Right now I'm not including the grid at all in the movement, but it's time I do it. I've read this article on how to do it. But there's no real code examples just theory.
I like the second example and that's the one I'm going for. I want the movement to be smooth, and the player should be able to run in between squares from my map array.
This means I have to get tile information from the array, and according to that allow/forbid my player to move in that direction. And that's where I'm stuck.
My array is a bunch of 1's and 0's right now. I know how to calculate a hitbox around the player, but how do I compare that to the array in an efficiant way?
UPDATE: I've been playing around with this for a while now, and the only thing I came up with is using player X and Y which is in pixels, dividing by tile size, and getting a rough estimate on the map. Then I make it an AABB by adding its width and height to get the corners.
This showed to be very unreliable though, and I would really need some help on how to structure this.

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:
Pass-through pixel shader not displaying properly I'm new to shaders, HLSL and XNA in general. I'm trying to write a pass-through pixel shader but I'm experiencing some odd behaviour. I created a simple texture, shown below:

Here's what I see when I run my game:

Drawing the texture without passing effect in spriteBatch.Begin() works fine, for instance:

Drawing the texture at (40, 10) instead of (0, 0) gives different results, too (the green stripe isn't as thick):

My shader file:

sampler input;

float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
    float4 color = tex2D(input, coords);
    return color;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
}

My game code:

public class Game1 : Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Texture2D tex;
    Effect effect;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
    }

    protected override void Initialize()
    {
        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);

        tex = Content.Load<Texture2D>("tex");
        effect = Content.Load<Effect>("effect");
    }

    protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            Exit();

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin(sortMode: SpriteSortMode.Immediate, effect: effect);
        spriteBatch.Draw(tex, new Vector2(0, 0), Color.White);
        spriteBatch.End();

        base.Draw(gameTime);
    }
}

What am I doing wrong? I'm expecting my pass-through shader to simply draw the texture on the screen as-is (appearing as in the second screenshot above), but it looks totally wrong. (For what it's worth, I was trying to follow this tutorial: http://blog.josack.com/2011/07/my-first-2d-pixel-shaders-part-1.html)

sentences:
Implicity of "Objects" in component based design For a while, I have mostly been using "standard OOP" (inheritance heavy, tree structure, etc.) styled designs for my Game Development needs. However, for my current project I am trying to shift over to a component-based design (This is all at a hobby level, so time/money/productivity speed are not important ATM.) However, while researching into component based designs, I am confused about how the concept of "objects" are implement.

From what I can understand, there are 2 schools of thought in regards to the relationship between components and objects. One paradigm seems to implement objects as classes that simply serve as "containers" for holding components that interact with another. However another paradigm seems to get rid of the concept of an object itself, with objects only existing implicitly. (however, I fail to understand how synchronization issues don't appear. If anybody could also explain this, that would be very helpful.)

Regarding these 2 ideals, are there any major benefits (performance, usability, etc.) to choosing one paradigm over another?

sentences:
What's the scope of RPCs in unity? I can define several RPCs in unity and I can call them via the networkView component. But it seems that it gets the RPC called regardless where it is defined.

So I was wondering to know how do the scope of RPC works in Unity. Am I able to call whatever RPC in whatever script which share the same networkView? Or is there any other logic behind?

As a corollary: can I define a unique structured file gathering every RPC in my project?

sentences:
Why is my bullet disappearing after I release the shoot button? I'm making a game using DirectXTK for my university project. When I press space bullet moves forward like I wanted, but when I let go it stops my bullet from moving. How do I keep the bullet moving when space was pressed?

void update
{
  //shooting
  if (kb.Space)
    Shoot(true);
  else
    Shoot(false);
}
void Render()
{
  if (draw)
  {
    for (int i = 0; i < 10; i++)
    {
      m_projectile[i]->Draw(m_bullet[i], m_view, m_proj, Colors::Red);
    }
  }
}
bool shoot(bool test)
{
  shoot = test;
  draw = true;

  //bool isShot = false;
  if (!shoot)
  {
    for (int i = 0; i < 10; i++)
    {
      m_bullet[i] = Matrix::CreateRotationY(m_ship._42) * m_ship;
    }
  }
  else
  {
    m_bullet[0] = Matrix::CreateTranslation(-Vector3::Forward *float(1))*Matrix::CreateRotationY(0.f) * m_bullet[0];
    //m_bullet *= Matrix::CreateTranslation(-Vector3::Forward);
  }

  return draw;
}

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:
Unity: OnCollisionEnter not called I created a sphere object, added a rigidbody component (no kinematics) and attached a script to it like this:

function Update () {
}

function OnCollisionEnter(collision : Collision) {
    Debug.Log("OnCollisionEnter");
}

I then created a cube under the ball, added a box collider component with no trigger of course.

Then, when I run the game, the ball falls down onto the cube, but nothing happens. The OnCollisionEnter function isn't called.

What should I do?

sentences:
What's wrong with this Open GL ES 2.0. Shader? I just can't understand this. The code works perfectly on the emulator(Which is supposed to give more problems than phones…), but when I try it on a LG-E610 it doesn't compile the vertex shader. This is my log error(Which contains the shader code as well):

EDITED

Shader:

uniform mat4 u_Matrix;

uniform int u_XSpritePos;
uniform int u_YSpritePos;
uniform float u_XDisplacement;
uniform float u_YDisplacement;

attribute vec4 a_Position;
attribute vec2 a_TextureCoordinates;

varying vec2 v_TextureCoordinates;

void main(){
    v_TextureCoordinates.x= (a_TextureCoordinates.x + u_XSpritePos) * u_XDisplacement;
    v_TextureCoordinates.y= (a_TextureCoordinates.y + u_YSpritePos) * u_YDisplacement;

    gl_Position = u_Matrix * a_Position;
}

Log reports this before loading/compiling shader:

11-05 18:46:25.579: D/memalloc(1649): /dev/pmem: Mapped buffer base:0x51984000 size:5570560 offset:4956160 fd:46
11-05 18:46:25.629: D/memalloc(1649): /dev/pmem: Mapped buffer base:0x5218d000 size:5836800 offset:5570560 fd:49

Maybe it has something to do with that men alloc? The phone is also giving a constant error while plugged: ERROR FBIOGET_ESDCHECKLOOP fail, from msm7627a.gralloc

Edited: "InfoLog:" refers to glGetShaderInfoLog, and it's returning nothing. Since I removed the log in a previous edit I will just say i'm looking for feedback on compiling shaders.

Solution + More questions: Ok, the problem seems to be that either ints are not working(generally speaking) or that you can't mix floats with ints. That brings to me the question, why on earth glGetShaderInfoLog is returning nothing? Shouldn't it tell me something is wrong on those lines? It surely does when I misspell something.

I solved by turning everything into floats, but If someone can add some light into this, It would be appreciated. Thanks.

sentences:
Get all objects of Additively loaded Scene? (LoadSceneMode.Additive) I learned how to Load and unload scenes in unity. using LoadSceneMode.Additive.

I like to spit up my scenes as much as possible and retain the stuff I need as I go along.

I'd like to be able to find all objects loaded from a specific scene. Obviously Unity knows but I can't find how to get them.

For now, my workaround is to put them in a specifically named empty or have them tagged in a certain way, but that is a workaround.

Is there an easier way?

sentences:
How do I get parabolic movement in Unity using Rigidbody2d? EDIT: It was the Animator after all. Apply Root Motion basically nullifies any physics based work.

I "know" this answer but I can't figure out what can possibly be wrong. My code is in FixedUpdate(). My Rigidbody2D has a Gravity Scale of 4 and a Mass of 1. For whatever reason a Gravity Scale of 1 just isn't strong enough to keep it from floating away. In the pictures below the little cubes should be marking each frame.

Using the below code I get a jagged leap movement. The object shoots upwards and falls like a feather.

if(Game.inputManager.GetKey("Jump").KeyPressed())
{
    yForce = 1000f;
    this.rigidbody2D.AddForce(Vector2.up*yForce);
}

And using another suggestion I distribute the force over a second of time.

if(Game.inputManager.GetKey("Jump").KeyPressed())
    {
        addForceTimer = 1;
        yForce = 1000f;
    }
    addForceTimer -= Time.deltaTime;
    if(addForceTimer > 0)
    {
        this.rigidbody2D.AddForce(Vector2.up*yForce* Time.deltaTime*4);

    }

And I get a more desirable but still just as wrong movement where there is no hang at the top of the jump.

From what I thought I knew neither of these should be happening at all. The object shouldn't be falling at a constant speed like it is. Does anybody have any suggestions?

The character is animated if that can possibly have some sort of effect but I don't imagine it would.

sentences:
How to create a regular grid of triangles correctly? I am trying to create an terrain using opentk/opengl.

I have a problem with the VBO/IBO.
I think a picture of the problem is the best way to show it:

I dont understand why the last triangle of a row connects to the first vertices of the row.

Here is the code:

int mapSize = 7;
    void CreateVertexBuffer()
    {
        Vector3[] vertices = new Vector3[(mapSize + 1) * (mapSize + 1)];
        short[] indices = new short[ ((mapSize)*(mapSize)) * 6];

        for (int x = 0; x < mapSize + 1 ; x++)
        {
            for (int y = 0; y < mapSize + 1 ; y++)
            {
                int li_offset = x * (mapSize + 1) + y;
                vertices[li_offset] = new Vector3(x / 4.0f, 0 , y / 4.0f);
            }
        }
        int index = 0;
        for (int x = 0; x < mapSize ; x++)
        {
            for (int y = 0; y < mapSize ; y++)
            {
                indices[index + 0] = (short)( x * (mapSize + 1) + y);
                indices[index + 1] = (short)(indices[index + 0] + mapSize + 2);
                indices[index + 2] = (short)(indices[index + 0] + mapSize + 1);

                indices[index + 3] = (short)(indices[index + 0]);
                indices[index + 4] = (short)(indices[index + 0] + 1);
                indices[index + 5] = (short)(indices[index + 0] + 2);

                index += 6;
            }
        }
        GL.GenBuffers(1, out vbo);
        GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
        GL.BufferData<Vector3>(BufferTarget.ArrayBuffer,
                               new IntPtr(vertices.Length * Vector3.SizeInBytes),
                               vertices, BufferUsageHint.StaticDraw);
        GL.GenBuffers(1, out ibo);
        GL.BindBuffer(BufferTarget.ElementArrayBuffer, ibo);
        GL.BufferData<short>(BufferTarget.ElementArrayBuffer,
                               new IntPtr(indices.Length * sizeof(short) ),
                               indices, BufferUsageHint.StaticDraw);
    }

How can I make the last row of triangles properly formed like all the others?

sentences:
How to get dynamic RigidBody rotation/tilt on uneven platform? I have a rigid body with PolygonCollider2D which has some complex circular shape and I'm using uneven platform.

Im using Following code to move the object forward

CharacterRigidBody.velocity = new Vector2 (speed, CharacterRigidBody.velocity.y);

Problem : The rigid body keeps on rotating when it moves forward.

I want the character to move without rotation on asymmetrical  platform(above).But i don't want to freeze rotation because i want the character to tilt when climbing or decending platform.

My RigidBody2D config(I'm using unity 5.1.2)

Can collider do anything with this problem?

sentences: How to read a data from text file in unity Can anybody help me out with giving the steps needed for reading data from the text file in unity and how can the script be added.

sentences:
Where to find designers for independent projects? Let's say I'm a programmer, I know some artists, we've got a game engine and fun prototype done, and we're ready to enter the indie equivalent of "production".

But the game is full of "programmer design" (and/or "artist design"). We've got a core design concept, but average level design, average AI patterns, average writing, poor balance here and there.

Other questions have covered how to help independent developers find programmers and artists. Where can independent artists and programmers find designers? People who can refine and extend the design elements of the game until they really stand out.

sentences:
Movement of an object based on thrust and gravity force in 2d scrolling game, need help I want to make a box "fly" so while user press D it's add thrust then on A it decrese untill 0, W and S control the direction of my box.

I have problems after I add the gravity to update correctly my X and Y position.
My actual code is like this: (I'm using gamemaker but it's same as other languages, came execute 60 frames per second)

frametime = delta_time / 1000000;
spd = sqrt(power(velx ,2)+power(vely ,2));
tempgy = g * frametime ;
//tempay = ((thrust / m) * 32) * frametime; // or my box procede diagonally offcurse
tempax = ((thrust / m) * 32) * frametime;
y -= (vely + tempgy/2   + tempay/2 ) * frametime ;
x += (velx + tempax/2  ) * frametime ;
vely += tempgy + tempay;
velx += tempax  ;

m is mass of object = 500

g = 9.81

32 it's pixel per meter

So, basically I calculate the acceleration on gravity, and need to apply acceleration to x and y based on direction if I not understand wrong. So for the X component of thrust I have to multiply sin(degtorad(dir)) and for the Y must multiply cos(degtorad(dir)), but I have to apply the sin and cos only on acceleration?

I think I am doing it wrong because if I use g=0 and just using thrust my box act not as intended (ex: If I try to do a loop and stop accelerating my box will not follow the loop direction but continue on straight line)

Sorry for the stupid question but I really not know how to fix it. I see lot of tutorials with vectors but it's not supported here so can't use them. Thank you and best regards.

sentences:
Calculating the bounding box of a game object based on its children 2D game with Unity. Have a parent game object, with several children objects scattered all over the scene.

I want to calculate the bounding rectangle of the parent game object.

Let the black dots be the children objects. The red rectangle is the bounding box. I am not really interested in the position - I only want the dimensions of such box.

Of course, the bounding box should also consider the bounding boxes of the children... and so on.

How can I achieve this? I heard that Renderer has a bounds property... but my parent object doesn't have a renderer. And when I put one, the value is 0 anyway.

sentences:
Finding roots/zeros for collision detection? For the most simple of 2D games, I have implemented a posteriori collision detection (overlapping rectangles) on the x/y Cartesian plane, but am now interested in understanding the basics of a priori collision detection...

In the link here, I noticed the reference to Newton’s Method.  So, I want to better understand the link b/w 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 solving 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?)

Again, the basic question is where does root finding come into play?  Any links to a basic primer on this topic, with a simple example would also be greatly appreciated.

sentences:
Quad Rendering Issue I am fairly new to using Quads, so I'm not sure how I can properly describe this issue in all honesty or to even hazard a guess as to why it's happening, so I have a screenshot to illustrate.

So the white lines are actually Quads, the Red lines are just rectangles. So if you can see the issue, for some reason every "now & again" I will get this issue were I get this somewhat looking "dotted line" which will sometimes be a full end-to-end line.

I'm not too sure what's causing this issue, I have a feeling it has something to-do with the way I'm drawing the quads, I don't think it's an incorrect vertices purely because the because of the thickness of the line, this leads me to believe it's the rendering:

effect.CurrentTechnique.Passes[0].Apply();
device.DrawUserPrimitives<VertexPositionColorTexture>(PrimitiveType.TriangleStrip, vertices, 0, totalNumberOfQuads);

This is the order I'm adding the vertices:

Top Left Segment Corner
Top Right Segment Corner
Bottom Left Segment Corner
Bottom Right Segment Corner

So after getting the vertices in the correct order, things are now even stranger, as this is an image of the current output:

Here's my Current Code, including the rendering:
http://pastebin.com/yK5yBZy0

sentences:
Cull mode back faces When i draw a cube using indices, the faces of the cube are skewed but only when CullMode is set to cull back. When i switch it to cull none, it draws the cube perfect. Unfortunately i cant post any code at the time because I'm using my phone, but what are some possible explanations for why the faces of my cube are skewed wjile culling the back? I was thinking the order of my indices may be the problem.

http://i.imgur.com/S1PfxCr.png

VertexType* vertices;
unsigned long* indices;
D3D10_BUFFER_DESC vertexBufferDesc, indexBufferDesc;
D3D10_SUBRESOURCE_DATA vertexData, indexData;
HRESULT result;

m_vertexCount = 8;
m_indexCount = 36;

vertices = new VertexType[m_vertexCount];
if(!vertices)
{
    return false;
}

// Create the index array.
indices = new unsigned long[m_indexCount];
if(!indices)
{
    return false;
}

vertices[0].position = D3DXVECTOR3(-1, 1, -1);
vertices[0].color = D3DXVECTOR4(1, 0, 0, 1);

vertices[1].position = D3DXVECTOR3(1, 1, -1);
vertices[1].color = D3DXVECTOR4(1, 1, 0, 1);

vertices[2].position = D3DXVECTOR3(-1, -1, -1);
vertices[2].color = D3DXVECTOR4(1, 1, 1, 1);

vertices[3].position = D3DXVECTOR3(1, -1, -1);
vertices[3].color = D3DXVECTOR4(0, 1, 0, 1);

vertices[4].position = D3DXVECTOR3(-1, 1, 1);
vertices[4].color = D3DXVECTOR4(0, 1, 1, 1);

vertices[5].position = D3DXVECTOR3(1, 1, 1);
vertices[5].color = D3DXVECTOR4(0, 0, 1, 1);

vertices[6].position = D3DXVECTOR3(-1, -1, 1);
vertices[6].color = D3DXVECTOR4(1, 0, 0, 1);

vertices[7].position = D3DXVECTOR3(1, -1, 1);
vertices[7].color = D3DXVECTOR4(1, 0, 0, 1);

//indices = { 2, 0, 3, 3, 1, 0, 3, 1, 7, 7, 5, 1, 6, 4, 2, 2, 0, 4, 7, 5, 6, 6, 4, 5, 0, 4, 1, 1, 5, 4, 6, 2, 7, 7, 3, 2 };

indices[0] = 2;
indices[1] = 0;
indices[2] = 3;
indices[3] = 3;
indices[4] = 1;
indices[5] = 0;
indices[6] = 3;
indices[7] = 1;
indices[8] = 7;
indices[9] = 7;
indices[10] = 5;
indices[11] = 1;
indices[12] = 6;
indices[13] = 4;
indices[14] = 2;
indices[15] = 2;
indices[16] = 0;
indices[17] = 4;
indices[18] = 7;
indices[19] = 5;
indices[20] = 6;
indices[21] = 6;
indices[22] = 4;
indices[23] = 5;
indices[24] = 0;
indices[25] = 4;
indices[26] = 1;
indices[27] = 1;
indices[28] = 5;
indices[29] = 4;
indices[30] = 6;
indices[31] = 2;
indices[32] = 7;
indices[33] = 7;
indices[34] = 3;
indices[35] = 2;

vertexBufferDesc.Usage = D3D10_USAGE_DEFAULT;
vertexBufferDesc.ByteWidth = sizeof(VertexType) *m_vertexCount;
vertexBufferDesc.BindFlags = D3D10_BIND_VERTEX_BUFFER;
vertexBufferDesc.CPUAccessFlags = 0;
vertexBufferDesc.MiscFlags = 0;

vertexData.pSysMem = vertices;

result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer);
if(FAILED(result))
{
    return false;
}

indexBufferDesc.Usage = D3D10_USAGE_DEFAULT;
indexBufferDesc.ByteWidth = sizeof(unsigned long) *m_indexCount;
indexBufferDesc.BindFlags = D3D10_BIND_INDEX_BUFFER;
indexBufferDesc.CPUAccessFlags = 0;
indexBufferDesc.MiscFlags = 0;

indexData.pSysMem = indices;

result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer);

return true;
}

void CubeClass::RenderBuffers(ID3D10Device* device)
{
unsigned int stride;
unsigned int offset;

stride = sizeof(VertexType);
offset = 0;

device->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &offset);

device->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);

device->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

device->DrawIndexed(36, 0, 0);

}

sentences:
Can instantiated objects have different material/texture? While I have some experience with simple 2D games, I am new to more process-demanding 3D games. One basic question that has been concerning me recently and for which I am having difficulties to find a proper detailed answer, is the following.

I understand that when we instantiate an object, we are saving memory because the instantiated copy does not have to save mesh memory (like vertices' position, UV cood and normals). So, the instantiated copy only needs to save a transformation matrix in order to properly position, scale and rotate the mesh structure they share with the original mesh.

But can the instantiated copies have different texture or material from the original mesh from which they were instantiated? If so, then it means the instantiated objects actually save with themselves more than transformation matrices. I would love to read more on that, so suggestions are welcome.

sentences:
Using same buffer for vertex and index data? Is it possible to use the same buffer for both GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER?

I load both vertex data and index data into a big slab of memory, so it would be easier for me to just load it all into a single buffer. So naturally, I do like this

glBindBuffer(GL_ARRAY_BUFFER, vboId);
glBufferData(GL_ARRAY_BUFFER, dataSize, data, usage);
glBindBuffer(GL_ARRAY_BUFFER, 0);

Is it legal to – during rendering – simply use it as both?

glBindBuffer(GL_ARRAY_BUFFER, vboId);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboId);
glVertexAttribPointer(...);
...
glDrawElements(mode, count, dataType, (void*)indexOffset);

I can't find anything in the spec saying it's ok to do so, but I can't find anything that says that I can't either. Googling doesn't turn up much either, but I might be looking in the wrong places.

sentences:
FPS-like mouse-look camera WinAPI problem I have a problem with implementing mouse-look camera movement, like in FPS games. For me common solution is:

Process WM_MOUSEMOVE event in WndProc
Calculate delta movement from the window's center using event's lParam
Rotate camera
Return cursor back to window's center using SetCursorPos

The problem is when SetCursorPos is called, another WM_MOUSEMOVE event is being fired. So camera rotates back.

What is the common way to create such type of camera on Windows platform (using WinAPI)?

I know that in WM_MOSEMOVE I can check is mouse.x == windowCenter.x and if it is - do nothing, but it's a hack from my point of view. Is there any "non-hacky" way to achieve the goal?

sentences:
Get collision details from Rectangle.Intersects() I have a Breakout game in which, at some point, I detect the collision between the ball and the paddle with something like this:

// Ball class
rectangle.Intersects(paddle.Rectangle);

Is there any way I can get the exact coordinates of the collision, or any details about it, with the current XNA API?

I thought of doing some basic calculations, such as comparing the exact coordinates of each object on the moment of the collision. It would look something like this:

// Ball class
if((rectangle.X - paddle.Rectangle.X) < (paddle.Rectangle.Width / 2))
    // Collision happened on the left side
else
    // Collision happened on the right side

But I'm not sure this is the correct way to do it.

Do you guys have any tips on maybe an engine I might have to use to achieve that? Or even good coding practices using this method?

sentences:
How can I get a list of sprites which are being drawn in the current viewport using XNA? Just starting out using XNA to draw 3D scenes and have a question about determining which objects are currently visible.

If I load many thousands of sprites and shapes in a scene, then render the current view from a camera, is it possible to actually find (e.g. list to a text file) the IDs of those visible objects?

I guess another way to ask this is to say: how can I get a list of objects (e.g. sprites) which are being drawn in the current viewport?

sentences:
ID3D11Device::CreateInputLayout: Encoded Signature size doesn't match specified size I get [ STATE_CREATION ERROR #161: CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE] with the following code:

// Vertex data
struct VertexData {
    XMFLOAT3 v;
    XMFLOAT2 vt;
    XMFLOAT3 vn;
};

// ...

// Create the input layout vertex shader.
D3D11_INPUT_ELEMENT_DESC vertexLayoutDesc[] =
{
    { "V", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, offsetof(VertexData, v), D3D11_INPUT_PER_VERTEX_DATA, 0 },
    { "VT", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(VertexData, vt), D3D11_INPUT_PER_VERTEX_DATA, 0 },
    { "VN", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, offsetof(VertexData, vn), D3D11_INPUT_PER_VERTEX_DATA, 0 }
};

HRESULT hr = g_d3dDevice->CreateInputLayout(vertexLayoutDesc, _countof(vertexLayoutDesc), geomVertexShaderBlob->GetBufferPointer(), geomPixelShaderBlob->GetBufferSize(), &g_d3dInputLayout);

And wannabe matching HLSL code:

struct Input
{
    float3 v : V;
    float2 vt : VT;
    float3 vn : VN;
};

struct Output
{
    float4 color : COLOR;
    float4 position : SV_POSITION;
};

Output main(Input input) {...}

I can't spot the mismatch and what exactly the error message is pointing to. Weird thing I have very similar input layout and shaders that work perfectly fine, but this one doesn't.

sentences:
Most efficient way to calculate angle between two line-segments that do not necessarily touch each other Although I found answers on calculating angles from vectors, I didn't find a specific way to calculate angles between line-segments that do not necessarily touch each other (I say "not necessarily because I will apply to different cases).

See the figure below:

Consider that I know the 2D position of all 4 red points. I am using C# here. What would be the cheapest way of calculating the angles formed by line-segments that do not touch each other, such like the ones above?

sentences:
NavMeshAgent.CalculatePath - how to use properly? I seriously can't figure out how to use this function, and the documentation doesn't help at all.

Here's the documentation code:

public class ExampleClass : MonoBehaviour {
 public Transform target;
 private NavMeshAgent agent;
 void Start() {
     agent = GetComponent<NavMeshAgent>();
     NavMeshPath path;
     agent.CalculatePath(target.position, path);
     if (path.status == NavMeshPathStatus.PathPartial) {
     }
   }
}

Here's my code:

public class Movement : MonoBehaviour {
 NavMeshAgent agent;
 NavMeshPath path;

 void Start () {
     agent = GetComponent<NavMeshAgent>();
 }

 void MoveToTargetLocation() {
     agent.SetDestination(targetLocation); <-- being set somewhere else

     NavMeshPath path;
     agent.CalculatePath (targetLocation, path);

     if (path.status != NavMeshPathStatus.PathPartial) {
         if (Vector3.Distance (curLocation, targetLocation) > 0.55) {
             animation.CrossFade (animationRun.name);
             moving = true;
         } else {
             animation.CrossFade (animationIdle.name);
             moving = false;
         }
      }
   }
}

The error I'm receiving is:

  Assets/Movement.cs(59,54): error CS0165: Use of unassigned local
  variable `path'

Am I supposed to be setting the path somewhere else?

sentences:
WebGL (three.js) - rendering object behind camera far plane I need to have one object that is always visible/rendered (a lens flare, to be exact). I don't want to set the camera far plane to the maximum possible distance between camera and the sun (performance reasons). Are there any tricks to this? Is this even possible? I could obviously play math and update flare's position so it's always no further than a camera far plane at the correct angle but I also want it to change size depending on the distance as well.

If there are some solutions to such a problem I would be very thankful for answers on how it can be done in three.js.

sentences:
Is non-indexed, non-instanced rendering useful anymore? I'm adding batched rendering to my game engine and I'm wondering: Should I support non-indexed, non-instanced batches or just indexed and/or instanced?

It's my understanding that the concept of indexed rendering was invented after pure "vertex only" drawing. That said, is supporting vertex-only rendering useful anymore? Is there a modern use-case for it?

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:
How to create a high score in Unity from a Time.deltatime float? When I play my game, it sets my score to 0 and does not change, no matter how high my float gets.

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

public class highscore : MonoBehaviour {

    public Text Highscore;

    void Start () {
        Highscore.text = PlayerPrefs.GetFloat ("Highscore", 0).ToString();
    }
}

This is where the next page starts

using UnityEngine;
using UnityEngine.UI;

public class Score : MonoBehaviour {

    public Text ScoreText;

    public float playerScore = 0;

    void Update () {
        playerScore += Time.deltaTime*10;

        {
            ScoreText.text = playerScore.ToString("0");
        }
    }

    private void OnCollisionEnter (Collision collisionInfo) {

        if (collisionInfo.collider.tag == "Obstacle")
        {
            PlayerPrefs.SetFloat ("Highscore", playerScore);
        }
    }
}

sentences:
Can Cruncher crunch Daz models? I have a number of Daz 3D models that I would like to use in my Unity shooter game. The only problem seemed to be the high poly count of the Daz models.

However, I just came across the Cruncher Polyreduction tool (http://assetstore.unity3d.com/#/content/4294). Is it possible to use this plugin to incorporate Daz models in my game?

sentences:
Press and hold camera movement with mouse in new Input System? I am transitioning to the new movement system and am having trouble figuring out how to move the camera when a mouse button is pressed and held.
Here's how I did it before:
private void Update()
{
    // Get the position of the mouse when a middle click occurs
    if (Input.GetMouseButtonDown(2))
    {
        _dragOrigin = cam.ScreenToWorldPoint(Input.mousePosition);
    }

    // If the MMB is still held down, calculate the distance and move the camera
    if (Input.GetMouseButton(2))
    {
        Vector3 difference = _dragOrigin - cam.ScreenToWorldPoint(Input.mousePosition);
        cam.transform.position += difference;
    }
}

I have tried doing something similar in the new input system but it doesn't work:
public void OnMMB(InputAction.CallbackContext context)
{
    if (context.phase != InputActionPhase.Started)
    {
        // Get the position of the mouse when a middle click occurs
        dragOrigin = cam.ScreenToWorldPoint(Mouse.current.position.ReadValue());
    }
    else
    {
        // If the MMB is still held down, calculate the distance and move the camera
        Vector2 newPosition = cam.ScreenToWorldPoint(Mouse.current.position.ReadValue());
        Vector3 difference = dragOrigin - newPosition;
        cam.transform.position += difference;
    }
}

Here is how I set this up inside the Input editor:

The Action Type of the action is Button.

sentences:
How to parse HTTP response (JSONdata) in cocos2d-x I am making a HTTP request to a server and I am getting data from the database. Now I want to parse the JSON data and get the data into variables like this:

std::vector<char> * buffer = response->getResponseData();
char * concatenated = (char *) malloc(buffer->size() + 1);
std::string s2(buffer->begin(), buffer->end());
strcpy(concatenated, s2.c_str());

Json * json = Json_create(concatenated);
std::string test1 = Json_getString(json, "id", "default");
std::string test2 = Json_getString(json, "pass", "default");

CCLog("HTTP Response : id : %s", test1);
CCLog("HTTP Response : pass : %s", test2);

But I am getting an error on:

Json *Json_getItem (Json *object, const char* string) {
Json *c = object->child;  //error on this line -- exc_bad_access
while (c && Json_strcasecmp(c->name, string))
c = c->next;
return c;
}

When I log...

 log("%s",concatenated);

...it outputs data like this:

 id:mtpass:thkr

Reference - https://gist.github.com/Tetz/81686772

So how to get the data in variables id and pass?

sentences:
How can I render 3D objects and particle systems in front of a Screen Space - Overlay Camera? I am using Unity 2019 with the Universal Render Pipeline.  I have a canvas that is using Screen Space - Overlay render mode.  I cannot change my render mode to Screen Space - Camera, because it is not currently supported by the Universal Render Pipeline.

How can I have a particle system, or any other 3D objects, render on top of my canvas?

sentences:
Where do I have to put actions when the game state changes I’ve just started to learn Unreal Engine implementing a clone version of Atari’s Pong game.
I’m thinking about where to put the code to change the state of the game. I have an enum in the GameState class to manage when the game hasn’t started, or when we are playing the game. In case when someone scores I decided that I have to stop the ball and move it to its initial position.
My problem comes here because I don’t know where to put the code to do that: on GameMode class or on GameState class.
Where do I have to put that code?

sentences:
Optimized linear to sRGB GLSL I'm currently using a simple implementation of  linear to sRGB transform:

float sRGB(float x) {
    if (x <= 0.00031308)
        return 12.92 * x;
    else
        return 1.055*pow(x,(1.0 / 2.4) ) - 0.055;
}
vec3 sRGB_v3(vec3 c) {
    return vec3(sRGB(c.x),sRGB(c.y),sRGB(c.z));
}

Possibly, that the correction for small values (x <= 0.00031308) will not matter in practice.

I considered to just let ´pow(x, 1.0 / 2.4) but I'm not sure how much impact it will have.

Is there any way to optimize it?
Can be vectorization help?
Can some polynomal fitting be better?

sentences:
What is a good path-finding algorithm when a target is moving? I've been looking for a path-finding algorithm for a moving target.
If there are no obstacles in proximity Seek behaviour would be good.
However, A* or some other path-findings are needed when obstacles are on the way to the moving target.

The problem I'm facing now is that calculating a path using A* seems not efficient for a moving target.
so I want to know if there are some good or preferred ways to solve this problem.

The image below shows some basic background of the problem.
The red arrow shows the direction my Seek behavior calculates.
But I want the "Chaser" to take the green direction instead.

Thanks in advance.

sentences:
Bounding Box not rotating based on draw rotation (Java) In the process of developing a 2D game and am having some issues with translating coordinates on rotation. The object being rotated is a sword that is attached to the player. The player currently points towards a Point (mouse pointer). I am having no problems drawing the rotation, but am a bit confused on how to update the local coordinates so that the bounding box will follow also, around the player.

The weapon (coordinates) is just stuck on the left side of the player(invisible), but the drawing of the weapon is rotating around the player. The bounding box is working fine, but who wants invisible collision detection. It basically just isn't following the draw rotation.

Here is my basic draw implementation for rotating this weapon around the player.

WEAPON CLASS:

/**
* Updates child weapon
*/
public void Update(Point mp)
{
    this.boundingBox = new BoundingBox(startX,startY,width,height);
}

/**
 * Draws weapon to player
 */
public void DrawTo(Graphics2D g2d,Player p)
{
   AffineTransform backup = g2d.getTransform();
   AffineTransform trans = new AffineTransform();
   trans.rotate(Math.toRadians(getRotation()), p.getCenterX(), p.getCenterY() );
   g2d.transform( trans );
   g2d.drawImage(this.getImg(), startX, startY,null);
   g2d.setTransform( backup );
}

GAME LOOP:

/**
 * Player collision with weapons
 */
for(int l = 0; l < weaponManager.getDroppedWeapons().size(); l++)
{
    Weapon w  = this.weaponManager.getDroppedWeapons().get(l);

    if(player.Collision(w))
    {
        //If player already has a weapon, update that weapons position, add others to list that are picked up later
        if(player.getWeaponEquipStatus() == true)
        {
            //Sets the picked up weapon to the left side of the player
            player.getCurrentWeapon().setX(player.getX()-player.getCurrentWeapon().getWidth());
            player.getCurrentWeapon().setY(player.getY()+((player.getHeight()-player.getCurrentWeapon().getHeight())/2));
        }
        else if(player.getWeaponEquipStatus() == false)
        {
            player.setCurrentWeapon(w);
            w.isPickedUp = true;
        }
    }
}

I am aware of the AfflineTransform's getTranslateX and Y() methods.  I have tried assigning these returned values to my x and y weapon values in the update method, but that is definitely not the solution.

Main issue: weapon coordinates aren't rotating, but the drawing is successful.

If anyone has any advice on where to start, based on my problem, it would be greatly appreciated.

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: How to keep player rotated toward a sphere when within a certain radius? In my game the player can fly to multiple spheres, I want to make it so that when the player gets within a certain distance of the sphere, (maybe using a bigger is trigger sphere collider around it?) their feet will stay pointing towards the sphere until they leave the radius, (maybe using a quaternion?) then if they get within the radius of a different sphere, their feet will point towards that too. How can I make this work? I don't know too much about c#, so any example code would help a lot too!

sentences:
How can I create a curved path for a ball? I am creating a soccer game. Now I want to shoot the ball and create an after-effect resulting in a curved path. I tried several things, but nothing seems to work.

I am using a 3D tool, but the camera is from the top. I especially want to create a curve of the ball with the effect to the left or right.

What is the best way to create a effect on the ball?

sentences:
How to use HyperLink with Actor in Libgdx I am making a quiz game using LibGDX. I want it to redirect to a website. I am using classes like Text and Label that extends Actor to write text using a bitmap Font. I have no idea on how to provide a link (like anchors in html) in a native app. However, I am not very good at Android but know java well. In android , I saw on stackexchange, we can do so using Intent or string.xml configuration.

Can anyone suggest me a way to do so using Actor in libGDX?

sentences:
Unity: What does the green line gizmo signify? When I place a point light it shows this green gizmo that ends in the terrain.
What's the name of this gizmo?
What does it signify?

sentences:
Non deterministic dice rolls Are there any algorithms out there for non deterministic dice rolls?

For example, I'd like to make a small mini-game: Liars dice. But the biggest issue here is dice rolling. When the cups are turned the result of the dice should be determined by the game rather than physics (if I were using unity for example). How can I ensure that the model behind it provides random results acute to an actual dice role?

sentences:
How to correctly implement player acceleration caused by player input In my game I implement movement in the Player class like so:

// called from Player's update() method, which is called from the gameloop.
void move(){
    velocity.x += acceleration.x;
    velocity.y += acceleration.y;
    position.x += velocity.x;
    position.y += velocity.y;
}

Keyboard input affects the acceleration directly, for example:

// in Player, called from main gameloop.
void update(){
    if(playerInput.rightPressed()) (acceleration.x += 2);
    // .. etc
    move();
}

I think so far this is standard (if not, please say so).

Now my question:

During movement invoked by player input, I want the acceleration to be constant. So when the player presses the right arrow key, the acceleration.x will always be 2 - and not 2, and then 4, and then 6, etc.

I could easily acheive this be having if(playerInput.rightPressed())(acceleration.x = 2), but then other forces acting on the entity will be ignored.

What is the standard way to implement this?

sentences:
How can I make new strategies viable? I am making a 2D platformer where the player has to reach the end of the level as fast as possible. I would like the player to be able to find new ways to reach the end of the level faster.

Making multiple path is not enough, in my opinion, because the shorter one will be easily findable and the others will become useless. I thought that maybe I should add abilities to the player to increase the number of possibilites.

I would like the player to be able to find strategies I have not thought about. For example players who are doing speedruns find new path and strategies to beat a game faster. I would like to help the research of new strategies. I would like to make new strategies possible even if I have not specificaly thought about them.

My question is, how can I make it possible for the player to make up new strategies ?

sentences:
sf::RectangleShape's position is not same as I set it to When I try to print my box.getSfShape()'s position it does not print out the position I set it to have.

( The box.getSfShape()'s position is by default set to 0 )

Wrong output : ( printing the position of the box.getSfShape() )

( prints out : X : 0 Y : 0 ((These are the default assigned positions)) )

box.getSfShape().setPosition(box.getBody()->GetPosition().x / b2Meter, box.getBody()->GetPosition().y / b2Meter);

But when I print out the calculation only :

std::cout << "X : " << box.getSfShape().getPosition().x << " Y : " << box.getSfShape().getPosition().y << std::endl;

It prints out a increasing Y value and a X value on 0 like it should do.

So, I'm guessing the call to set the box.getSfShape() position somehow fails.

If you need something more, please tell me what to add :)

sentences:
How do I get bullets to move in the direction of the mouse's position? Possible Duplicate:
  Shoot a bullet towards cursor - top down 2d

I'm creating a 2D top down shooter, and I want to get the bullets to go in the direction of the mouse. Not sure of the logic that goes into it.

sentences:
Animated lighting in amusement parks What is the best way to handle animated lights on rides in a night time amusement park scene?

Is there a better way that doing lots of emission lights?

At the moment I have been using emission lights, but there could be a lot of them in a park (some are just static lights) and I would also like to animate some of them on some rides.

Best example I could find was from GTA 5:

Video: https://youtu.be/zVj8D0lqgl4?t=146

sentences:
Why does the debug say my assigned field "is never assigned to, and will always have its default value 'null'"? I have an itemData class that stores the data for a couple of items. It looks something like this:

public class ItemData : MonoBehaviour
{
    public List<Item> items;

    [SerializeField] private Sprite itemOneSprite, itemTwoSprite, itemThreeSprite;

    void Awake()
    {
        items = new List<Item>();

        Item itemOne = new Item(0, "Item 1", itemOneSprite);
        items.Add(itemOne);

        Item itemTwo = new Item(1, "Item 2", itemTwoSprite);
        items.Add(itemTwo);

        Item itemThree = new Item(2, "Item 3", itemThreeSprite);
        items.Add(itemThree);
    }
}

I get an error message for itemTwoSprite and itemThreeSprite, stating that they are null and will always be null:

  Field name of field is never assigned to, and will always have its default value 'null'

Oddly, when I check the inspector, those fields are not null. I have manually attached sprites to them. When I debug, I see that they are not null. I get something like "itemTwoSprite(UnityEngine.Sprite)". I can run the game, and things seem to work normally.

The order of the declared Sprite variables seems to be important, as well. For instance, if my line of code looked like Sprite itemTwoSprite, itemOneSprite, itemThreeSprite, then itemOneSprite and itemThreeSprite would bring up error messages. The first one declared seems to be unproblematic.

What could be causing the issue, and how do I fix it? I have isolated the problem into an empty project, and it still persists. The only other script is the item class. To reiterate, the error message does not prevent the game from running, but it pops up in the console from time to time, with the yellow exclamation mark.

sentences:
Weird problem with advect program in fluid simulator I implemented 2d fluid simulator. Solver runs entirely on GPU. All works fine... on my work PC. But on home PC I have some awful glitches, and I can`t understand how to fix them. Empirically I discovered that problem is localized somewhere in advect program. This is very strange cause at work I have integrated video, and at home — NVIDIA GeForce 9800 GT. Here is the GLSL source of advect program (some lines were dropped for clearness):

#version 130

out vec3 value;

uniform sampler2D q;
uniform sampler2D velocity;
uniform float dt;
uniform float inverseSize;

void main()
{
  vec2 p = gl_FragCoord.xy * inverseSize;

  vec2 np = p - dt * texture(velocity, p).xy;

  value = texture(q, np).xyz;
}

And some screenshots.

Work PC:

Home PC:

sentences:
JavaScript canvas remove image I'm writing a platformer and I want to implement own art, now I know how to display it and this isn't my question. It rather is how do I remove it?
I tried drawing a rectangle over it and removing it, but that doesn't seem to work, here's my code:

function clearImage(id) {
    for (var i = 0; i < 6;) {
        if (img_id[i] == id) {
            console.log(img_loc_x[i]);
            console.log(img_loc_y[i]);
            ctx.fillRect(img_loc_x[i], img_loc_y[i], "1000", "1000");
            ctx.clearRect(img_loc_x[i], img_loc_y[i], "1000", "1000");

            img_loc_x[i] = null;
            img_loc_y[i] = null;
            img_id[i] = null
            console.log("Cleared image with id: "+id+" succesfully!");
        } else {
            i++;
        }
    }
}

I'm using some arrays to store the image data such as the location and an id form management, but I didn't implement a method yet to get the dimensions of it, thats why I'm giving it the size parameters.
(Strangely it works if I enter the fillRect and clearRect commands in the console)

sentences:
Make camera move constantly upwards in box2d world Im using libGdx to develop a 2d game, which has the following:

The world moves in an upward direction by having a camera follow the player's y position.
The user only controls player's x movement, the y is a constant speed.

What i want to do now is let the user control the players x and y movement and let the camera move constantly up without following the player.

What is the best way to do this?

This is what i tried:

in Render()

player.body.setTransform(fingerPosition.x, fingerPosition.y, player.body.getAngle());

box2dCamera.position.y = box2dCamera.position.y + cameraSpeed;
box2dCamera.update();
box2dSpriteBatch.setProjectionMatrix(box2dCamera.combined);

This worked but all my collisions stopped working with other box2d bodies. Do i need to update each body in my game with the recalculated camera some-how? How would I do this?

sentences:
Monogame: Texture anti-aliasing result in transparent edges This is a follow-up question on a previous issue I faced with a game I'm trying to make. It's in a 2D isometric perspective and the levels are created from individual tiles. A simple 3x3 map can be seen here:

The tiles are individually added to the sprite batch, and (at least, this is what I think is happening) each one get anti-aliased on their edges, resulting in a small blur which creates the thin edges that you can see in the picture.

To make matters worse, I actually want to provide a bit more complex tiles in my game than what is displayed above. For example, I want to be able to show roads. To do so, I wanted to layer multiple sprites on top of each other, resulting in the picture below:

I think you can see where I'm going here. The same problem that I described with the aliasing is now occuring aroud each texture. So sad.

I know I can use Point sampling to make the textures align pixel perfect, but even though this does work, the (relatively) high resolution textures really do not seem fit for such a setting:

I mean, these edges simply need to be anti-aliased.

So, my question to you all is: Is there a way to stitch my tiles (and tile-pieces) together in a way so that anti-aliasing does not ruin it with those annoying edges, while still being able to produce a nicely anti-aliased result?

I hope there is, and that someone here can show me how :)

Thanks,

Rutger

Edit 1: Changed the title to be more representative to the problem (I hope?)

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:
Building for the Android errors Unity3D EDIT:

After doing some research on my own I found that by deleting the debug.keystore file everything fixed itself.

So currently I'm exporting my game strictly for testing to the Android.

However, when I attempt to build for the Android, I get these errors:

  Using keystore: C:\Users\Tim Williams.android\debug.keystore THIS TOOL IS >DEPRECATED. See --help for more information.

  Debug Certificate expired on 4/14/12 11:18 AM

  UnityEngine.Debug:LogError(Object) PostProcessAndroidPlayer:BuildApk(String, >Boolean) (at C:/BuildAgent/work/b0bcff80449a48aa/Editor/Mono/BuildPipeline/PostProcessAndroidPlayer.cs:1014) PostProcessAndroidPlayer:PostProcess(BuildTarget, String, String, String, String, String, String, BuildOptions) (at C:/BuildAgent/work/b0bcff80449a48aa/Editor/Mono/BuildPipeline/PostProcessAndroidPlayer.cs:444) UnityEditor.HostView:OnGUI()

And

  Error building Player: UnityException: APK Builder Failed! Failed to build APK >package. See the Console for details.

Does anyone have any ideas what these errors are, and how I could fix them? This is my first time building for any mobile device, so I'm a bit confused (Also, I do have the Android SDK.)

Thanks,

Tim.

sentences:
Is it viable to wrap D3D to change its API style? I have an interest in developing games professionally and have started learning DirectX 11 to that end.

I come from a Java background, but with the recent changes introduced with C++11, I've come to like C++ a lot. Coming from Java, I find that the DirectX API reliance on output arguments and a lot of descriptor structs a little disconcerting.

I'm trying to build a framework around the API that returns values instead of using output arguments. The framework also rolls descriptors into the class (e.g. DXGI_SWAP_CHAIN_DESC into a SwapChain class) and internally handles the updating that would be required for any changes. I also plan to use exceptions rather than return codes to handle error conditions.

Is such a framework viable or it just a Java programmer carrying over his coding style into C++?

EDIT: The goals I'm trying to achieve with the framework are that, I want it to rely on returning values, throwing exceptions, handling memory using C++11 and ATL smart pointers. An early iteration of the framework can be found at:
https://github.com/Dolvic/DirectX-Classes

sentences:
Issues with 3dsmax and Unity3d scale I changed the units in Blender so they are identical to Unity 3d. If I make a 1m^3 box in Blender, it will import into unity as exactly the same size as the standard cube.

With 3ds max, I changed the unit setup to metric and made sure it was centimeters in the system unit setup tab. However, when I import an obj file made in Blender and used in Unity, it is absolutely tiny. I have to convert the model to meters on import and then, when exporting, I have to set the model scale to .01 otherwise it is enormous in the unity scene.

I've tried changing the max units to meters and nothing changed.

How do you change the max unit/grid setup so one grid unit is 1m^2 and exactly equivalent to unity's grid?

sentences:
Spritekit water flowing I'm wondering if there is a way in spritekit to implement water flowing through a path?

like this water flow

Right now I'm generating the path using UIBezierPath and PaintCode

Any suggestion?

Thanks.

sentences:
How can I fix the artifacts near the shadow edges in my variance shadow map? I'm trying to implement variance shadow mapping in my engine. I'm using WebGL 2 and now I have only one directional light source.  It's working, but it has a serious issue near the shadow edges and I don't know how to solve it.

The back of the cube isn't entirely in shadow, the edges are in light.

The shadow on the sphere is too small, I think about half of the sphere should be in shadow.

This is how I implemented variance shadow mapping:

Create the shadow map

Vertex shader:

#version 300 es

layout(location = 0) in vec3 i_positiom;

uniform mat4 projectionViewModelMatrix;

void main(){
    gl_Position = projectionViewModelMatrix * vec4(i_positiom, 1.0f);
}

Fragment shader:

#version 300 es

precision highp float;

out vec4 o_color;

void main(){
    float depth = gl_FragCoord.z;
    float depthSquared = depth * depth;
    float dx = dFdx(depth);
    float dy = dFdy(depth);
    depthSquared += 0.25f * (dx * dx + dy * dy);
    o_color = vec4(depth, depthSquared, 0.0, 1.0);
}

The texture's size is 1024x1024, it uses linear filtering, but doesn't use mipmapping or multisampling. The result looks like this:

Blur the shadow map, horizontally, then vertically

Vertex shader:

#version 300 es

layout (location = 0) in vec3 i_position;
layout (location = 1) in vec2 i_textureCoordinates;

out vec2 io_textureCoordinates;

void main(){
    io_textureCoordinates = i_textureCoordinates;
    gl_Position = vec4(i_position, 1.0f);
}

Fragment shader:

#version 300 es

precision highp float;

in vec2 io_textureCoordinates;

uniform sampler2D image;
uniform bool horizontal;

out vec4 o_color;

void main(){
    ivec2 texSize = textureSize(image, 0);
    float blurAmount = 1.0;
    vec2 blurScale = horizontal ? vec2(blurAmount / float(texSize.x), 0.0) : vec2(0.0, blurAmount / float(texSize.y));
    vec4 color = vec4(0);

    color += texture(image, io_textureCoordinates + (vec2(-2.0) * blurScale)) * (1.0 / 16.0);
    color += texture(image, io_textureCoordinates + (vec2(-1.0) * blurScale)) * (4.0 / 16.0);
    color += texture(image, io_textureCoordinates + (vec2(0.0) * blurScale)) * (6.0 / 16.0);
    color += texture(image, io_textureCoordinates + (vec2(1.0) * blurScale)) * (4.0 / 16.0);
    color += texture(image, io_textureCoordinates + (vec2(2.0) * blurScale)) * (1.0 / 16.0);

    o_color = color;
}

Render the scene and calculate the shadows

float calculateShadow(vec3 N, vec3 L){
    /*if(dot(N, -L) < 0.0){
        return 0.0;
    }*/
    vec3 projectionCoordinates = io_fragmentPositionLightSpace.xyz / io_fragmentPositionLightSpace.w;
    projectionCoordinates = projectionCoordinates * 0.5 + 0.5;
    float currentDepth = projectionCoordinates.z;
    vec2 moments = texture(shadowMap, projectionCoordinates.xy).xy;
    if (currentDepth <= moments.x) {
    return 1.0;
    }
  float variance = moments.y - (moments.x * moments.x);
  variance = max(variance, 0.00002);
  float d = currentDepth - moments.x;
  float pMax = variance / (variance + d * d);
    return smoothstep(0.1f, 1.0f, pMax);
}

I tried many things, like changing shadow map resolution, filtering, blur kernel size, blur amount, changing the magic numbers in calculateShadow (which are there to prevent light bleeding), but the best I could do is what you can see (it's commented out) at the beginning of the calculateShadow function. If the angle between the surface's normal vector and the light direction is greater than 90°, then it's in shadow.

It solves the problem, however on the sphere the shadow becomes too sharp:

sentences:
What algorithm can I use for handling two types of HP, one of which may be undefined? In my game, each unit has two types of HP: Hard and Soft. Soft represents the human part of the unit, while hard represents anything mechanical. For example, a regular rifleman would have 100 softHP, and 0 hardHP. Another example would be the Tank which has 100 soft and 1000 hard (subject to balancing).

Now, the problem I'm facing is the fact that it should be enough for one of these types of HPs to be =< 0 for the unit to die - a Tank can't work without its driver, and it needs its gears, nuts, and bolts to function properly.

At first I was thinking of setting the soft and hard values for a unit, but leave, for example infantry, with an undefined value for hard HP, but this becomes an issue when a weapon hurts a unit: A weapon can hurt both hard and soft. A check for undefined value also becomes an issue, as many other things can affect HP as well, thus necessitating this check to be done many places, which to me seems very redundant.
Another thing I was thinking of would be to set the hard HP for infantry abnormally high, to the point where it would "never" reach 0, but this is bound to bite me at a later point, I'm sure.
I could easily overcome this hurdle some other way, but I would love some fresh eyes on this, in case there are any obvious solutions that I'm missing.

Any suggestions? Pseudo-code would be appreciated.

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:
GUI Library for MonoGame Is there any GuiLibrary available, which works with MonoGame? I know there are some GUI Libraries for XNA but I assume most will not work with MonoGame.

Even simple stuff like Buttons and Inputfields would help me...

Thanks.

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 can I make an enemy to step around solid objects and follow the player at a given distance? var target_distance = 40;
var distance_to_object = 0;

target_distance = distance_to_object(objPlayerParent);

if ( target_distance >= follow_distance )
{
    mp_potential_step_object(objPlayerParent.x, objPlayerParent.y, 1, objEnemyParent);
}

With this code, the enemy ships are chasing the player, but are still colliding with each other, they also rather fly around the player than following his trail.

mp_potential_step(objPlayerParent.x, objPlayerParent.y, 1, true)

This did not lead to the desired effect either.

How can I make an enemy to step around all solid objects in my level and follow the player at the given distance?

More context: The whole game plays in space and at the moment there are not many objects, but each type of object has it's own parent ( objPlayerParent, objEnemyParent, objPowerUpParent etc) and they are supposed to avoid all objects marked as solid. I also apologize for the quite noobish question but I am really new to advanced AI programming.

sentences:
How can I stop looking for keyboard input for a length of time? I'm pretty new to programming, and even newer to C# and XNA. I currently call a method that looks for keyboard input in my Update method. This method has if statements for doing what needs to be done when a key has been pressed. The problem is, since it's being called constantly, it's impossible to press a key quickly enough for it to register only once.

One issue this creates is going through a menu. A short tap of a key sends the "cursor" that indicates which menu item is selected wheeling through the menu several times. I'd like to be able to "turn off" keyboard input for perhaps a fourth of a second after any valid key has been pressed.

sentences:
Instancing meshes messing up scene lighting I've been rendering a scene (some objects over a large field of grass) to test shadow mapping which is working fine.

But when I use instancing to "gain" performance, I not only get a decrease in performance (by losing 2-4 ms per frame !), but my lighting also gets messed up.

Comparaison :

Scene without instancing :

Scene with instancing :

The shadows are still rendered fine, but the grass lighting is completely off, alternating between dark and bright grass. The small "scene" above the grass is also very dark (I use the same shader as the one for the grass, for convenience purposes).

Even the debug text in the upper left corner isn't being rendered anymore...

I use the same shader for both scenes, except I use a uniform to let the shader know when I use instancing and when I'm not.

Here is the lighting shader:

//Vertex Shader
#version 330 core
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 texCoords;
layout (location = 2) in vec3 normal;
layout (location = 3) in mat4 a_model;

out vec2 TexCoords;

out VS_OUT
{
    vec3 FragPos;
    vec3 Normal;
    vec2 TexCoords;
    vec4 FragPosLightSpace;
} vs_out;

uniform bool instanciate;

uniform mat4 projection;
uniform mat4 view;
uniform mat4 model;
uniform mat4 lightSpaceMatrix;

uniform float u_time;

void main()
{
    mat4 model1;
    if (instanciate)
        model1 = a_model;
    else
        model1 = model;
    //Grass movement
    float time = u_time + 8.5f * gl_InstanceID;
    vec3 pos = position;
    float fact = 7/position.y;
    float sx = sin(pos.x*32.0+time*4.0)/fact*0.5+0.5;
    float cy = cos(pos.y*32.0+time*4.0)/fact*0.5+0.5;
    vec3 displacement = vec3(sx, cy, sx*cy);
    vec3 normalN = normal.xyz*2.0 - 1.0;

    pos = pos + normalN*displacement*vec3(0.06, 0.06, 0.06)*vec3(8.0, 3.0, 1.0);

    gl_Position = projection * view * model1 * vec4(pos, 1.0f);
    //Used for shadow mapping
    vs_out.FragPos = vec3(model1 * vec4(position, 1.0));
    vs_out.Normal = transpose(inverse(mat3(model1))) * normal;
    vs_out.TexCoords = texCoords;
    vs_out.FragPosLightSpace = lightSpaceMatrix * vec4(vs_out.FragPos, 1.0);
}

The fragment shader didn't change when I implemented instancing, so I don't think it's relevant to put it here.

Also, here is how I render the scene :

    glUniform1i(glGetUniformLocation(programMesh, "instanciate"), GL_TRUE);
    //The buffer is setup before with the matrices
    glEnableVertexAttribArray(3);
    glBindBuffer(GL_ARRAY_BUFFER, modelbuffer); // model matrices buffer
    glVertexAttribPointer(3, 4, GL_FLOAT, GL_FALSE, 4 * vec4Size, (GLvoid*)0);
    glEnableVertexAttribArray(4);
    glVertexAttribPointer(4, 4, GL_FLOAT, GL_FALSE, 4 * vec4Size, (GLvoid*)(vec4Size));
    glEnableVertexAttribArray(5);
    glVertexAttribPointer(5, 4, GL_FLOAT, GL_FALSE, 4 * vec4Size, (GLvoid*)(2 * vec4Size));
    glEnableVertexAttribArray(6);
    glVertexAttribPointer(6, 4, GL_FLOAT, GL_FALSE, 4 * vec4Size, (GLvoid*)(3 * vec4Size));

    glVertexAttribDivisor(3, 1);
    glVertexAttribDivisor(4, 1);
    glVertexAttribDivisor(5, 1);
    glVertexAttribDivisor(6, 1);

    double instanceTime = elapsedTIme;
    glUniform1f(u_time, instanceTime);
    glDrawArraysInstanced(GL_TRIANGLES, 0, vertices.size(), 100);

    glUniform1i(glGetUniformLocation(programMesh, "instanciate"), GL_FALSE);

I don't really know where the problem could be.

I can give more code if needed.

Thanks in advance for any help.

sentences:
How can I make the terrain infinte? I am making a game in Unity 5 in C# and I need to make the terrain infinite. I have tried to make it infinite but it just keeps spawning the terrain too much times and then the game crashes. Does someone know how I can make the terrain infinite? Here is my
code.

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

public class TerrainScript : MonoBehaviour
{
    public Transform PlayerTransform;
    private float SpawnZ = 4139f;
    public GameObject[] prefabs;
    private float RoadLength = 2.2f;
    private int amountRoads = 6;
    private List<GameObject> roadList;

    public void Start()
    {
        roadList = new List<GameObject>();
    }
    public void Update()
    {
        if(PlayerTransform.position.z > (SpawnZ - amountRoads * RoadLength))
        {
            spawnTile(0);
        }
    }

    public void spawnTile(int index)
    {
        GameObject go;
        go = Instantiate(prefabs[index]) as GameObject;
        go.transform.SetParent(transform);
        go.transform.position = Vector3.forward * SpawnZ;
        SpawnZ += RoadLength;
    }
}

sentences:
How to address a function inside an if condition using C# in unity 3D I am new to game development and have very limited idea of C# syntax. I was watching unity 3D tutorials of UI and thought of using ModalPanel.cs and TestModalWindow.cs
In a quiz game where 3 choices are there of a question and total 5 questions are there

Now suppose in

public void TestNYCI ()
{
   modalPanel.Choice(
         " string? ",
         icon,
         TestYesFunction,
         TestNoFunction,
         TestCancelFunction);

   // Here I want to use an if loop
   // if ( condition)
   // where condition means choosing of a function among
   // TestYesFunction, TestNoFunction, TestCancelFunction

   //Statements

   // If suppose TestYesFunction is true I want
   // to increment the count and write it as score
}

And will repeat the process in rest of the 5 functions.

Can someone please provide a suitable syntax to address the problem.

sentences:
Application stops working when I add two fonts I created a game that has two fonts.
Being precise, the two fonts are PRESS_START_2P with the difference only in size. One of the fonts serves to write the title and the other for all other things.
The problem occurs after building the application (apk). As it is a special font I click on the option "copy to project" for it to be exported to the cell phone.
Image of the two fonts:

A detail is that the program does not recognize the original source directory, so I need to copy the source to the desktop to be able to copy it to the project.
Image demonstrating the problem:

Adding any of the fonts (alone), the game works. The problem happens when I add the second font.
Before posting here, I posted on the official engine forum, but I still haven't gotten any response.
LINK:
https://forum.yoyogames.com/index.php?threads/application-does-not-work-when-i-export-2nd-font.83968/

sentences:
Success checks for client-side javascript mini-game embedded within a server-side browser game Disclaimer: I know that client-side is always to be held with suspicion, but I'm trying to conceive of a way to verify the success or failure of javascript-based mini-games.

Mini-games to add fun to client-side game

Here is an example scenario:

I implement a javascript-dependent picture-sliding game for various pictures.
You know the type:

So that would be a javascript game that would be served from my website.

How to check success

I then want to set up a verification scheme to verify that the game has been completed, the browser would ping the website with a verification code or scheme to say "hey, I'm done, and the javascript mini-game is complete".

There are two ways that I can think of to make the verification work.

One is a "replay" scheme, e.g. each
of the moves that the user does
would be concatenated and sent to
the server, which would have a
system for verifying that the end
result was indeed a valid solved
state.
The other is a "summary"
verification code, for example if
each of the numbers is assigned a
random letter client-side, the final sliding puzzle state
would result in a word-code like
asdfaseasewadsfwef when read from left to right, top to bottom, which can be
sent to the server upon completion
to receive a pass/fail grade of
success.  Obviously that isn't
checking the intermediary steps,
just the final result, but it'd
probably be a lot faster and less
resource-intensive, and would probably prevent a bit more abuse than just a GET request with a "go" parameter.

I don't have a huge, high bar for 100% secure communication in this case because I just want to add fun, and give some minor/non-overwhelming benefits from the mini-games, not build a fort-knox system.  And if someone is smart enough to hack up a solution to the mini-games to automate them, I won't be excessively broken up about it.

Techniques?

So with that in mind, are these two approaches valid?  Are there other approaches to try with this?  Any examples in the wild that I could learn from?

sentences:
How to make space invaders destructible scenery and conform it to a shape? We all like the bases that can be destroyed by chunks being split out,

I originally implemented it by making a rectangle filled with individual squares (2x2 pixel size CANVAS rects) that would collision detect with any bullets (On^2 very inefficient). I am now trying to make the base into a shape instead of a boring rectangle. I also want to perform collections of nearby squares when one is hit so that chunks can be taken of the base, instead of just the part that was hit. (easy to do with a rectangular array)

Is a 2 dimensianal arry still the best way to acheive this? Is there a way to create this array by somehow performing image analysis of a PNG to populate this array? Transparent parts would hold no base item at that [i][j].

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:
Propel entities at some angle (depending on explosion's position) I have a 2D platformer. There are multiple particles that are just 1x1 colored pixels. Let's assume there are 256 particles laid out as a 16x16 cube. Say I popped an explosion right in the middle. All of these particles should fly out all over the place.

My question is how would I calculate the angle at which they have to be propelled toward and find what the initial velocity vector right after the blast has to be set to. I already have gravity and friction so that they would be naturally attracted to the ground and slow down after they have traveled a good distance along the X axis.

sentences:
Libgdx: How to leave the dialog visible? setBtn.addListener(new ClickListener() {
    @Override

    public void clicked(InputEvent event, float x, float y) {
        final Dialog dialog = new Dialog("Settings", skin, "dialog") {
            public void result(Object obj) {
                Preferences prefs = Gdx.app.getPreferences("My Preferences");

                if (obj.equals(2))
                    muteMusic = true;
                if (obj.equals(3))
                    muteMusic = false;

                prefs.putBoolean("music", muteMusic);
                prefs.flush();

            }

        };
        dialog.text("Do you want to play music");
        dialog.button("Yes", 2); //sends "true" as the result
        dialog.button("No", 3); //sends "false" as the result
        dialog.button("Ok", false);

        dialog.show(stage);
    }

});

I want the ok button to be on an another row but if I do dialog.row() like with tables, it won't work, I can't add an empty row
I want the dialog to stay visible on the screen until the ok button is touched, only then I want to call dialog.hide()

I can't do

if (obj.equals(false))
dialog.hide(); // IDE will suggest that i create a local variable called dialog

sentences: Diffuse Maps and DirectX How would I load two diffuse maps onto one mesh. I have a mesh with multiple sub meshes but each one of those sub meshes has a vertex buffer and I don't think that's very efficient. How could I have two diffuse maps on one mesh without having to go into 3d modeling software and merge the Uv coordinates of the two objects. I'm using directX and C++.

sentences:
Unity Raycast not detecting layers I am having problems with layers detection using raycasts.

Context: I created a grid to use in a pathfinding algorithm on a 2D plane. I want to implement now different weights according to the layer each node of the grid is in e.g. a node in a normal terrain will have a "terrainPenalty" of 1 and more difficult terrains 2 or more. In order to detect the terrain type on the 2D plane, I am shooting a raycast on the node position for each node previously considered "walkable". The problem comes up now, because I observed that the paths created are neglecting such values, this is the slice of code which is giving me problems:

            if (walkable)
            {
                Ray ray = new Ray(worldPoint + Vector3.back * 10, Vector3.forward);//PROBLEM HERE (NOT DETECTING PENALTIES)
                RaycastHit hit;
                walkableMask = ~walkableMask;
                if (Physics.Raycast(ray, out hit, 100, walkableMask))
                {
                    walkableRegionsDictionary.TryGetValue(hit.collider.gameObject.layer, out terrainPenalty );
                }
            }

At first I thought that the problem was how the layers were called, because I created a LayerMask combining 2 layers using the bitwise OR operator, but then I tried to play around with all the layers (hence why there is walkableMask = ~walkableMask; now). The result was always a false output for Physics.Raycast(ray, out hit, 100, walkableMask).

I thought that maybe I was getting the wrong coordinates for the ray, but I created some gizmos to actually check that the ray was piercing perpendicularly my plane and it did, as well as trying to change layers to see if anything worked, but the output is always false. What am I getting wrong? Here is the rest of the function, if needed I can upload the whole script as well:

    void CreateGrid()
{
    grid = new Node1[gridSizeX, gridSizeY];
    Vector3 worldBottomLeft = transform.position - Vector3.right * gridWorldSize.x / 2 - Vector3.up * gridWorldSize.y / 2;

    for (int x = 0; x < gridSizeX; x++)
    {
        for (int y = 0; y < gridSizeY; y++)
        {
            Vector3 worldPoint = worldBottomLeft + Vector3.right * (x * nodeDiameter + nodeRadius) + Vector3.up * (y * nodeDiameter + nodeRadius);
            bool walkable = !(Physics2D.OverlapCircle(new Vector2(worldPoint.x, worldPoint.y), nodeRadius, unwalkableMask));
            //bool walkable = !(Physics.CheckSphere(worldPoint, nodeRadius));

            int terrainPenalty = 0;

            if (walkable)
            {
                Ray ray = new Ray(worldPoint + Vector3.back * 10, Vector3.forward);//PROBLEM HERE (NOT DETECTING PENALTIES)
                RaycastHit hit;
                walkableMask = ~walkableMask;
                if (Physics.Raycast(ray, out hit, 100, walkableMask))
                {
                    walkableRegionsDictionary.TryGetValue(hit.collider.gameObject.layer, out terrainPenalty );
                }
            }

            grid[x, y] = new Node1(walkable, worldPoint, x, y, terrainPenalty);
        }
    }
}

EDIT : Here is how I create the layerMask:

        foreach (TerrainType region in walkableRegions)
    {
        walkableMask.value |= region.terrainMask.value; // | is the bitwise OR operation, I could have simplified by writing " --- |= ---; "
        walkableRegionsDictionary.Add((int)Mathf.Log(region.terrainMask.value, 2), region.terrainPenalty);
    }

Where TerrainType is the following class:

    [System.Serializable]
public class TerrainType
{
    public LayerMask terrainMask;
    public int terrainPenalty;
}

I basically create an array of TerrainType objects that will store their layerMask and penalty and then upon positive output from the raycast I access the dictionary to retrieve the terrain penalty. For the terrain and obstacles I am using a 2D BoxCollider and 2D PolygonCollider respectively, they do not interact with any other layer.

Thanks for any possible hints, I don't know what else to try :\ .

sentences:
What would it take to program a game engine like the build engine My favorite games of all time are thanks to Ken Silverman's BUILD engine, The engine that brought us DukeNukem 3D, Shadow warrior and Blood. I've read a few articles on the build engine however I haven't found any good ones that go in depth. Ive been programming in C for 3 and a bit years now and am reading through many books every day, so I believe I have minimal skills needed to take on this task.

I was wondering what it would take to make my own "Build engine". What sort of mathematics do I need to learn/know, What books would you recommend, what sort of programming do I need to know (I.E low level programming with bitwise operators or any thing else). My current goal is not to make a game like Duke nukem 3D but to merely make a engine that supports things like sloped walls, translucency, wall and floor sprites etc.

sentences:
How to send data from Unity to Mailchimp I have followed the WWWForm script reference to try to connect Unity with Mailchimp. According with the log, the form is sent without errors. Unfortunately Mailchimp did not stored any data.

This is my code:

public class EmailSendButton : MonoBehaviour {

    public GameObject emailInputText;
    private WWWForm form;

    ///
    /// In the Inspector we tell Unity to call this function when the button is clicked.
    ///
    public void onClick() {
        StartCoroutine(SendToMailChimp());
    }

    // TODO It seems to be working but Mailchimp did not store anything
    private IEnumerator SendToMailChimp() {
        form = new WWWForm();
        string email = emailInputText.GetComponent<UnityEngine.UI.Text>().text;
        form.AddField("mce-EMAIL", email); // I have also tried with: form.AddField("email", email);
        WWW w = new WWW("http://bustogames.us11.list-manage.com/subscribe/post?u=8855252b454d05c2f913c1d2b&amp;id=2ac022b22a", form);
        yield return w;

        if (!string.IsNullOrEmpty(w.error)) { print("Error sending the form: " + w.error); }
        else { print("Form sent without errors"); }
    }
}

This is the cut and paste code provided by Mailchimp:

<link href="//cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">

<form action="//bustogames.us11.list-manage.com/subscribe/post?u=8855252b454d05c2f913c1d2b&amp;id=2ac022b22a" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>

    Subscribe to our mailing list
    <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>

<input type="text" name="b_8855252b454d05c2f913c1d2b_2ac022b22a" tabindex="-1" value="">

<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">

</form>

sentences: How necessary are shader coders? I know that gameplay mechanics programmers, either directly working with source or with scripting are needed, however there are so many shaders written already that I would imagine you could find anything to meet the visual effects you are looking for, is this a fair assumption?

sentences:
Viewport Navigation controls I'm encountering an issue: I cannot move into my view with W, A, D, S. However UP, LEFT, RIGHT, DOWN arrows work. What's wrong?

Here's my viewport navigation configuration:

Viewport navigation key binding

sentences:
How to build a hidden 3D snapping grid effect? Looking to build a 3D grid similar to the image below taken from Google Blocks.

Seems like it consists of these main components:

A set of spheres that can go transparent.
A stencil that follows the controller's location.
When stencil overlaps with spheres, they show up, otherwise, alpha fades to zero.

Any advise on how to approach building this?

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:
3D Object in 2D Unity Project Is there a way to bring 3D objects into a 2D project that is using the 2D Universal pipeline for rendering light? I have some 3D objects I want to bring in to the project I'm working on, but they just get imported as pure white.
Is there a way to import 3D models into a 2D game, and keep the 2D pipeline for lighting? I'l tried a few different shaders, but if they're not pure white they're pink. I would like them to have shading as a 3D object, and still interact with light and rotate on all axis if possible. If it's impossible to use a 3D object, if there was a way to at least have a 2D sprite taken from a 3D object, but still react to light as if it were 3D, that'd work too I suppose. This is what it looks like,
https://i.stack.imgur.com/HJeIN.jpg
I've also tried adding 3D lights as well, but to no avail. I'm guessing the issue is because of my 2D lighting renderer, and for the record, this is what this tree looks like in a 3D project.
https://i.stack.imgur.com/nKCyd.jpg
I have since attached a custom shader graph to it that I made, it looks okay, but it still doesn't receive shading at all...
Thanks in advance.

sentences: How to get a turret to shoot at player in a shmup I'm developing a basic vertical shoot em up on the DS and am trying to get stationary turrets to shoot at the player in a shoot em up. Early on I simply had them shooting in fixed 8 directions N, S, E W, NE, NW, SE, SW, depending on the player's relative position, but I want something more specific. My attempts have been awkward at best, and my aiming algorithm is not very crude and often the turrets miss by a mile. I am looking for a simple algorithm that plots a basic straight line trajectory towards the player's xy position. Nothing fancy like predictive aiming. Does anybody know of an algorithm or an article that covers such an algorithm?

sentences:
How do I raycast to detect which hexagonal tile was clicked? I want to detect the hexagonal tile a unit is on upon clicking on the unit. I was thinking of using a ray cast I can't  get it to work.

I'm trying to get the raycast to shoot from the bottom of the unit and change the material of the collided object.

if (Input.GetMouseButtonDown (0)) {

    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    RaycastHit hit;

    if(Physics.Raycast(ray, out hit)){

        Debug.Log (hit);

        string hitTag = hit.transform.tag;

        if(hitTag == "player"){

            if(Physics.Raycast(user.transform.position,Vector3.down,10)){

                Debug.Log ("I'm on something!");

                hit.collider.renderer.material.color = Color.red;

            }
        }
    }
}

What might be going wrong?

sentences:
How to animate a bezier curve over a given duration I have created a bezier curve by adding the following script to an empty game object in the inspector. This draws to complete curve at once when I run the code. How can I animate it over a given period of time, say 2 or 3 seconds?

public class BCurve : MonoBehaviour {

LineRenderer lineRenderer;
public Vector3 point0, point1, point2;
int numPoints = 50;
Vector3[] positions = new Vector3[50];

// Use this for initialization
void Start () {
    lineRenderer = gameObject.AddComponent<LineRenderer>();
    lineRenderer.material = new Material (Shader.Find ("Sprites/Default"));
    lineRenderer.startColor = lineRenderer.endColor = Color.white;
    lineRenderer.startWidth = lineRenderer.endWidth = 0.1f;
    lineRenderer.positionCount = numPoints;

    DrawQuadraticCurve ();

}

void DrawQuadraticCurve ()  {
    for (int i = 1; i < numPoints + 1; i++) {
        float t = i / (float)numPoints;
        positions [i - 1] = CalculateLinearBeziearPoint (t, point0, point1, point2);

     }
    lineRenderer.SetPositions(positions);
}

 Vector3 CalculateLinearBeziearPoint (float t, Vector3 p0, Vector3 p1,    Vector3 p2)   {

    float u = 1 - t;
    float tt = t * t;
    float uu = u * u;
    Vector3 p = uu * p0 + 2 * u * t * p1 + tt * p2;

    return p;
}

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:
Do matrix manipulations for 3D graphics ever produce singular matrices? A singular matrix is a matrix that cannot be inverted.  The vecmath library, for example, throws a SingularMatrixException if you try to invert a singular matrix.

I think I understand what singular matrices are.  But there are plenty of matrix operations that I don't understand, so I'm not sure what might produce one.  Are singular matrices ever produced accidentally when manipulating 3D graphics transforms, the way gimbal lock can be?  If so, are there any strategies for avoiding singular matrices, and/or what can you do about them if you encounter one?

sentences:
Wander algorithm for a maze I am making a multiplayer coop FPS game. I have created the first monster with it's AI. I have worked out the A* algorithm for the level based on the triangles of the walkable mesh.
So I can already find a path from point A to point B in the level. The question is, how would I implement a random wander algorithm?

The simple wander and evade obstacle steering behavior will not do, I think. I probably need to use the Path finding data.

What kind of algorithm do you suggest?

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:
The game-server model to handle user actions I'm starting to work on a mobile game that will have a server-side part (to handle user's interactions between them) and, of course, the client (game itself) part. It's not meant to be a browser game and the goal is for it to run even when not connected to the internet.

I would want to have the network-requireing functions disabled when the network isn't accessible (so user can't send a message to another user when offline, obviously, or trade with other users) but when the network becomes available, the game should sync with the server.

Now, my main concerns are:

how to handle the syncing part? What would be the best way to handle it? Should I just send full game state from the device to the server? This way if a user plays the game on 2 different devices, one of them can get out of sync, but lets say I can live with that...
how to ensure there's no "cheating"? I mean, having some kind of server API exposed, would there be a possibility that someone makes a request that creates some powerful item on the server for him, right?

What would be best practices to approaching thos

sentences:
Libgdx Animation Timing I'm having a small issue with libgdx animation.

I'm using getKeyFrame() to get the current frame of the animation and I'm updating the state time by adding on deltaTime in my update function for the object. The animation is not looping.

My problem is that the animation seems to play at different speeds depending on the frame rate. On my phone this animation plays particularly slow. My thinking was that the stateTime would cause it to skip a few frames when it's going slow, but this doesn't seem to be happening.

Here is the code;

        sprite = Animation.getKeyFrame(stateTime, false);
        sprite.setRotation(angle);
        sprite.setPosition(position.x, position.y);
        sprite.draw(batch);

Has anyone else experience this issue.

sentences:
Apply a grain effect to all the elements of a level I'm currently experimenting a little bit on level design. Let's say that I've a room composed of walls and a floor tiles. I'd like to apply to all these elements a sort of "grain" effect, similar to concrete.  I wonder which is the better way to go... the only think I can immagine is working with texture directly, so for each element create the texture that already contains the "grain" effect.

I've also tried to apply a generic screen shader but the result is not good because the grain is fixed to the screen, I wanted it to be fixed to walls/floor. Obviously creating all the textures is a long process and I have to keep UV absolutelly proportional for each element.

I'm ok with that solution actually but I wonder if there is anyother way to apply this effect all in once in a simpler and "safer" way, soemthing like a decal that maybe adds also some imperfections.

sentences:
Differential programming for a vehicle I am to a point on my vehicle where, when im going fast and turning, the vehicle acts weird because the inside tires are moving faster than the outside tires. So i need to figure out how to program in a differential but I can't seem to get it working properly so I am here to see if anyone has experience with this.

I have checked online for the physics but that seems to take more info into account than i can supply in my game (like real gravity influence on the vehicle). Currently I use the following logic to determine the differential wheel speeds. I will try to explain as clearly and simply as possible so I apologize if it is confusing or over-simplified, its confusing to me!

Here is what i do:
I divide my current turn degree by the max turn amount to get a percentage, I then take that percentage and apply that to a modifier percentage (just a percent i have made up and been tweaking to reduce the number passed to the differential, not sure what this should really be. Engine speed? Velocity?). Then in my differential, I check to see if the vehicle is turning left or right and reduce the speed on one side by x% and increase the speed on the other side by the same x%

I'm certain that my biggest problem is the number i'm making up to reduce the turn percent but I cant tell what to put there. I know that directly passing the turn % to the differential (say, 40%) would reduce one side by 40 and increase the other by 40 and that is clearly not right.

I have access to the engine speed, transmission, each wheels axle speed, torque, vehicle velocity, etc but I am not sure which of these i should take into consideration when doing this formula.

Maybe I am over complicating it or maybe i am over simplifying it. Any help in understanding this would be great!

sentences:
Correct the rotation of a car gun? This script for drive a car by arrows. I added a gun above it to aim at target. My issue here is the rotating of my gun effected by my drive when I turn left or right. How to stop the rotation of my gun to be effected by car turns ?

using UnityEngine;
using System.Collections;

public class RearWheelDrive : MonoBehaviour {

private WheelCollider[] wheels;

public float maxAngle = 30;
public float maxTorque = 300;
public GameObject wheelShape;

public Transform target;
public Transform gun_car;

// here we find all the WheelColliders down in the hierarchy
public void Start() {

    wheels = GetComponentsInChildren<WheelCollider>();

    for (int i = 0; i < wheels.Length; ++i)
    {
        var wheel = wheels [i];

        // create wheel shapes only when needed
        if (wheelShape != null)
        {
            var ws = GameObject.Instantiate (wheelShape);
            ws.transform.parent = wheel.transform;
        }
    }
}

public void Update()    {

    // Gun rotation
    Vector3 dir = target.position - gun_car.transform.position;
    Quaternion lookr = Quaternion.LookRotation(dir);
    Vector3 rotationy = Quaternion.Lerp(gun_car.localRotation,lookr, Time.deltaTime * 7).eulerAngles;
    gun_car.localRotation = Quaternion.Euler (0f,rotationy.y,0f);

   //    Drive
    float angle = maxAngle * Input.GetAxis("Horizontal");
    float torque = maxTorque * Input.GetAxis("Vertical");

    foreach (WheelCollider wheel in wheels)
    {
        // a simple car where front wheels steer while rear ones drive
        if (wheel.transform.localPosition.z > 0)
            wheel.steerAngle = angle;

        if (wheel.transform.localPosition.z < 0)
            wheel.motorTorque = torque;

        // update visual wheels if any
        if (wheelShape)
        {
            Quaternion q;
            Vector3 p;
            wheel.GetWorldPose (out p, out q);

            // assume that the only child of the wheelcollider is the wheel shape
            Transform shapeTransform = wheel.transform.GetChild (0);
            shapeTransform.position = p;
            shapeTransform.rotation = q;
        }

    }
}

}

sentences:
How can I do fast Triangle/Square vs Triangle collision detection? I have a game world where the objects are in a grid based environment with the following restrictions.

All of the triangles are 45-90-45 triangles that are unit length. They can only rotate 90°. The squares are of unit length and can not rotate (not that it matters)

I have the Square vs Square detection down and it is very very solid and very fast (max vs min on x and y values)

Wondering if there are any tricks I can employ since I have these restrictions on the triangles?

sentences:
Is it acceptable to mix simple physics logic with gameplay logic? In my 2D game I have a PhysicsEngine class. It currently does two things:

Called every frame to apply global forces on all entities (e.g. gravity).
Called by the CollisionDetector to do the physics part of collision response.

Currently, (almost) all physics-related logic goes through this class (including single-line things like entity.applyImpulse(..)).

My question is, from an OO design perspective: is it okay for an entity to do simple physics logic by itself, or should all physics logic (even simple things) go through classes dedicated to it?

For example: in my game, when spotting a collision the CollisionDetector notifies both entities to take care of gameplay related logic, and the PhysicsEngine to take care of physics related logic. Looks like this:

// on collision between entityA and entityB
entityA.handleCollision(entityB); // take care of gameplay
entityB.handleCollision(entityA); // take care of gameplay
physicsEngine.handleCollision(entityA, entityB); // take care of physics

But what if, for example when a Missile hits something I want to apply an impulse on the hit object? (In addition to the physics that always happens on collisions, in PhysicsEngine).

This is easy to do by simply adding about 3 lines of code to the handleCollision() method in Missile:

public void handleCollision(Entity entity) {
    Vector impulse = entity.getPosition().subtract(this.position);
    impulse.scaleBy(5);
    entity.applyImpulse(impulse);
    explode();
}

However, this would be putting physics logic in a 'gameplay' class. Should the Missile delegate to the PhysicsEngine in some way? Or is it okay that it would contain physics logic?

Another example I encountered in my game, is that when an entity 'fires' a Missile, I want to apply an impulse on the entity to push it backwards. Again, this can be done easily by adding 2-3 lines to the fire() method in the Entity subclass, but I'm not sure it's okay design-wise to mix gameplay and physics logic.

So, is it acceptable to have simple physics logic mixed with the gameplay logic? Or should I always separate the two?

How is this done in 'serious' games?

sentences:
drawing meshes so that they respect the position in space (doesn't draw on top of another mesh if behind it) How can i make my meshes be drawn taking in account which one is in from of another? i.e. if i have a mesh that is farder than another it should be drawn behind the second.

Is there a way to do this in xna that is more standardized or do i have to calculate for each mesh myself? If i have to calculate for each mesh by myself, from which point do i calculate the distance to the mesh? the camera position?

Here is how i draw them :

        Matrix[] transforms = new Matrix[gameobject.model.Bones.Count];
        gameobject.model.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in gameobject.model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.Projection = camera.projectionMatrix;
                effect.View = camera.viewMatrix;
                effect.World = transforms[mesh.ParentBone.Index] * gameobject.orientation;
           }
            mesh.Draw();
        }

sentences:
Combining Minecraft and Dwarf Fortress: Simulating autoplay in a pseudo-infinite procedurally generated world? One of the interesting things about Dwarf Fortress (and other procedurally generated games like Civilization) is that the game simulates multiple AI factions interacting with each other over time (what might be termed "autoplay") to generate an evolving world which changes over time, even whilst the player is playing the game.

On the other hand, simulating all the factions simultaneously is surely going to become a bottleneck as the map grows. With a bigger map and more factions, the performance requirements become exorbitant. Minecraft gets around this problem by simply storing the inactive chunk in memory as-is as soon as the player leaves the area. The minecraft world is a static, never-changing place. When a player comes back from a trip, the chunk is exactly as he left it. No world evolution occurs. Everything is always the same.

The most straightforward approach to this, which is to just to make chunks remain loaded in memory even after the player is no longer in them, has the same performance issues as mentioned earlier - as the player moves across thousands of blocks, you will sooner or later run into computation limits. Moreover, this does not solve the general problem of faction simulation - factions can expand or contract through many chunks, whereas keeping one chunk loaded in memory would not affect its neighboring chunks, so that doesn't quite achieve the same effect as autoplay.

The "solution" that I thought of is to come up with a closed form formula that simulates autoplay somehow. That is, a function f(time,coordinates), such that given the time and and coordinates of a block, will tell you what state that block should be in. The problem with this is that this assumes a truly predeterministic world evolution, in which players have control over only their local chunk and no others. In other words, no butterfly effect. Furthermore, when a player leaves a chunk, he has made some changes to it, but the function cannot take those changes into account when computing the state of the block the next time the player enters it, in other words all changes that the player made to the block are lost as soon as he leaves. This is obviously not ideal.

Am I asking for something impossible?

sentences:
Godot: error(10) expected '(' after Identifier When trying to write up a new shader for a material, I've been trying to create a variable to use to alter speed and test animation. Now, the below outputs fine until I try to assign a value to number.

shader_type canvas_item;

uniform float time_factor = 1.0;
uniform vec2 amplitude = vec2(10.0,5.0);
uniform sampler2D frame1;
uniform sampler2D frame2;
uniform sampler2D frame3;
uniform float speed = 1.0;

float number = 1.9;

void vertex(){
    VERTEX.x += sin(TIME * time_factor + VERTEX.x + VERTEX.y) * amplitude.x;
    VERTEX.y += cos(TIME * time_factor + VERTEX.y + VERTEX.x) * amplitude.y;
   }

I had seen tutorials demonstrating that this would have worked fine in previous versions.

sentences: Frustum culling with an octree: one AABB per bone or one AABB per object? I've constructed an octree for use in frustum culling. The question is, should I insert an AABB for each bone of each object, or just the one AABB for the object?

sentences:
Strategies to make it difficult to cheat + easier to identify cheaters in Javascript/HTML5 game I intend to have a Javascript/HTML5 game with a global leaderboard. I have devised a very simple system for submitting highscores as follow:

  When the game finishes, the game client makes a POST request to server hosting the leaderboard that contains the name of the player and their score. Then, the server inserts the submission into its database.

However, this system can easily be cheated by an individual with an html form submitting POST requests with whatever score they want to my server.

I already know that a foolproof anti-cheat system is impossible because of how easy it is to modify Javascript and HTML on the client. I also know that I should never trust the client. However, implementing everything on the server side will be impractical for me since my server will not have the resources necessary to perform all the calculations for all the players.

So instead, I simply wish to make it as hard as possible for the average individual to cheat (and recognizing that it will always be possible to cheat), while making it as easy as possible for me to identify when a score that was submitted might possibly be fake.

What are strategies I can use to accomplish such? Please include examples whenever possible. For example, I have heard someone suggest using "pre-shared keys". However, I am not a cryptography expert and I have no idea how to go about implementing that.

sentences:
Using shader for cubes I am trying to use a shader to get an effect like this. Notice how

every cube has exactly the same lightning as every other no matter where it is on the screen
if you look closely the lightning is making the front face's top parts darker, and the front face's lower  parts lighter (about 20% difference at most)
also more importantly the edges of the cubes are smoothed ( filleted )  and foggy looking

I am drawing my cubes like this with the default lightning.

        cubeEffect.EnableDefaultLighting();
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 25; j++)
            {
                // apply the effect and render the cube
                foreach (EffectPass pass in cubeEffect.CurrentTechnique.Passes)
                {
                    cubeEffect.World = Matrix.CreateTranslation(-15.6f + i * 3.05f, 15.5f - j * 1.168f, 0.0f);
                    pass.Apply();
                    //draw
                    RenderToDevice(GraphicsDevice);
                }
            }
        }

This is how my cubes looks like with the default lightning... i am trying to achieve an effect like the first image. I have no experience with lightning effects and how to do something like this so, i'd appreciate any help on how to get started.

I used this http://blogs.msdn.com/b/dawate/archive/2011/01/20/constructing-drawing-and-texturing-a-cube-with-vertices-in-xna-on-windows-phone-7.aspx tutorial's help to draw this

sentences:
Sprite drag drop andengine How to drag an andEngine sprite anywhere on the phone screen?

I have written this code in onAreaTouched function of IOnAreaTouchListener interface which is implemented in my activity, but its not working:

public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
      ITouchArea pTouchArea, float pTouchAreaLocalX,
      float pTouchAreaLocalY) {
    // TODO Auto-generated method stub

    Log.v(TAG,"Sprite Touched ##########");

    secondSprite = new
    Sprite( CAMERA_WIDTH/2, CAMERA_HEIGHT/2,
            playerTextureRegion, this.getVertexBufferObjectManager()){
        @Override
        public boolean onAreaTouched(final TouchEvent pSceneTouchEvent,
                                     final float pTouchAreaLocalX,
                                     final float pTouchAreaLocalY) {
            secondSprite.setPosition(pSceneTouchEvent.getX(), pSceneTouchEvent.getY());
            System.out.println(String.format("spriteB %fx%f", pSceneTouchEvent.getX(),
                pSceneTouchEvent.getY()));
            return true;
        }
    };
    scene.registerTouchArea(secondSprite);
    return true;
}

sentences:
Why are points adjusted using the projection and inverse view matrix during picking? I am working on my first 3D game, which contains several vehicles placed on a board. I want to implement mouse picking of the vehicles. I found this great tutorial and used its code. But I don't understand part of the math.

Early in the function (listed below), I convert the input mouse coordinates into the -1 to +1 range:

// Create picking ray from camera position and mouse click
void VehiclePicker::SetPickingRay(LONG mouseX, LONG mouseY) {
    float pointX, pointY;

    /* Conversion to -1 to +1 here: */
    // Move the mouse cursor coordinates into the -1 to +1 range.
    pointX = ((2.0f * static_cast<float>(mouseX)) / static_cast<float>(SCREEN_WIDTH)) - 1.0f;
    pointY = (((2.0f * static_cast<float>(mouseY)) / static_cast<float>(SCREEN_HEIGHT)) - 1.0f) * -1.0f;

    ...

Next, I adjust the points using the projection matrix. Listed below:

    XMFLOAT4X4 prMtrx;
    // Convert projectionMatrix from XMMATRIX into XMFLOAT4X4 in order to pick its members
    XMStoreFloat4x4(&prMtrx, _d3d->GetProjectionMatrix());
    pointX = pointX / prMtrx._11;
    pointY = pointY / prMtrx._22;

I don't understand what is exactly done here. I understand that I should somehow transform the points using the inverted projection matrix into world space. But in the tutorial they are using non-inverted projection matrix and using only two elements from it for dividing the points. Why? In tutorial, they say they want "Adjust the points using the projection matrix to account for the aspect ratio of the viewport." Could somebody please explain it?

The same question is for the next part of the code. In tutorial they say "Calculate the direction of the picking ray in view space." Could you please also explain this one?

    // Get the inverse of the view matrix.
    XMFLOAT4X4 invViewMtrx;
    // Convert inverseViewMatrix from XMMATRIX into XMFLOAT4X4 in order to pick its members
    XMStoreFloat4x4(&invViewMtrx, XMMatrixInverse(nullptr, _camera->GetViewMatrix()));
    XMFLOAT3 dir;
    dir.x = (pointX * invViewMtrx._11) + (pointY * invViewMtrx._21) + invViewMtrx._31;
    dir.y = (pointX * invViewMtrx._12) + (pointY * invViewMtrx._22) + invViewMtrx._32;
    dir.z = (pointX * invViewMtrx._13) + (pointY * invViewMtrx._23) + invViewMtrx._33;
    _pickingRayDirection = XMLoadFloat3(&dir);

I understand that the goal is to invert the process of rendering 3D scene into 2D screen. But I don't understand the math used.

Here's the rest of the function, for context:

    // Get the origin of the picking ray which is the position of the camera.
    _pickingRayOrigin = _camera->GetPosition();

    // And finally I must normalize the final vector
    _pickingRayDirection = XMVector3Normalize(_pickingRayDirection);
}

sentences: How can I get Unity to do letterbox/pillarbox to maintain aspect ratio? I'd like my game to have the same aspect ratio at all cost, including keeping all UI elements fixed in the same place. I'm totally ok with losing screen space in the interest of fixing the aspect ratio.

sentences:
Best way to connect multiplayer users with each other (matchmaking) on a low powered server? OK so I am using unity to make a multiplayer game, but I'm not sure how to connect players with each other over the internet.

Unlike other questions, this isn't a general problem of working out how to do UPnp or using unity's matchmaking server. My issue is that my server that I would use is a simple low powered pc (running normal windows 10, no idea how to use windows server).

I think it is powerful enough to match players with each other, but not to host more than one or two actual games.

The other issue is that I have a residential internet connection with a dynamic ip that changes every few months. However the speed should be ok (150Mb/s download, 20Mb/s download).

Also, I'm not planning to spend money on a monthly basis for a server (like unity's matchmaking service) as I plan to spend as little as possible (So far I've paid £12 to Microsoft for a dev account and I've received a £200 voucher from them so my current spending is -£189!)

So my question is should I use my server (would it work), are there any online services that are very cheap to use, or is there another way to make this work?

Only other thing is I could use the free 20 users at once on unity's matchmaking, but would this limit be too small?

EDIT:
just for information, my game is a simple tank shooter. I was thinking about limiting the amount of tanks in a game somewhere around 8-20. The bullets in my game are physical objects with rigidbodys and they move at a slower speed (if you've ever played tank trouble, it looks like that). The world is in 3D. There is a potential for there to be up to a hundred bullets in a scene at once at the worst.
After hosting a LAN world with 7 players connected for about 20-30 minutes, windows reports the data usage being around 3-4MB.

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: 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:
How can I compute the orbit of one body around another? I'm attempting to have a planet (with a known mass and radius) orbit it's sun (also with a known mass and radius). It doesn't have to be 100% realistic, but it should be possible that the sun have more than one planet orbit it at a time.

What equations should I use to accomplish this?

sentences: How to use nodes in scene graph for game logic I am working on a 3D 2048-game using Java with LWJGL to gain some 3D math and OpenGL experience. I built a small scene-graph (GroupNode and Box). My problem is that the tree structure of my scene-graph is not very convenient for the game-logic. For the game-logic I would use a 2D-array to store the tile-values, merge tiles and calculate points and so on. I think it would be a good approach to separate the view (SceneNodes) from the game-logic-type (Tile). What is best practice to link them, update views, and how to care about animations? If I merge two tiles and present this by move the source tile into the target tile, I need to know when the animation finished to do the next merge-move.

sentences:
Is Free2Play w/ cash shop "non-commercial"? I'm new to game development and considered using the Unreal Development Kid for a test game. The website states it is free for non-commercial use. I know that games that can be obtained free of charge are considered non-commercial.

However, my mind came up with the question: What are free-to-play games with cash-shops categorized as? Not saying I'm planning to embed one in my test game, that would be just non-sense.

A quick Google search couldn't come up with any answer, especially since I'm unsure of what to search.

sentences:
Cocos2d not getting the texture which is added to CCTextureCache using thread I convert the image into texture in a thread using the following line of code to reduce the image to texture converting time.

[[CCTextureCache sharedTextureCache] addImage:@"imageName"];

But when i retrieve this image from cache i am getting a blank image. If i am calling the above line of code in main thread i am getting the image.

sentences: Smoothing found path on grid I implemented several approaches such as A* and Potential fields for my tower defense game. But I want smooth paths, first I tried to find path on very small grid ( 5x5 pixels per tile) but it is extremly slow. I found nice video showing an RTS demo where paths are found on big grid but units dont move from each cell's center to center. How do I implement such behavior? Some examples would be great.

sentences:
Programmatically determine UVs by rotating a plane along X axis I'm having a math brainfart while trying to solve what might be a simple problem.  I've got a plane in 3d space (it's actually the face of a 10-sided die):

Coordinates [x,y,z]:
Point_top  = [0,0,1]
Point_left = [Sin (2pie9/10), Cos(2pie9/10), 0.1] = [-.5878,.809,.1]
Point_right= [Sin (2pie/10) , Cos(2pie/10), 0.1]  = [ .5878,.809,.1]
Point_bot  = [-1,0,-0.1]

If you project that out, it's a plane with the top leaning back away from you, and the bottom closer to you.

I'm trying to automatically build a UV map of that face to put a texture on, so think I should rotate it around the x-asix so that it's only in 2D, then scale that to best fill up a 256x256 texture.  I'm doing this in Three.JS for a canvas app.

Is this the right approach?  In this example:
http://wecreategames.com/games/DiceBoard ( die creation code is in: http://wecreategames.com/games/DiceBoard/die10.js ), I'm estimating the UVs by:

//Build UVs
scope.faceUvs = [[]];
scope.faceVertexUvs = [[]];
for (var f = 0; f < numHalfFaces; f++) {
    var faceuv = [
        new THREE.UV(.2, .6),
        new THREE.UV(.5, .75),
        new THREE.UV(.8, .6),
        new THREE.UV(.5, .2)
    ];
    scope.faceUvs[0].push(new THREE.UV(0, 1));
    scope.faceVertexUvs[0].push(faceuv);
}

But when I view on an iPhone or Android, it shows weird screen artifacts... I'm thinking because the UVs aren't exact.

I think I'd apply some function like this (where andDist is an angle):

rx = x;
ry = (y * Math.cos(angDist)) - (z *Math.sin(angDist));
rz = (y * Math.sin(angDist)) + (z *Math.cos(angDist));

But, I'm not sure how to get the angle that the face is inclined at. Any suggestions?  Or, are those white screen artifacts due to something else I've overlooked?

sentences:
Is speed runs ranking mechanism heuristic or statistics based? I'm looking to implement some sort of speed run mode in my game.

Let's say I want to assign each level three 'winning' bars, (bronze, silver and gold for example), which are independent of the player, and are based only on the difficulty of the level itself.

I can think of two methods:

Having a heuristic which outputs these three bars, given the level's settings.
Spending some time for testing the game over several players, and collecting statistics (mainly time to completion), in order to determine the bars.

Are both methods considered acceptable? Or is one of them is somewhat "banned"?

I would also like to consider a more limited situation, where there's not a real option to perform a wide-scale statistics collection. Would that completely throw the second method off the windows? Or is small-scaled (for example, having 5-10 players playing a level for a few times) is usually enough in common indie game developer scales?

I guess the answer here should depend on the nature of the game itself, but I wonder if this certain type of test ('winning bars' for speed runs) is considered easy to handle.

sentences:
How to export 3D models that consist of several parts (eg. turret on a tank)? What are the standard alternatives for the mechanics of attaching turrets and such to 3D models for use in-game?  I don't mean the logic, but rather the graphics aspects.

My naive approach is to extend the MD2-like format that I'm using (blender-exported using a script) to include a new set of properties for a mesh that:

is anchored in another 'parent' mesh.  The anchor is a point and normal in the parent mesh and a point and normal in the child mesh; these will always be colinear, giving the child rotation but not translation relative to the parent point.
has a normal that is aligned with a 'target'.  Classically this target is the enemy that is being engaged, but it might be some other vector e.g. 'the wind' (for sails and flags (and smoke, which is a particle system but the same principle applies)) or 'upwards' (e.g. so bodies of riders bend properly when riding a horse up an incline etc).
that the anchor and target alignments have maximum and minimum and a speed coeff.
there is game logic for multiple turrets and on a model and deciding which engages which enemy.  'primary' and 'secondary' or 'target0' ... 'targetN' or some such annotation will be there.

So to illustrate, a classic tank would be made from three meshes; a main body mesh, a turret mesh that is anchored to the top of the main body so it can spin only horizontally and a barrel mesh that is anchored to the front of the turret and can only move vertically within some bounds.

And there might be a forth flag mesh on top of the turret that is aligned with 'wind' where wind is a function the engine solves that merges environment's wind angle with angle the vehicle is travelling in an velocity, or something fancy.

This gives each mesh one degree of freedom relative to its parent.  Things with multiple degrees of freedom can be modelled by zero-vertex connecting meshes perhaps?  This is where I think the approach I outlined begins to feel inelegant, yet perhaps its still a workable system?  This is why I want to know how it is done in professional games ;)

Are there better approaches?  Are there formats that already include this information?  Is this routine?

sentences: What do I need to consider before making any class singleton? I am sure most of my classes like for rendering text, sprite, shapes are not going to need more than one instance. Is it adequate to consider only this fact that its only going to need one instance? Should i also consider other things?

sentences:
Box2D how to implement a camera? By now i have this Camera class.

package GameObjects;

import main.Main;

import org.jbox2d.common.Vec2;
public class Camera {

public int x;
public int y;
public int sx;
public int sy;

public static final float PIXEL_TO_METER = 50f;

private float yFlip = -1.0f;

public Camera()
{
    x = 0;
    y = 0;
    sx = x + Main.APPWIDTH;
    sy = y + Main.APPHEIGHT;
}

public Camera(int x, int y)
{
    this.x = x;
    this.y = y;
    sx = x + Main.APPWIDTH;
    sy = y + Main.APPHEIGHT;
}

public void update()
{
    sx = x + Main.APPWIDTH;
    sy = y + Main.APPHEIGHT;
}

public void moveCam(int mx, int my)
{

    if(mx >= 0 && mx <= 80)
    {
        this.x -= 2;
    } else if(mx <= Main.APPWIDTH && mx >= Main.APPWIDTH - 80)
    {
        this.x += 2;
    }

    if(my >= 0 && my <= 80)
    {
        this.y += 2;
    }
    else if(my <= Main.APPHEIGHT && my >= Main.APPHEIGHT - 80)
    {
        this.y -= 2;
    }
    this.update();
}

public float meterToPixel(float meter)
{
    return meter * PIXEL_TO_METER;
}

public float pixelToMeter(float pixel)
{
    return pixel / PIXEL_TO_METER;
}

public Vec2 screenToWorld(Vec2 screenV) {
    return new Vec2(screenV.x + this.x, yFlip
            * screenV.y + this.y);
}

public Vec2 worldToScreen(Vec2 worldV) {
    return new Vec2(worldV.x - this.x, yFlip
            * worldV.y - this.y);
}

}

I need to know how to modify the screenToWorld and worldToScreen functions to include the PIXEL_TO_METER scaling.

sentences:
Inverse Kinematics using Pseudoinverse Jacobian I'm having problems solving IK with Jacobian Pseudoinverse method.

What I do is:

At each local joint frame q_i of the chain q calculate the cross product between rotation axis (taken from local transform) and joint-to-end-effector vector (end-effector is transformed to q_i coordinates):

// for each joint q_i -> to parent iteration

// Get Local Joint Position and Rotation Axis
lTransform = ... // local transform of i-th joint
if (lTransform.Decompose(s, q, t)) {
    q.AxisAngle(lRotationAxis, angle); // quaternion, XMQuaternionToAxisAngle
}

// Transform End-Effector To Local Joint Coordinates
lEndPosition = Vector3::Transform(lEndPosition, lTransform); // each iteration is updated to-parent
lJointToEnd = lEndPosition - lTransform.Translation();
lResultAxis = lRotationAxis.Cross(lJointToEnd);

jacobian(0, i) = lResultAxis.x;
jacobian(1, i) = lResultAxis.y;
jacobian(2, i) = lResultAxis.z;
jacobian(3, i) = lRotationAxis.x;
jacobian(4, i) = lRotationAxis.y;
jacobian(5, i) = lRotationAxis.z;

Set up desired change in position dX = globalObjective - globalEndPosition (fill the rest with zeros [orientations]).
Calculate configuration dQ with jacobian pseudoinverse:

jT = jacobian.transpose();
inv = (jacobian * jT).inverse();
jpinv = jT * inv;

dQ = jpinv * dX;

So what exactly is dQ? Each value should represents a local change in i-th joint.

Is it the angle of rotation around rotation axis in local joint frame?
Or maybe translation value along cross product?

I tried applying both variations above updating local joint transform with simple matrix multiplication and none of this works. The end-effector position seems to be moving very randomly - at each iteration it's very different.

sentences:
2d, Top-down map with different levels So, I'm creating a 2d, top down, sprite based (tiled) game, and right now I'm working on maps (well, a map editor at the moment, but it will be creating my maps, so basically the same thing).
The scenario
So, I'm thinking about efficiency and creating a map in pieces. In each piece, I plan on having 'layers'. Basically, I plan on rendering it down to a 'below hero' level, and an 'above hero' level, with the hero rendered in between obviously. There will likely also be a 'on level with hero' layer, but I'm not quite there yet. Not even worrying about events or interaction yet. Just looking to get a hero on the screen.
Now for movement, I obviously need to know what tiles can be moved and in what direction. My plan at the moment is each tile getting 8 bits (4 'can enter in direction' bits, 4 'can leave in direction'). This will allow me to limit movement and even allow one way directional movement.
The dilemma
This works great for a lot of scenarios. It will allow me to store a map in essentially 3 layers, a string, and gives me flexibility going forward. However, I can't create maps that themselves have layers. A good example is a bridge where the user can go under or over the bridge without invalid moves being allowed. I can't create a platform and allow movement underneath. These are things I would like to be able to include in my game.
My idea
In theory, I could allow multiple hero layers and then allow multiple sets of 'below' and 'above' layers (or sandwich layers). But this complicates my system, and makes movement between maps potentially tricky (If the hero is on the third layer at the edge of a map, but that corresponds to the second layer on the other map, how can I allow or disallow movement).
My question
Is there a better way to manage multiple maps with multiple levels like this where a users level may be 'connected' on different levels on different maps?
Or even...
Am I doing this the hard way? Is there a more standard way to handle top-down 2d tiled maps that I am just not aware of?
Things to note or that might be helpful

This will be done in Javascript (transferred around in JSON)
State will need to be transferred quickly, so a map-id and x/y/direction should be enough to get me a boolean 'can move' value
Maps will not be standard sized (though they will be in a certain number of tiles)
Making an editor tool so that I can have others help, so something that I can create in a tool would be helpful
'Teleportation' locations will likely need to exist to get into building maps and to and from different map sets (which will not necessarily be connected), but have not been created yet (lumping in with events at the moment).

sentences:
Change the tilemap shown on stage in Flixel I am building a simple platformer using Flixel, beginning with the source code from Flixel creator's EZPlatformer . I would like to adjust the level's tilemap when the player sprite enters/overlaps with a sprite representing a door. I use Flixel's built in function to track if the player overlaps the door sprite.

exits is a class level variable: public var exits:FlxGroup;

I call this function in the Update event to check for overlap:
FlxG.overlap(exits,player,UpdateScreen);

I successfully catch when they overlap, however when I try and load the new tilemap, the old one continues to show. I use this function to attempt to update the tilemap on the screen:

public function ChangeScreen():void
        {
            //load the screen and locations of sprites(e.g. player, exits) based on current screen
            switch(currentScreen)
            {
                case 1:
                    //load tilemap
                    level = new FlxTilemap();
                    level.loadMap(FlxTilemap.arrayToCSV(data1,40),FlxTilemap.ImgAuto,0,0,FlxTilemap.AUTO);
                    add(level);
                    break;
                case 2:
                    //load new tilemap
                    level = new FlxTilemap();
                    level.loadMap(FlxTilemap.arrayToCSV(data2,40),FlxTilemap.ImgAuto,0,0,FlxTilemap.AUTO);
                    add(level);
                    break;
            }
        }

I thought that I would need to first call remove on level to take it off the stage, and then call add on it, however, when I do that, the tilemap does not show up at all. What is the correct way to do this?

sentences:
Unity 3D Vive Focus conversion difficulties I Keep getting this error message below when I try to build and run the game. I have downloaded sdk package:        sdk-tools-windows-4333796.zip Android studio. I am new to this kinda technology any help will be appreciated. The VR device is Vive Focus.

error Message below:
Extracting from
com.htc.vr.samples.hellovr.unity manifest:

miniWaveSDKVersion is Null!
NumDoFHmd is Null!
NumDoFController is Null!
NumController is Null!

Please ensure that these metadata in your
manifest matches the capabilities of your title.
This metadata will affect how viveport store distributes and displays your title

sentences:
Camera and enemy behaviour in AS3 platformer beginner in AS3 here. I am working on a platformer game based on the code of a provided example exercise. I have the following problem:

I have an enemy who shoots bullets. The enemy is the parent, and the bullet are the child. When I move to the next scene (level), the bullets are still there, but invisible, even using the removeEventListener to shut down the bullet hit check.

Here is the code of the child "disparoEnemigo_mov":

addEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
function fl_MoveEnemyShot(event: Event) {
try {
    if (enemy_shot.y < 300) {
        if (enemy_shot.hitTestObject(Object(this.parent).mario)) {

            variablesGlobales.variables().vidas -= 1;
            Object(root).texto.text =
variablesGlobales.variables().vidas.toString();
            trace("vidas: " + variablesGlobales.variables().vidas);
            if (variablesGlobales.variables().vidas < 1) {
                MovieClip(this.parent).gotoAndStop(2);
            }
            this.parent.removeChild(this);
            removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
        } else {
            enemy_shot.y += 3;
        }
    } else {
        trace("LLEGADA");
        removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
        this.parent.removeChild(this);
    }
} catch (error: Error) {
    removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
}
}

import flash.events.Event;
import flash.media.SoundMixer;

addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler);

function fl_EnterFrameHandler(event: Event): void {
try{
if (this.hitTestObject(Object(this.parent).mario)) {

    SoundMixer.stopAll();
    var sound:gameOver = new gameOver();
    sound.play();
    Object(this.parent).mario.y=1000;
    Object(this.parent).mario.x-=15;
    trace("Mario dies");
    var cartel:StageLose = new StageLose();
    stage.addChild(cartel);
    cartel.x = -85;
    Object(this.parent).mario.y = 1000;
    }
}catch(error: Error){
removeEventListener (Event.ENTER_FRAME, fl_EnterFrameHandler);
}
}

And this is the code of the parent, "enemigo_mov":

var leftPressed: Boolean = true;
var rightPressed: Boolean = false;
stage.addEventListener(Event.ENTER_FRAME, fl_MoveEnemy);
function fl_MoveEnemy(event: Event) {
try{
if (leftPressed) {
    enemy1.x -= 0;
    if (enemy1.x < -120) {
        leftPressed = false;
        rightPressed = true;
    }
} else if (rightPressed) {
    enemy1.x += 1;
    if (enemy1.x > 120) {
        rightPressed = false;
        leftPressed = true;
    }
}
var number: Number = Math.random();
if (number < 0.05){// &&
variablesGlobales.variables().coleccionEnemigos.indexOf(this) != -1) {
    trace("creation");
    var disparo: disparoEnemigo_mov = new disparoEnemigo_mov();
    this.parent.addChild(disparo);
    disparo.x=enemy1.x +115;
    disparo.y=enemy1.y +115;

    //disparo.z=50;
    trace(disparo.x + " " + disparo.y);
    }

}catch(error:Error){
removeEventListener(Event.ENTER_FRAME, fl_MoveEnemy);
}
}

In both codes, "mario" is the player character.

What I need to do is to stop the bullet creation of ""disparoEnemigo_mov" when we move to the next scene. Shouldn't the "removeEventListener(Event.ENTER_FRAME, fl_MoveEnemy)" line stop the bullets to check if there is any collision with the player?

Any help or resource will be helpful. Thank you so much!

sentences:
How to find the nearest object from another, in a non tile based game where obstacles are present? The nearest object means the path from the initial position to this object is shorter than the path from initial position to any other object. The path is the smallest number of pixels this object must move to reach the target object while making sure that it does not collide with any obstacle.

Like in this example below, consider that object A has to determine which object is closer, object B or object C. The pink rectangle is an obstacle. Now if we consider the euclidean distance, object B will be closer but due to the presence of an obstacle euclidean distance will give false answers.

Another solution would be to find the distance using some pathfinding algorithm (like A*), which will give the correct solution, but will be slower than simply calculating euclidean distance.

The ideal solution should give the answer as an object the path to which is no more than 10% larger than to the nearest object. And it should take no more than 10 millisecond on a modestly powered computer to find the nearest object for 1000 different objects on a map that has upto 1000 obstacles of different sizes and the map is no larger than 1000*1000 pixels (like in the image above the nearest object for A is C, for B it is A and for C it is A). Also it should not take more than 50 MB of RAM (excluding the size of RAM used to store the coordinates of objects and obstacles and their sizes).

And the map is dynamic. The solution need not return the path between the objects, it need to only find the nearest object.

What will be the ideal solution of this problem?

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:
What is a simple deformer in which vertices deform linearly with control points? In my project I want to deform a complex mesh, using a simpler 'proxy' mesh.

In effect, each vertex of the proxy/collision mesh will be a control point/bone, which should deform the vertices of the main mesh attached to it depending on weight, but where the weight is not dependant on the absolute distance from the control point but rather distance relative to the other affecting control points.

The point of this is to preserve complex three dimensional features of the main mesh while using physics implementations which expect something far simpler, low resolution, single surface, etc.
Therefore, the vertices must deform linearly with their respective weighted control points (i.e. no falloff fields or all the mesh features will end up collapsed) - as if each vertex was linked to a point on the plane created by the attached control points and deformed with it.

I have tried implementing the weight computation algorithm in this paper (page 4) but it is not working as expected and I am wondering if it is really the best way to do what I want.

What is the simplest way to 'skin'* an arbitrary mesh, to another arbitrary mesh?

*By skin I mean I need an algorithm to determine the best control points for a vertex, and their weights.

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:
Determining my playable area/field of view Contrary to what I found searching for the answer, I'm not trying to see whether a character is in view of another character. What I need to find out is the size of the field of view. This is because I'm using Mercury Particle Engine in a 3D space, and while MPE emitters take parameters ranging from (0,0) being the upper left corner of the screen to (graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight) being the lower right corner of the screen, the positioning of enemy ships use Vector3 values, where (0,0,0) would be the exact center of the screen. Since my ships don't move along the Z axis, this isn't a problem. What is a problem, however, is translating their coordinates in 3D space to the correct particle emitter positions when I need to show them exploding. This is what I'm currently using to create the perspective field of view:

projectionMatrix = Matrix.CreatePerspectiveFieldOfView(
  MathHelper.ToRadians(45.0f),
  GraphicsDevice.DisplayMode.AspectRatio,
  1250.0f,
  1450.0f);

And this is how I'm attempting to obtain the X and Y values for the particle emitter from the enemy ship position (however, the positions are not quite right with my math because I have the wrong constants):

x = ((float)graphics.PreferredBackBufferWidth/2) + (((float)graphics.PreferredBackBufferWidth/1700) * enemy[i].position.X);

y = ((float)graphics.PreferredBackBufferHeight / 2) + (((float)graphics.PreferredBackBufferHeight / 1100) * enemy[i].position.Y);

That being said, how do I calculate the proper constants from the information on hand?

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:
Adjust Aim Angle for Motion with Accelerating Bullet So, here's my problem:

I have a turret attached to a ship that moves at a variable speed through my game world, shooting at the centre of another ship travelling through the game world in a possibly different vector. Currently, I get the angle that I need to shoot at using atan2:

double targetAngle = Math.Atan2(ship.CurrentTarget.Position.Y - ship.Position.Y, ship.CurrentTarget.Position.X - ship.Position.X);

This works fine when both ships are stationary, or moving very slowly, but if moving faster, the aim lags behind. An additional fun part of the puzzle: the bullet's vector isn't static, they start at 0 and increase in speed. Their position is calculated as follows:

var direction = new Vector2((float)Math.Cos(currentRotation),
                (float)Math.Sin(currentRotation));

            if (direction.Length() > 0)
                direction.Normalize();

            var velocity = new Vector2(direction.X * MotionData.CurrentSpeed,
                direction.Y * MotionData.CurrentSpeed) + additiveVector;

Where additiveVector is my ship's vector at the point the projectile was launched. CurrentSpeed will be added to every frame until it hits a static maxspeed.

So far, the problems I've encountered with other solutions for compensating my aim is that the formulas rely on a static velocity for the projectile, and mine isn't.

sentences:
setting a time delay between two frame when animation a sprite sheet this is my jsfiddle :http://jsfiddle.net/Z7a5h/

As you can see the animation of the sprite sheet when the player is not moving is too fast so i was trying to make it slow by declaring two variable lastRenderTime: 0,RenderRate: 50000

but my code is not working and it seem i have a misunderstanding of the algorithm i am using so can anyone lay me a hand to how can i fix it ?

 if (!this.IsWaiting) {
                    this.IsWaiting = true;
                    this.Pos = 1 + (this.Pos + 1) % 3;

                }
                else {
                    var now = Date.now();
                    if (now - this.lastRenderTime < this.RenderRate) this.IsWaiting = false;
                    this.lastRenderTime = now;

                }

sentences:
Having issues with pong physics, is my approach wrong? I've been working on a pong clone, i've made games in the past but they have all been very hacky. This time I was trying to go for a better approach in terms of using OOP or patterns. So far the games not posed many issues, I am however having problems thinking about the collision system and ball physics. In my main loop the collision code is as follows:

if (ball->Y < 0)
{
    ball->direction = -ball->direction;

    if (ball->ballSpeed < 700)
    {
        ball->ballSpeed += 25;
    }
}

if ((ball->X + ball->width > player2->X)
    && (ball->X + ball->velocityX) + (ball->width) < player2->X + player2->width
    && (ball->Y + ball->velocityY) + (ball->height) > player2->Y
    && (ball->Y + ball->velocityY) + (ball->height) < player2->Y + player2->height)
{
    ball->direction -= 70;

    if (ball->ballSpeed < 700)
    {
        ball->ballSpeed += 25;
    }
}

if ((ball->X + ball->width) > player1->X
    && (ball->X + ball->velocityX) + (ball->width) < player1->X + player1->width
    && (ball->Y + ball->velocityY) + (ball->height) > player1->Y
    && (ball->Y + ball->velocityY) + (ball->height) < player1->Y + player1->height)
{
    ball->direction += 70;
    if (ball->ballSpeed < 700)
    {
        ball->ballSpeed += 25;
    }
}

The program checks the points of the objects rect's to see if they have passed any of the paddles and then applies changes to the balls public variables. Here is the ball update code:

if(move)
{
velocityX = int(cos((direction + 0.0) * M_PI / 180.0) * (ballSpeed *deltaTime));
velocityY = int(sin((direction + 0.0) * M_PI / 180.0) * (ballSpeed *deltaTime));

    rect.x += velocityX;
    rect.y += velocityY;
}

X = rect.x;
Y = rect.y;
width = rect.w;
height = rect.h;

This PARTIALLY works however the ball goes in weird directions sometimes, on top of that the ball can actually go through the bottom portion of the paddle (it seems that from the bottom of the paddle, there is a gap the ball can exactly fit through). Really the physics of the ball just seem weird and not fluid at all. I'm not brilliant at maths so I don't really know of any other way to go about this. Help would be greatly appreciated.

sentences:
Physics in a 2D oblique perspective game So, just to clarify, because I'm still fuzzy on the terms for perspectives in older games myself, examples of an oblique perspective can be seen in many older RPGs (Earthbound, Final Fantasy, Secret Of Mana, etc.).

I've seen many games created in this perspective that utilize a more action-oriented style of gameplay in which one can see various physical interactions at work, such as projectiles, jumping, friction, and more. (Alundra is one that always stands out in my mind)

My question is: How are the physics often being done from a design/engine perspective in these games? Are there common practices for this sort of game design?

sentences:
How to create random seeds, randomly in gamemaker studio? So, I'm working on a match-3 game similar to Ironcast (in concept, it's just seeing if I can). I've finally got the board to generate properly, and to place down random gems. Problem is, it's always generating the same placement, as though it were seeded (which it isn't, as far as I know).

Here's the code that directly generates the randomness (scr_generate_gem).

var insert = irandom_range(1, 4);//randomizing the gem inserted
var gem_insert;

        switch (insert)
        {
        case 1: gem_insert = obj_Food;
        break;
        case 2: gem_insert = obj_Fuel;
        break;
        case 3: gem_insert = obj_Parts;
        break;
        case 4: gem_insert = obj_Meds;
        break;
        default: gem_insert = obj_Parent;
        break;
        }

return gem_insert;

And here is where it's used.

//hardcoded height and width of the board. could change later
Large_Width = 6;
Large_Height = 6;

var i = Large_Width-1; //5, at the moment
var jreset = Large_Height-1; //5. Used to keep a reference to when j
//needs to be reset to maximum, so the board fills out.
var j = jreset;

repeat(Large_Width) //repeat 6 times; i goes from 5 to 0 through repeats
   {
    repeat(Large_Height) //repeat 6 times; j goes from 5 to 0 through repeats
    //ends up repeating this repeat 6 times, because of the above Repeat, making 36 in total
        {
        //initialize the board by generating the objects
        BoardGems[i, j]  = instance_create((i-1)*36, (j-1)*36, scr_generate_gem()); //creates an object, and places it here
        j -= 1;//decrement j so we aren't overwriting the last object created.
        }
    j = jreset;//resets j
    i -= 1;//decrements i to make a new column
   }

sentences:
Legally possible to re-create/remake an old game? Recently I started remaking an old game on Unity. Basically I want to remake an old RPG that was released for Playstation 1. I'm not ripping anything from the old game, all the assets are being created by me. I'm creating everything from the scratch, music, 3D models, gameplay however I will keep the (copyrighted ?) names, I will try to create the characters and maps/levels as they were in the original version of Playstation 1 but with better graphics.

I'm not planning on selling it or adding in on a platform like Steam (for obvious reasons, copyrights etc), just giving it for free. But I wanna know when I will finish the development, can I share the game on public with other people so they can download it?

Can the company that made the original game sue me/fine me because of copyrights reasons even though I'm not planning on selling for money?

tl;dr Remake an non-profit game of PS1 from the scratch, can the company that holds the copyrights of the game sue me/fine me?

sentences:
How can I create the illusion of a 3D object moving around in a static background? I'm designing a Resident Evil clone using OpenGL. I'm curious how the older Resident Evil games used a static pre-rendered background with 3D models roaming around:

(source: spong.com)
Here, if the main player (Claire) moved a few steps back, she will overlap with the pay phone booth. But if she keeps moving alongside the phone booths, she'll still be overlapping them until she is adjacent to the second phone booth.
Conceptually, how is this done and how can I replicate it? I'm not interested in the implementation technicalities on any particular platform. Just the concepts.

sentences:
Fitting Gameobjects within camera view I am trying to fit a grid of gameobject into the orthographic view but I have a problem whenever I change the amount of grids to display it would overlap the view.

What cαn I do to fit a series of gameobjects, having always the same margin as the amount of grid changes?

private void Start() {
    for(int i = 0; i < wordSearch.Gridsize; i++) {
        for(int j = 0; j < wordSearch.Gridsize; j++) {
            cell = Instantiate(gridCell, new Vector3(j * 1 * gridCell.transform.position.x * cellSpacing, i * 1 * gridCell.transform.position.y * cellSpacing, 0), Quaternion.identity);
            cell.name = "cell-Y: " + i.ToString() + " cell-X: " + j.ToString();
            GameObject textObject = cell.transform.GetChild(0).gameObject;
            textObject.GetComponent<TextMeshPro>().text = wordSearch.matrix[i, j].ToString();
            textObject.name = textObject.GetComponent<TextMeshPro>().text;
        }
    }
    CenterPoint();
   // FitToScreen();
}

private void CenterPoint() {
    Vector3 offset = new Vector3(0, -1, -10);
    cellGameobject = GameObject.FindGameObjectsWithTag("cell");
    transformCell = new Transform[cellGameobject.Length];
    for(int i = 0; i < cellGameobject.Length; i++) {
        transformCell[i] = cellGameobject[i].transform;
    }
    for(int a = 0; a < transformCell.Length; a++) {
        cellVectors += transformCell[a].position;
    }
    centercell = cellVectors / transformCell.Length;
    GetComponent<Camera>().transform.position = centercell + offset;
}

private void FitToScreen() {
    Camera.main.orthographicSize = /* Insert Comment */
}

sentences:
How can I unregister an event from another scene or another script? This is where and how I register the event :
void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (Time.timeScale == 0)
            {
                DisableEnableUiTexts(true);
                SceneManager.UnloadSceneAsync(0);
                if (fadeImage != null)
                    fadeImage.SetActive(true);
                GetGameMusicVolume();
                Cursor.visible = false;
                Time.timeScale = 1;
            }
            else
            {
                Time.timeScale = 0;
                MenuController.LoadSceneForSavedGame = false;
                SceneManager.LoadScene(0, LoadSceneMode.Additive);
                SceneManager.sceneLoaded += SceneManager_sceneLoaded;
                Cursor.visible = true;
            }
        }
    }

And the event :
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
    {
    }

I need to be able to unregister the event either from another scene or another script.

sentences:
Collision detection 3d rectangles using SAT This question builds on a previous post asked by griffinHeart nov 2012. See link below.

How many and which axes to use for 3D OBB collision with SAT

Refering to the explanation/answer by Ken.

 What if the yellow cube had a rotation so the gap was hidden. This scenario does not necessarily mean that there is a collision/interception. The scenario would look something like this:

Which of the 9 edge - edge vectors would then show that there is no collision.

I am trying to implement an anti- coll algo between two 3d rectangles that might have a rotation around any axis (x, y, z). I am struggling with the projection part. How to project the points onto the face normals.

Hope someone can give me an answer that could lead to a solution. Thanks!

sentences:
Turn-based browser game I want to try to build a multiplayer turn-based browser game.

What technologies do you recommend me to use for server side considering I plan to host it on a shared host? Would PHP be fast enough?

sentences:
How can I edit .qvm (Quake Virtual Machine) files? I was browsing through how to mod a game (Urban Terror, a Quake 3 mod). I found that it can be done by editing .qvm files in the game. Under the file named zpak000.pk3. That file contains other files named

ui.qvm
qagame.qvm
cgame.qvm

But I can't find a way in which I can edit these files.

sentences:
Advantages and disadvantages of libgdx I've been an android developer for a while and am thinking about getting into gaming. While looking for a game dev framework, I thought libgdx provides very friendly documentation and functionality. So I would like to use it if there is no big obstacle.

But when I tried to see how many developers employ this library, I could find not that many. Is there anything wrong with this library? In other words, I would like to know its advantages or disadvantages from any experienced developer.

UPDATE: After reviewing its documentations and trying to build simple games with libgdx, I decided to go with it as its documentations are good enough and its community is very active. What I liked the most is that it provides a bunch of demo games that I can learn a lot from.

sentences:
How do I properly change the value of a prefab'd instance variable? I am currently following a tutorial on how to make a 2D platformer in Unity.

The tutorial explains how to make an enemy wave spawner, but it doesn't explain how to make enemies stronger after I have completed a certain amount of waves.

So, to explain: I have an Enemy class, which has an EnemyStats class in it:

public class Enemy : MonoBehaviour
{
    [System.Serializable]
    public class EnemyStats
    {
        public int damage = 20;
        public int maxHealth = 100;

        public int CurrentHealth
        {
            get { return _currentHealth; }
            set { _currentHealth = Mathf.Clamp(value, 0, maxHealth); }
        }

        private int _currentHealth;

        public void Init()
        {
            CurrentHealth = maxHealth;
        }
    }

    public EnemyStats stats = new EnemyStats();

    private StatusIndicator statusIndicator;

    void Awake()
    {
        stats.Init();
        statusIndicator = transform.Find("StatusIndicator").GetComponent<StatusIndicator>();

        if (statusIndicator != null)
        {
            statusIndicator.SetHealth(stats.CurrentHealth, stats.maxHealth);
        }
    }
}

And in the WaveSpawner class I have the method to spawn the enemy:

private void SpawnEnemy(Enemy enemy)
{
    Transform sp = spawnPoints[UnityEngine.Random.Range(0, spawnPoints.Length)];

    if (CurrentWave % 5 == 0)
    {
        enemy.stats.maxHealth += 20;
    }

    Instantiate(enemy.transform, sp.position, sp.rotation);
}

In the WaveSpawner you can set a certain number of waves (let's say 5), and after you complete all of the waves I've set them to repeat.
So after I beat the 5 waves, I want the 5 waves to repeat and the enemies to be stronger (for example to have their max hp increased by 20).

I do that with the line: enemy.stats.maxHealth += 20;

But the problem here is that after this line is executed and I Instantiate the enemy prefab, the prefab changes its value in the inspector. So let's say that the initial value of the prefab was 120, after I beat the 5 enemy waves, the value of the prefab is set to 140. Then, after I reset the game, the initial value of the prefab is 140 and the max health of the first enemies is 140 and not 120.

I have tried to not change the maxHealth variable of the EnemyStats class, but instead to have another variable tempMaxHealth and do the changes on it. This doesn't resolve my problem, as other problems arise and I don't know what to do anymore.

I hope that you have an answer for me, I would be grateful if that's the case.

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:
Full screen quad in the HLSL Directx 11 I want to create a full screen Triangle/Quad so I can blur the box that is the quad I made. I want to do this in the vertex buffer. I tried this code:

    struct VSQuadOut {
    float4 position : SV_POSITION;
    float2 uv: TEXCOORD;
};

// outputs a full screen triangle with screen-space coordinates
// input: three empty vertices
VSQuadOut VSQuad( uint vertexID : SV_VertexID ){
    VSQuadOut result;
    result.uv = float2((vertexID << 1) & 2, vertexID & 2);
    result.position = float4(result.uv * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0.0f, 1.0f);
    return result;
}

I want something like this

Any ideas?

sentences:
Is there a way to hardcode a JSON file into a Unity build? I'm currently creating an external tool to generate dialogues that are exported as JSON files.

The idea is that after you create a dialogue (as a JSON), my main Unity project reads that file and generates a dialogue.

Right now it works just fine, but the JSON is an external file that you can modify even after compiling the game (of course).

Is there a way to actually "hardcode" that JSON file so that the game doesn't need to find and read the file every single time it plays?

sentences:
How to put labels at a specific point on any resolution I am working on a project in Unity 4.6.1 and I put the label at the top:

But when I put the Scene in full view this happened:

I made a Development Build and when I select my resolution (1366x768) the label goes behind the buttons. Is there any way to put the label at a specific point no matter what resolution?

sentences:
Is there a simpler way to create a borderless window with XNA 4.0? When looking into making my XNA game's window border-less, I found no properties or methods under Game.Window that would provide this, but I did find a window handle to the form.

I was able to accomplish what I wanted by doing this:

IntPtr hWnd = this.Window.Handle;
var control = System.Windows.Forms.Control.FromHandle( hWnd );
var form = control.FindForm();
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

I don't know why but this feels like a dirty hack.  Is there a built-in way to do this in XNA that I'm missing?

sentences:
Are native code obfuscations needed to prevent piracy of Android games? Is the copyright protection and enforcement of Android apps written in Java sufficient or should I be relying on a native implementation to use machine code obfuscating techniques in order to prevent piracy of my game?

Please provide an answer with supporting examples of games which use either technique.

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:
How many matrices do i need to represent a rectangular figure and translate it? I'm learning math at the moment and i can't really understand the purpose of the matrix.
Yes, i've watched several tutorials out there and reading the book but still confused.

Correct me if i'm wrong.
We need one matrix to represent one point(vertex) on the screen. So to represent a rectangular, we need 3 matrices. Right?

sentences:
How to initiate manually an animation in Unity? I have a prefab and I want to control when an animation is initiated. I can't seem to figure out how to do that. I have already created the animation clip, the animator component for the prefab, and the animator controller. The animation works, when I enter play mode in the unity editor (it plays automatically), but I want to control when the animation occurs when providing input (such as pressing on the space bar or clicking on the prefab).

How would I go about doing that?

sentences: FPS camera up and down control I am new to Unity. Now I am working with FPS camera. While pressing a key down arrow I want my camera to go down and again it come back to normal position. I am not getting any idea how to do it. Anyone, please help.

sentences:
Terrain detection on racing game Hi I don't speak English very well so ill try to do my best :P

I'm doing my first top-down racing game for LibGDX, now I need to create tracks, the tracks aren't very large, I prefer doing this with a set of tiles with different types of curves, because I want to do a level editor.
So I need to check whether the car is on the track or not. I thought that these alternatives are good but I need help by choosing the best one

An big array. Doing an array of tiles, saving whether in that position there is a track, looks very memory consupting
A set of polygons. And then checking if the car is inside them. Looks very CPU consupting
An Black-White image of the track. I've seen a recomendation here about that, but looks similar to an array

Do you know another way to do this?

sentences:
Collision resolution in case of collision with multiple objects I have static objects and movable objects. The collisions are detected using the separating-axis-theorem.
For example, in this situation I have two static objects (in red):

and a movable object between the two:

My algorithm is able to compute the collision between two of these objects, and it also spits out a perfect resolution vector (meaning a minimum-displacement-vector) to the collision.
So for example, when I check the collision between the green rectangle and the right red rectangle, the algorithm spits out a vector that tells me how I need to move the green rectangle in order to resolve the collision:

Notice that I just quickly drew this in MSPaint, so in that picture it could actually be that the minimum-translation-vector pushes the green rectangle out on the top, but I'm going to assume here that pushing it out to the left/right is actually shorter.
The general way of approaching this would be to only resolve the collision of one collision per frame, instead of all at once. But in my case, this would result in flip-flopping:
First, the solver detects two collisions but only resolves the collision between the right rectangle and the green rectangle:

Then, in the next frame, it detects only one collision which is between the left red rectangle and the green rectangle, and resolves it:

As you can see, this doesn't actually resolve the collision (for example by pushing the green rectangle out to the top), and instead just flip flops between the two states infinitely.
How can I solve this?

sentences:
Collision Detection in Direction (SFML) I am experiencing a problem with collision detection, an efficiency problem. Right now I want to make it so that my player square stops traveling in the direction of collision into the static object. I followed what a guy did in a tutorial when he checked this type of collision but it's long and hard to understand let alone read. Is there an easier way to tackle this issue?

sf::RectangleShape player;
player.setSize(sf::Vector2f(50, 50));
player.setFillColor(sf::Color::Cyan);
player.setPosition(width / 2, height / 2);

sf::RectangleShape object;
object.setSize(sf::Vector2f(100, 100));
object.setFillColor(sf::Color::Green);
object.setPosition((width / 2) - 200, (height / 2) - 120);

sf::Vector2f velocity(0, 0);
float gravity = .1;

bool jumping = true;

sf::Event event;
while (window.isOpen())
{
    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            window.close();

        if (event.type == sf::Event::KeyPressed)
        {
            if (event.key.code == sf::Keyboard::Space)
            {
                if (jumping == false)
                {
                    velocity.y = -3.5;
                    jumping = true;
                }
            }
            else if (event.key.code == sf::Keyboard::Right)
            {
                velocity.x = 3;
            }
            else if (event.key.code == sf::Keyboard::Left)
            {
                velocity.x = -3;
            }
        }
    }

    //Move the player
    player.move(velocity);

    //Gravity

    if (player.getPosition().y < height / 2)
    {
        velocity.y += gravity;
    }
    else if (player.getPosition().y >= height / 2)
    {
        player.setPosition(player.getPosition().x, height / 2);
        jumping = false;
    }

    //Check collision with object
    sf::FloatRect player_boundingBox = player.getGlobalBounds();

    if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().y + 50 < object.getPosition().y + 5 && player.getPosition().y + 50 > object.getPosition().y && player.getPosition().y < object.getPosition().y)
    {
        player.setPosition(player.getPosition().x, object.getPosition().y - 50);
    }
    else if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().x > object.getPosition().x + 90 && player.getPosition().x < object.getPosition().x + 99)
    {
        player.setPosition(object.getPosition().x + 100, player.getPosition().y);
        velocity.x = 0;
    }
    else if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().x + 50 < object.getPosition().x + 10 && player.getPosition().x + 50 > object.getPosition().x)
    {
        player.setPosition(object.getPosition().x - 50, player.getPosition().y);
        velocity.x = 0;
    }
    else if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().y > object.getPosition().y + 97 && player.getPosition().y < object.getPosition().y + 99)
    {
        player.setPosition(player.getPosition().x, object.getPosition().y + 100);
        velocity.y = 0;
    }

    window.clear(sf::Color::White); //Clear

    window.draw(player);
    window.draw(object);

    window.display(); //Display
}

sentences:
How to move object on local space not object space in unity I am watching this (game dev, space parenting & rotation)
Sebastian Lague video and found that there are three spaces actually (not two) and these are world space, local space and object space.

World space: The static space (0,0,0)
Object space: related to the object space
Local Space: related to the parent of the object

I am amazed that i didn't find the distinction between these two spaces(local and object) on official unity forms but actually it exists. My question is that why there is no Space.Local? I found that there are Space. Self and Space.World.
Space.Self is refer to object space. I can move my object to object space using this

    void Update () {
        transform.Translate(new Vector3(0,0,1) * Time.deltaTime * 2,Space.Self);
    }

And i can move my object to world space using this

void Update () {
    transform.Translate(new Vector3(0,0,1) * Time.deltaTime * 2,Space.World);
}

but there is no support for local space that i could move the object to local space (means move the object related to its parent object). There is a fair distinction between Local and Object space but unity didn't consider it i guess or i am wrong.

sentences:
How do we adapt our game to work over a network? A friend of mine has made a Java version of a popular board game in Java, and has it working for multiplayer on one PC with different turns for each player. He's mentioned he wants it to eventually run from a webserver and people around the world can play the game together, but he's dismissed this as impossible (translated: Too hard to be worthwhile).
I'd like to make this happen for him, and I'm wondering:

Do we need to completely rebuild or can we just adapt the existing code, for the game to work across a network?
What are the advantages of a GWT based browser game, compared to a swing based client side game that updates to a server?

What is the common practice here, for going from one instance on one PC to multiple instances across several networked PCs?
Edit:
The game code is very well broke and down and generalised; game logic and display are completely seperate. The main GUI is a scroll pane with a dungeon, squares are coloured for monsters, players, doors, floors etc, and are just JButtons essentially. Players have turns and then the monsters have a turn. It's very simple in essence.

sentences:
Error in Finding Nearest Hexagonal Tile Using Openfl for a game using hexagonal tiles

Working out the problem of walkability in a game, and I've run into an issue with my Hexagonal tiles.
I think it is an odd rounding error of sorts.  When heading down on the left side of tile, for a moment the nearest returns the coordinates of the tile on the right side. So the coordinates I get from the bellow nearest causes the "no walk" area for each unwalkable (water in this case) tile to be the area in red on this image.

public function nearest(pos:Point):Point
{
  var real_x:Float = pos.x + character.xOffset;
  var real_y:Float = pos.y + character.yOffset;
  var pos_y:Float = ((real_y + yOffset) / tileHeight)+1;
  var pos_x:Float = ((real_x  + xOffset - ( pos_y%2 * tileWidth/2) ) / tileWidth);
  return new Point(Math.round(pos_x),Std.int(pos_y));
}

For reference, this is how my map is laid out, later the map data will be read in from a file and not hard coded into the application.

public function createMap()
{
  map.push([0,0,0,0,0,0,0,3,0,0]);
  map.push([ 0,0,0,0,0,0,3,0,0,0]);
  map.push([0,0,0,0,0,0,3,0,0,0]);
  map.push([ 0,0,0,0,0,3,0,0,0,0]);
  map.push([0,0,0,0,0,3,0,0,0,0]);
  map.push([ 0,0,0,0,3,0,1,1,0,0]);
  map.push([0,0,0,0,3,0,1,2,1,0]);
  map.push([ 0,0,0,3,0,0,1,1,0,0]);
  map.push([0,0,0,3,0,0,0,0,0,0]);
  map.push([ 0,0,3,0,0,0,0,0,0,0]);

  walkMap.push([true,true,true,true,true,true,true,false,true,true]);
  walkMap.push([true,true,true,true,true,true,false,true,true,true]);
  walkMap.push([true,true,true,true,true,true,false,true,true,true]);
  walkMap.push([true,true,true,true,true,false,true,true,true,true]);
  walkMap.push([true,true,true,true,true,false,true,true,true,true]);
  walkMap.push([true,true,true,true,false,true,true,true,true,true]);
  walkMap.push([true,true,true,true,false,true,true,true,true,true]);
  walkMap.push([true,true,true,false,true,true,true,true,true,true]);
  walkMap.push([true,true,true,false,true,true,true,true,true,true]);
  walkMap.push([true,true,false,true,true,true,true,true,true,true]);

  tileData = [];
  for (row in 0...map.length)
  {
    for (cell in 0...map[row].length)
    {
      tileData = tileData.concat(
        [
          (tileWidth * cell + ((row%2) * (tileWidth/2))) - xOffset,
          (tileHeight * row) - yOffset,
          map[row][cell]
        ]
      );
    }
  }
}

What is causing the issue, where is my math off that I'm getting this odd effect?

Update:

The tile mapping from the above code should look like (realizing that I haven't taken the corners into account yet):

But instead look like:

They are not diagonal at all (like DMGregory suggests in his answer), the the top of them where the corners live is shifted by 1/2 a tile width, and I don't see why.

I could force the the tops to the right half a tile after (and that might be what I end up doing), but the code above should work, and I don't see where it is off by half a tile.

The bit DMGregory is doing at the bottom of his answer is what I was starting to work on to try and solve the corner problem (except the corners are at the top, not the bottom), when I realized what the shifting bug that's really going on really is.

sentences:
What is the best design pattern to apply effects and abilities? What would be the best design pattern to apply effects and abilities in a game. For example:

I have a unit that has base stats like attack power, defense etc. The unit can hold several items that will boost one or more of these effects. Also the unit can have several skills that can either boost stats, or be like a special attack.
The trick behind the skills is, it should get stronger per level.

I have the following requirements:

Data for the skills and items should be loaded through (for example) xml or serialized classes.
The skills should contain a level system. Each level they increase in strength (but not with a fixed percentage each level).
An item or skill can have multiple effects (time based and immediate effects).
The skills should have something like an Execute method with a target unit (for example special attack on unit Y) This effect has a graphical representation (like a rocket firing) that should occur and an effect (damage, armor decrease etc) on the target. This effect could be applied over time or instantaneously.

What is the most usefull design pattern to achieve this?

I can think of the following:

I have several classes: Unit, Ability, Effect.

The Unit class has an array of applied Effects. On add to and on remove from this array the Apply and Remove methods on the Effect class are called, with the Unit object as parameter. The Effect class then handles the appropriate Boost or Decrease on the Units properties.
This will work, however, I don't see this working with time based effects.

Are there better solutions?

sentences:
Facet file that contains face coloring inside the file I'm looking for a few example facet file types that allow applying face materials in the same file.  At the moment I know of COLLADA (.dae) but I'm looking for others due to the difficulty on manually parsing and writing that I'm implementing.  Other requests I have are that the file is human readable, ie ASCII vs binary.  I've looked at Wavefront (.obj) formats but they require a secondary file for the face materials.  I've also looked into the PLY format but that one looks focused around vertex coloring vs face coloring.

Having an open and easy to understand format is greatly appreciated.

sentences:
How do I avoid "too" lucky / unlucky streaks in random number generation? I'm currently dealing with a multiplayer combat system where the damage dealt by the players is always multiplied by a random factor between 0.8 and 1.2.

In theory, a truly random RNG may eventually yield the same number many times (see the Tetris dilemma). This could result in a match where player is always making very high damage while the other always makes very low damage.

What can I do to make sure this doesn't happen? Are some RNGs better than others at avoiding repetition?

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:
Garry's Mod gamemode scripting (lua) - How do I tell if an object is inside a hollow cylinder? I'm fiddling about with gMod trying to make a gamemode where you have to throw a piece of cake into a cylinder that spawns on the map.

This is the code I'm using to spawn the cylinder:

local ent = ents.Create( "prop_physics" )
ent:SetModel("models/props_phx/construct/windows/window_curve360x1.mdl")
ent:SetPos( Vector(math.random(100,2500), math.random(1500,-1000), 150) )
--ent:SetPos( math.random(-1500,-2500), math.random(-1500,-2500), 100 )
ent:Spawn()

cleanup.Add( self.Owner, "props", ent )

undo.Create( "Spawned_Cylinder" )
undo.AddEntity( ent )
undo.SetPlayer ( self.Owner )
undo.Finish()

The cake throwing part is basically just a SWEP that shoots the 'cakehat' prop. How would I test whether there is a piece of a cake inside the cylinder?

sentences:
Moving unit along a computed path I am generating a path using pathfinding.js. This returns a path of node coordinates from a matrix. Example:

var matrix = [[0,0,0,0], //0 are passable, 1 are obstacles
              [0,1,1,0],
              [0,1,1,0],
              [0,0,0,0]]

var path = [[0,0],[0,1],[0,2],[0,3],[1,3]] etc.

I now wish to convert this to path to something like, takeoff(), turnLeft(), forward(4) etc.

What this process called, I have had a look at many programming books and guides but they seem to ignore this method or miss it out. I also had a go at it myself but can't figure out the direction of unit that is being moved along the path.

sentences:
Does it make sense to use voxel editors only for meshing? I am a hobbyist game developer. If there is something that I really don't like is 3D modeling, in particular all the work that needs to be put in the "pipeline" for the creation of models, in particular UV mapping.

Remembering games like Minecraft or "Little big planet", I was wondering if voxel editors could be used for just modeling; let me explain: using a voxel editor to make each object I need for my games and then export them singularly as FBX with either marching cubes or even better dual contouring for meshing.

Does an approach like this make sense in terms of performance? From what I can tell, I would need a voxel software which allows all of the following criteria.

Dual contouring meshing
FBX or OBJ export of meshed area
Multiple materials

Now, it looks like such software doesn't exist, which makes me think that this approach for 3D modeling may be totally wrong. Any heads-up on this?

sentences:
How to make Flood fill algorithm return different Lists of separate groups in the grid? So i have this flood fill method :

 public int groupedCells(int y, int x, int value)
{
    //base state
    if (!gSetup.isValidLocation(y, x) ||
        gSetup.getCell(y, x).value != value ||
        gSetup.getCell(y, x).cMAtch.isInMatchPool)
    {
        return 0;
    }

    // keep track of matched cells
    gSetup.getCell(y, x).cMAtch.isInMatchPool = true;

    // collect
    int up = groupedCells(y + 1, x, value);  //  up
    int left = groupedCells(y, x - 1, value);  //  left
    int right = groupedCells(y, x + 1, value);  //  right
    int down = groupedCells(y - 1, x, value);  //  down

    // sum
    int total = up + left + right + down + 1;

    return total;
}

basically i have this grid :

and currently if i click on a yellow triangle, the method above will tell me how many of them are next to each other.

What i want is a solution that will run all over the grid, and check if a group has :

less than 3-triangles then do (A)
if it has 3-triangles then do (B)
if it has 4-triangles then do (C)

etc ...

Am not sure about this, but i thought the best way is to have a list for every group, and then check those conditions over the lists.

I tried it here but the list keep re-initializing itself, so it always either have 0 cells or 1 :

  public List<CellSetup> listedCells(int y, int x, int value)
{
    List<CellSetup> cList = new List<CellSetup>();
    //base state
    if (!gSetup.isValidLocation(y, x) ||
        gSetup.getCell(y, x).value != value ||
        gSetup.getCell(y, x).cMAtch.isInMatchPool)
    {
        return cList;
    }

    // keep track of matched cells
    gSetup.getCell(y, x).cMAtch.isInMatchPool = true;
    cList.Add(gSetup.getCell(y, x));
    // collect
    List<CellSetup> up = listedCells(y + 1, x, value);  //  up
    List<CellSetup> left = listedCells(y, x - 1, value);  //  left
    List<CellSetup> right = listedCells(y, x + 1, value);  //  right
    List<CellSetup> down = listedCells(y - 1, x, value);  //  down

    return cList;
}

The result of that method when its called here :

for (int y = 0; y < gSetup.cell2DArray.GetLength(0); y++)
        {
            for (int x = 0; x < gSetup.cell2DArray.GetLength(1); x++)
            {

                print(listedCells(y, x, 1).Count);
            }
        }

is printing "1" three times and "0" 22 times.

Thank you

sentences:
Avoid the same code several times in game state enum I use a switch with enums to divide my game in different parts. In the code below, that is simplified, I have a problem, becasue I need to show the same text in two or perhaps more parts and I wonder if there is a better way to do this, to avoid the use of the same code at several cases?

 switch (currentGameState)
        {
            case GameState.Start:
                // Code
                break;

            case GameState.Info:
                // Code
                break;

            case GameState.PlayGame:
                spriteBatch.Begin();
                spriteBatch.DrawString(scoreFont, "Score : " + currentScore, new Vector2(10, 10), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.DrawString(timeFont, "Time : " + secondsToDisplay, new Vector2(10, 30), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.DrawString(timeFont, "Spaceship : " + numberOfSpaceship, new Vector2(10, 50), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.End();
                break;

            case GameState.NewSpaceship:
                spriteBatch.Begin();
                spriteBatch.DrawString(scoreFont, "Score : " + currentScore, new Vector2(10, 10), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.DrawString(timeFont, "Time : " + secondsToDisplay, new Vector2(10, 30), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.DrawString(timeFont, "Spaceship : " + numberOfSpaceship, new Vector2(10, 50), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.End();
                break;

            case GameState.GameOver:
            // Code
                break;
        }

sentences:
How does mmorpg store data? I want to use sql database in my server.exe.

lets say 1000 users online. And players will change their data when they play. And server need to save these updates.

But how ?

i think there two way:

1) server will save in ram at run time and sometime or hourly server will write data (update) to sql database from ram. But if electricity goes or somehow the server shuts down , updates won't save. of course i don't want lose updates.

2) server will save updates in database at run time. but what will happen to speed ? I thought of a method. i will show you below with image. Can i get enough speed for 1000 online players with this method ?

sentences:
How to form a concave shape out of convex shapes? I'm trying to get around the rule of only being able to form convex shapes in the SFML C++ library.

  To do this I'm planning on testing given vertices, and if concave,
  splitting the vertices into groups, testing each groups' concaveness,
  and repeating until a full set of convex shapes results that look
  just like the original shape when put together

What I would like to know is...

What the equation for testing a shapes concaveness is: what is it and how does it work?
How would I split up the vertices of the concave shape so in the end the shape is formed out of as few convex shapes as possible?
Whats the best practice for achieving my goal?

Thanks!

sentences:
Missing UI options in Inspector window when I import FBX files I am missing all the animation options in the Animation tab in the Inspector Window when importing FBX files.

In the picture below, there are only 2 checkboxes. I can't see the list of animations, options, animation events etc., but you can see on the lower left window that the animations we're imported. Also, the Materials tab is empty as well.

This FBX was exported from Blender. If I directly drag the .blend file to Unity, all those tabs appear normally, but when dragging an FBX, they become empty. I am using Unity 2019.3.0f6.

sentences:
How to move a Box2D body towards a mouse click? In a top down game using Box2D, I would like the player's Box2D body to rotate towards the mouse click, and then move to a point on mouse click (move, not teleport). I have worked out the rotation part, but cannot figure out the movement.

Every time the screen is touched, the target point (mouse click) is updated:

if (Gdx.input.isTouched())
{
    Vector3 tmp = camera.unproject(new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0));
    touch_prev = touch_target;
    touch_target = new Vector2(tmp.x, tmp.y);
}

Here is the Rot2D class:

package com.elsealabs.ghostr;

public class Rot2D {

   public static Rot2D fromDegrees(double angle) {
      return fromRadians(Math.toRadians(angle));
   }

   public static Rot2D fromRadians(double angle) {
      return new Rot2D(Math.cos(angle), Math.sin(angle));
   }

   public static Rot2D fromVector(double dx, double dy) {
      float length = (float) Math.sqrt(dx * dx + dy * dy);
      return new Rot2D(dx / length, dy / length);
   }

   public double getAngle() { // radians
     return Math.atan2(sin, cos); // atan2(y, x)
  }

   public double cos, sin;

   private Rot2D(double cos, double sin) {
      this.cos = cos;
      this.sin = sin;
   }

   public Rot2D load(Rot2D that) {
      this.cos = that.cos;
      this.sin = that.sin;

      return this;
   }

   public Rot2D copy() {
      return new Rot2D(cos, sin);
   }

   public Rot2D rotate(Rot2D that) {
      double cos = (this.cos * that.cos) - (this.sin * that.sin);
      double sin = (this.cos * that.sin) + (this.sin * that.cos);

      this.cos = cos;
      this.sin = sin;

      return this;
   }

   public static double cross(Rot2D a, Rot2D b) {
      return (a.cos * b.sin) - (a.sin * b.cos);
   }
}

(Source)

I am showing these because it may be helpful, but what I need to get working is the movement. I do not want to use setTransform, as it may end up letting the player travel through walls.

Using the vectors below, and any other variables needed, how would I move the player gradually towards a point on mouse click?

private Vector2 touch_prev = new Vector2(0, 0);
private Vector2 touch_target

sentences:
Sound effects in separate thread? Does it make sense to carry out all audio (music, sound effects, etc.) in a separate thread?

In your experience, how large would you expect the performance impact of playing some MP3 music and 10-30 sound effects to be?

Could performance be an issue with starting to play many different sound effects (e.g. in the same frame)?

sentences:
Moving a platform left to right with continuous movement I made a 2D game with Unity, and I am trying to create a platform that will move from left to right continuously, but I don't know how to make the platform move a greater distance then -1 to 1 units because I use the Mathf.Sin function. I can only control the speed of the platform.

Here is my code:

private Vector2 startPosition;
private int speed;

void Start ()
{
    startPosition = transform.position;
    speed = 3;
}

void Update()
{
    transform.position =
        new Vector2(startPosition.x + Mathf.Sin(Time.time * speed), transform.position.y);
}

Here is what the code actually does:

How can I control the distance that the platform can move to each side? For now, it can only move 1 unit to each side.

sentences:
HTML5 Canvas: Get rect coords after rotation (relative to screen) update: function(delta) {
    for (var i = 0; i < this.bullets.length; i++) {
        this.bullets[i].velocity = this.bullets[i].speed * delta;
        this.bullets[i].contextX += this.bullets[i].velocity;
    }
},

draw: function(ctx) {
    for (var i = 0; i < this.bullets.length; i++) {
        ctx.save();

        // Move the context to where the player is then make it face the target degree
        ctx.translate(this.bullets[i].startX, this.bullets[i].startY);
        ctx.rotate(this.bullets[i].rotation);

        ctx.fillRect(this.bullets[i].contextX, -5, 10, 10);
        ctx.restore();
    }
}

The code above contains two methods that describe a class that manages the drawing and updating of bullets. The update method moves a bullet along and the draw function then draws it to the screen.

The canvas does the following:

Saves the current canvas context state
Moves the context to where the bullet originated from
Rotates the canvas to the way the bullet was facing when shot
Draw the rectangle
Restore the canvas context to original state

Here is an image I have made that better describes what the canvas context is doing:

So we know the x position of the bullet but this is relative to the context as it's been rotated. What I need to know is the bullet's X and Y properties in relation to the actual screen. Any ideas as to how I can do this?

sentences:
Can I create a Sprite Asset using a downloaded Texture at runtime? I know that Asset Bundles exist, and I'm already taking a look at them. But I'm still interested in this particular approach:

I am interested in downloading a .png image from the Web, and then "consolidate" it as a Sprite asset. After doing so, I can display this sprite in my game in the future without ever downloading that image again.

I was able to download the image and use its texture to create a Sprite object and use it for my SpriteRenderer:

        WWW request = new WWW("www.example.com/image.png");
        yield return request;
        if (request.isDone) {
            ((SpriteRenderer)renderer).sprite = Sprite.Create(request.texture, new Rect(0,0,request.texture.width,request.texture.height), new Vector2(0.5f,0.5f));
        }

Is it possible to grab this texture and generate a Sprite asset? With all the properties like pivot, pixels per unit, packing tag, etc?

UPDATE

Alright, so turns out that Sprite.Create let's me set the pivot and pixels to units properties. No packing tag, though, but I guess that makes sense since packing should be done during development and not during runtime.

Given this, I suppose one could serialize the generated Sprite class.

sentences:
Matrix operations to flip 3d models front to back, without changing position Multiple 3D objects look to be in the correct screen position, and I can move around them and this continues to be true, but each one looks like it is flipped back to front (I can see the backside of the object as if the camera were on the other side of it).

Any clues to why this may be happening in addition to correcting it would be welcome also- I'm getting a transform matrix from one api what is documented as OpenGL 4x4 matrix format, but my underlying api (bgfx) is wrapping opengl so may be assuming another format.  I can probably go get the transform in different format, but now I'd really like to know how to correct this also if there was no option but to start with the opengl matrix.

sentences:
Quaternion understanding I have some understanding problem concerning quaternions.

In order to have my world object rotate in the correct way, I need to invert their quaternion rotation while refreshing the object world matrix.

I create the object rotation with this code:

Rotation = Quaternion.RotationMatrix(Matrix.LookAtRH(Position, Position + new Vector3(_moveDirection.X, 0, _moveDirection.Y), Vector3.Up));

and refresh the object World matrix like this:

Object.World = Matrix.RotationQuaternion(Rotation) * Matrix.Translation(Position);

This is not working; it makes the object rotate in the opposite way compared to what it should!

The is the way that makes my object rotate correctly:

Object.World = Matrix.RotationQuaternion(Quaternion.invert(Rotation)) * Matrix.Translation(Position);

Why do I have to invert the object rotation?

sentences:
Game Maker - Create Instance When Health Is 0 I have five objects: obj_Boss, obj_bossHealth, obj_GameOver, obj_BtnOK, and obj_rec2.
This is what I want. When obj_Boss has no more health, obj_GameOver and obj_BtnOK will appear.
This is my first method:
In obj_bossHealth, I have these events:

Create Event: set var global.bossHealth to 100
Draw Event: draw_healthbar

In obj_Boss, I have these events:

Collision with obj_rec2: set var global.bossHealth relative to -1.5; destroy the instance (other)
No More Health: create instance of obj_GameOver; create instance of obj_BtnOK

This is my second method:
In obj_bossHealth, I have these events:

Create Event: set var global.bossHealth to 100
Draw Event: draw_healthbar
Step Event: if global.bossHealth is equal to 0 then create instance of obj_GameOver and create instance of obj_BtnOK

In obj_Boss, I have these events:

Collision with obj_rec2: set var global.bossHealth relative to -1.5; destroy the instance (other)

The result of both methods:
obj_GameOver and obj_BtnOK won't appear. How can I fix this? Please explain your answer. Thanks.
I add some images: method1 method2

sentences:
Keep 3d model facing the camera at all angles I'm trying to keep a 3d plane facing the camera at all angles but while i have some success with this:

Vector3 gunToCam = cam.cameraPosition - getWorld.Translation;
Vector3 beamRight = Vector3.Cross(torpDirection, gunToCam);
beamRight.Normalize();
Vector3 beamUp = Vector3.Cross(beamRight, torpDirection);
shipeffect.beamWorld = Matrix.Identity;
shipeffect.beamWorld.Forward = (torpDirection) * 1f;
shipeffect.beamWorld.Right = beamRight;
shipeffect.beamWorld.Up = beamUp;
shipeffect.beamWorld.Translation = shipeffect.beamPosition;

*Note: Logic not wrote by me i just found this rather useful

It seems to only face the camera at certain angles. For example if i place the camera behind the plane you can see it that only Roll's around the axis like this:

http://i.imgur.com/FOKLx.png (imagine if you are looking from behind where you have fired from.

Any idea what to what the problem is (angles are not my specialty)

shipeffect is an object that holds this class variables:
public Texture2D altBeam;
public Model beam;
public Matrix beamWorld;
public Matrix[] gunTransforms;
public Vector3 beamPosition;

sentences:
How to move an object while the animation is going on? I added a jump animation with the character in unity and to move the character I have some code like this:

if (Input.GetKeyDown(KeyCode.Space))
    {

        transform.Translate(Vector3.forward * 1 * jumpSpeed);
        Anim.SetTrigger("is_jumping");
    }

But here the character first moving its position (like a glitch) and then doing the animation. How can I make them happen at the same time?

sentences:
Tile Map Coordinates I am have now this code: http://jsfiddle.net/DK67k/2/ In here is 2D tile map and when you click on tile you get coordinates on alert. But for get precises coordinate you need click on top left tile(tiles is 16x16) and if I click on bottom right tile I am get second tile coordinates.

Maybe anyone have idea how to fix this?

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:
Disable system sounds in Unity? I've got an editor script in Unity 5 that uses the cursor position in the scene view to change objects in the scene when you press the space key. This all works perfectly, except that Unity thinks that space isn't a valid key to press, so it makes the system "boop" sound to let you know that it's invalid or that nothing happened.

So, focus is on scene view, I press space, my script triggers, and the mac system "boop" sound activates. It spams the sound if you hold it down. Is there a way to:

Disable the system boops in Unity

or

Add space to registered hotkeys / stop unity from triggering the system sound for a specific key

(just to be clear, the script works, I'm just wondering about disabling the sound)

sentences:
Actually utilizing relational databases for entity systems Recently I was researching several entity systems and obviously I came across T=Machine's fantastic articles on the subject. In Part 5 of the series the author uses a relational schema to explain how an entity system is built and works. Since reading this, I have been wondering whether or not actually using a compact SQL library would be fast enough for real-time usage in video games.

Performance seems to be the main issue with a full blown SQL database for management of all entities and components. However, as mentioned in T=Machine's post, basically all access to data inside the SQLDB is done sequentlially by each system over each component. Additionally, using a library like SQLite, one could easily improve performance by storing the entity data exclusively in RAM to increase access speeds.

Disregarding possible performance issues, using a SQL database, in my opinion, would allow for a very intuitive implementation of entity systems and bring a long certain other benefits like easy de/serialization of game states and consistency checks like the uniqueness of entity IDs.

Edit for clarification:

The main question was whether using a SQL database for the actual entity management (not just storing the game state on the disk) in a real-time game would still yield a framerate appropriate for a game or even if someone is aware of projects that demonstrate SQL in a video game.

sentences:
equirectangular panorama rendering? I want to render my scenes as equirectangular panorama frames.

I can get the angular fisheye which is what I actually need by applying the rendered frame as a texture to a correctly UV mapped circle.

But how can the scene be rendered as equirectangular panorama?

I'm using a 3d engine which uses OpenGL and GLSL.

sentences:
What 3d mesh formats usable with DirectX10 are there? I want to load a mesh into my game (written in C#, if this matters) but am not sure what mesh format to use. What mesh formats are there, how easy/hard it is to load them into DirectX10 and what's the difference between those formats?

Or is it best to write my own mesh format?

sentences:
Meshes exported from blender as .obj does not map correctly I am having some problems with developing my game in OpenGL with java (Using LWJGL3). I have been following a guide for the more complex steps of the process, like loading meshes.

When using the basic mesh of a cube that was provided by the guide it works as it should, so it seems like it is not my software that is the problem? The problem comes when I attempted to create my own models using blender. I made sure to triangulate faces and include normals when exporting, but for some reason even when I created a simple cube it does not work correctly. The textures get smeared, only one face is intact. I have both tried the automatic UV projection, and making my own seams.

I have been stuck on this for a while and I have no idea where I am doing something wrong. I would greatly appreciate some help.

sentences:
Retrieving JSON return value from function and parsing in Construct 2 I would like to know how to parse a JSON object and parse each value into either an array, or something that I can use to set values of several global variables in my project file. I want to avoid editing the Javascript file itself, so please try to provide an approach that can be done in Construct itself rather than an external way.

Code sample

 axonify.game = {
  gameData: function() {
    data = {
      name: 'Block Mania',
      timeLimit: 30,
      addedTimePerQuestion: 0,
      addedTimePerCorrectQuestion: 15,
      questionCount: questionCount
    };
    return data;
  },

sentences:
Procedural... house with rooms generator I've been looking at some algorithms and articles about procedurally generating a dungeon. The problem is, I'm trying to generate a house with rooms, and they don't seem to fit my requirements.

For one, dungeons have corridors, where houses have halls. And while initially they might seem the same, a hall is nothing more than the area that isn't a room, whereas a corridor is specifically designed to connect one area to another.

Another important difference with a house is that you have a specific width and height, and you have to fill the entire thing with rooms and halls, whereas with a dungeon, there is empty space.

I think halls in a house is something in between a dungeon corridor (gets you to other rooms) and an empty space in the dungeon (it's not explicitly defined in code).

More specifically, the requirements are:

There is a set of predefined rooms
I cannot create walls and doors on the fly.
Rooms can be rotated but not resized
Again, because I have a predefined set of rooms, I can only rotate them, not resize them.
The house dimensions are set and has to be entirely filled with rooms (or halls)
I.e. I want to fill a 14x20 house with the available rooms making sure there is no empty space.

Here are some images to make this a little more clear:

As you can see, in the house, the "empty space" is still walkable and it gets you from one room to another.

So, having said all this, maybe a house is just a really really tightly packed dungeon with corridors. Or it's something easier than a dungeon. Maybe there is something out there and I haven't found it because I don't really know what to search for.

This is where I'd like your help: could you give me pointers on how to design this algorithm? Any thoughts on what steps it will take? If you have created a dungeon generator, how would you modify it to fit my requirements? You can be as specific or as generic as you like. I'm looking to pick your brains, really.

sentences:
Cube map or 2D texture map I'm trying to map quadsphere with COBE spherical cube (CSC) projection in OpenGL (wanna map planets). I managed to create a 2D texture and it works well except seams at edges.

Then I learned that there is a cubemap in OpenGL. It has some advantages: It automatically generates seamless mipmap and it requires less memory (I was using 4*size width 3*size height texture where a half is just wasted like this: https://camo.githubusercontent.com/b017f71b03e6180dc75ff34f017d45f32e9db817/68747470733a2f2f7261772e6769746875622e636f6d2f6369782f517561645370686572652f6d61737465722f6578616d706c65732f677269642e706e67)

The problem with using cubemap is that CSC is not gnomonic projection. So I can't just use vertex point as 3D texture coordinates. I have to calculate 3D texture coordinates from uv coordinates and the face. Then OpenGL recalculate it to uv coordinate and the face. I guess that slows down the rendering compared to simple 2D texture.

The problem with using 2D texture is that it is not easy to make texture seamless. And it takes more memory if I use one image file for whole texture. I think I could pre-generate mipmaps sampling adjacent faces and add 1px padding and modify uv coordinates slightly (like this? https://gamedev.stackexchange.com/a/49585/74052). But it sounds complicated and I have to pre-generate all mipmaps, and textures might no be in size of power of 2 and I might have another problem with that.

I have no idea which way to go.

When using cubemap, is there a way to specify uv coordinates and face directly, and not specify 3D texture coordinates (direction)?
Is there a way to set 2D texture wrap mode to something like CLAMP_TO_EDGE_OF_OTHER_TEXTURE to make it seamless at edges?
Is there other way to make a 2D cube texture seamless?
Any other suggestion to deal with this problem?

Thanks in advance!

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:
Bright lights produce strange artifacts on Android I'm testing lighting on Android and I'm getting strange artifacts when the light is increased. I'm not sure if this is normal with Unity or a setting somewhere is unchecked.

The only light in my scene is a spot light. I have to increase the brightness of it so that it illuminates everything in the scene properly.

On Windows 10 (in the editor), it displays just fine. You can turn the brightness up all day long and everything will just appear whiter. On Android, however, once you reach a certain threshold (a really low threshold), the colors turn to an abrupt magenta, then dark cyan, and eventually black. Because I'm using a spot light, these colors appear as a radial gradient.

Here's what I've tried so far:

Turning the brightness down. Unfortunately, I have to decrease it a lot to avoid the artifacts meaning my scene doesn't get illuminated in the way that I need it to be.
Changing Lightmapper from Enlighten to Progressive in the Lighting window. But what I think this actually indicates is compression and so is unrelated.
Not specifying a Skybox material and using Custom environment reflections.
Tweaking Graphic settings for each tier (I have double checked HDR is enabled both here and on the camera present in each scene).
Switching to Linear color space (I was originally using Gamma). The idea was maybe the color space was too small so really, really bright colors couldn't be represented; however, it is my understanding that Gamma is much larger than Linear so I'm admittedly confused.

I have Googled this issue quite a bit and all I get are issues with emissive materials not emitting light and other unrelated light issues.

Here is what my scene looks like when a spot light faces a rectangular mesh.

When the threshold is exceed initially, it looks like this:

If you continue to increase the Intensity, it eventually looks like this:

Of course, the exact colors you see vary based on the actual color of the mesh being illuminated. In the pictures above, the mesh is supposed to be a medium-dark green.

Could this be a color space issue? Perhaps a device limitation? My device isn't exactly a super computer, but it isn't bottom-grade either.

sentences:
Ideas to create a Best Move in a match 3 game I'm trying to make a match 3 game in C++ and I want to make a best move method to show the player the ideal position to move to get the most amount of points.

The rules of the game are as follows:

Pairs of objects adjacent vertically and horizontally can be swapped.
You can only swap objects when this will result in a match being created.
A match happens when there are 3 or more objects of the same kind adjacent vertically or horizontally.
objects that match are removed from the board. objects above a gap will keep fall down until all gaps are filled. New matches made by objects falling into place will be removed with the process repeating until there are no matches left.
Points are awarded based on the number of objects removed. The best move for a given board is the one that removes the most objects .

However, I'm stumped for ideas on how to implement such a method. Can anyone give me some ideas on how I can do it?

If you've made a match 3 game, and have implemented a similar method; how did you do it?

sentences:
Is Test Driven Development viable in game development? As being Scrum certified, I tend to prone for Agile methodologies while developping a system, and even use some canvas from the Scrum framework to manage my day-to-day work.

Besides, I am wondering whether TDD is an option in game development, if it is viable?

If I believe this GD question, TDD is not much of a use in game development.
Why are MVC & TDD not employed more in game architecture?

I come from industrial programming where big projects with big budgets need to work flawlessly, as it could result to catastrophic scenarios if the code wasn't throroughly tested inside and out.

Plus, following Scrum rules encourages meeting the due dates of your work while every single action in Scrum is time-boxed! So, I agree when in the question linked above they say to stop trying to build a system, and start writing the game. It is quite what Scrum says, try not to build the perfect system, first: make it work by the Sprint end. Then, refactor the code while working in the second Sprint if needed!

I understand that if not all departments responsible for the game development use Scrum, Scrum becomes useless. But let's consider for a moment that all the departments do use Scrum... I think that TDD would be good to write bug-free code, though you do not want to write the "perfect" system/game.

So my question is the following:

Is TDD viable in game development anyhow?

sentences:
Normalization of Vectors: Return a copy of the result or alter the object itself? When calculating the normal of a vector, which is considered canon:

Returning a copy:

Vector2D Vector2D::Normalize() const {
    double a1 = GetX();
    double a2 = GetY();
    double a3 = GetZ();
    double length = GetLength();
    assert(Math::IsEqual(length, 0.0) == false);
    if(Math::IsEqual(length, 0.0)) {
        throw Exception("Can not normalize a Null Vector.");
    }
    return Vector2D(a1 / length, a2 / length, a3 / length);
}

Or altering the object itself?:

void Vector2D::Normalize() {
    double a1 = GetX();
    double a2 = GetY();
    double a3 = GetZ();
    double length = GetLength();
    assert(Math::IsEqual(length, 0.0) == false);
    if(Math::IsEqual(length, 0.0)) {
        throw Exception("Can not normalize a Null Vector.");
    }
    SetTerminal(a1 / length, a2 / length, a3 / length);
}

P.S.
IsEqual verifies the following: (std::fabs(a - b) <= 0.0001)

sentences:
How to get a difference of angles in one mathematical expression? I need to do this for AI and also range calculation over a curved surface.

I have two angles, a1 and a2, which can be in the range from 0 to 359. I need to calculate the difference between them, and it has to be the inside angle (smallest angle), not the "reflexive" outside angle. And it has to preserve the direction from a1 to a2, which will be positive if going counterclockwise and negative if going clockwise.

Examples of what the function should yield:

scr_ang_diff(30, 50) == 20

scr_ang_diff(80, 310) == -130 // NOT 230 !!!

scr_ang_diff(130, 130) == 0

Now I could do this with test cases, but it seems there should be a way to do this in one mathematical expression. I can no longer use the simple min of abs of the two differences (without test cases) because that doesn't preserve direction.

EDIT: in order to differentiate between this post and this, I've decided to make it mandatory to preserve direction between a1 and a2.

Super bonus points if a1 and a2 can have range -359 to +359.

NOTE: yes efficiency matters. That doesn't mean you can't use trig functions, it just means I'll pick the least complex solution.

sentences:
Simplify Matrix math code- Sun billboarding If was trying to set the correct position of my sun billboard in my 3d game. I tried long until it worked correctly, but I wonder why this code must be so complicated:

sun.sprite.Position = Vector3.Transform(Vector3.Transform(-sun.lightDir,
Quaternion.Inverse(world.Rotation)), Quaternion.Inverse(myRelativeRotation));

Can I simplify this expression? I tried changing it at least to this:

sun.sprite.Position = Vector3.Transform(-sun.lightDir,
Quaternion.Inverse(world.Rotation) * Quaternion.Inverse(myRelativeRotation))

But this is giving me different results, so the sun is at the wrong position.

sentences:
RPG Maker (Issue) RGSS_RTP STANDARD the issue i am having is rpg maker is installed onto my computer as well a rgss-rtp standard and when i go to run RPG maker it says RGSS-RTP STANDARD not installed?
how can i get it to run?

sentences:
Why are there fewer glitches in current day games? I remember that almost every single game in the early 2000s had at least a few amusing glitches, mostly related to animations, that often produced funny situations. I also remember that game magazines used to dedicate a section with the funniest screenshots people sent in.

As an example, I was just playing Far Cry from 2004 and out of nowhere, whenever I killed some bad guy, instead of dropping to the ground they'd start playing the running animation. This was getting me confused since I was trying to shoot them down from a large distance and didn't understand why they weren't dying.

I've rarely seen stuff like this in current-day games. Was there some change in the technique used to develop games that would make these programmer mistakes less likely?

P.S. I'm not talking about RPGs and other inherently complex genres. I'm talking about games like Far Cry; shooters like Battlefield 3, Modern Warfare 3, even Mass Effect. I've seen plenty of glitches in games like The Witcher 2, Skyrim, etc.

sentences:
Creating a DPI and Resolution Independant GUI How would one best go about it? Assuming I'm using OpenGL to do all the drawing.

It seems like the best approach is to have the GUI elements maintain the same physical size regardless of the screen it is displayed on.It seems that Windows will act as if you had a screen with 72 DPI regardless of its actual size unless you specifically request tell it that you handle high DPI cases. Which would greatly simplify things, does this hold for Linux as well?

Does things change between running things in Windowed mode versus fullscreen? It seems like it should, as the Window changes size depending on resultion while in fullscreen the image is always the same size, just with less or more density!

sentences:
How to change variable position within shader - Unity I recently learned how to write shader in Unity and I'm trying to move the texture within one of my variable.

this is the texture I used on the model.

I separated the texture into two shapes, which is texRound and texStar based on position. What I'm trying to do is to move the star texture stored in texStar variable without affecting the position of texRound.

What comes to my mind right now is to use something like this code below, but it doesn't work as the texStar variable only save the color value without the position.

(texStar.x + posModifier).a = texUV.r;

What should I do to access the position of the texStar variable?
Thank you so much in advance.

Here's my full code:

Shader "Custom/ASK RGB" {
    Properties {
        _UV ("UV", 2D) = "white" {}

        // variable I intend to use as modifier value to change the y position of the star texture
        _modifier ("Modifier" , float) = 0
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _UV;

        struct Input {
            float2 uv2_UV : texCOORD1;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            // variable used to store the UV texRoundture mentioned
            half4 texUV = tex2D (_UV, IN.uv2_UV.xy);

            // variables used to store the round texture and the star texture
            half4 texRound;
            half4 texStar;

            if (IN.uv2_UV.x > 0.7)
            {
                if (IN.uv2_UV.y > 0.5)
                {
                    texRound.a = texUV.r;
                    texStar.a = 0;
                }

                else
                {
                    texRound.a = 0;
                    texStar.a = texUV.r;
                }
            }
            else
            {
                texRound.a = 0;
                texStar.a = 0;
            }

            texRound.rgb = texUV.rgb;
            texStar.rgb = texUV.rgb;

            o.Albedo =  texRound.rgb * texRound.a + texStar.rgb * texStar.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

sentences:
Cocos2D v3 and Physics simulation on server I'm trying to develop a real time multiplayer game using Cococs2d v3. The game is basically a side scrolling racing game. I wanted to develop the client using Cococs2d for iPhone, and the server side using Java.
I've read about real time networking and the difficulties I can encounter, but also how can I overcome it. The most helpful articles I read was Valve's, Glenn Fiedler's game networking article and Gabriel Gambetta's article on fast-paced multiplayer games.
I can attach links to those articles if anyone is interested :)

I have come to the conclusion that the physics should be implemented both on the client side and the server side. Using cocos2d v3 this could be done without any problems on the client side, but how can I use the same physics simulation in my server written in Java?
For example how could the server know if there's a hill the client player is climbing, or if there's an obstacle it need to collide with? The physics engine the client use is written in Objective C..

Am I missing something over here?
If my question is not clear enough, please tell me and I will explain it in more details.

Thanks in advance :)

sentences:
Character progression through leveling, skills or items? I'm working on a design for an RPG game, and I'm having some doubts about the skill and level system. I'm going for a more casual, explorative gaming experience and so thought about lowering the game complexity by simplifying character progression. But I'm having trouble deciding between the following:

Progression through leveling, no complex skill progression, leveling increases base stats.
Progression through skills, no leveling or base stat changes, skills progress through usage.
Progression through items, more focus on stat-changing items, items confer skills, no leveling.

However, I'm uncertain what the effects on gameplay might be in the end. So, my question is this:

What would be the effects of choosing one of the above alternatives over the others?
(Particularly with regards to the style and feel of the gameplay)

My take on it is that the first sacrifices more frequent rewards and customization in favor of a simpler gameplay; the second sacrifices explicit customization and player control in favor of more frequent rewards and a somewhat simpler gameplay; while the third sacrifices  inventory simplicity and a player metric in favor of player control, customization and progression simplicity.

Addendum: I'm not really limiting myself to the above three, they are just the ones I liked most and am primarily interested in.

sentences: Turn-based board game server references? Are there any good references/books to recommend about how to build a turn-base game server? It's something like a chess server for pairing chess players and keep game states. In the past, for example the IGS (for go, weiqi) is a socket based implementation. What are the available contemporary technologies to learn from? Thanks!

sentences:
How To Deselect (Unfocus) All gameObjects in a Unity Scene View? When I'm done with moving and rotating gameObjects in a Unity scene, I want to deselect everything to not accidentally change it. How?

In some applications ESC key does the trick, in others 'D' (deselect) comes to rescue. But I don't know any remedy in Unity. My workaround is that I click somewhere in the Project View (I don't like this approach because it brings up the inspector for that asset).

sentences:
Synchronize objects' movements moved by coroutine function I'm using Unity version 5.3.5.

I'm having problems to synchronize the movement of three different objects from point A to point B and vice versa. To move the objects I use the following code:

public float time;
public Vector3 endPos;
private Vector3 startPos;

 void Start()
 {
     startPos = transform.position;
 }

 void FixedUpdate()
 {
     if(transform.position == startPos)
     {
         StartCoroutine(Move(gameObject.transform, startPos, endPos, time));
     }
     if(transform.position == endPos)
     {
         StartCoroutine(Move(gameObject.transform, endPos, startPos, time));
     }
  }

 public IEnumerator Move(Transform thisTransform, Vector3 startPosition, Vector3 endPosition, float time)
 {
     float i = 0f;
     float rate = 1/(time);
     while(i < 1)
     {
         i += Time.deltaTime * rate;
         thisTransform.position = Vector3.Lerp(startPosition, endPosition, i);
         yield return null;
     }
 }

As long as all of the objects have the same "time" value, their movements is correctly synchronized regardless the distance that they have to cover. The problems arises when they all have different "time" value. For example, if they have to move backwards and forwards from startPos(0,0,0) and endPos(5,0,0) with the following "time" value:

Object A time = 1 second
Object B time = 2 second
Object C time = 4 second

After 4 second, they should all be again at the same start position. However, what happen is that the fastest object (Object A) has a delay over the other two and this delay increase over time.

How can i fix this problem?

sentences:
How to clip what is outside scroll view when using a custom UI element? I have created a custom UI element (that use CanvasRenderer).

Here is code :

Mesh mesh = new Mesh();

Rect drawArea = GetComponent<RectTransform>().rect;

using (VertexHelper helper = new VertexHelper())
{
    helper.AddVert(new Vector3(drawArea.xMin, drawArea.yMin), Color.white, Vector2.zero);
    helper.AddVert(new Vector3(drawArea.xMin, drawArea.yMax), Color.white, Vector2.zero);
    helper.AddVert(new Vector3(drawArea.xMax, drawArea.yMax), Color.white, Vector2.zero);
    helper.AddVert(new Vector3(drawArea.xMax, drawArea.yMin), Color.white, Vector2.zero);
    helper.AddTriangle(0, 1, 2);
    helper.AddTriangle(2, 3, 0);

    helper.FillMesh(mesh);
}

var canvas = GetComponent<CanvasRenderer>();
canvas.SetMesh(mesh);
canvas.SetMaterial(Material, null);

It creates a simple rectangle that is same size as rect transform.

It works great. However if I put this inside a scroll view, everything that is outside scroll area / viewport is rendered (while it should be clipped).

The scrolling works as it should (rectangle get scrolled by changing position when scrollbar is used).

I have tried to call canvas.EnableRectClipping(...); but without success.

sentences:
MonoGame Save Game Location Example I am building a game using Monogame 3.6 and Visual Studio Community 2017. Up until this point I have been serializing the data using BinarySerialization and created a custom ContentImporter and ContentProcessor.

My question is what is the standard used for saving game data and where is it saved? I attempted to use the IntermediateSerializer class, but that was stored in XML and is easily modified. I would like to store the game data in a file that is more difficult to tamper with, which is why I chose binary serialization.

I would also like to see an example of code that uses the standard for file paths when saving to the file system. On my development system, I can save anywhere because I am Administrator. But I would like to understand which parts of the framework are available for me to get file path information and save the data.

sentences:
2d Procedural universe generation I want to create a flat universe, where at first the whole universe is blank.

That would be represented by a parallax scrolling nebula background image.

What I want to do is represent the planets as disc shaped objects in the universe.
They can be of various sizes.

The inside of the discs will consist of a landmass, then outside that will be a body of water and after that air.

what would be the best way to go about creating those tiles procedurally as for example the air would consist of various gases and the land of various minerals and resources.

My first thought is to create texture images and then stamp out the circles out of those textures, but problem is that those textures would have to wrap horizontal and vertically. Is there a fully procedural way of doing this?

sentences:
How do I launch a ballistic projectile to hit a moving target, given: launch position & angle, target position & velocity? This problem is in 3D space. My question is: How do you find the initial velocity of a projectile that flies under constant gravity, so that it hits a target moving with constant velocity, given the parameters:

Launch Position
Launch Angle
Target Position
Target Velocity
Acceleration due to Gravity

Most of the answers I find solve the problem using Launch Speed instead of Launch Angle.

The reason why I want to use Launch Angle, rather than Launch Speed, is because the arc of the projectile doesn't look good when solving with Launch Speed. The low angle is too low, and the high angle is too high.

My goal is to be able to adjust the arc of the projectile to be more visually pleasing, while still being able to hit the moving target 100% of the time.

sentences:
Cheap ways to do scaling ops in shader? I've got an extensive world terrain that uses vec3 for the vertex position attribute. That's good, because the terrain has endless gradations due to the use of floating point. But I'm thinking about how to reduce the amount of data uploaded to the GPU. For my terrain, which uses discrete / grid-based vertex positions in x and z, it's pretty clear that I can replace my vec3s (floats, really) with shorts, halving the per-vertex position attribute cost from 12 bytes each to 6 bytes. Considering I've got little enough other vertex data, and an enormous amount of terrain data to push into the world, it's a major gain.

Currently in my code, one unit in GLSL shaders is equal to 1m in the world. I like that scale. If I move over to using shorts, though, I won't be able to use the same scale, as I would then have a very blocky world where every step in height is an entire metre.

So I see these potential solutions to scale the positional data correctly once it arrives at the vertex shader stage:

Use 10:1 scaling, i.e. 1 short unit = 1 decimetre in CPU-side code. Do a division by 10 in the vertex shader to scale incoming decimetre values back to metres. Arbirary (non-PoT) divisions tend to be slow, however.
Use (some-power-of-two):1 scaling (eg. 8:1), which enables the use of a  bitshift (eg. val >> 3) to do the division... not sure how performant this is in shaders, though. Not as intuitive to read values, but possibly quite a bit faster than div by a non-PoT value.
Use a texture as lookup table to convert the value from decimetres to metres. I've heard that this is really fast.

Or whatever solutions others can offer to achieve the same results -- minimal vertex data with sensible scaling.

sentences:
Algorithm for drawing asteroids from, er... Asteroids game? What would the algorithm be for generating/drawing the asteroid shapes from the original Asteroids game? Is it even an algorithm? Or would they be hard coded shapes?

Here is a screenshot to jog your memory.

Screenshot from Asteroids game http://www.heinzwerner.de/emu_asteroids.jpg

EDIT - Also found this:

alt text http://www.next-gen.biz/files/images/feature_article/2009/05/asteroids4.jpg

from the article Edge - The Making of Asteroids. Interesting read, but does not mention any specifics.

sentences:
Creating three-dimensional biomes I have an idea for a space-based game where there are different sectors of control. These would be set up in a manner similar to terrain biomes, where there will be clusters with limited space between them where there are 'mixed' biomes or even no biomes whatsoever, indicating no 'side' has control over that region.

There are a plethora of articles on the web these days about how to create two dimensional biome maps, but I have seen none about making three-dimensional maps. Has anyone done any coding like this before? My Google-fu is strong but I haven't found any significant pages on it.

I will continue to work on it solo, but as a beginning, solo programmer I expect I will be quite slow on it. I was just wondering if anyone had done this already.

sentences:
error after changing the app name I have made a game in Libgdx(eclipse).I changed the name of the app inside the
string.xml file.Now I have an error in AndroidManifest.xml. in this line:
  android:label="@string/app_name" (line 12).
its written:" No resource found that matches the given name (at 'label' with value '@string/app_name')."
what is the solution?

sentences:
Unity 2D animation issue I have this weird animation bug in Unity that I believe is how Unity handles the frame. I dont know how to show the image so I'll do my best to explain it. So I put a bunch of 2D sprites in a sequential order right and I made a timer in my code to play animation whenever. The weird thing is that it does complete the whole animation but then it goes back to the first frame and ends it. I tried changing the timer to every number possible but it just does the same thing or repeats the animation twice when I increase my timer.

Here's the code :

using UnityEngine;
using System.Collections;

public class PlayerAttack : MonoBehaviour {

private bool attacking = false;//Switches for all attac combo
private bool attacking2 = false;
private bool attacking3 = false;

//attack 1 stats
public float attackTimer = 0f;
public float attackCD = .3f;

public Collider2D attackTrigger;//Referring to our attack collider

Animator anim;

// Use this for initialization
void Start () {
    anim = GetComponent<Animator> ();
    attackTrigger.enabled = false;//Disable our collider at start
}

// Update is called once per frame
void Update () {
    if (Input.GetKeyDown ("space") && !attacking)
    {
        attacking = true;//We are attacking
        attackTimer = attackCD;//assign variables

        attackTrigger.enabled = true;//Enabled our trigger collider
    }

    //If we are attacking
    if (attacking) {
        //Check if our timer is greater than zero
        if(attackTimer > 0){
            attackTimer -= Time.deltaTime;//Decrease our timer
        }else
        {
            attacking = false;//We arent attacking anymore
            attackTrigger.enabled = false;
        }
    }
    anim.SetBool ("Attack", attacking);
 }
}

sentences:
Having troubles with LibNoise.XNA and generating tileable maps Following up on my previous post, I found a wonderful port of LibNoise for XNA. I've been working with it for about 8 hours straight and I'm tearing my hair out - I just can not get maps to tile, I can't figure out how to do this.

Here's my attempt:

            Perlin perlin = new Perlin(1.2, 1.95, 0.56, 12, 2353, QualityMode.Medium);
        RiggedMultifractal rigged = new RiggedMultifractal();

        Add add = new Add(perlin, rigged);

        // Initialize the noise map
        int mapSize = 64;
        this.m_noiseMap = new Noise2D(mapSize, perlin);
        //this.m_noiseMap.GeneratePlanar(0, 1, -1, 1);

        // Generate the textures

        this.m_noiseMap.GeneratePlanar(-1,1,-1,1);
        this.m_textures[0] = this.m_noiseMap.GetTexture(this.graphics.GraphicsDevice, Gradient.Grayscale);

        this.m_noiseMap.GeneratePlanar(mapSize, mapSize * 2, mapSize, mapSize * 2);
        this.m_textures[1] = this.m_noiseMap.GetTexture(this.graphics.GraphicsDevice, Gradient.Grayscale);

        this.m_noiseMap.GeneratePlanar(-1, 1, -1, 1);
        this.m_textures[2] = this.m_noiseMap.GetTexture(this.graphics.GraphicsDevice, Gradient.Grayscale);

The first and third ones generate fine, they create a perlin noise map - however the middle one, which I wanted to be a continuation of the first (As per my original post), is just a bunch of static.

How exactly do I get this to generate maps that connect to each other, by entering in the mapsize * tile, using the same seed, settings, etc.?

sentences:
Other displacement/deformation methods than vertex displacement? Using vertex displacement on low-res models lead to artifacts, and I imagine tessellation might be a bit slow, if I want it pixel-perfect.
I know signed distance fields can be used, though I doubt that's fast either.
Are there any other approaches? Is using tessellation fast enough for a large scene with hundreds of constantly deforming objects?

sentences:
2D Driving Game with Unity I'm trying to make a 2D car driving game in Unity and I'm having problems with my code.

I am able to move forward,backward,turn left/right using arrow key from my present code

using UnityEngine;
using System.Collections;

public class CarControll : MonoBehaviour {

// Use this for initialization
float speedForce = 15f;
float torqueForce = -200f;
float driftFactorSticky = 0.9f;
float driftFactorSlippy = 1;
float maxStickyVelocity = 2.5f;
float minSlippyVelocity = 1.5f;

bool move=false;
public bool forwardArrow=false;
public bool backwardArrow=false;

public bool rightTurn=false;
// Use this for initialization
void Start () {

}

void Update() {

    move=true;
}

// Update is called once per frame
void FixedUpdate () {

    Rigidbody2D rb = GetComponent<Rigidbody2D>();

    float driftFactor = driftFactorSticky;
    if(RightVelocity().magnitude > maxStickyVelocity) {
        driftFactor = driftFactorSlippy;
    }

    rb.velocity = ForwardVelocity() + RightVelocity()*driftFactor;

    if( Input.GetButton("Accelerate") || Input.GetButtonDown("Forward") || Input.GetKeyDown(KeyCode.UpArrow)) {
        Debug.Log ("Uparrow....................................................");
        rb.AddForce( transform.up * 20);

    }

    if( forwardArrow==true) {

        rb.AddForce(transform.up*0.5f);
    }

    if(backwardArrow==true) {

    rb.AddForce( transform.up * -speedForce/25f );
    }

    if(Input.GetButton("Brakes") || Input.GetButton("Backword") || Input.GetKeyDown(KeyCode.DownArrow)) {

        rb.AddForce( transform.up * -speedForce/2f );
    }

        float tf = Mathf.Lerp (0, torqueForce, rb.velocity.magnitude / 2);
        rb.angularVelocity = Input.GetAxis ("Horizontal") * tf;

}

Vector2 ForwardVelocity() {

    return transform.up * Vector2.Dot( GetComponent<Rigidbody2D>().velocity, transform.up );
}

Vector2 RightVelocity() {

    return transform.right * Vector2.Dot( GetComponent<Rigidbody2D>().velocity, transform.right );
}

public void MoveForward()  //forward button
{
    forwardArrow = true;
    backwardArrow = false;
}

public void MoveBackward() backward button
{
    backwardArrow = true;
    forwardArrow = false;
}

public void RightTurn()  //right button
{

    rightTurn = true;
}

}

I have added four button(Forward,backward,right,left).Now I need to move the car using this button. The car is moving Forward,backward using the button but when Press the right/left button the car is not Turing left/right while move.But its working perfectly on key press.Can anyboady help solving this issue

sentences: Getting help on collaboration with Unity especially programmers My team and I are currently creating a 3D tower defense game with Unity and are compromised of me a few animators modelers and programmers. However as I am still fairly new to Unity I have trouble figuring out ways to collaborate with them. I know not what practices or advice I could get on the front of developing this game. I was hoping someone here might have some insight as to how best to collaborate with all team members and what one might do to get a better flow of information and help or assistance when working on this project. We are all about an hour or more away from each other so we must work remotely to collaborate. Thank you in advance.

sentences:
Do Octrees, Kd-Trees, BSP only make sense for static geometry? I'm still implementing my scene graph (see this question). Now, I wonder if a spatial representation such as a Kd-Tree or Octree to do View Frustum Culling (VFC) only makes sense with static geometry. The reason for my doubt is that usually dynamic geometry is a small part of the scene, while static geometry can be very large, and dynamic geometry forces to handle updates in the spatial representation at each frame.

Your opinions?

Tunnuz

sentences:
How do I get the height of an XNA SpriteFont? I have some text in a spritefont and I need to know the height in pixels.

I would have thought that MeasureString() would get me close to it, but it seems to just be about length.

sentences:
How can I use IntelliJ to make Minecraft mods? I'm starting out creating Minecraft mods with my son.

I've seen one YouTube tutorial which sets up project with Eclipse.

Since I don't like Eclipse much, I ask: how would I setup IntelliJ or Android Studio(if feasible) to develop Minecraft mods?

My son specifically want to create roller coaster mods.

sentences:
Comparing two tree structures I'm having a hard time trying to describe this in correct terms so I will just give as much detail as possible and hopefully someone knows what I'm trying to do =-)

I am trying to compare two node trees to determine how similar/different they are structure-wise. In my diagrams below, both examples have the same number of children, grandchildren, etc. In example 1, Root has a child with two children, but in example two, root does not.

I could probably figure out how to recursively loop through and count how many of each level there are and compare that, giving me an idea of how similar the trees are, but only doing it that way, it will look like they are identical, but in fact they aren't.

Anyone happen to know about this? Or even what the technical term for what this is?

Edit: Also, this is in C# and I am using Lists to store these objects and their children.

Example 1

Example 2

sentences:
Find optimal placement for label/sticker on a simple polygon with holes I'm working on a real-time archviz renderer and I need to place a label/sticker/decal on walls, which have openings. So one way to think about this is a simple (possibly concave) polygon with holes. So there are two things I need: optimal position, maximum fitting size.

After some research I came to conclusion that I need a solution for maximum inscribed circle in a simple polygon. That will provide both the position and radius.

https://www.sthu.org/blog/14-skeleton-offset-topology/index.html

And couple of other questions, most answered by Stefan Huber, apparently The Authority nowadays regarding this problem. I'm time constrained and looking for plugin solution. So it's either commercial solutions (*Vroni) or CGAL that can at least help me construct straight skeleton. However my environment is JVM, not C++ (yes, I can go the FFI way using JNA).

Can you think of any other solution that I could use to position/scale the labels?

sentences:
Using 16 bit index buffers - USHORT vs UINT In D3D11, they still have the ability to make 16 bit and 32 bit index buffers.

Few models will use more than the max (20k tri) that a USHORT index buffer can handle, but will I really pay a bad performance cost for always using an INT (32 bit) format?

Memory savings aren't that much (2 bytes per index!).  For a 20k tri model, that's only 40 kB of memory we're saving for using the USHORT (compared with probably a lot more for just the vertex data for that same model).

Is it really worth ever using USHORT index buffers then, or is this just a holdover from when computers had less memory in the 90's?

sentences:
Unity Terrain Tools plants trees sideways My tree is clearly straight, but painting trees result in sideways ones.
What can cause this?
Tree is straight when placed manually as a prefab.

sentences:
Where can I find examples of demoscene-like pixel art effects? I will keep this simple. The question pretty much sums up what I am looking for. Where are some locations for 2D effects. Specifically ones like those used in old Amiga demos. They do not need to have source code. I am just looking for inspiration to code and replicate some of the effects.

It would be nice to have a list of links to images and examples as opposed to downloading old demos and running them through an emulator.

sentences:
deferred rendering and point light radius I use a common attenuation equation for point lights:
attenuation = 1 / kc + kl * d + kq * d^2.

I use deferred rendering so I need to know a light radius. An example light has following intensity: vec3(10, 1, 8). RGB components can be greater
than 1.0 beacuase of HDR/Tone Mapping. How to calculate a light radius ?

Edit1
An attenuation equation can be defined this way (link) and we get following equations:

attenuation = 1 / ( (d / r) + 1) ^ 2
attenuation = (attenuation - cutoff) / ( 1 - cutoff)
attenuation = max(attenuation, 0)
lightRadius = r * (sqrt(Li / cutoff) - 1)
cutoff = minLuminance / lightLuminance
Li = lightLuminance

Let's assume that d = 40, r = 1, lightLuminance  = 10 and minLuminance = 0.01. Then: lightRadius = 99 but attenuation = 0. What is wrong ?

sentences:
Why does SDL2 blur pixel art even with SDL_HINT_RENDER_SCALE_QUALITY set to 0? I am working on a game with SDL2 and having trouble turning off linear filtering when upscaling textures.

My game has a bunch of 32x32 tiles. I used SDL_RenderSetLogicalSize so that there is a one-to-one pixel mapping (i.e. my logical size is n * 32 x m * 32.)

However, when the the whole scene is upscaled to fit the actual screen, it seems to be interpolated (blurry).

I saw these two other posts (1, 2) which recommended using SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");. I did that, but nothing seems to change at all. It returns true and it is in fact changing the hint, but the rendering just doesn't change at all. I even tried setting it with priority but nothing changes.

Any idea how to fix this? I am on Windows if that's relavent.

sentences:
What are good questions for design interns? I've recently been interviewing design interns and been pitching what I consider fairly easy practical design questions to measure their skill level. I've been shocked by poor quality of answers. Now this may be the quality of the applicants.

What questions do you ask an entry level games designer to probe for their skill level?

sentences:
Libgdx understanding screen size I'm trying to create my own jumper type game where the player moves up through an infinite y value. The problem I am having is getting the screen size to match up with the android screen.

  viewport = new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), camera);
    camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

Currently I just want the sprite to be drawn in the center of the screen. I'm not worried about the game world size as it will differ from each device.

  camera.update();
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    batch.draw(player.getKeyFrame(animationTime), Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);

This draws the player somewhere in the upper right corner of the screen. It's my understanding that Gdx.graphics.getwhatever is used to get the dimensions of whatever your device screen is. So I'm wondering if I'm using the viewport class correctly or not?

sentences:
How fast do games in Flash C++ Compiler execute compared to C++? Flash Player can now run C++ code, that is cross complied with the Adobe Flash C++ Compiler. How fast does such code run in comparison to a C++ application running as an EXE, in the context of gaming?

And does GPU rendering performance compare with C++ applications? Or is Flash far behind?

sentences: Monte Carlo Tree Search for simultaneous multiplayer game I am developing AI for bomberman and i want to implement monte carlo tree search. I read that MTCS can be applied for simultanous multiplayer game. Problem i have is that i dont know how to implement it. For instance, how to store all possible moves in one game state or how to apply UTC selection. Should i call utc selection for all players and final state to select will be combination of their moves? Has anybody any literature to read or article? Thanks

sentences:
Storage and Lookup of Voxel Chunks How can one store chunks in such a way that they can be looked up using their XYZ location without wasting memory?

The problem with a HashMap<Vector3i, Chunk> is that you have to keep creating Vector3i objects, just to use them in the lookup.

I am basically looking for a solution that does not involve the creation of an object to perform a lookup.

sentences:
Which SceneGraph is optimal to begin with for small game programming? I am a Java web application developer (mostly server side) since 7 years who recently got interested in game development (i dont know why, maybe i am bored). Today I was looking for frameworks. I read about a few scene graphs and took a look at jMonkeyEngine. It was recommended here and here.

My first goal was to create a simple plane and a sphere which could be moved around using the keyboard. Well, as I mentioned I am a web developer and never programmed anything else so I started with the tutorials of jMonkey. But I wasn't able to get them working. I took a look at the wiki but I noticed that the documentation seems to be very poor, at least compared to what I am used to. I then took a look at a few other scene graph's (also for C++) but they also seem to have an outdated, incomplete poor documentation.

Can someone recommend me a scene graph which is well documented with working samples? Or is there something like the "ultimate guide" to get into this topic? Do I first need to know how to develop my own scene graph to get it working or is it possible to just understand the abstract principles and use it from a higher point of view?

Somehow I have the feeling I need to understand the deep insides of a scene graph to use it well (like it's the case for ORM tools in web dev, you can't use them well if you don't understand databases)

I'm sorry if this question is too 'noobish', but I just want to get on my feet and do my first steps.

sentences:
Random numbers on C++ Recently I got used to modern languages which include a stock good random generator, which usually is the Mersenne Twister; now that I got back to C++ I have to decide what to use.

I searched for Mersenne Twister implementations and I noticed there are so many: is there one which is more used and widespread, or am I supposed to pick one assuming they are all equally good?

sentences:
Which is the best method implementing a background scrolling for game in libgdx? My question is very simple I am new to libgdx development, which is the best approach implementing a background that is to make the background move in y direction

1)My First approach is drawing the background image 10 times towards positive y direction using camera.translate(x,y) function to move camera from bottom to top
2)second approach is to make the camera still while making the background scroll ie drawing the background frame by frame updating the position each time

Can you please suggest which is the best approach?

sentences:
cocos2d - exclude GUI layer transformation I have a game layer that should be pannable and pinchable and a GUI layer as an overlay that's excluded from the transformations. I added the pinch and pan gesture recognizer to the view and set the view.transform like so

view.transform= CGAffineTransformConcat(panTransformation, pinchTranslation);

But it actually scales/moves the GUI layer, ofcourse, as it is a layer added to that view aswell. Sure I could do the transformations the layer itself, but the touch coordinates are scaled aswell, and calculating where the user actually tapped based on scale and translation looks like a big overhead to me.

Can I somehow add a separate view and make a GUI layer it's child? Or in any other way add GUI layer that's excluded from the transformations ?

sentences:
How do I add an "offset" to LookAt? I have created a Third Person Controller.
The camera is behind the player:

I would like to make it so that the player aims at the mouse pointer position.
To do that, I use the following code to rotate the chest towards the position:
        var mousePos = Input.mousePosition;
        mousePos.z = 10; // Make sure to add some "depth" to the screen point
        var aim = Camera.main.ScreenToWorldPoint(mousePos);
        Chest.LookAt(aim);

The hands do not perfectly straightly point forwards, so I need to add an "offset" to the LookAt.
I tried this approach:
var mousePos = Input.mousePosition;
mousePos.z = 10; // Make sure to add some "depth" to the screen point
var aim = Camera.main.ScreenToWorldPoint(mousePos);
aim += new Vector3(ChestAimCenterOffsetForLookatBecauseChestIsNotStraightForward, 0, 0);

Chest.LookAt(aim);

Of course I do all rotation patching in LateUpdate(). In Update(), it would simply be erased by the animation itself.
It does work, but when the model is rotated around the Y axis, something goes wrong: The offset is "wrong", it doesn't have the same effect.
This surprises me because all I do is rotate the entire model.
So I think this line is not correct:
aim += new Vector3(ChestAimCenterOffsetForLookatBecauseChestIsNotStraightForward, 0, 0);

Is this not the way to offset the LookAt results?

sentences:
How do I use GetComponent on multiple children? I'm a beginner and I'm making a game in Unity where I set random colors for four enemies. I made an empty object called "enemies" for me to use it as a folder for the four enemies. I want to get the colors of the enemies and pick randomly one of them for my player.

I wrote this piece of code and I wanted it to store the colors in a list, but whenever I try to print it I find out that it only stores the color of the first child in the "enemies" hierarchy. How do I fix this?

enemies = GameObject.Find("enemies");

GameObject[] allenemies = new GameObject[enemies.transform.childCount];
List<Color> colors = new List<Color>();

foreach (Transform child in transform)
{
    allenemies[i] = child.gameObject;
    i++;
}

foreach (GameObject child in allenemies)
{
    thecolor = enemies.GetComponentInChildren<Renderer>().material.color;
    colors.Add(thecolor);
}

finalcolor = Random.Range(0, colors.Count);
//Debug.Log(finalcolor);

mr.material.color = colors[finalcolor];

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:
Load Material from file path or parse .mat file to Material - Unity Is it possible to load a material from a file path? Or, otherwise parse a .mat file saved on disk to a Material usable at runtime?
I had naively thought it would be possible to assign the bytes from a .mat file, as read by File.ReadAllBytes to a Material object, but that does not seem to work.

sentences:
Rotate meshes with different pivots, equality If I have multiple equal meshes but with different pivots and I make a rotation on the first, is there a way to replicate this rotation to all meshes using a rotation Matrix?
For example, if I have a cube, one with it's pivot in the center and another with the pivot outside of the mesh, how can I rotate the first one 90 degrees on the X axis and use it's rotation Matrix to have the second model rotate on itself and not on his pivot?
Assuming that when I pass on the rotation matrix to other meshes I can't pass the vector of the pivot, is this possible?

sentences:
If I make a 3d model in a .fbx format, do I owe any royalties/fees to autodesk for using fbx files in Unity? I'm currently making a game where every format for every asset is either opensource/freeformat, or requires no license fees to use.

I've pretty much settled happily on .ogg for audio, vorbis/webm for video, .png for pictures and openoffice for documents (or .pdf files since they were free standard since 2001?)

What I'd like to know though is, if I make a 3d model in a .fbx format, do I owe any royalties/fees to autodesk for using fbx files in Unity?

If not, does this apply to every 3d model format, or only certain ones? Do software companies like Blender/Unity pay for the privilege to import fbx files so that users like me don't have to?

sentences:
Unity - resizing particles dont mantain collisions properly I am trying to make particles for blood on death. This is what I got so far:

Which looks fine and all. But now I also wanted to make the blood particles turn smaller over their lifetime, so I checked "Size over lifetime" and this is what happens now:

See the problem? As they shrink, they seem to float a little, giving some space between the floor they are laying on. This behaviour is not really desired.

How could I solve this?

sentences:
How to enable CrossPlatformInput in Unity? I'm new to Unity but not a complete programming novice.

I'm trying to use the CrossPlatformInput component from the "Car" prefab from Standard Assets.

I can't see it appear and when reading the notes file it says this:

  Importing the CrossPlatformInput package adds a menu item to Unity, "CrossPlatformInput", which allows you to enable or disable the CrossPlatformInput in the editor. You must enable the CrossPlatformInput in order to see the control rigs in the editor, and to start using Unity Remote to control your game.

So,

What is "a menu item" and where do I find it in the Unity UI?
How do I enable CrossPlatformInput? I have dragged the prefab called DualTouchControls into my scene but I can't see anything and I'm not sure how to link it to the actual car object.

sentences:
Getting around limitations posed by float in space game I'm working on a procedurally generated game set in outer space. As in the real world, the game universe will be pretty much 99% empty, with planets/stars/solar systems etc... being very far apart.

For example at the beginning of the game, you will pretty much be stuck in the solar system you spawn in, as even flying from planet to planet will take a very long time. Flying from one solar system to another will be theoretically possible, however it would take days of IRL time without obtaining the in-game equivalent of a warp-drive.

I realize with all the thousands of planets/stars etc... they can't all be updated 60 times per second, and I can deal with that. Let me describe my problem.

Okay, so lets say 1 meter is 16 pixels.

Earth diameter      =  12,756,000 meters
Earth diameter      = 204,096,000 pixels
Earth circumference = 640,861,440 pixels

Okay, that's... still arguably manageable. Obviously there wouldn't be an earth.png, it could be procedurally rendered. But it gets worse:

Distance from earth to sun =   149,600,000,000 meters
Distance from earth to sun = 2,393,600,000,000 pixels

So if we define earth as our arbitrary origin, and we travel to the sun in our ship:

int main()
{
    //        Distance to sun:
    //        2393600000000
    float X = 2383695718491;
    std::cout << X << "\n";

    X += 6;
    std::cout << X << "\n";
}

This outputs:

2.3837e+012
2.3837e+012

That's the correct amount of zeroes, but now over 4 million pixels of precision is lost, and that's a big deal. And of course, the distance to the sun is tiny compared to the distance to the nearest star.

For the purpose of the game universe, I will decrease the distances just to make travel a little less boring, but this is still clearly impossible by only using x and y variables.

How should I handle these huge distances?

UPDATE: Just to clarify, I realize that earth is unimaginably huge and there's no way I'd be able to fill it with meaningful content. GTA V's map is about 100 square miles, and that's less than .00000005% percent of earth's surface. So my planets will definitely be significantly smaller than this, however the issue with huge distances remains.

sentences:
Calculate whether you can jump from one platform to another I need some kind of formula that will help me connect two platforms that are reachable to each other by jump. I am working on a pathfinding implementation for a 2D platformer and preprocessing the map has been the bane of my existence. Here are some of the physics involved in this platformer:

fallSpeed = 670 px/s (Maximum speed falling in the downwards direction)

gravityAcc = 2000 px/s^2

jumpSpeed = 555 px/s (velocity component along the y-axis)

walkSpeed = 125 px/s (Base speed of a character)

sentences:
Wheels not facing right direction when car faces different directions I am creating a real time multiplayer driving game in Unity. I am using google play's real time multiplayer service. I am having an issue where the wheels of the cars that are over the network are not facing the right direction. What I am currently trying to do is just add the calculated steering angle to the current rotation of that particular player's car, but for some reason the wheels face the wrong way and rotate incorrectly if the car is facing certain directions. Logically I thought what I have is correct. Basically for each wheel I use this code:

car.transform.rotation = Quaternion.Euler(0, car.transform.rotation.y + steerAngle, 0);

So I find the rotation of that car and then I add the steer angle to it. Why wouldn't this work?

sentences:
How to make my simple round sprite look right in XNA Ok, I'm very new to graphics programming (but not new to coding). I'm trying to load a simple image in XNA which I can do fine. It is a simple round circle which I made in photoshop. The problem is the edges show up rough when I draw it on the screen even with the exact size. The anti-aliasing is missing. I'm sure I'm missing something very simple:

        GraphicsDevice.Clear(Color.Black);

        // TODO: Add your drawing code here
        spriteBatch.Begin();
        spriteBatch.Draw(circle, new Rectangle(10, 10, 10, 10), Color.White);
        spriteBatch.End();

Couldn't post picture because I'm a first time poster. But my smooth png circle has rough edges. So I found that if I added:

spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied);

I can get a smooth image when the image is the same size as the original png. But if I want to scale that image up or down then the rough edges return. How do I get XNA to smoothly resize my simple round image to a smaller size without getting the rough edges?

sentences:
Marketing a game with limited budget I am building a decent multiplayer iOS-Android card based game. While this game is played with regular old 52 cards deck, it does have unique rules and game play. That makes it little hard to market since no one is precisely looking to play  initially.

I have been researching quite a bit about game marketing and most recommendations are to build out fan following which is also quite hard and time consuming (taking away from building game).

I have some indie marketing budget (~5k) I set aside to help gain some traction. While I understand that this not my strengths, what are the best ways to invest it into the game?

sentences:
Test for the presence of the ouya ODK How would it be possible to test for the presence of the ODK at run time?
Currently I took this approach:

private activityDelegate delegate;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //Need to test for the presence of the ouya ODK here
    {
        delegate = new OuyaDelegate(savedInstanceState);
    }
}

But maybe there is a better way of doing this than in the main activity?

sentences:
Unity Deactivating Keyboard Input Interpolation I'm working on a game in Unity, and it is a little jarring to use with keyboard controls. I'm using the built in Input Manager, where I have a set of axes mapped to the left and right keys. When the player is using the keyboard instead of a joystick, I'd like it to simply be -1 when hitting left, 1 when hitting right, and 0 otherwise, but this isn't the case. I've found that for the first few frames of the button being held, Unity automatically builds up to the value-- for example, if I'm holding right, the value wouldn't go straight from 0 to 1, but rather from 0, to 0.25, to 0.5 and so on, continuously up to 1. Can I deactivate this? If so, how?
Thanks in advance.

sentences:
How can i change the Camera component height in FirstPersonCharacter? The player looks very short. I changed his scale to 2,2,2 but the camera is in the middle it's like the player head is in the middle and not near the top.

In the screenshot in the Hierarchy i have a FPSController and the FirstPersonCharacter with the Camera is child of it. The FPSController scale set to 2,2,2 like the two soldiers. But you can see when i'm getting closer to the soldiers it looks like i'm looking at them from the ground.

I need to move the camera only up somehow.

And this is the camera and the firstpersoncontroller before running the game:

sentences:
Which iPhone/iPod Hardware to Support for iPhone Game I'm coming from a background of Android. I would like to figure out what kind of iBlah device hardware I need to support for iPhone game development; something like Android's OS distribution stats, but for iBlah hardware.

From my research, it seems that I need to support both iPod and iPhone. But which versions of hardware? is 3G still used? What about 3GS?

For example, the -S phones seem to have dual core instead of single-core CPUs.

I also worry about performance. In Android, I had a severely low-end phone, which meant pretty much anything that ran okay there ran okay on other phones. For iPhone, how do I figure out what to support in terms of performance?

sentences:
Collision detection: Swinging bat/racket and ball I am programming a side-view tennis game, inspired by an old arcade game,
using Javscript and HTML5 canvas elements. The player can move left and right and holds a racket at arms length which can be rotated 360 degrees around the shoulder joint.

I am quite happy with the collision detection and resulting deflection angle between the racket and the ball in the case where the player stands still and the racket does not move. I use a ray-casting approach for this collision detection between the vector that represents the racket and the trajectory vector for the ball as proposed here.

However, I am having trouble implementing the collision detection between the rotating racket and the ball. When the racket is swung, the area in which a collision would apply has a shape similar to a circular segment , but the racket rotates rotates to fast and the collision detection does not pick it up in most cases.
The image bellow illustrates the problem, the red arrow indicates the direction of the swinging racket.

The following code snippet from the player entity's update function shows how the racket is updated. arcmx and armcy is the location of the shoulder joint, rstart_ and rend_ are the beginning and end of the racket.

  if(KEY_STATUS.rleft || KEY_STATUS.rright) {
    if(KEY_STATUS.rright) {
      this.rangle += this.rspeed;
    } else if (KEY_STATUS.rleft) {
      this.rangle -= this.rspeed;
    }
  }

  this.armcx = this.x + this.width/2;
  this.armcy = this.y + 46;
  this.rstartx = this.armcx + Math.cos(this.rangle)*40;
  this.rstarty = this.armcy + Math.sin(this.rangle)*40;

  this.rendx = this.armcx + Math.cos(this.rangle)*71;
  this.rendy = this.armcy + Math.sin(this.rangle)*71;

I am pretty lost on this problem and appreciate any hints on how to approach it.

sentences:
Adding Shader Model 3.0 support to my Direct3D9 app So far, we've only used pixel shaders because we never needed to do any custom processing at the vertex shader level. However, the 3.0 model shader forces you to define a vertex shader. And that's where I get lost.

That's because our pixel shaders have this signature:

sampler2D Texture0;

struct PixelShaderInput{
        float2 TexCoord : TEXCOORD0;
        float4 Color : COLOR;
};
struct PixelShaderOutput {
    float4 color : COLOR0;
};
PixelShaderOutput PixelShaderFirstPass( PixelShaderInput input ) {
        //Magic happens here
        //We use the tex2D function to sample Texture0
}

From what I've read about vertex shaders, the vertex shader output is the pixel shader input. So I added this:

struct VertexShaderInput{
    float4 Position : POSITION;
}

PixelShaderInput MyVertexShader( VertexShaderInput input  ){
     //At a loss here...
}

I don't know how to map the vertex shader input to the pixel shader input. All examples I found on the web just have the vertex shader return a float4, which is what their pixel shader expects.

sentences:
Cocos2d v3 - addChild method make performance problems i have currently a performance problem with the addChild method in cocos2d version 3.3. My scenario is currently that i have about ten CCNode which holds a bundle of other CCNode (about 500), i called those ten "Big Node".

The childs of the "Big Node" has their own childs (about 3). Those CCNodes are sprites.

None of the childs from "Big Node" runs any actions. Everthing happens in their update method (if this relevant).

In my main scene i figured out which "Big Node" are on screen. If their is a new "Big Node" or the old one is not anymore visible on the screen i run this code:

self = mainScene
_allBigNodes = holds all avaible big nodes

        NSMutableArray * childsToRemove = [NSMutableArray arrayWithCapacity: _children.count];

        for(CCNode * child in _children){
            if([child isKindOfClass:[BigNode class]]){
                [childsToRemove addObject:child];
            }
        }

        for(CCNode * child in childsToRemove){
            [child removeFromParentAndCleanup:NO];
        }

        [childsToRemove removeAllObjects];

        for(int BigNodeIndex = _fromBigNodePosition; BigNodeIndex<=_toBigNodePosition; ++BigNodeIndex){

            BigNode * BigNode = [_allBigNodes objectAtIndex: BigNodeIndex];

            [self addChild: BigNode];

        }

The main screen has normaly maximum two childs. The above method works fine.

In concerning to the question: sometimes in my game i have some jittery movement. So i figure out with the profiling tool that the addChild method above cost between 60-100ms.

Running Time    Self                        Symbol Name
90.0ms   79.6%  0.0                         -[CCNode addChild:]
90.0ms   79.6%  0.0                          -[CCNode addChild:z:name:]
89.0ms   78.7%  0.0                           -[CCNode onEnter]
88.0ms   77.8%  0.0                            -[NSArray makeObjectsPerformSelector:]
88.0ms   77.8%  0.0                             -[CCNode onEnter]
72.0ms   63.7%  0.0                              -[NSArray makeObjectsPerformSelector:]
71.0ms   62.8%  0.0                               -[CCNode onEnter]
42.0ms   37.1%  0.0                                -[NSArray makeObjectsPerformSelector:]
42.0ms   37.1%  0.0                                 -[CCNode onEnter]
39.0ms   34.5%  0.0                                  -[CCScheduler scheduleTarget:]
38.0ms   33.6%  2.0                                   PrioritySearch
1.0ms    0.8%   1.0                                   DYLD-STUB$$objc::DenseMap<objc_object*, unsigned long, true, objc::DenseMapInfo<objc_object*> >::grow(unsigned int)
1.0ms    0.8%   0.0                                  -[CCNode physicsNode]
1.0ms    0.8%   0.0                                   -[CCNode physicsNode]
1.0ms    0.8%   1.0                                  objc_msgSend
1.0ms    0.8%   1.0                                  objc_object::sidetable_release(bool)
28.0ms   24.7%  0.0                                -[CCScheduler scheduleTarget:]
26.0ms   23.0%  1.0                                 PrioritySearch
1.0ms    0.8%   0.0                                 -[CCScheduler scheduledTargetForTarget:insert:]
1.0ms    0.8%   1.0                                 DYLD-STUB$$objc_msgSend
1.0ms    0.8%   0.0                                -[CCNode physicsNode]
1.0ms    0.8%   1.0                               DYLD-STUB$$objc_msgSend
16.0ms   14.1%  0.0                              -[CCScheduler scheduleTarget:]
14.0ms   12.3%  0.0                               PrioritySearch
2.0ms    1.7%   0.0                               -[CCScheduler scheduledTargetForTarget:insert:]
1.0ms    0.8%   0.0                            -[CCScheduler scheduleTarget:]
1.0ms    0.8%   1.0                           -[CCNode wasRunning:]

So my question would be: Is there a way to deactivate a ccnode or what is the best solution to handle this scenario of having many ccnodes or these "Big Nodes" which are offscreen?

Thank you in advance

sentences:
How do I deal with this tilemap wraparound edge case? I'm building a 2D game engine that uses tilesets to build levels.  I recently added functionality to handle wraparounds (ie. where the right edge of the map connects to the left edge.)  The engine scrolls the map to follow the character around, remaining centered on the player whenever possible.

I implemented wraparound as follows:

The map engine has a Viewport object, which has a bounding rect and can test each tile to see if the tile is contained within the viewport.  When the screen coordinates are such that wraparound is needed, the viewport can set up sub-viewport objects that display different parts of the coordinate space, and place them side by side.

Each frame, I test the tiles on the map against the viewport to see if they can render.  Each tile object has a viewport property designating which viewport it's rendering into.  In the case of a composite viewport, this will delegate the test to each sub-view in turn, and on the first match, set the tile's viewport object and break the loop.

This works just fine in practice, until I hit one specific edge case: When the map is the minimum size, which is exactly the size of the screen, while trying to scroll, the tiles along the edge will be in the area of both viewports at once until the scroll completes the full width of that tile, which causes it to render on one edge and the other edge to show blank space for a moment.

I could resolve this by giving each tile a list of viewports instead of a single one, but that would significantly increase the complexity of my rendering, which I want to keep as fast and simple as possible, just to deal with a minor edge case.

Does anyone know of an elegant way to resolve this issue?

sentences:
Using break statement in a GLSL compute shader I'm writing a compute shader that is invoked once for each vertex of a geometry, and does a distance based search to find the the N closest vertices. To do this each invocation iterates over the position buffer and does a distance based check:
uniform float   uRadius;
uniform int     uMaxPoints;
void main()
{
    vec4 currentPoint = texelFetch(inputPosBuffer, ivec2(gl_GlobalInvocationID.xy), 0);

    if (currentPoint.w < 1.0f)
    {
        int pointsInRange = 0;
        uint rx; // inputPosBuffer width
        uint ry; // inputPosBuffer height

        // I also tried to add the uMaxPoints check to the for loop
        // as opposed to using a break
        // but the results also seems to be wrong
        for (uint i = 0; i < rx * ry, pointsInRange < uMaxPoints; i++)
        {
            uint x = i / rx;
            uint y = i % rx;
            vec4 p = texelFetch(inputPosBuffer, ivec2(x, y), 0);
            if (distance(currentPoint.xyz, p.xyz) <= uRadius)
            {
                pointsInRange++;
            }

            if (pointsInRange >= uMaxPoints)
                break;
        }
        currentPoint.w = float(pointsInRange);
    }
    imageStore(computeOutputBuffer, ivec2(gl_GlobalInvocationID.xy), currentPoint);
}

The issue is my break statement which I use to stop looping if uMaxPoints (max number of closest points to find) is reached, I'm not sure what happens but if I remove it the outcome is correct. I am assuming that my texelFetch should not be causing any problems as it is a read only.
So two questions:

Is it OK to use break in this context or does it maybe apply break to the whole work group?
Do I need a barrier somewhere or something similar?

sentences:
Started game development no idea of computer graphics. Should I learn tools or concepts? I am in 6th semester of my Computer science bachelor degree program, Working as Intern in a start up company. I started game development using AndEngine, things are going good because I have good hold on OOP and Java.

But I don't have any experience in OpenGL programming and neither studied a course of computer graphics. I want to develop 3D games and there are tools available like Unity3d etc.

My question is should I master tools or take online lectures of computer graphics to get started on basics. I want to continue game development as my profession. So what should I do? start learning from scratch or Learn already built tools and just dive into development?

I see successful designers with no background of academic study, just did a photoshop course and now they are in the softwarehouse and making websites, sprites etc.

sentences:
Chromium Embedded Framework and Unity3D? I have recently heard about the Chromium Embedded Framework and was over-joyed as I want to use html as my GUI source.

I did find a C# version but it seems to be for Windows Forms.

I'm not too terribly well versed but I was under the impression that it may cause it to be unavailable for cross-platform use.

Can anyone provide and insights? And if this will not work, any free alternatives?

sentences:
Can I render some vertices as an object instead? I am generating vertices at runtime that represent terrain.

I've always drawn the vertices as triangles with GraphicsDevice.DrawUserPrimitives<VertexPositionColor>, but I'm wondering: Can vertices be converted into a "Model" so I could handle model and terrain rendering in a unified way?

This page is quite similar to what I am searching for.

I want to later port my game to Mono. Would this approach cause problems when using the Content Pipeline to convert the data?

sentences:
Android : Some textures not loading after resuming twice This is an odd one.  When I press home and then restart my game I reload all my textures (checking glIsTexture on the id's first).  If I do this once, all textures load as expected, but if I do it twice or more one of my textures doesn't load (the texture is white).

I have checked glGetError and there are no errors (assuming GLES10.glGetError() is the correct way to do this)

Do I need to do any tidying up when home is pressed?  I currently call myGlView.onPause() and myGlView.onResume() when the onPause/Resume activity events are triggered.  I was under the impression that's all that's needed.  Is there anything else (perhaps non-openGL) that needs to be cleaned up?  Perhaps I'm hitting a limit of some kind

I am also using the NDK for some physics and rendering functions if that is relevant, but all resources are loaded using java.

sentences:
How can teams collaborate on Unity 3D projects? With a friend of mine, we are planning to develop a small game to get the hang of game development and teamwork. But since Unity 3D barely supports version control (or at least the free version lacks of it) we have no idea how to efficiently manage teamwork. Sharing tasks in a small project is also seems like a challange for us.

I would also appreciate any advice that could be useful for beginner indie developers related to teamwork. :)

sentences:
Algorithm for approximating sihlouette image as polygon Possible Duplicate:
  Is there any heuristic to polygonize a closed 2D raster shape with n triangles?

I want to be able to analyze a texture in real time and approximate a polygon to represent a silhouette.  Imagine a person standing in front of a green screen and I want to approximately trace around their outline and get a 2D polygon as the result.  Are there algorithms to do this and are they fast enough to work frame-to-frame in a game?

(I have found algorithms to triangulate polygons, but I am having trouble knowing what to search for that describes my goal.)

sentences:
Why isn't my tilemap collider appearing? I am trying to make a 2d game but my player falls through the tilemap every time.
My tilemap collider doesn't seem to show up.
What is going on and how do I fix this?
The first image is rigidbody currently falling through the tilemap and the tilemap. The second image is rigidbody currently falling through the tilemap and the rigidbody.

sentences:
Farseer: RemoveBody is not working I want to remove bodies after they touched the character(playerrect). But the bodies get not removed. I set a breakpoint in the following line but it doesn't get yellow:

world.RemoveBody(world.BodyList[i]);

What is wrong? Why is the breakpoint not getting released?

How can I remove a body?

bool Player_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
{
  if (fixtureB.CollisionCategories == Category.Cat1)
  {
    fixtureB.UserData = "RemoveMe";
  }
  return true;
}

playerrect = BodyFactory.CreateRectangle(world, 0.64f, 0.64f, 1.0f);
playerrect.BodyType = BodyType.Dynamic;
playerrect.Position = new Vector2(0.22f, 0f);
playerrect.FixedRotation = true;

playerrect.OnCollision += Player_OnCollision;

reccoin = BodyFactory.CreateRectangle(world, 0.64f, 0.64f, 1.0f);
reccoin.BodyType = BodyType.Static;
reccoin.Position = new Vector2(0.96f, 4.16f);
reccoin.IsSensor = true;
reccoin.CollisionCategories = Category.Cat1;

 protected override void Update(GameTime gameTime)
 {
   float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
   world.Step(Math.Min(elapsed, (1f / 60f)));
   for (int i = world.BodyList.Count - 1; i >= 0; i--)
   {
     if (world.BodyList[i].UserData == "RemoveMe")
     world.RemoveBody(world.BodyList[i]);
   }

 base.Update(gameTime);
 }

//Drawing:
spriteBatch.Draw(coinSprite, ConvertUnits.ToDisplayUnits(reccoin.Position),
                                   null,
                                   Color.White, reccoin.Rotation, new Vector2(coinSprite.Width / 2.0f, coinSprite.Height / 2.0f), 1f,
                                   SpriteEffects.None, 0f);

sentences:
Rotate A towards B with limited turn rate I want to rotate A towards B with a fixed turn rate per second.
My math skills are very limited and I have no clue in how to accomplish this.

Best Regards

sentences: why are texture atlases called texture atlases and not image atlases More specifically, is there anything about texture atlases specific to textures? From what I've read of them, they might just as well be called image atlases. Images are not the same as textures, but textures can be created out of images.

sentences:
Bullet Physics ConvexDecomposition? I've looked at Bullet Physics ConvexComposition Demo and would like to implement that in my game but the code is so undescriptive and it's hard to understand what is going on. Would any of you people out there have the time to show how to use ConvexDecomposition?

Thank you very much!

sentences:
Animator get number of animations (Unity) In C#, how would I get the number of animations in an Animator Controller?

So I want to find out how many animations there are in an Animator Controller, and have this number in script.

Thanks in advance!

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:
Resolution independence (for touch input on different mobile screens) I have drag mechanic in Unity game and I want to have same experience in all devices. I've done this before in another game engine and now that Unity gives us Dpi with Screen.DPI, it should be much easier to achieve, but I can't figure it out for the love of the god.

My theory is you have to divide the delta movement of touch with Screen.Dpi to normalize the movement and make it same across devices with different screen sizes and dpi's:

(touch0.deltaPosition.x / dpi) * SENSITIVITY * Time.deltaTime;

But this doesn't work. Would someone please tell me why?

I've done extensive search on this but surprisingly nothing much can be found.

Thanks in advance and regards.

sentences:
How to abstract GLFW from my rendering library? I would like to split my game engine in different libraries, so it is easier to maintain, however i have one problem: for example the window creation is handled by GLFW, so I encapsulated it into a class so it will be able to interact with the rest of my library. The problem is that I don't want to make the applications that use my library also depend on GLFW development headers, because otherwise when I pass user input to the application it must know about GLFW and it's data types and has to do something like this:

    //Application.cpp
    #include<mylibrary.h>

    int main()
    {
        myLibrary::window w("Title", 640, 480)
        myLibrary::event e;

        while(w.pollEvents(&e))
        {
            if(e.key == GLFW_KEY_ESCAPE) //Unnecessary GLFW dependancy
                w.close();
        }
    }

Because my header is like this:

    //mylibrary.h
    #include <glfw/glfw3.h>

    namespace myLibrary
    {
        class window
        {
        public:
            //Blah-blah-blah
        private:
            //Blah-blah-blah
            GLFWwindow* mWindow;
            //Blah-blah-blah
        };
    }

How should I go about abstracting GLFW from the application?

And I cannot use GLFW without wrapping it, because making it interact with the rest of my library ecosystem will look very ugly and out of place, and it would mean that the other libraries not only have to know about the rendering library, but also GLFW.

TL;DR: How can I hide GLFW from the user of my library?

sentences:
Viewport like Angry Bird in Corona Not sure if that's the right name for it, but I'm looking for a way to implement zooming in my game.

Essentially the game should zoom in on my character during the moving and shooting phase (its like Worms), but zoom out when the character has shot (preferably by following the shot, like Angry Birds does).

Can Corona/Lua do something like this?

sentences:
Finding the "top" of a mesh representing the terrain I'm generating a low-poly mesh for terrain, and for a given world coordinate I'd like to know where the "ground" is.

My game uses fairly standard infinite terrain - I generate noise values for world coordinates and use them to generate this mesh procedurally. This is done in chunks of 16x16.

I'm planning to begin decorating the terrain with plants and such and I need a good way to determine how high the ground is.

So for example, if I want a rock at x: 5, z: 5, what's the best/most efficient way to figure out the "height" of the ground at that location?

I've considered trying to inspect the mesh vertices, or maybe using a top-down ray cast and picking the collision point, but I'm looking for advice before I begin.

I've tried the raycast method, and it works perfectly, I'm just not sure how efficient that is. I'll profile if any alternatives seem worth comparing.

sentences:
What type of rotation is this and how do I apply it? I'm developing a 3D game in Java using LWJGL and JOML. In order to simplify player and NPC coding, I'm representing their orientation as two scalar quantities: "direction" and "angle" (maybe not the best names). "Direction" is the compass direction that the object is facing, and "angle" is the angle of the object relative to a horizontal plane. So for example if a player has a direction of 180 and an angle of 45, it will be looking south at a point halfway between the horizon and the zenith.

First question: what is this kind of rotation called officially?

I've already written code to handle calculations on points/positions represented in this manner, but I don't know how to include the rotation in a transformation matrix for OpenGL. I have the following code to produce a transformation matrix for an object:

Matrix4f world_matrix = new Matrix4f().identity().translate((float) position.x, (float) position.z, (float) -position.y).rotateY((float) Math.toRadians(-direction));

(same code, more readable)

Matrix4f world_matrix = new Matrix4f()
    .identity()
    .translate((float) position.x, (float) position.z, (float) -position.y)
    .rotateY((float) Math.toRadians(-direction));

where position is the location of the object and direction is the aforedescribed "direction" of the object.

Second question: how do I include angle in world_matrix?

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 to load and unload objects at a certain radius from the player? I am making a procedurally generated space exploration game in unity. I'm currently generating 5000 stars in a cube of a fixed size. Each star just gets a random 3d coordinate. What I would like to do is to dynamically load and unload stars at a certain radius from the player. This would be the maximum view distance. The algorithm that does this must be working with a seed for the universe, as the stars need to be loaded in the same spot when you revisit them.

My idea is something like in the amazing Space Engine.

I have pretty much no knowledge of algorithms that can do this, so I ask for your help.

sentences:
How to draw or translate into world space? I've been hacking around with OpenGL, but there's a few concepts which I can not find the answer on.

I want to draw three GL_QUADS next to eachoter like so:
1[2][3]

I know GL_QUADS are deprecated, but for this question i'd like to use them nonetheless.
Each quad will have its own color, the first being red, second green and the third blue.
[r][g][b]

my code:

void display()
{
  glClear(GL_COLOR_BUFFER_BIT);

  GLfloat vertices[] = {
    -1, -1,  1, -1,  1, 1,  -1, 1,
     1, -1,  3, -1,  3, 1,   1, 1,
     3, -1,  5, -1,  5, 1,   3, 1
   };

   GLfloat colors[] = {
    1, 0, 0,  1, 0, 0,  1, 0, 0,  1, 0, 0,
    0, 1, 0,  0, 1, 0,  0, 1, 0,  0, 1, 0,
    0, 0, 1,  0, 0, 1,  0, 0, 1,  0, 0, 1
  };

  glLoadIdentity();
  glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_COLOR_ARRAY);

  glVertexPointer(2, GL_FLOAT, 0, vertices);
  glColorPointer(3, GL_FLOAT, 0, colors);

  glMatrixMode(GL_PROJECTION);
  glTranslatef(-1, 0, 0);

  glDrawArrays(GL_QUADS, 0, 12);

  glDisableClientState(GL_COLOR_ARRAY);
  glDisableClientState(GL_VERTEX_ARRAY);

  glFlush();
}

result being:

I'm confused as which to which matrix I should apply the translation matrix and in which order.
I'm almost certain I should not use glMatrixMode(GL_PROJECTION)
What are the initial values of a matrix?
I'm not certain which coords to pass in the vertex array at this point, model space or world space?

I hope you can shed some light in my confusion.

sentences: cocos2dx- set draw() method interval time What is the default interval of draw method call in cocos2dx engine? Can we set it manually? I couldn't find much information about it online. After researching a bit I found that update() method interval step could be adjusted by setting setAnimationInterval. Can I set a specific interval for draw method too?

sentences:
Unity – How to keep sprites sharp and crisp, even while rotating How can I maintain crisp, sharp edges on sprites, while avoiding the aliasing caused by rotation?

None of the things I've tried produce a pixel-perfect non-rotated block, while allowing rotation without aliasing

Click here for the sample project, which also has some extra images in it.

Click here for my Unity Forums Thread

Ideally, this is what it would look like

From Photoshop, not Unity.

Flawless edges, smooth corners, and very faint aliasing when rotated.

Screenshot from Github project:

Row 1

Non-rotated: Perfect edges, pixelated corners

Rotated: Pixelated everywhere

Row 2

Non-rotated: Perfect edges, smooth corners.

Rotated: Pixelated edges, smooth corners

Row 3

Non-rotated: Blurry everywhere.

Rotated: Blurry everywhere

Row 4

Non-rotated: Not quite perfect edges, pixelated corners

Rotated: Blurry everywhere

Row 5 (MY BEST SOLUTION SO FAR)

Non-rotated: Semi-blurry everywhere.

Rotated: Semi-blurry everywhere

Texture for "no border padding" texture:

Texture for "with padding" texture:

Shader Method

(Note: I'm a total shader newbie)

I created a fragment shader to draw the block.

It has AA (via smoothstep) built in, and throttles it on as block is rotated (so that there is no AA when it's not rotated)

This has some problems:

A (geometry) shader doesn't seem like the correct solution for this problem at all, since I'd have to make a shader for all the geometry that has this problem.

But maybe there is a shader that can apply AA to a texture, that doesn't do anything for vertical or horizontal (non-rotated) edges?

Corners of block with AA turned off are pixelated

This doesn't seem too difficult to fix
I'd probably want it to work identically to row 2 (non-rotated)

Not sure how much AA to apply (when rotated) so that it's as sharp as possible for a given screen DPI.

I thought this is what mip maps were good for, since the highest possible res texture should be chosen. (Another reason why a texture-based solution seems best)

Other things I've tried:

Vector graphics (per Unity's vector package)

Unity's vector package required 4x MSAA to look right, which was too intensive for mobile devices

MSAA

Creates blurry graphics (is there a way around this?)

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:
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: Is 1 pixel of a height map representative of 1 vertex on the mesh? I'm trying to get my head around heightmap terrain generation. If I have a plane say 64 x 64 verts will I need to create a 64px by 64px greyscale heightmap in order to displace the geometry of the plane correctly?

sentences: Difference between Material and Shader In games, materials often only influence the visual appearance of objects. The visual appearance is effected by shaders. So regarding to terminology is there a difference between materials and shaders? Should you write one shader for one material?

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:
interace between C and Lua function with 3D vector arguments I have C++ function (which runs some physical simulation inside my game engine) which looks like this:

void doSomePhysics( int nIters, Vec3d pos, Vec3d vel ){ /*... don't care ...*/ }

I want call this function from a lua script likes this:

doSomePhysics( 100, {1.0,-2.0,3.0}, {-8.0,7.0,-6.0} )

I'm trying to figure out how to make lua interface to this function.

I would like to do several general helper functions for passing 2D,3D and 4D vectors and matrices since I will heavily use them.

Here is sketch what I'm currently trying to do (But I know it is not correct):

void lua_getVec3(lua_State *L, Vec3d& vec ){
    // universal helper function to get Vec3 function argument from Lua to C++ function
    luaL_checktype(L, 1, LUA_TTABLE);
    lua_settop(L, 1);
    int a_size = lua_rawlen(L, 1);
    lua_rawgeti(L, 1, 1); vec.x = lua_tonumber(L, -1);
    lua_rawgeti(L, 2, 2); vec.y = lua_tonumber(L, -2);
    lua_rawgeti(L, 3, 3); vec.z = lua_tonumber(L, -3);
    lua_pop(L, 3);
}

int l_doSomePhysics(lua_State* L){
    // lua interface for doSomePhysics
    Vec3d pos,vel;
    int n = lua_tointeger(L, 1);
    lua_getVec3(L, pos );
    lua_getVec3(L, vel );
    doSomePhysics(n,pos,vel);
    lua_pushnumber(state, 123);
    return 1;
}

I read several short tutorials 1 2 3 but it seems horribly complicated, confusing and error-prone ... I'm completely lost in stack indexes (what is my current position in the stack?, what is correct relative index? etc.). I'm reluctant to believe the most famous game scripting language needs sooooo much boiler-plate code and so much pain for interfacing every little function.

EDIT: answer is here

sentences: How to increase the thickness (Size) of a plane in Unity I am making a small game where you have to roll around and not fall of a platform. I am using a plane to simulate the ground, but it is really thin. Is there a way to make it thicker by increasing a variable?

sentences:
Animator has not been initialized My animation is working but unity keep saying that my Animator has not been initialized error
Here my Code:

using UnityEngine;
using System.Collections;

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;

void Start ()
{
    anim = GetComponent<Animator> ();
}

void FixedUpdate () {
    grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
    anim.SetBool ("Ground", grounded);

    float move = Input.GetAxis ("Horizontal");
    anim.SetFloat ("Speed", Mathf.Abs (move));

    GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxspeed, GetComponent<Rigidbody2D>().velocity.y);
    if (move > 0 && !facingRight){
        Flip ();
    } else if (move < 0 && facingRight) {
        Flip ();
    }
}

void Flip()
{
    facingRight = !facingRight;
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
}

}

sentences:
Deterministic Procedural Wave Function Collapse I've been looking into the Wave Function Collapse algorithm and was wondering if there is a way to make it (appear) deterministic regardless of starting position.
I can see how this is trivial if the starting position remains the same. We can simply always collapse the tile with the lowest entropy and use a seeded pseudo random number generator or a noise function to decide which is next whenever there isn't a clear winner.
Now what would be the best solution if I wanted to procedurally generate a world around the player? Say I generate the world in chunks. If a player moves far enough away distant chunks get unloaded and new chunks are generated.
This works perfectly fine until the player starts to backtrack. Since tiles depend on their neighbors, a revisited chunk might very well look completely different if approach from a different direction.
I can think of two possible solutions:
a) Always generate the world from a set starting position.
This doesn't seem feasible in big worlds, as it would require more resources the further away from the starting position the player is.
b) Only generate chunks once and then save them.
I don't really like this approach, because it could potentially require a lot of disk space. It's also not really deterministic, because the order in which the player explores the world would still influence what individual chunks look like.
Is there a solution I'm overlooking or is this simply not possible because of how the algorithm works? Keep in mind that I don't care if the algorithm itself is actually deterministic regardless of starting position. The result just has to appear that way, so that already visited chunks can be recreated unchanged.

sentences:
Face Detection in Vuforia Unity Android I am working on face detection in unity.I have tried out a face tracking sample from the below link.It worked fine

https://github.com/marcteys/unityFaceTracking

The problem is that,when I runned the above project,Am show with a separate camera view window for detection. But when we consider unity android,the tracking should be done through phone camera.

Is there any option other than OpenCV.

Please help me out

sentences:
How to properly differentiate single-clicks and double-click in Unity3D using C#? What I am trying to understand and learn here is a very basic thing: what is the most general and most polished way to properly differentiate single-clicks and double-clicks for the 3 main mouse buttons in Unity, using C#?

My emphasis on the word properly is not for nothing. Although I was surprised that this seems to have never been asked in this website before, of course I have searched and found numerous similar questions on Unity's forums and Unity's own question-answer pages. However, as it is often the case with answers posted in these resources, they all seemed to be either plain wrong or at least a bit too amateurish.

Let me explain. Proposed solutions always had either of the two approaches and their corresponding flaws:

every time a click happens, calculate time delta since last click and if it was smaller than a given threshold, a double click would be detected. However, this solution results in that a quick single click is detected before the double-click is detected, which is undesirable in most situations because then it activates both single and double click actions.

Rough example:

float dclick_threshold = 0.25f;
double timerdclick = 0;

if (Input.GetMouseButtonDown(0)
{
   if (Time.time - timerdclick) > dclick_threshold)
   {
       Debug.Log("single click");
       //call the SingleClick() function, not shown
   } else {
       Debug.Log("double click");
       //call the DoubleClick() function, not shown
   }
   timerdclick = Time.time;
}

set a wait-for delay for the single-click to be activated, which means, at every click, only activate single click actions if the time delay since last click is above a given threshold. However, this gives sluggish results, since a waiting before it is possible to notice the waiting before single-clicks are detected. Worse than that, this kind of solution suffers from discrepancies across machines, since it does not take into account how slow or how fast is the user's double-click speed setting at the OS level.

Rough example:

   float one_click = false;
   float dclick_threshold = 0.25f;
   double timerdclick = 0;

   if (one_click && ((Time.time - timerdclick) > dclick_threshold))
   {
       Debug.Log("single click");
       //call the SingleClick() function, not shown
       one_click = false;
   }

   if (Input.GetMouseButtonDown(0))
   {

       if (!one_click)
       {
           dclick = -1;
           timerdclick = Time.time;
           one_click = true;
       }

       else if (one_click && ((Time.time - timerdclick) < dclick_threshold))
       {
           Debug.Log("double click");
           //call the DoubleClick() function, not shown
           one_click = false;
       }

   }

Therefore, my questions becomes the following. Is there a more polished and reliable way of detecting double clicks in Unity using C#, other than these solutions, and one that handles the problems aforementioned?

sentences:
Unity : Orthographic Camera is not Occlusion Culling? In the scene where the occlusion culling is done as desired,

When I change the camera to orthograhpic, occlusion culling is not done.

(Look at the sphere the red arrow points to on the right)

What should I do?

sentences:
Correct normal map for rotated sprites I am trying to find the best way to correctly do normal mapping in a 2D batched sprite renderer.

For each sprite sheet (aka texture atlas) I render all sprites as a textured quads with a single glDrawElements() call. Therefore, vertex coordinates in VBO are already transformed (on CPU) according to sprite position, rotation and scale.

Unfortunately, on rotated sprites normal map texture is also rotated, leading to incorrect normals:

I did a bit of research on this subject and so far I found few possible solutions:

Pass tangents to shader. Pretty straightforward, the same way it's usually done for 3D models. While this approach would work, doing it for just simple 2D sprites seems quite wasteful.
Pass just sprite rotation in additional vertex attribute. Then I could use this attribute in the fragment shader to rotate normal vector accordingly.
Use dFdx(), dFdy() functions. It looks like I could use these functions to deduce transformation from screen to texture coordinates and then use it to rotate normals. To be honest, this approach is not entirely clear to me, and I don't fully understand its possible performance implications, especially on mobile platforms.
Use geometry instancing. I think if I use glDrawElementsInstanced() and just dump all the sprite coordinates + transformations in one giant texture buffer, I then could use this information in the fragment shader to rotate normals. But as with approach #3, I don't fully understand if it could lead to possible performance or compatibility issues on mobile platforms.

So far I think approach #2 is probably the better solution. Not only it is simple and requires minimal changes to the code, but it would also allow me to offload sprite rotation calculations from CPU to GPU. I'd still have to pass sprite rotation per-vertex (and not per-sprite), but I don't think this is to big overhead.

But maybe there is a better, more elegant or more performant solution to this problem? How this is typically done in 2D games?

sentences:
External gui within a render loop I was wandering how easy is to interface existing Java programs/GUIs inside a game loop. Sorry if my question is a bit vague. I'll try to explain.

I am currently designing a simulation environment for a work-station. We have the actual programs running in the real compunters (which have a java GUI and run on linux virual machines). We also have 3D models of the room, chairs, monitors, etc. We can render those in Unreal engine. Currently, I have hard-coded very simple monitor textures that represent the programs running on the computers, but ideally, the player should have have the same experience as being in the actual control room, meaning that he should be able to use the programs in the same or almost the same manner.

My question is if it is possible to interface the I/O of the actual programs within the simulation. More specifically, if it possible to render the java awt as textures for the monitors, as well as taking the player actions and feeding them in the program as inputs. The actual program code may run inside or outside the game loop (preferably outside, in its native virtual machine).

Can you please direct me to the right path, since I am only remotely familiar with game development. Thank you in advance!

Edit: Just to clarify one thing: Running the program on an external machine (virtual or physical) and feeding this machine's display to a local texture is acceptable, but I was wandering if it could be possible to use Java's GUI library output directly into the game loop (instead of the host machine). I suppose this has to be supported by the game engine (eg. having support for an in-game desktop-environment/window-manager). Unreal engine was just chosen for testing. Any engine recommendation is welcome.

sentences:
How can I generate a navigation mesh for a tile grid? I haven't actually started programming for this one yet, but I wanted to see how I would go about doing this anyway.

Say I have a grid of tiles, all of the same size, some traversable and some not. How would I go about creating a navigation mesh of polygons from this grid?

My idea was to take the non-traversable tiles out and extend lines from there edges to make polygons... that's all I have got so far. Any advice?

sentences:
How to share battle execution code between client and server? We're making an online turn-based game. There's some logic that is executed in both client and server side. Here's the pseudocode that shows how we share the code:
// Shared Code
class BattleExecutor {
  constructor(eventHandler)

  void ExecuteTurn(userInputs) {
    ......
    trigger events such as Move, Fire, TakeDamage
    ......
  }
}

// Server
new BattleExecutor(noOperationHandler)

// Client
class ClientEventHandler {
  // play Move, Fire, TakeDamage anime
}

new BattleExecutor(new ClientEventHandler())

In this design, the shared BattleExecutor has the logic of how game is played. Client code is just to play the anime for the events that triggered in BattleExecutor. Server needs the BattleExecutor to determine if user inputs are valid and to determine battle result (who won).
Now our problem is, think of this scenario, in one turn BattleExecutor triggers a Fire and a TakeDamage event within 1 millisecond. But in client side TakeDamage can only be played when Fire anime is done (bullet flying takes time). How to control the playing of events in client side?
The solution we're considering is to add "Id" and "DependOnIds" property to Event class, meaning that BattleExecutor provides the information of "event A should happen after events B, C, D". Client knows when anime of B, C, D is done playing, after which client starts playing anime of A. This solution looks a little messy to us, because BattleExecutor now needs to figure out the dependency of events which server doesn't care about at all.
Is there any more elegant solution that can share battle execution code between client/server and allow client to control the playing of events correctly?

sentences: How to convert a number from one min\max set to another min\max set? I'm doing terrain generation and I have a perlin library that is giving me random numbers between -1 and +1. I want to convert this to the scale of 0-255. What is the proper way to do this?

sentences:
DirectX 11 Constant Buffers vs Effect Framework I'm having some trouble understanding the differences between using constant buffers or using the effect framework of DirectX11 for updating shader constants.

From what I understand they both do exactly the same thing, although from reading the documentation it appears as if using effects is meant to be 'easier'. However they seem the same to me, one uses VSSetConstantBuffers and the other GetConstantBufferByName.

Is there something I'm missing here?

sentences:
C# XNA Rectangle.Contains returns false? I am creating a simple XNA game. My mainMenu class contains a list of strings for menu options wich I draw on the scren using spriteBatch.DrawString. I've set Vector2 variables to controll the position of the spritefont. Then I created 2 Rectangles (and took the values of the Vector2s) and 2 Colors that will be given a value if the mouse is/isn't currently hovering the drawn string. My mainMenu.cs class contains these variables:

Vector2 playGameButtonPos = new Vector2(303, 300);
Vector2 exitGameButtonPos = new Vector2(303, 350);
List<string> m_ButtonList = new List<string>();
Rectangle m_ButtonArea0 = new Rectangle(303, 300, 50, 30);
Rectangle m_ButtonArea1 = new Rectangle(303, 350, 50,30);
Color optionsColor0;
Color optionsColor1;

mainMenu.LoadContent(ContentManager Content):

Game1.g_MainMenuFont = Content.Load<SpriteFont>(".\\mainMenu\\mainMenuFontTex");

mainMenu.cs's constructor:

m_ButtonList.Add("Play Game");
m_ButtonList.Add("Exit Game");

mainMenu.Draw(SpriteBatch spriteBatch):

var m_MousePosition = new Point(Game1.g_MouseState.X, Game1.g_MouseState.Y);
if (m_ButtonArea0.Contains(m_MousePosition))
{
    optionsColor0 = Color.Yellow;
}
else
{
    optionsColor0 = Color.CornflowerBlue;
}
if (m_ButtonArea1.Contains(m_MousePosition))
{
    optionsColor1 = Color.Yellow;
}
else
{
    optionsColor1 = Color.Red;
}
spriteBatch.DrawString(Game1.g_MainMenuFont, m_ButtonList[0], playGameButtonPos, optionsColor0);
spriteBatch.DrawString(Game1.g_MainMenuFont, m_ButtonList[1], exitGameButtonPos, optionsColor1);

Game1:

public static MouseState g_MouseState = Mouse.GetState();
public static SpriteFont g_MainMenuFont;
mainMenu m_MainMenu;

Game1's Initialize() method:

m_MainMenu = new mainMenu();

Game1's LoadContent() and Draw() methods:

m_MainMenu.LoadContent(Content);

m_MainMenu.Draw(spriteBatch);

But when I hover with my mouse on the position where the Rectangle should be, nothing happens.

sentences:
Quaternion precision problems Each entity and camera have a Transformation object that holds position info as vec3, rotation info as quat and scale info as vec3.
When I need a matrix (that being either model or view matrix), I construct the matrix out of given data. That gives me the freedom to change any of transformation info without having to worry about order of change.
Now, I'm trying to implement it in a fly-camera. The two constraints are pitch that has to be limited from -90° to 90° and roll which should not occur.
While rotating the camera along X and Y axis, a sort of drift happens along the Z axis. In order to combat that, after all changes to rotation are applied, I get the angle of rotation around the Z axis and then rotate it by -angle, effectively resetting the Z-rotation to 0.
That all works nicely in theory, but not so much in practice.
You see, when I go over ~55ish° both in the positive or negative Y-rotation, the camera starts freaking out and fluctuating. It seems that every frame it switches from some negative z rotation, to positive z rotation of the same value. It looks like this (moving camera to the left, negative Y-rotation):

Of course, since the object is only in the one place at one time, I had to edit the screenshot in paint to give you a better idea of what's going on. It really does look like there are two objects at the same time, both flickering as crazy.
Also note that if I were to move camera further to the left, the Z-rotation offset would increase, moving both objects further from the horizontal plane.
At this point, the Y-rotation would also start to fluctuate ever so slightly. You couldn't see it on screen, but printing out angle each frame would show that it's fluctuating at about 3rd digit after the dot (0.00####).
Once I get far enough, the camera would just give up and just show the object rapidly changing it's Z-rotation with no apparent pattern.
My guess is that quaternion rotation is imprecise for some reason. You can tell by the fact that my strict Z-rotation starts to influence the Y-rotation after the Z-drift gets severe enough.
Here's a snippet of code, for what it's worth:
transformation->rotateAroundY(angleY);

GLfloat roll = transformation->getRoll();
transformation->rotateAroundZ(-roll);

angleY is delta Y of mouse position between this and previous frame.
rotateAround#(angle) calls this code:
rotation *= glm::tquat<GLfloat>(glm::angleAxis(glm::radians(angle), axis));

where rotation is the quaternion, while axis is tvec3<GLfloat> representing the axis around which the rotation takes place.
How do I combat this? How can I consistently reverse unintentional Z-drift without making the camera freak out?

sentences:
LibGdx 2d Free-Form Terrain I have a query about how to create a 2d landscape level using libgdx/ box2d (Or possibly with Unity) for Android and iOs. Let me describe the goal and then the specific points I need help with.
What I'm trying to create is something like "Hill Climb Racing" where the player has to drive across a finite 2d free-form landscape, like the one shown here. Different areas may have different properties (friction, texture, restitution, etc) as shown. The player will be able to pinch and zoom out to see all or most of the map and pinch to zoom in to see details..

The level width will vary from game to game but at most it will be about 800 box2d meters wide. Now if I use 32px/m that requires an image 25,600 pixels across and this is where the issues start.. I can't tile it because that might preclude me from making free formed curves which I need to be able to do.
So what I need to know is:

How can I create a box2d body for the terrain?
What pixel/meter ratio should I use?
How many pixels wide should the image be?
Should I split the image up into sections and how should I chunk the images together?
What strategies have people used before to achieve this effect?

Hope I have been specific enough and thanks for all the help..

sentences:
Elements of a widget blueprint do not appear if I click on simulate I made a widget that contains 2 minimaps and 2 texts related to a character's variables.

When I click the play button (Selected Viewport) everything happens fine:

Focus where I circled in pink.

It turns out that when I click the Simulate button, these two texts do not appear, but the minimaps do:

I did a test by first clicking the play button (Selected Viewport) and then I ejected the character (which for me is the same thing as simulating, except without closing and opening the game) and the texts appeared, so my problem is only when I'm done start simulating.

I would like to know how to make these 2 texts appear even if I click on simulate instead of play.

sentences:
Sidecar Processes in Unity? I'm a .NET Core web developer trying to learn Unity. In web development, if I want to perform more than one domain function at a time, I either want to run it as a totally separate service (disjointed/microservice) or as a separate process (sidecar). In .NET Core we have IHostedService and other varying hosting abstractions, so creating small sidecar processes is fine, and in 3.0, even ASP.NET Core is considered a sidecar process because it's building on top of IHostBuilder for Generic Host support. My web development experience is primarily focused on distributed backend systems.

In my process of trying to learn Unity, I'm trying to understand how networking works in Unity. I was looking at their NetworkManager documentation, it seems most helpful for integrated host/client systems. I like that I can provide custom implementations of NetworkManager, and I think that will be most helpful. I've been reading up on asynchronous programming in Unity, and looking at their ECS Job System. It looks useful, but it also doesn't seem to be quite what I'm looking for. I'm looking for a background/sidecar process architecture the main Unity thread can call into as needed, but that doesn't interact with the main Unity thread at all, only it's lifecycle is tied to the main Unity thread.

In the asynchronous multiplayer game I am learning to create, the game's world is going to be a dedicated server running remotely, and the client will have to connect to it to load it's internal state. As the game's remote state is primarily near real-time, I was thinking about implementing a mixture of real-time and cached network managers. Something like this:

// Used for strongly consistent, real-time communication, talks to the remote server
// directly. The main Unity thread never calls this directly.
public RealtimeStateNetworkManager { }

// Used for GameObjects. Tries to load from cache before making real-time networking
// calls. Cache items are instantiated when GameObject makes initial call,
// then background threads keep the cache updated during the lifecycle
// of the GameObject.
public CachedNetworkManager : NetworkManager { }

For my CacheHostSidecar, I want to run it outside of the main thread as a sidecar process, so it doesn't affect the game client's core performance. The primary goal of the internal cache is to handle the network sync so client updates are real-time once the cache has been warmed, and then the cache updates it's internal state separate from the main unity thread on a ticking basis.

The process would like this:

My understanding of NetworkManager and it's function may be wrong. My core goal is to understand how I could intialize and run the CacheSidecarHost as a background/sidecar process when the main Unity thread starts so I can decouple networking from the main Unity thread.

My hope is that by decoupling the core networking functionality from the main Unity thread, it helps folks with poor network connections have an agreeable experience as the networking stack is implemented in a more sustainable/modern way, ensuring they can still play well enough in a game requiring an internet connection.

sentences:
Rotation along normal vector I have a triangle in the 3D world. I have the:

positions for the three points
the normal vectors for the three points (all the same, because vertices are not shared)

This triangle faces to a direction, so it has a XYZ rotation (but I dont know the rotation itself).

If I put a cube into the same scene, how I can achieve the same rotation for the cube? So if the triangle "looks" upwards, the cube should do the same. If it has a 10f x rotation, how can I get what is the x?

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:
How do I program procedural generation with objects that must fit together in specific ways? I'm working on a game where I have to procedurally generate a large open room building. I'm using Unity, but I think this applies to any engine. The room is made up of different wall segments. What makes this difficult for me is the ends of the segments have to join with a similar end of another segment. There are 2 types of ends. Flat and angled. The purpose of the angled ends is to create an outside corner. Meaning for example a flat wall then turns into a hallway it would use angled ends to make the transition.
The method I tried initially was to define each segment type and what the follow up modules could be. Meaning SegmentA can be followed by: SegmentB, SegmentC, and SegmentD. Then I would randomly select which  of those to add and place it, then move on and repeat. It works ok, but I feel like there is a better way to do it. It's pretty unwieldy and is kind of prone to bugs. I also run into issues trying to close the loop and return to the original segment.

sentences:
Most efficient way to capture OpenGL ES content of iPhone screen I'd like to efficiently capture a "screenshot" of my OpenGL ES iPhone game.  I put screenshot in quotes because I really want to move the screen contents into a pixel buffer that I can eventually use to create a mov file using AVFoundation.

Currently I'm taking the screenshot with this method from Apple.  The resulting image is great... however capturing the image causes a small stutter in my game.  Looks like the call to glReadPixels causes the stutter.

How can I capture the screen's contents more efficiently?  Perhaps I can improve the efficiency of the call to glReadPixels?  Or perhaps I can populate a CMSampleBuffer or CVPixelBuffer without calling glReadPixels?

Perhaps the OpenGL ES data could be accessed directly somehow w/o having to copy the data into a buffer via glReadPixels.

Edit #1:  Perhaps a "Frame Buffer Object" could be useful?  Or "rendering directly to a texture"?

sentences:
How to reset AnimatedSprite? In Godot v2, it seems that AnimatedSprite had a method set_frame() see here.
But in v3, this method does not seem to exist anymore. Only 3 methods are available see here:
bool is_playing ()

void play (String anim="", bool backwards=false )

void stop ()

What is the way to reset an animation in Godot 3?

sentences:
Unity GameView Differrent with CameraView - Dont have 3D environments Now on my existing project, if i create new scene, automatically i got my gameview like below :

above game does not have 3d environments outlook, i'm expecting like below (my old existing scene) :

Any Idea to solve this ?

thanks

sentences:
How can I draw a linerenderer line between two vector3 positions using the mouse left button click? This code is drawing a line but it's not drawing it on the camera in front of the camera.

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

public class DemoScriptDraw : MonoBehaviour
{
    private List<Vector3> _positions = new List<Vector3>();
    private LineRenderer lr;

    private void Start()
    {
        lr = this.GetComponent<LineRenderer>();
    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Vector3 pos = Input.mousePosition;
            pos = Camera.main.ScreenToWorldPoint(new Vector3(pos.x, pos.y, lr.transform.position.z));
            _positions.Add(pos);

            if (_positions.Count == 2)
            {
                SpawnLineGenerator(_positions[0], _positions[1], Color.red);
            }
        }
    }

    void SpawnLineGenerator(Vector3 start, Vector3 end, Color color)
    {
        GameObject myLine = new GameObject();

        myLine.AddComponent<LineRenderer>();
        myLine.AddComponent<EndHolder>();
        LineRenderer lr = myLine.GetComponent<LineRenderer>();
        lr.material = new Material(Shader.Find("Particles/Alpha Blended Premultiply"));
        lr.startColor = color;
        lr.useWorldSpace = true;
        lr.endColor = color;
        lr.startWidth = 0.1f;//0.03f;
        lr.endWidth = 0.1f;//0.03f;
        lr.SetPosition(0, start);
        lr.SetPosition(1, end);
    }
}

The result is that the line is seen in the scene view window but not in the game view window:

sentences: How to make a video game map that can be used by Android? I am interested in developing games for the Android OS. I have played Replica Island and I have browsed over the source. I found that the levels/maps were in a .bin format. I could execute them because they were in an Android format. So how could I make a game map/level that could be used in my game? What program would I use? How could I load the map in Java (for Android)?

sentences:
Management of objects as targets of other objects I have started my first game three years ago and learned a lot during that process. Now I would like to rewrite it to incorporate my "lessons learned" or try out new ideas.

My game consists of space ships that can target other space ships either for combating, trading or communicating. When they have no current target, they look for other ships in their area, lock them as target (by keeping a pointer to them as member variable) and do some stuff. After a ship is destroyed, its pointer used by other ships as a target becomes invalid. To avoid any dangling pointers and crashes, I add the to be destroyed Ship's id to a cleaning list. During the next World's update, I go through all of these to be destroyed ids and remove them as potential targets. See this pseudo code to demonstrate this:

class Ship
{
public:
    Ship();
    Ship::destroy(){
        // set to be destroyed flag
        _world.pointersToDelete(_id);
    }

private:
    void        destroy();

    int         _id;
    Ship*       _target;
    World*      _world;
    bool        _to_be_destroyed;

};

// in World::update
World::update()
{
    for (auto ship: all_ships)
    {
        for (auto id_to_delete: ids_to_delete)
        {
            if(ship._target != nullptr && ship._target->_id == id_to_delete)
            {
                ship._target = nullptr;
            }
        }
    }

    // now trigger the actual final destruction of the ships
    // ...
}

Question: Is this a good design in general?
I ran into some problems when I used it in practice:

There are more objects that communicate, combat and trade with ships like Space Stations, Planets, etc.. I would need to go through all of them every update loop to check whether they have no dangling pointers. I am concerned about the performance since my game allows space battles of thousands of ships at the same time.

I thought about using an id approach instead: the _target variable is not a pointer but an id that I can look up in an unordered_map of Ship objects. If the id is not found anymore, the target is not valid any longer. But this could lead to performance issues as well if every object has to check this during every update multiple times.

sentences:
Texture Packer - Any way to make it combine intelligently I am making a Pokemon Clone, using libgdx. I have the different types of sprites: e.g. Back, front, back shiny, and front shiny.

The current way the Texture Packer combines the textures seems to be semi-randomly. I would like to be able to tell it to put the sprites together based on number, because my sprites go:

003
003b
003bs
003s

Where the 003 is the pokedex number, and the b is for back, and s for shiny.

Two questions here:

Is there a way to get it to sort the textures in some way?
Is there a benefit to this sorting?

sentences:
Why do the order of struct members between vertex and pixel shader must be reversed? This has been driving me crazy for the last two days but it is finally working, however I really don't see why the order of struct members should be reversed.

Why do members of PS_INPUT must be reversed compared to VS_INPUT for this shader to work ?

Texture2D<float4> Texture;

SamplerState linearSampler
{
    Filter = MIN_MAG_MIP_LINEAR;
    AddressU = Wrap;
    AddressV = Wrap;
};

// A constant buffer that stores the three basic column-major matrices for composing geometry.
cbuffer ModelViewProjectionConstantBuffer : register(b0)
{
    matrix model;
    matrix view;
    matrix projection;
};

struct VS_INPUT
{
    float4 Position : SV_Position;
    float4 Color    : COLOR0;
    float2 TexCoord : TEXCOORD0;
};

struct PS_INPUT
{
    float2 TexCoord : TEXCOORD0;
    float4 Color    : COLOR0;
    float4 Position : Position;
};

PS_INPUT mainVS(VS_INPUT vs_input)
{
    float4 pos = float4(vs_input.Position);
    pos.w = 1.0f;
    pos = mul(pos, model);
    pos = mul(pos, view);
    pos = mul(pos, projection);

    PS_INPUT output;
    output.Position = pos;
    output.Color = vs_input.Color;
    output.TexCoord = vs_input.TexCoord;
    return output;
}

float4 mainPS(PS_INPUT ps_input) : SV_TARGET
{
    float4 value = Texture.Sample(linearSampler, ps_input.TexCoord);
    value.rgb = 1 - value.rgb;
    return value;
}

float4 main(float2 uv : TEXCOORD0) : SV_TARGET
{
    float4 value = Texture.Sample(linearSampler, uv);
    value.rgb = 1 - value.rgb;
    return value;
}

technique Technique1
{
    pass Pass1
    {
        EffectName = "TextureEffect";
        VertexShader = compile vs_4_0 mainVS();
        PixelShader = compile ps_4_0 mainPS();
    }
}

Note that I am still getting the following even though things are being drawn:

D3D11 ERROR: ID3D11DeviceContext::DrawIndexed: Rasterization Unit is enabled (PixelShader is not NULL or Depth/Stencil test is enabled and RasterizedStream is not D3D11_SO_NO_RASTERIZED_STREAM) but position is not provided by the last shader before the Rasterization Unit. [ EXECUTION ERROR #362: DEVICE_DRAW_POSITION_NOT_PRESENT]
D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (COLOR,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]
D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (Position,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]

Can you explain why it does that and how can I fix it ?

sentences:
How can I unit test rendering output? I've been embracing Test-Driven Development (TDD) recently and it's had wonderful impacts on my development output and the resiliency of my codebase. I would like to extend this approach to some of the rendering work that I do in OpenGL, but I've been unable to find any good approaches to this.

I'll start with a concrete example so we know what kinds of things I want to test; lets say I want to create a unit cube that rotates about some axis, and that I want to ensure that, for some number of frames, each frame is rendered correctly.

How can I create an automated test case for this? Preferably, I'd even be able to write a test case before writing any code to render the cube (per usual TDD practices.) Among many other things, I'd want to make sure that the cube's size, location, and orientation are correct in each rendered frame. I may even want to make sure that the lighting equations in my shaders are correct in each frame.

The only remotely useful approach to this that I've come across involves comparing rendered output to a reference output, which generally precludes TDD practice, and is very cumbersome.

I could go on about other desired requirements, but I'm afraid the ones I've listed already are out of reach.

sentences:
How do game devs optimize their games for new CPUs/architectures? I've learned that DirectX helps devs to program games on a variety of hardware. However, that's the visual/graphics side of things.

How do game devs deal with new CPUs or CPU architectures? Is there another API for that? Do they use DirectX for this too? Or do they need to learn the ins and outs of the architecture and program accordingly?

Thanks.

sentences:
How should I handle missing resources? Your game expects a certain asset to be loaded, but it isn't found. How should the situation be handled? For example:

Texture* grassTexture = LoadTexture("Grass.png"); // returns NULL; texture not found
Mesh* car             = LoadMesh("Car.obj");      // returns NULL; 3D mesh not found

It might have been accidentally deleted by the user, corrupted or misspelled while in development.

Some potential responses:

Assertions (ideally only during development)
Exit the game gracefully
Throw an exception and try to handle it.

Which way is best?

sentences:
Unity C# : How to make 3D objects move in the grid? I want to move and deploy 3D objects in the grid, like bakery 2(Storm8 Studios). How do you make a grid like that? For example, make a 5x5 grid and move it to a touchdrag. I'd like you to give me some advice.

Pictures for reference: https://lh3.googleusercontent.com/Kwp9i9ExRboeQCtM65sztw3tqEL9R76zZzB9U6j5vs98ueF9ksOU3huMdZqv4KPDZ2E=w2590-h1430

sentences:
Play and Stop Animation on Condition - Unity I've applied a scale animation on Play button of my game. I want to stop animation when play button is not interactable. It stops playing animation, but animation is not playing again, even when play button gets interactable. Here is my snippet to Play and Stop Animation.

if (!PlayButton.GetComponent<Button> ().IsInteractable()) {
    PlayButtonAnimator.Stop ();
} else if (PlayButton.GetComponent<Button> ().IsInteractable()) {
    PlayButtonAnimator.Play ("Play_Button_Animation");
}

What should i do to play animation again. Thanks in advance :)

sentences:
Strange collision behaviour in 2D game even though the collision is very basic I have a player ship (cube) and some enemy laser projectiles. When the player ship has position X values greater than 1, collision with the enemy projectiles occur but when it has lower X values, the projectiles pass through.

If the image below is too small to view, you can refer to this link.

There are two screens in the image. The above image is where the collision occurs and the below one is where the laser projectiles miss the player ship. (You can see in a larger image better the tiles. When the collider of the player ship goes below the central horizontal line, collisions do not occur). Let me post the scripts for projectiles and player ship.

LaserProjectile

public class LazerProjScript : MonoBehaviour {

    private float speed = 5.5f;

    // Update is called once per frame
    void Update ()
    {
        // translate
        transform.Translate (new Vector3 (0f, -1f, 0f) * speed * Time.deltaTime);

        // destroy the projectile once it's out of screen
        if(transform.position.y <= -10)
            Destroy(gameObject);
    }

    void OnCollisionEnter(Collision other)
    {

        if(other.gameObject.tag == "Player")
        {
            print ("lazer on collision enter!");
            print ("hit player");
            other.gameObject.GetComponent<PlayerController>().hp -= 1;
            Destroy(gameObject);
        }
        if(other.gameObject.tag == "Enemy") return;

    }

}

Player Controller

public class PlayerController : MonoBehaviour
{
    public int hp = 100;
    public float speed = 0.3f;

    // Update is called once per frame
    void Update ()
    {
        /*********************************************************/
        /********************** TRANSFORM CODE *******************/
        /*********************************************************/
        //horizontal <- || -horizontal ->
        //vertical down || -vertical up
        float h = -Input.GetAxis ("Horizontal")*speed;
        float v = -Input.GetAxis ("Vertical")*speed;

        // do not let the ship get out of the camera
        if (Input.GetAxis ("Horizontal") < 0 && transform.position.x <= -11.8) {
            h = 0;
        }
        if (Input.GetAxis ("Horizontal") > 0 && transform.position.x >= 11.8) {
            h = 0;
        }

        if (Input.GetAxis ("Vertical") > 0 && transform.position.y >= 8.2) {
            v = 0;
        }
        if (Input.GetAxis ("Vertical") < 0 && transform.position.y <= -8.2) {
            v = 0;
        }

        transform.Translate (h, v, 0);
    }
}

Please note that neither the player ship nor the laser projectiles are isTrigger, isKinematic. Both have their Z values 0 all the time when they translate.

I cannot identify the problem. If the collider is above X=1 axis, there's no problem. If it's below that, collision does not occur! What is this, how can I solve this problem?

EDIT

Well, I played with the positions a bit and it got stranger. If projectiles start moving towards the player when they are in some range, they collide but if they travel for a certain amount of time (i.e. if they are more distant than some distance) they do not collide. I changed the Y values of the projectiles and one collided with the player even though it was below the X=1, and the other just passed through.

EDIT2

If I do not move the player, the projectiles miss. When I move the player, collisions occur whatever the distance was.

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:
Ensure packet owner from connection is the authentic user In a multiplayer game, how can you be sure that the IP from a packet is the real IP? By spoofing I could send, for example, a "suicide packet" which tells the server that the owner of said packet wants to destroy its avatar when in reality I faked it.

Do games just give up on this aspect?

sentences:
How to get connected tiles in hexagonal grid system I've been developing a game where a number of tiles can drag into a hexagonal grid background.

For some purpose I need to find the location of same tiles into an array and merge them.

Data Layer:

Presentation Layer:

I need to find the location of all the tiles those who have same value and connected with each other.

So I need a basic idea, how can I do that or if exists any algorithm.

Note: As3 related code will help.

sentences:
How can I design good continuous (seamless) tiles? I have trouble designing tiles so that when assembled, they don't look like tiles, but look like a homogeneous thing. For example, see the image below:

Even though the main part of the grass is only one tile, you don't "see" the grid; you know where it is if you look a bit carefully, but it is not obvious. Whereas when I design tiles, you can only see "oh, jeez, 64 times the same tile," like in this image:

(I took this from another GDSE question, sorry; not be critical of the game, but it proves my point. And actually has better tile design that what I manage, anyway.)

I think the main problem is that I design them so they are independent, there is no junction between two tiles if put closed to each other. I think having the tiles more "continuous" would have a smoother effect, but can't manage to do it, it seems overly complex to me.

I think it is probably simpler than I think once you know how to do it, but couldn't find a tutorial on that specific point. Is there a known method to design continuous / homogeneous tiles? (My terminology might be totally wrong, don't hesitate to correct me.)

sentences:
One or multiple quadtrees? Let's say we have 100 objects of each of few types, that may have an effect if they collide with one other type, or they may not.

Is it better to have quadtrees for each object type, and check collisions directly between the object types we want; or is it better to have a single quadtree holding all objects, then generate collision pairs and check if the collision has effect or not?

Is having a single quadtree slower?
Why not having multiple quadtrees, one for each object type?

sentences:
OpenGL ES 2.0 Best Practices / Architecture Guide I've recently started working with OpenGL (ES 2.0) on the Android. While there is lots of documentation about the basics, I can't seem to find much about the overall architecture of OpenGL. In particular, while I see how a Program works, shaders are linked, and vertices are loaded, I can't find any indication of how this should be used to create entire scenes.

That is, does one create multiple programs, reuse the programs, create multiple indexes, try to share textures/shaders, etc. What I'm looking for are some solid references that explain the trade-offs, and intended use, of these functions in the production of scenes. The various Android docs, and OpenGL docs also hint at several limitations in using the API, but don't give concrete information in many cases.

I understand this may be a bit subjective, but I really can't find anything useful on this topic by searching. I'm  unsure where else to ask and I believe that concrete useful answers can be given.

sentences:
Are hard coded "rooms" better than dynamically generated on a smart phone, from performance point of view This question pertains to a type of platform/maze game (made with Unity 5) for typical smartphones (iOS/Android).

This game has following characteristics:
 1. an upper limit (about 100) on the amount of rooms
 2. 3-5 different "levels", each with a different amount of rooms
 3. the shape and type of the "ground" in each room is dynamically generated
 4. each room has some items that are dynamically placed in the room but are generated from a prefab

A rough idea on the rooms in this game is given in below screen shot.

In that image only the platforms (black and white tiles) and the ground (light brown) would be shaped by an algorithm. The other objects shown in the image are prefabs that would be located somewhere in the room by an algorithm.

But considering that this game would not exactly be an infinite runner, and since it should run on smart phones, would it be better from performance perspective, to create 100 hard coded rooms instead?

sentences:
When should I use a fixed or variable time step? Should a game loop be based on fixed or variable time steps?  Is one always superior, or does the right choice vary by game?

Variable time step

Physics updates are passed a "time elapsed since last update" argument and are hence framerate-dependent.  This may mean doing calculations as position += distancePerSecond * timeElapsed.

Pros: smooth, easier to to code

Cons: non-deterministic, unpredictable at very small or large steps

deWiTTERS example:

while( game_is_running ) {
    prev_frame_tick = curr_frame_tick;
    curr_frame_tick = GetTickCount();
    update( curr_frame_tick - prev_frame_tick );
    render();
}

Fixed time step

Updates might not even accept a "time elapsed", as they assume each update is for a fixed time period.  Calculations may be done as position += distancePerUpdate.  The example includes an interpolation during render.

Pros: predictable, deterministic (easier to network sync?), clearer calculation code

Cons: not synced to monitor v-sync (causes jittery graphics unless you interpolate), limited max frame rate (unless you interpolate), hard to work within frameworks that assume variable time steps (like Pyglet or Flixel)

deWiTTERS example:

while( game_is_running ) {
    while( GetTickCount() > next_game_tick ) {
        update();
        next_game_tick += SKIP_TICKS;
    }
    interpolation = float( GetTickCount() + SKIP_TICKS - next_game_tick )
                    / float( SKIP_TICKS );
    render( interpolation );
}

Some resources

Gaffer on games: Fix your timestep!
deWitter's game loop article
Quake 3's FPS affects jump physics—allegedly a reason Doom 3 is frame-locked to 60fps?
Flixel requires a variable timestep (I think this is determined by Flash) whereas Flashpunk allows both types.
Box2D's manual § Simulating the World of Box2D suggests it uses constant time steps.

sentences: Recreating this flat-shaded look I'll keep it short. How does one achieve the effect depicted in the image below? Is it feasible to do in realtime? It looks deceptively simple, but it probably isn't. Are there any keywords I can search for to get more information about programming the shaders to achieve this look? Thanks.

sentences: Is there any way to earn money with an open source game? I know FreeToPlay games are financed by advertisements and/or selling additional content, but what about an Open Source single player game to which several people have contributed? And how can a fair sharing be determined?

sentences:
How do I debug two android devices simultaneously in Eclipse? I have a multiplayer game which should be tested on two devices at the same time, if possible, with debugging.

Can eclipse do this?  If so, how?

sentences:
Which MoCap Animation Sits I have an UMA that I want to be in a sitting position basically forever. I assume I need an animation that will put him in an idle sitting position.

I found the MoCap Huge Animation library for free in the Assets Store, but it is so big that I don't know which animation is sitting.

Does anyone know of an idle sitting animation that I could use? Or specifically which number (ie 02_01) of the MoCap Huge Library which has one?

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:
How can I know how big my game "world" should be? here is the world map (randomly generated) for a game I'm making:
The green rectangle corresponds to the size of one screen. Each pixel represents 3x3 tiles in my game, this makes the whole map be roughly 7,9 km² (2,3 x 2,3).
How can I assess if the game is too big or too small?

sentences:
Getting distance between point of an object and another object in Unity First, I'd like to apologize because this is a very basic and repetitive question, but I am completely new to game development.

I understand that I can find a distance between two objects using:

float dist = Vector3.Distance(other.position, transform.position);

However, how can I find the distance between a point of one object to other object?

For instance let's say my object is this sphere

Now, how can I return an array that says that there are no objects to the left (null), in the front there is an object at 1, and to the right there is an object at 0.5?

Thank you for your patience and understanding

sentences:
Strongly Typed Skills I am working on a skill system for use in a game project I'm chipping away at. The project is entirely in C# so I'm using .NET to its advantage.

In my preliminary implementation of a Skill Category -> Skill types system I'm using subclasses of ISkill and SkillCategory (base class with some virtuals) and using System.Type based reflection to generate a map of these at runtime (on demand).

The great thing about this implementation is that it entirely decouples specific skill types (such as Engineering / LaserWeapons from the SkillLibrary (the container for the generated skill mapping).

The goal is to remove the need to explicitly add each skill at some point as they are automatically detected by the library throughout the entire AppDomain.

Only game logic which relies on these skills use concrete types.

ISkill

public interface ISkill
{
  string GetName();
  string GetDescription();
  int GetSkillLevels();
  float GetMinutesOfTrainingForLevel(int level);
}

[SkillCategory(typeof(EngineeringSkills))]
[PrerequisiteSkill(typeof(ElectronicsSkill))]
public class LaserWeaponSkill : ISkill
{
  public string GetName()
  {
    return "Laser Weapons";
  }

  public string GetDescription()
  {
    return "Allows you to maintain and improve laser based weapons on your ship.";
  }
}

Usage example:

[RequiredUpgradeSkill(typeof(Skills.Engineering.LaserWeapons))]
public class LaserTurretWeapon : IShipWeapon
{
}

There's two slight ugliness's with being very System.Type based, though. One is that my Player._skillLevels dictionary can't serialize as Dictionary<Type, int> because Type isn't supported by DataContractSerializer (what I'm using at the moment).

So what I'm doing in SetSkillLevel<TSkill>(int level) and GetSkillLevel<TSkill>() is translating typeof(TSkill) to and from a string using typeof(TSkill).FullName (i.e. "Game.Skills.Engineering.LaserWeapons").

And the other is potential performance problems, which is something I should profile.

This all works, of course, but it feels like the weak point in an otherwise enum-less, strongly typed skill definition system.

I don't really want to use enums and a "list" of Skill structures, or move it to an external data definition file because then that requires more maintenance of created and deleted enum values and such.

Do you think this is worth it, or do topics such as performance of Type based operations and other considerations make it worth rethinking?

sentences:
How can I divide a 3D mesh into small pieces? I'm considering a manufacturing game. A player should assemble parts of an object in given time. The object will be a 3D mesh model. I want to automatically split the 3D mesh into many small pieces to be provided to players. Each divided piece is needed to have area as similar as possible. And I want to control the number of pieces too within range about 2~6. How can I do this?

I know the method to modify a given mesh like adjusting values of vertices, indices. All I need is the algorithm.

sentences:
Capsule getting stuck on edge of block I'm making a first person game and when I jump and my character gets close to the top of the wall, the vertical movement stops, jitters, or suddenly snaps to the top of the wall.
Video
Here is my character controller code, based on this tutorial:
using UnityEngine;

[RequireComponent(typeof(CharacterController))]
public class PlayerController : MonoBehaviour
{
    private InputManager inputManager;
    private CharacterController controller;
    private Vector3 playerVelocity;
    private bool groundedPlayer;
    [SerializeField] private float playerSpeed = 2.0f;
    [SerializeField] private float jumpHeight = 1.0f;
    [SerializeField] private float gravityValue = -9.81f;

    private Transform cameraTransform;

    private void Start()
    {
        controller = GetComponent<CharacterController>();
        inputManager = InputManager.Instance;
        cameraTransform = Camera.main.transform;
    }

    void Update()
    {
        groundedPlayer = controller.isGrounded;
        if (groundedPlayer && playerVelocity.y < 0)
        {
            playerVelocity.y = 0f;
        }

        Vector2 movement = inputManager.GetPlayerMovement();
        Vector3 move = new Vector3(movement.x, 0f, movement.y);
        move = cameraTransform.forward * move.z + cameraTransform.right * move.x;
        move.y = 0f;
        controller.Move(move * Time.deltaTime * playerSpeed);

        // Changes the height position of the player..
        if (inputManager.PlayerJumpsThisFrame() && groundedPlayer)
        {
            playerVelocity.y += Mathf.Sqrt(jumpHeight * -3.0f * gravityValue);
        }

        playerVelocity.y += gravityValue * Time.deltaTime;
        controller.Move(playerVelocity * Time.deltaTime);
    }
}

I also tried using other solutions by changing the physics material of the level and player, neither worked.

sentences:
Game Design: Faction/Player circular relationship For a Java game, say I have two classes:

Player, representing a player in the game.
Faction, representing a faction of players in the game.

When the game starts up, all factions are loaded into some collection and all players are loaded into some collection.

Collection<Player> players;
Collection<Faction> factions;

Say there are two variables:

Player player1;
Faction the_destroyers;

player1 is in the faction the_destroyers.

the_destroyers needs to reference player1, since player1 is in the_destroyers. At the same time, player1 needs to reference the_destroyers, for quick lookup (otherwise I would have to iterate through the collection of factions, which may be a very large collection).

Obviously, whichever variable is loaded first cannot reference the other, since the other has not yet been loaded.

Generally speaking, how do I get around this issue? Is there a simpler solution?

sentences:
Difference between shader input element classification between D3D12 and Vulkan I'm confused about the difference between the shader input element classifications in D3D12 and Vulkan. For example, in Vulkan I could have the following declarations:
struct vertex
{
    glm::vec3 pos;
    glm::vec3 col;
};

VkVertexInputBindingDescription input_binding_description
{
    .binding = 0,
    .stride = sizeof(vertex),
    .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
};

std::array<VkVertexInputAttributeDescription, 2> input_attribute_descriptions {
    VkVertexInputAttributeDescription{
        .location = 0,
        .format = VK_FORMAT_R32G32B32_SFLOAT,
        .offset = offsetof(vertex, pos)
    },
        VkVertexInputAttributeDescription{
        .location = 1,
        .format = VK_FORMAT_R32G32B32_SFLOAT,
        .offset = offsetof(vertex, col)
    }
};

Here the input rate is specified per vertex and not per attribute. On the other hand, in D3D12, we would have
struct Vertex
{
    XMFLOAT3 pos;
    XMFLOAT3 col;
};

std::array<D3D12_INPUT_ELEMENT_DESC, 2> input_element_descs =
{
    { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0,
    D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
    { "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12,
    D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }
};

And as you can see, the input rate is specified per attribute. Why is that? Is there a difference between the meaning of the input classification in D3d12 and Vulkan that I'm missing? I'm not familiar with D3D12, but at first glance, it doesn't make sense to me to have different input classifications for the attributes of a vertex.

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:
What's the difference between Camera::getPosition() and Camera::getPositionForViewUpdate()? In Ogre3d, what's the difference between methods  Camera::getPosition() and Camera::getPositionForViewUpdate(), official documentation doesn't says much:

/** Get the derived position of this frustum. */
const Vector3& getPositionForViewUpdate(void) const;

/** Retrieves the camera's position.*/
const Vector3& getPosition(void) const;

Thanks!

sentences:
How can I enable flat surface reflections in UE4 on mobile? Could someone please tell me how do I enable reflections on flat surfaces on a mobile in UE4? I have a simple room with one directional light. I need reflections on the tables and ground planes. I have tried every single setting and variation possible and nothing works.

I have tested the Sun Temple demo project and the Reflection Content Example demo project and nether of those projects have reflections on the mobile (iPhone 6). Those projects do have some kind of glare on the ground plans but noting close to what would be classified as a realistic reflection.

SSR does not work on mobile, neither do Sphere or Box Reflection captures. An alternative solution to get reflections working may be to use a Scene Capture Cube, but they don't work on mobile either.

UE4 is suppose to be an amazing game engine but it doesn't even offer the ability to support reflections on mobile. Reflections are quite simple to get running in Unity.

I have spent so much time trying to get reflections to work, and the worst thing is, every post or document that i have read about this subject does not offer a solution.

If someone could please confirm for me that reflections do not work on mobile or offer me a solution to get detailed reflections displaying on the ground and tables I would be so appreciative.

sentences: How to apply Image effect only on specific part of objects? I need a way to censore part of characters' bodies like Cyberpunk 2077.this is mean I want to apply Image effect only to specific parts of bodies that you can see in the below Image:

sentences: What are names like "net.minecraft.blocks" called? I'm trying to find these types of names for certain Minecraft blocks to add them to a block whitelist for one of my mods. Is there an actual name for these? If not, how would I go about finding a list of or searching for them?

sentences:
Camera rotation deforms objects I'm working on a ray-tracer in C++ with an adjustable camera for a university assignment. I'm entirely new with graphics and I'm struggling with one thing.

I have a matrix as a mat4 object (4x4 matrix with each cell saved in a 1D array) that I save in a Camera object that handles transformations of every point in the scene (which is currently just two spheres). Translations seem to be working fine, but when I attempt rotations, things break. The spheres deform, and it only gets worse the more I attempt to rotate the camera.

This is where I set the camera matrix:

mat4 Renderer::setCameraMatrix(const Camera &camera)
{
    mat4 cameraToWorld = mat4(); // Initialise 4x4 matrix.

    // Translation.
    cameraToWorld.cell[3] = camera.pos.x;
    cameraToWorld.cell[7] = camera.pos.y;
    cameraToWorld.cell[11] = camera.pos.z;

    // Rotation.
    cameraToWorld.cell[0] = camera.orientmat.cell[0], cameraToWorld.cell[1] = camera.orientmat.cell[1], cameraToWorld.cell[2] = camera.orientmat.cell[2];
    cameraToWorld.cell[4] = camera.orientmat.cell[4], cameraToWorld.cell[5] = camera.orientmat.cell[5], cameraToWorld.cell[6] = camera.orientmat.cell[6];
    cameraToWorld.cell[8] = camera.orientmat.cell[8], cameraToWorld.cell[9] = camera.orientmat.cell[9], cameraToWorld.cell[10] = camera.orientmat.cell[10];

    return cameraToWorld;
}

This matrix is then used to set the origin and direction of the camera in the world space later on in the code:

vec3 orig = transformpoint(vec3(0), cameraToWorld);
/*...*/
vec3 dir = transformvector(vec3(x, y, -1), cameraToWorld) - orig;
dir.normalize();

The transformpoint and transformvector functions basically multiply a vector v by a matrix M (M.v), except the former takes into consideration translations, and the latter doesn't. Their code can be found here.

The orientmat matrix is calculated from the three separate orientation angles (orient.x, orient.y, orient.z) in this line of code:

cam->orientmat = mat4().rotatexyz(cam->orient.x, cam->orient.y, cam->orient.z);

Using this function:

mat4 mat4::rotatexyz(const float a, const float b, const float c)
{
    mat4 M;
    const float ca = cosf(a), sa = sinf(a);
    const float cb = cosf(b), sb = sinf(b);
    const float cc = cosf(c), sc = sinf(c);

    M.cell[0] = cb * cc, M.cell[1] = -1 * cb * sc, M.cell[2] = sb;
    M.cell[4] = sa * sb * cc + ca * sc, M.cell[5] = -1 * sa * sb * sc + ca * cc, M.cell[6] = -1 * sa * cb;
    M.cell[8] = -1 * ca * sb * cc + sa * sc, M.cell[9] = ca * sb * sc + sa * cc, M.cell[10] = ca * cb;

    return M;
}

(This function basically creates this transformation matrix from the three camera orientation angles.)

I've tried to keep this question as compact as possible but I can provide more code if needed. I'm completely baffled about why I'm getting this kind of deformation on my spheres, and some insight would be invaluable! Thanks.

sentences:
3D Box Collision Data Import I'm trying to implement a collision system using oriented bounding boxes, using a center for the box, it's extents as a 3D Vector and a rotation matrix, which is all stuff I picked up online and seem to be somewhat the standard.

Detecting the center is no problem so I'm gonna leave these out here.

My problem however is importing the data from a 3D file. Say I've placed a box with 2 units length on each side aligned to the world axis. The logic results here are extents of 1,1,1 and I use an identity matrix for rotation - easy.

However I'm stuck when I rotate the box in the 3D program, say 30 degrees each axis. How would I parse the box? I only have these 8 vertices as information, and I guess what I would need to do is to find out the rotation of said box, apply it to the vertices so they are aligned to world axes and then calculate the extents out of that.

How do I get the rotation of the box when I only have the vertex information of the box available?

sentences:
Where to look for team mates? Where is a good place to look for people interested in creating games online? I'll be using XNA.

I'm going to start the project later this week, but I'm definitely commited to it. I'd like to find people who won't hit it and quit it after a month.

sentences:
how could RTT be so slow on my intel card? I simply draw something into a render target, and use it as an normal texture. It's always working greate to me with my nvidia video card. But today I found my program ran terribly slow (less than 5 fps) on a intel card.

After running an analyse I found glGenerateMipmapEXT is the trouble maker, it costs most of the cpu time. Here's how I bind a RT texture:

  glBindTexture(GL_TEXTURE_2D, m_textureID);<br>
  glGenerateMipmapEXT(GL_TEXTURE_2D);

without glGenerateMipmapEXT the texture is nothing but pure white pic. Something wrong with my RTT?

sentences: How to invert background pixel's color I'm writing a game and map editor using Java and jMonkeyEngine. In the map editor, I've got a brush done by wireframed sphere. My problem is: I want to make it visible everywhere, so I want to invert color of the pixel "behind" this brush. I wanted to do it with fragment shader (GLSL), but I don't know how to get color of this pixel.

sentences:
How do you apply relativistic physics to a 4x strategy game? I had the big idea of trying to create a hard science fiction 4X strategy game (with the obvious space setting), which is supposed to simulate a realistic way of creating interstellar societies while simulating real life physics as well.

The problem is: how do I apply Einstein's relativistic equations into the game? I will make a separate series of questions for other issues, such as applying Keplerian planetary movement and Newtonian combat physics.

Do note: the game is being made in C++ and in Unity. Be warned: I am trying to simulate special relativity, not general relativity quite yet. That I can try in a different game.

sentences:
OpenGL Calculate Matrices Im trying to switch from the glTranslate etc to my own Matrices, but for some reason it does not work. Here are my 2 functions to create the view- and projection matrix:

public Matrix4f getViewMatrix() {
    Matrix4f viewMatrix = new Matrix4f();
    viewMatrix.setIdentity();
    viewMatrix.translate(game.player.position);
    viewMatrix.rotate(game.player.rotation.x, new Vector3f(1.0f, 0.0f, 0.0f));
    viewMatrix.rotate(game.player.rotation.y, new Vector3f(0.0f, 1.0f, 0.0f));
    viewMatrix.rotate(game.player.rotation.z, new Vector3f(0.0f, 0.0f, 1.0f));
    //System.out.println(viewMatrix);
    return viewMatrix;
}

public Matrix4f getProjectionMatrix() {
    FloatBuffer projectionBuffer = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL_MODELVIEW_MATRIX, projectionBuffer);
    Matrix4f projectionMatrix = new Matrix4f();
    projectionMatrix.load(projectionBuffer);
    return projectionMatrix;
}

I send those 2 matrices to the Vertex shader with a uniform, and use:

gl_Position = view_matrix * proj_matrix * vec4(in_position, 1.0);

Where in_position is the coordinate of the vertex.

I do see some things on the screen, but it's very, very buggy, and nothing is right about it.
If I use the build-in gl_ModelViewProjectionMatrix in the shader and use glTranslate and glRotate in OpenGL, it works perfectly fine.

What am I doing wrong here?

Here is the output of me view projection together with the camera position:

0.5095141 0.0 -0.8604623 1.1625774
0.7321221 0.52541286 0.43351877 16.980185
0.45209795 -0.8508474 0.26770526 0.8665553
0.0 0.0 0.0 1.0

Vector3f[1.1625774, 16.980185, 0.8665553]

sentences:
Unity: redraw only part of the GUI I am making an RTS game which currently has a very heavy GUI and takes up sometimes 50% of the CPU time per frame.
Most of the data on the GUI remains constant, (selected units and their avalible actions) but some needs to be updated frequently (health bars, progress bars).

Is it possible to draw the GUI once on an event and then keep that on screen and only redraw parts of the GUI?

sentences:
How does real-time raytracing draw reflections of off-screen geometry? I know what raytracing is, but I'm a bit curious how games are able to reflect off-screen geometry using raytracing in real-time.

I tried looking up the technical details but most of the articles are "what it is"

sentences:
UNITY 3D - Saving last scene I can't find working solution for this problem anywhere. Here is what I'm trying to do:

My Android game contains 10+ levels, user quits game on level 2. Next time user starts game it load level 2 automatically. Thats all I want, no need to save objects, just load last scene. I prefer simple javascript, but examples on the unity tutorials confuse me. Thanks for answers.

sentences:
Unity 3D - Rotate towards object with random offsets Title is a little confusing, but let me explain:

I want to make the enemies look at the player, and shoot at him, with random precision, meaning that one time the enemy will shoot a little bit to the left of the player, next time a little bit to the right of him, and sometimes exactly at him.

Currently I have this scene:

The turret rotates, and when the green direction spots the player, it shoots a bullet facing the player (the green arrow).

Now I need where the rotation is passed for the Instantiate, to have some random precision, and I don't know how to do it. Here's what I have so far

Vector3 pos = new Vector3(firingPoint.transform.position.x, firingPoint.transform.position.y, firingPoint.transform.position.z);

float playerX = playerObject.transform.position.x;
float playerY = playerObject.transform.position.y;
float playerZ = playerObject.transform.position.z;

float randomX = Random.Range(playerX - 1f, playerX + 1f);
float randomY = Random.Range(playerY - 1f, playerY + 1f);
float randomZ = Random.Range(playerZ - 1f, playerZ + 1f);

Quaternion aimPrecision = Quaternion.LookRotation(new Vector3(randomX, randomY , randomZ));

Instantiate(bulletPrefab, pos, aimPrecision);

How can I do this?

EDIT: Right now, the enemy shoots like this:

but never towards me, or backwards

sentences:
Why doesn't my animation stop when I press a key? I wrote a program that animates two squares diagonally across the screen, from opposite sides. Used Timer object to do so. The squares collide with each other and also with the frame boundary to change directions. The problem is that I added a key listener to stop the animation when you press a particular key, and again restart the animation when you press the same key, but that does not seem to work. The animation is not stopping.

problematic part:-

 public Drawing(){

    t=new Timer(10,this);
    t.start();
    addKeyListener(this);
    setFocusable(true);
    if(flag==-1){
        t.stop();
    }
    if(flag==1){
        t.start();
    }
}

and this is the keyListener part that changes flag to 1 / -1 :-

public void keyPressed(KeyEvent arg0) {
    if(arg0.getKeyCode()==KeyEvent.VK_ENTER || arg0.getKeyCode()==KeyEvent.VK_ESCAPE){
        flag=-(flag);
    }
}

i also found out that the value of flag variable is changing perfectly with each keyPressed, but it is not stopping the timer.

sentences:
Texture tearing with UV texture atlas mapping The following code maps the texture from a texture atlas to a UV. The problem is I'm having texture tearing issues.

Does anyone know how to overcome this problem and have any suggestions? Here is the code I have, all images are point filtered and no mipmapping is used.

    for (int i = 0; i < mesh.uv.Length; i++)
    {
        UVs.Add(GetUVTextureFromAtlas(mesh.uv[i].x, mesh.uv[i].y, voxel, 0));
    }

    [...]

    Vector2 GetUVTextureFromAtlas(float x, float y, ushort voxel, Facing side)
    {
        Rect rect = GetVoxelTextureRect(voxel, side);
        float xout = UVLerp(rect.x, rect.x + rect.width, x);
        float yout = UVLerp(rect.y, rect.y + rect.height, y);
        return new Vector2(xout, yout);
    }
    float UVLerp(float from, float to, float t)
    {
        float difference = to - from;
        return from + (difference * t);
    }

sentences:
How do I take 2D ballistic trajectory planning and apply it to 3D? I am currently using this formula

speed = sqrt((gravity.y*target.x^2)/(2*cos^2(angle)*(target.y - target.x*tan(angle)))

provided by DMGregory as an answer for my question here to determine the speed of a trajectory given an angle and start/end points. So now I need to be able to apply this to a 3D scenario. How would I go about doing that?

sentences:
How can I customize/remove the caret from Input Fields in Unity? Goal
Change the caret to a non-blinking asterisk.
Description
I'm using the TextMeshPro variant of the InputField, and my Unity ver. is 2019.3.
Potential Solutions
Remove Caret
I could remove the caret and manually add an asterisk at the end — and remove it upon submission.
Problem: I don't know how to do that. Caret width doesn't go below 1, and I've yet to see an option to disable it.
Change Caret
Self-explanatory. However, it doesn't appear that customizing the caret character is an option.
Shove The Input Field Off-Scree And Copy Its Value + * To Text On-Screen
I can still use the Input Field (and I need to), but hide it off-screen and put a simple Text field in its place, which will display the Input Field's text + the caret (*).
This could work, but I'm hoping there's a less hacky solution.

sentences:
What causes some computers to have no or slow OpenGL, and how to fix it? I am using Java with JOGL to create OpenGL enhanced 2D graphics.  The graphics operations I use are nothing fancy, and should be supported by almost any recent graphics card.  For example, my game runs great on a Netbook.

I was hoping the game would run on most computers.  It runs fine on my own computers.  However, I found some computers have very slow performance (apparently software fallback, yielding about 2 frames per second).  I ran a LWJGL app on one such computer. It doesn't run at all (it reports something like
org.lwjgl.LWJGLException: Pixel format not accelerated, you can find various forum threads complaining about this but no apparent solutions, except the suggestion that it is a driver problem).  Other OpenGL software does not seem to work, either.  I also found that my Flash version of the game with exactly the same graphical effects performs pretty well full-screen on that same computer.  The computer in question has a recent ATI card but unfortunately I have no access to the driver manager.

The problem appears fairly widespread.  I think it is very unfortunate that OpenGL does not always provide access to graphics features found on most computers.  This makes it less attractive for casual 2D games, which I expect to run on any computer.

Did any of you run into this problem and manage to fix it?  AFAIK, both NVidia and ATI provide OpenGL as part of their standard driver sets, but maybe there are some exceptions?  Is this problem caused by third party drivers not supporting OpenGL, and can the problem be fixed by installing better drivers?  How many other graphics cards are out there without OpenGL drivers?

EDIT: As a final note, I can conclude that OpenGL is just not well supported on Windows machines.  Microsoft seems to have been doing their best to keep it off their platform, for example by deliberately leaving out OpenGL drivers in some Windows driver bundles. Get the vendor drivers, and you get OpenGL; get the standard drivers that Windows downloads for you, and you don't.  This has been causing no end of trouble for others as well. For example, for implementing WebGL, Web browsers use Angle, which is an OpenGL ES emulator for DirectX. So, what we'd really need is something like Angle, only for full OpenGL.

sentences:
How do I create a simple animation for use in Unity? I'm trying to create a simple shrinking animation for use in Unity. The goal is to create an animation that shrinks the object to be 0.1 scale.

I've created an Animator Controller with an empty state, and an Animation, and assigned the Animation into the Animator Controller's empty state's "Motion" slot, but I have no idea what to do next. This is what the inspector looks like on the Animation:

When I click "Open", nothing happens. There doesn't seem to be any area to edit the animation.

I have no idea where to start, sorry if the question isn't detailed enough.

sentences:
How to play a sound only one time in XNA? I'm using a sound when a key is pressed, like a fire. But despite that I'm pressing the key for just a short moment, the sound is playing so many times. I guess it's because of the Update method that updates it all 60 times per second.

Is there a way to play the sound only one time, until I press the next time? I also have the same problems with sprites when they hit the border a short "bang" sound is played, but it dosen't sounds like it should do! I guess it playes to many times!?

Help id preciated to solve this! Thanks!

if (keyboardState.IsKeyDown(Keys.Space))
{
code play sound and activate a sprite
}

sentences:
Storing wins and losses locally in Unity I am writing here as I have made a game in Unity where I want to store how many wins/losses a player has. The way I am thinking to do it is by putting 2 counters; One for every time a player wins, and one for every time a player loses. What I do when a player wins or loses is that he can shoot something and restart the game; I load scene 0 here. I know that the counters will reset once the player closes the application, but that doesn't matter.

Anyway, is there a better way to do it?

The other thing I am thinking about is storing how many times a player has played the game in total, and this has to be stores locally too and must not get reset when the player closes the application. How is this done?

sentences:
How to adapt UV code to use a tilesheet that is "uneven"? The tutorial has code that takes a tilesheet and builds a UV mapping:

 const float tileSize = 0.25f;

 public virtual Vector2[] FaceUVs(Direction direction)
 {
     Vector2[] UVs = new Vector2[4];
     Tile tilePos = TexturePosition(direction);

     UVs[0] = new Vector2(tileSize * tilePos.x + tileSize,
         tileSize * tilePos.y);
     UVs[1] = new Vector2(tileSize * tilePos.x + tileSize,
         tileSize * tilePos.y + tileSize);
     UVs[2] = new Vector2(tileSize * tilePos.x,
         tileSize * tilePos.y + tileSize);
     UVs[3] = new Vector2(tileSize * tilePos.x,
         tileSize * tilePos.y);

     return UVs;
 }

He explains why he uses tileSize = 0.25f:

  The variable tileSize is equal to 1 divided by the number of tiles per
  side, in the case of our example texture 1/4 (0.25). The function
  creates an array of vector2 and gets the tile position with the
  direction and populates the array based on the tile position. Every UV
  coordinate corresponds to a vertex and the triangle made of those
  vertices uses the corresponding texture coordinates.

This is the tilesheet he is using, which is a 4x4:

I have a tilesheet which is not a 4x4:

I have tried tileSize = 0.0667f (1/15 if I assume the tilesheet is 15x15), but this is not correct. For example, a grass block is (5, 14) for the side, and (5, 8) for the top. But the game renders really weird textures.

What should the tileSize be since this tilesheet is not a perfect square (it looks like 6x15 tiles, but it also has a lot of empty space which might cause problems)?

Reference:

Tutorial:
http://alexstv.com/index.php/posts/unity-voxel-block-tutorial-pt-2

Source tilesheet (CC0 license):
http://kenney.nl/assets/voxel-pack

sentences:
How to create fog effect over specific tiles in dungeon game I'm working on a game in unity and I have areas the player cannot enter blocked off by game objects that are animated sprites that are supposed to look like fog. They don't look that great and I'd like to try something a little more complex, but as a beginner with Unity I don't know where to start.

I'd like to make a fog effect that surrounds the tiles that are blocked (Similair to this asset I found. But I only want it to be seen over specific tiles.)

I also looked into something like a darkness emitting light, but haven't found anything that works.

Here is a picture of the scene hierarchy.

sentences:
Why is permadeath essential to a roguelike design? Roguelikes and roguelike-likes (Spelunky, The Binding of Isaac) tend to share a number of game design elements:

Procedurally generated worlds
Character growth by way of new abilities and powers
Permanent death

I can understand why starting with permadeath as a premise would lead you to the other ideas: if you're going to be starting over a lot, you'll want variety in your experiences. But why do the first two elements imply a permadeath approach?

sentences:
Converting UnityScript code to C#: What is the alternative for .ToBuiltin? I'm trying to convert this code from UnityScript (Unity's version of JavaScript) to C#:

var polys = new Array(); // array to collect vertex locations
polys.Push((scanpoint + padding) + Vector2(0.5, 0.5) * Pixel_vs_Unit_Scale);
var poly:Vector2[] = polys.ToBuiltin(Vector2);

I converted the first two lines like so, with no errors:

var polys = new List<Vector2>();
polys.Add((scanpoint + padding) + new Vector2(0.5f, 0.5f) * Pixel_vs_Unit_Scale);

But when I try to adapt the last line like this:

Vector2[] poly = polys.ToBuiltin(Vector2);

I get two errors:

  ToBuiltin does not exist.

And also an error on the Vector2 inside the ():

  Vector2 is a type which is not valid in the given context.

How can I convert this code to C# correctly?

sentences:
Story line implementation in a game Say I have the general engine working and the only thing missing is a story line.

Let's take the Pokemon games as an example:
How would I implement surfing if I don't want to check wether the next tile is a water tile on every step I take? (I assume this would be horrible performance wise)
The guards will let me pass once I have delivered some juice to them. How would this be done?

The second one should I should be able to implement with a state machine. Am I correct in understanding that a state machine is an enum(java) with my different states?

The other thing I am a little bit confused about is Events. For example how would I implement that if I step on a certain tile my character dies - again without checking this for EVERY tile I step on. I believe the tile would need to call some sort of Event that then kills my character. How should I write my "EventHandler"?

sentences:
Android 2D terrain scrolling I want to make infinite 2D terrain based on my algorithm.Then I want to move it along Y axis (to the left)
This is how I did it :

public class Terrain {
Queue<Integer> _bottom;

Paint _paint;

Bitmap _texture;

Point _screen;

int _numberOfColumns = 100;
int _columnWidth = 20;

public Terrain(int screenWidth, int screenHeight, Bitmap texture)
{
    _bottom = new LinkedList<Integer>();

    _screen = new Point(screenWidth, screenHeight);

    _numberOfColumns = screenWidth / 6;
    _columnWidth = screenWidth / _numberOfColumns;

    for(int i=0;i<=_numberOfColumns;i++)
    {
        // Generate terrain point and put it into _bottom queue
    }

    _paint = new Paint();
    _paint.setStyle(Paint.Style.FILL);
    _paint.setShader(new BitmapShader(texture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT));
}

public void update()
{
    _bottom.remove();
    // Algorithm calculates next point
    _bottom.add(nextPoint);
}

public void draw(Canvas canvas)
{
    Iterator<Integer> i = _bottom.iterator();
    int counter = 0;
    Path path = new Path();
    path.moveTo(0, _screen.y);
    while (i.hasNext())
    {
        path.lineTo(counter, _screen.y-i.next());
        counter += _columnWidth;
    }
    path.lineTo(_screen.x, _screen.y);
    path.lineTo(0, _screen.y);
    canvas.drawPath(path2, _paint);
}

}

The problem is that the game is too 'fast', so I tried with pausing thread
with

Thread.sleep(50);

in run() method of my game thread but then it looks too torn.

Well, is there any way to slow down drawing of my terrain ?

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:
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:
Soccer Game only with National Team names (country names) what about player names? Ok...this question hasn't been asked before, its very similar to some, but here's the difference:

I am making a soccer/football simulator game, that only has national teams (with no official logos) just the country names and flags.
Now, my doubt is the following...can I use real player names (that play or played on that national team?)

From what I understand if I use a player name linked to a club like Barcelona FC (not a national team) I need the right from the club and the association that club is linked to, right?
But If I am only linking the name just to a country...I might just need the permission of the actual player (that I am using his name) and not any other associations, correct?

Thanks a lot in advance!
Cheers,
Diego.

sentences:
Looking for some insight on level mangment So, i'm creating this little music game as and exerciseand want to do it as "Correct" as possible.

The game works like this:

The player gets a short melody played to them ("C4","D4","E4","C4")
Then the player has to play it back.
The notes in each level are at the movment stored in arrays as strings, and each level has a class(Level1, Level2 etc...).

I'm thinking this can be difficult to manage as a create more complex levels. And I really want to be able to add Levels via the internet without having to update the app.

Would it be better to have a "LevelMangager" that loads inn XML data on runtime?

I'm using the starling framework and i want it to be able to run on Mobile to.

As you probably can tell i'm fairly new to game dev. so all insight is appreciated

sentences:
Deactivate VS warning "Macro in skipped region" Since the UE4 API relies heavily on macros outside of function bodies, the IntelliSense function (not the compiler!) of Visual Studio 2017 throws a lot of warnings with update 15.7, also visible in the scroll area.

Is there a possibility in the Visual Studio settings to deactivate such kind of warnings?

The option to deactivate IntelliSense

Tools -> Options -> Text Editor -> C/C++ -> Advanced -> Disable IntelliSense

will disable those warnings. However I don't want to renounce IntelliSense completely. Maybe Visual Studio offers more fine grain control over IntelliSense via its GUI or some settings file to disable only those macro warnings?

EDIT: The Visual Studio team recommends using a .hint file to register macros as workaround. However maintaining a separate macro list is not the way to go. You can also vote there that the VS Team works on that.

sentences:
How to create and choose sprite sheet for different mobile screen resolution in Unity Background
We’re working on a 2D mobile game. We want to publish the game on all apple devices which at least support iOS 7 and to all android devices which at least support Android 4 OS. These devices come with different screen size and resolution. For example, in following image we have different Aspect ratios and resolutions that we almost found in every mobile device.

Question

Do we need to choose a higher resolution to design a sprite sheet
for those devices which share same aspect ratio? For example, iPhone
3Gs and iPhone 4s share aspect ratio of 3:2. But they have different
screen resolution.
If those devices come with different aspect ratio. Do we need to
create multiple sprite sheet for multiple aspect ratio?
What are the best practices that unity offer us to design and create
sprite sheet for multiple mobile device, which are optimize to even
lower mobile device?

sentences:
How do I communicate that something is a tutorial button I made an (ios) arcade game that is rather unconventional, and as a result many people wont exactly know what to do or what the controls are when they first open it. As a results I have had to add a rectangular "Tutorial" button on my main menu screen so that when I hand it to people, or other people hand it to people (etc) its all ok.  FYI: When the game first opens it does go to a tutorial, I just wanted it to be accessible for repeats if necessary

In the original build I designed all the buttons and had labels on them, however the artist inside of me says that doesn't look good, so I had a friend redesign them.

The new buttons are bi-colored and very minimalist (usually with the outline of a shape in them).  We came up with simbols that work for "return", "play", and "leaderboard" that work... however we can not come up with one for "tutorial".

What would be a clear symbol that could be put on a "tutorial" button?

Here is a picture of the screen. That grey shape is meerly a placeholder.  The button on the top right opens a "Credits" page.

sentences: Building a windows game for Mac. I have a game that I made in Unity and I have a windows build for it. It works fine on windows no problems there but I want to make a mac version of it. To make a mac version will it work if I just build it for mac or will I have to reprogram it for mac? I don't have a mac to test this and obviously I dont want to release a broken game. Note that the game uses the command Input.GetMouseButtonDown(0) a lot, not sure if you need a different command for a mac mouse.

sentences:
Where can I publish my Windows Indie game? I've just finished an XNA game for the Windows Phone 7 and XBLIG.  At the moment, the game is a 'lite' version, so is free, but the next version will have a small price-tag.

I also did a Windows version.  Where's the best place to publish it?

sentences:
how to set up health bar rect that depends on health? I need some help with game math.

What I am using:

I am using java awt library.

What I am trying to do:

I am trying to build enemy health bar, which will display as an rectangle. I am display two rectangles. First one is black rectange and it will act as in base container. 2nd one is red rectangle and it will act as helath bar.

now the max size of enemy health bar will be enemy.getWidth(). I need some help with 2nd red rectangle width. how can I set up so that it dependents on enemy.getHealth() and max is enemy.getWidth.?

and enemy.getHealth() will be 4.

Code:

    g.setColor(Color.black);
    g.fillRect(enemy.getX(), enemy.getY(), enemy.getWidth(), 5);
    g.setColor(Color.red);
    g.fillRect(enemy.getX(), enemy.getY(), enemy.getHealth() * 4, 5);

sentences:
Efficient way to calculate "vision cones" on 2D tile map? I'm trying to calculate which tiles a particular unit can "see" if facing a certain direction on a tile map (within a certain range and angle of facing). The easiest way would be to draw a certain number of tiles outward and raycast to each tile. However, I'm hoping for something slightly more efficient. A picture says a thousand words:

The red dot is the unit (who's facing upwards). My goal is to calculate the yellow tiles. The green blocks are walls (walls are between tiles, and it's easy to check if you can pass between two tiles). The blue line represents something like the "raycasting" method I was talking about, but I'd rather not have to do this.

EDIT: Units can only be facing north/south/east/west (0, 90, 180, or 270 degrees) and FoV is always 90 degrees. Should simplify some calculations. I'm thinking there's some sort of recursive-ish/stack-based/queue-based algorithm, but I can't quite figure it out.

Thanks!

sentences:
Problem with preloading plist file in Cocos2d-x I am using Cocos2d-x engine with 3.2 version.

In my splash screen I am prefeching a plist by below line

SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ui.plist");

Now inside game when I am creating a sprite I am getting an assert fail error

Sprite *ss = Sprite::createWithSpriteFrameName("pause.png");

  Assert failed: Invalid spriteFrameName: pause.png

Also when the splash screen is removed, I am getting the below line in console

  cocos2d: TextureCache: removing unused texture:
  D:/cocos2dx/projects/ABCD/Resources/mid/ui.png

Is there anything I need to add or something?
I was doing the same thing for 2.x and was working but not in 3.2

EDIT:
In 3.x if you are calling this line
Director::getInstance()->purgeCachedData();, remember that it will delete all textures from the cache memory. So handle all sprite-sheets manually.

sentences:
Questions before I revamp my rendering engine to use shaders (GLSL) I've written a fairly robust rendering engine using OpenGL ES 1.1 (fixed-function.) I've been looking into revamping the engine to use OpenGL ES 2.0, which necessitates that I use shaders. I've been absorbing information all day long and still have some questions.

Firstly, lighting. The fixed-function pipeline is guaranteed to have at least 8 lights available. My current engine finds lights that are "close" to the primitives being drawn and enables them; I don't know how many lights are going to be enabled until I draw a given model. Nothing is dynamically allocated in GLSL, so I have to define in a shader some number of lights to be used, right? So if I want to stick with 8, should I write my general purpose shader to have 8 lights and then use uniforms to tell it how many / which lights to use?

Which brings me to another question: should I be concerned with the amount of data I'm allocating in a shader? Recent video cards have hundreds of "stream processors." If I've got a fragment shader being used on some number of fragments in a given triangle, I assume they must each have their own stack to work on. Are read-only variables copied here, or read when needed?

My initial goal is to rework my code so that it is virtually identical to the current implementation. What I have in mind is to create my own matrix stack so that I can implement something along the lines of push/popMatrix and apply all my translations, rotations, and scales to this matrix, then provide the matrix to the vertex shader so that it can make very quick vertex translations. Is this approach sound?

Edit: My original intention was to ask if there was a tutorial that would explain the bare minimum necessary to jump from fixed-function to using shaders.

Thanks!

sentences:
fading from one scene to another not working I am using the following code to fade from one scene to another, but it doesn't fade. It just loads the next scene without fading. I suspect there's something wrong with the image I'm using. I used a black .png image with dimensions 425×344 that I downloaded from Google. How can I solve this issue?

Fading.cs (I added this to an empty game object)

public Texture2D fadeOutTexture;
public float fadeSpeed = 0.8f;

private int drawDepth = -1000;
private float alpha = 1.0f;
private int fadeDir = -1;

void onGUI () {

    alpha += fadeDir * fadeSpeed * Time.deltaTime;
    alpha = Mathf.Clamp01(alpha);
    GUI.color = new Color (GUI.color.g, GUI.color.b, alpha);
    GUI.depth = drawDepth;
    GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), fadeOutTexture); }

public float BeginFade (int direction) {
    fadeDir = direction;
    return (fadeSpeed); }

void onLevelWasLoaded() {
    BeginFade (-1);

}

In the script of the trigger object:

IEnumerator gameScene2() {
    float fadeTime = GameObject.Find ("FadeObject").GetComponent<Fading>().BeginFade(1);
    yield return new WaitForSeconds(fadeTime);
    Application.LoadLevel("Scene2");
}

These are the image settings for the black .png image

sentences:
How can I represent location in a massive world? I've been thinking about No Man's Sky a lot recently and all the technical challenges they must face. For example, how on earth do you store a players location in a world that is so enormous?

I assume x,y,z isn't feasible. I notice the advertised number of planets (18 quintillion) is exactly double the maximum integer you can store on 64-bits, if that is relevant.

From watching tech videos of him (Sean Murray) describing the architecture, he seems to say everything is generated by formula where the inputs are x and y. Obviously he's simplifying, but how might one accomplish this?

sentences:
Sever-side physics simulation and client 'inputs' send rate in a fast multiplayer game I am building a very tiny first-person multiplayer game. I'm just aiming to get the basic rights: client-side prediction and reconciliation + entity interpolation. I have read many articles on these topics but I have a question that I can't find answer for. Consider the following problem:

There's a queue on the server where the client inputs are stored (movement keys + camera vectors)
Server runs the physics simulation 60 times per second. This means that each input from a client will be simulated for 16.6 ms.

Now, consider that I have two clients: one with a beefy computer able to run the game loop 100 times per second, and a slower one that is only able to run it 30 times per second.
My game will send the 'client inputs' packet to the server on every iteration of the game loop. This means that the 100 fps client will send 100 packets, while the 30 fps client only 30.
What this means is that the fast client will get more simulation time on the server, since each input is simulated for 16ms. So the fast client will move significantly more than the slower client.
What is the appropriate way to design the 'client input' packet send rate? What is a solution that ensures that fast clients and slow clients receive an equal or roughly equal amount of simulation time?
Thanks for your time!

sentences:
How move camera where i look? I am try make simple flying camera. Without character. But than I press forward camera moving to another direction.

    void Update()
{
    horizontalInput = Input.GetAxisRaw("Horizontal");
    verticalInput   = Input.GetAxisRaw("Vertical");

    var mouseX = Input.GetAxis("Mouse X");
    var mouseY = Input.GetAxis("Mouse Y");

    var trm = Camera.main.transform;

    if (horizontalInput != 0 || verticalInput != 0)
    {
        trm.position += moveSpeed * new Vector3(horizontalInput, 0, verticalInput);
    }

    var rotateValue = new Vector3(mouseY * 2, mouseX * -2, 0);

    trm.eulerAngles -= rotateValue;

    //trm.rotation = Quaternion.Euler(rotateValue);
}

Than I press 'W' camera moving  to left... I understand that it is necessary to coordinate the motion vectors and camera rotation. How best to do it?

sentences:
Random enemy generation algorithm help I've been working on a program for my friends to use for a homebrewed roleplay system that we all use for our campaigns that can generate random enemy statlines with certain constraints.

The program accepts a list of the statlines of the players, and then the user inputs a number that denotes a percentage of the player characters that this unit can beat on average in a 1v1. The issue I'm struggling with here is that combat involves different formulas for determining hit rate, critical hit rate, and damage

The formulas I have to deal with are:

Physical damage: strength - enemy defense = damage (multiplied by 2 if user's speed is 5 greater than enemy's)

Magical damage: magic - enemy resistance = damage (multiplied by 2 if user's speed is 5 greater than enemy's)

Hit rate: base hit + floor(user dex/3) + floor(user luck/5) - enemy dodge rate = hit rate (will always have a minimum of 5%)

Dodge rate: base dodge + floor(user speed/4) * 2 + floor(user luck/5) = dodge

Critical hit rate: 5% + floor((user dex - enemy luck)/5) + crit bonus = critical hit rate

(hit system is based on singular d20 with critical hit rate equivalent to number range on d20 that's considered a critical hit, meaning a 5% hit chance with a 5% or greater critical hit rate will result in every hit being a critical hit)

I've been struggling to think of an algorithm that can generate enemy statlines based on these formulas as well as the percentage constraint but I have no idea how to go about it in a way that isn't just bruteforcing it until I get a desirable outcome. I've toyed around with ideas such as ranking the inputting players based on their damage, survivability, dodge/hit, and determining upper/lower bounds on stats to work with but the issue I have is trying to establish a relationship formula between each stat to make sure that when I tweak one stat, I can change the others accordingly while staying within the user-defined constraints.

EDIT: After some thinking, I did come up with one possible solution, that being first determining the upper and lower bounds for the statline based on player stats, generating a random statline in between those bounds, and then generating tables that determine what effect on player and enemy DPS incrementing/decrementing a stat will have, and using that to precisely tweak enemies. The only issue with this solution is that for very high/diverse player stat values, this can take a long time, as well as figuring out a way to determine which stat to increment/decrement in the algorithm.

sentences: How image.ImageGrid() works? How to fix it? I understood what this method do (it cuts one spritesheet into a list of images), but I don't understood how it cuts. What height and weight for an image, it takes? I tried with few spritesheets png, and each time it cuts an image with part of the next image. Not correct.

sentences:
Performance problems with many entities in AndEngine I'm developing a rolling scene based game. I'm loading all the entities from a XML file and create them in the Loading Scene.

I recently increased the game width, and, by doing so, I now have about 300 entities (instead of about 100) in the whole level. This causes a performance problem: the game is "Lagging" \ "jumping" and everything moves slowly.

I'm loading the entities with the "LevelLoader".

I tried to add:

levelObject.setCullingEnabled(true);

before returning the object in :

public IEntity onLoadEntity(final String pEntityName, final Attributes pAttributes){...}

and also set Dithering in the engineOptions:

engineOptions.getRenderOptions().setDithering(true);

but it didn't help...

I'm implementing the sprite created from XML as Matin does in his tutorial:

http://www.matim-dev.com/full-game-tutorial---part-11.html

Is there a better way to handle such a high number of entities? Or is there another way to improve the performance?

sentences:
How to enable the option "edit physics shape" in the Sprite Editor? I can successfully import .png files, create tilesets, and use them in my tilemaps in Unity.
Thanks to DMGregory, I just learned that there exists an option to customize the Tilemap Collider 2D in the Sprite Editor, which allows me to set a custom collider for every tile instead of going through them one by one.

The steps I follow while creating a tileset in Unity is as follows.

Import the .png file.
Open the Sprite Editor.
Select the option Multiple for Sprite Mode.
Select Slice from the Sprite Editor.

Then, I create a Tile Palette in a folder, drop and drag my created tiles, and start creating my level.

I have never encountered the option to modify the colliders tile by tile. What am I doing wrong?

sentences:
Direct3D11 + Assimp imported model corrupted/failed I use Assimp library to import vertex and index data from model file.

I don't know how to correctly create index buffer from mFaces array of aiMesh. Or something wrong, because i my model is incorrect.

I have already experienced successful mesh rendering, if verticies and indicies are defined manually in code (x5 vertices triangle and indicies).

Here is my code.

// Loading TRIANGULATED vertex/index buffers:

// Load verticies:
m_uVertexCount = pMesh->mNumVertices;
CBasicEffect::sVertex * verticies = new CBasicEffect::sVertex[m_uVertexCount];
for(UINT i = 0; i < m_uVertexCount; i++)
{
    CBasicEffect::sVertex v;
    v.Pos = Vector3FromAi(pMesh->mVertices[i]);
    v.Color = XMFLOAT4(1,1,0,1);//test
    verticies[i] = v;
}

D3D11_BUFFER_DESC bd;
ZeroMemory( &bd, sizeof(bd) );
D3D11_SUBRESOURCE_DATA InitData;

// Create vertex buffer:
bd.Usage = D3D11_USAGE_DEFAULT;
bd.ByteWidth = sizeof( CBasicEffect::sVertex ) * m_uVertexCount;
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = 0;
InitData.pSysMem = verticies;
if( FAILED(pModelOf->GetDevice()->GetDevice()->CreateBuffer(&bd, &InitData, &m_pVertexBuffer)) )
    ;//...

// Load indicies:
m_uIndexCount = pMesh->mNumFaces * 3;
UINT* indices = new UINT[m_uIndexCount];
for (UINT face = 0; face < pMesh->mNumFaces; face++)
    for (UINT idx = 0; idx < 3; idx++)
        *indices++ = pMesh->mFaces[face].mIndices[idx];

// Create index buffer:
bd.Usage = D3D11_USAGE_DEFAULT;
bd.ByteWidth = sizeof( UINT ) * m_uIndexCount;
bd.BindFlags = D3D11_BIND_INDEX_BUFFER;
bd.CPUAccessFlags = 0;
InitData.pSysMem = &indices;
if( FAILED(pModelOf->GetDevice()->GetDevice()->CreateBuffer(&bd, &InitData, &m_pIndexBuffer)) )
    ;//...

UPDATE: Now i see my model. But it is loaded incorrecty: http://i.stack.imgur.com/Z9liR.jpg (originally it is scene with 5 primitives).

My render code:

// <Clean render target view and depth stencil view>

ID3D11Buffer* pVertexBuffer = pMesh->GetVerticiesBuffer();
    ID3D11Buffer* pIndexBuffer = pMesh->GetIndexesBuffer();

    // Set buffers and topology mode
    UINT stride = sizeof( sVertex ), offset = 0;
    m_pDevice->GetContext()->IASetVertexBuffers( 0, 1, &pVertexBuffer, &stride, &offset );
    m_pDevice->GetContext()->IASetIndexBuffer(pIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
    m_pDevice->GetContext()->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );

    // Shaders:
    m_pDevice->GetContext()->IASetInputLayout( m_pVertexLayout );
    m_pDevice->GetContext()->VSSetShader( m_pVertexShader, NULL, 0 );
    m_pDevice->GetContext()->VSSetConstantBuffers( 0, 1, &m_pConstantBuffer );
    m_pDevice->GetContext()->PSSetShader( m_pPixelShader, NULL, 0 );
    //m_pDevice->GetContext()->PSSetConstantBuffers( 0, 1, &m_pConstantBuffer );

    // Draw:
    //m_pDevice->GetContext()->Draw( pMesh->GetVertexCount(), 0 );
    m_pDevice->GetContext()->DrawIndexed( pMesh->GetIndexCount(), 0, 0 );

//

sentences:
Can a Switch Dev Kit do everything a normal Switch console can do? Today, news came out that the Nintendo Switch Dev Kit is only 50,000 yen (around $450-500 USD). I had been planning to buy a normal Nintendo Switch for $300, but since I enjoy making little games in Unity and it's only ~50% more expensive to get a Dev Kit, I thought maybe I'd get a Dev Kit instead of a console.

When I brought up the idea with a friend, they asked, "Can the Dev Kit even play normal games?"

It's an excellent question, and I have no idea what the answer is. I'm hoping people here know. More generally, what draw backs are there from getting a Dev Kit instead of a normal console? Does it weigh significantly more? Is it more bulky or less comfortable to carry around? Does the battery not last as long? Is it even portable? Can it play all the normal retail games that the ordinary console can?

sentences:
Design Pattern for Social Game Mission Mechanics When we want to design a mission sub-system like in the The Ville or Sims Social, what kind of design pattern / idea would fit the best? There may be relation between missions (first do this then this etc...) or not. What do you think sims social or the ville or any other social games is using for this?

I'm looking for a best-practise method to contruct a mission framework for tha game. How the well-known game firms do this stuff for their large scale social facebook games?

Giving missions to the players and wait players to complete them. when they finished the missions, providing a method to catch this mission complete events considering large user database by not using server-side not so much to prevent high-traffic / resource consumption.

how should i design the database and server-client communication to achive this design condidering this trade-off.

sentences:
Creating an interactive grid for a puzzle game I am trying to make a slitherlink game, and am not too sure how to approach creating the game, more specifically the grid structure on which the puzzle will be played on.

This is what a empty and completed slitherlink grid would look like:

The numbers in the squares are sort of clues and the areas between the dots need to be clickable:

I would like to create the game in VB .NET. What data structures should I try to use, and would it be beneficial using any frameworks such as XNA?

sentences:
How to optimize my random terrain generation and usage? I'm new to Unity. I've created an algorithm to procedurally generate a circle-shaped tunnel made of primitive cubes GameObjects. The problem is that the game is very laggy and I can understand why: there are thousands of objects to render.

What I'd like to know is if there's a better approach to this. For example, would be better if instead of rendering the single cubes I create a ring custom component and use that instead?

Are there any other solutions?

I'm using Unity 5.3.4f1.

EDIT

Here's what I've done so far. This works the way I want but the game is really laggy because (I assume) there are lots of objects to render.

public class TerrainGenerator : MonoBehaviour {

private static int MAX_RING_NUMBER = 1000;

private static int TUNNEL_SLOPE = 5;

// Use this for initialization
void Start () {
    int y = 0;
    for (int z = 0; z < MAX_RING_NUMBER; z++) {

        createRing(0, y, z, 10);
        // Every TUNNEL_SLOPE cubes the tunnel goes down a block.
        if (z % TUNNEL_SLOPE == 0)
            y--;
    }
}

// Update is called once per frame
void Update () {

}

private void createCube(int x, int y, int z){
    GameObject cube = GameObject.CreatePrimitive (PrimitiveType.Cube);
    cube.transform.position = new Vector3 (x, y, z);
    cube.GetComponent<Renderer>().material.color = new Color(Random.Range(0,255),Random.Range(0,255),Random.Range(0,255));
}

// Midpoint circle alghoritm.
void createRing( int x0, int y0, int z, int radius){
    int x = radius;
    int y = 0;
    int decisionOver2 = 1 - x;   // Decision criterion divided by 2 evaluated at x=r, y=0

    while( y <= x )
    {
        createCube(x + x0,  y + y0, z); // Octant 1
        createCube(y + x0,  x + y0, z); // Octant 2
        createCube(-x + x0,  y + y0, z); // Octant 4
        createCube(-y + x0,  x + y0, z); // Octant 3
        createCube(-x + x0, -y + y0, z); // Octant 5
        createCube(-y + x0, -x + y0, z); // Octant 6
        createCube(x + x0, -y + y0, z); // Octant 7
        createCube(y + x0, -x + y0, z); // Octant 8
        y++;
        if (decisionOver2<=0)
        {
            decisionOver2 += 2 * y + 1;   // Change in decision criterion for y -> y+1
        }
        else
        {
            x--;
            decisionOver2 += 2 * (y - x) + 1;   // Change for y -> y+1, x -> x-1
        }
    }
}

}

sentences:
Graph Isomorphism > What kind of Graph is this? Essentially, this is a variation of Comparing Two Tree Structures, however I do not have "trees", but rather another type of graph.

I need to know what kind of Graph I have in order to figure out if there's a Graph Isomorphism Special Case...

As you can see, they are:

Not Directed
Not A Tree
Cyclic
Max 4 connections

But I still don't know the correct terminology, nor the which Isomorphism algorithm to pursue, guidance appreciated.

sentences:
Load XNA Content Type from File I'm writing my own level editor and recently got the exporter working so now I'm working on the importer. My save file structure looks essentially like this:

[ObjectType]
    Property=Value
    ContentProperty:ContentType=ContentName
[/ObjectType]

The problem is in loading the content. I'm trying to find out how to load some content with the given content type at runtime. Technically, I could do a switch-case of each type

switch(ContentType)
{
    case Texture2D:
        Content.Load<Texture2D>(ContentName);
        break;
    case Model:
        Content.Load<Model>(ContentName);
        break;
    ...
}

but that just seems messy (and I can't find a reliable listing of all of the default content types in XNA).

Is there a way for me to load the content with the proper type without having to list out all possible types?

sentences:
Linq with Unity - Select One from Many I'm using Linq to select the objects closest to the player that have the usable tag thusly:

GameObject[] usables = GameObject.FindGameObjectsWithTag("Usable")
    .Where(t => Vector3.Distance(t.transform.position, playerT.position) < useDistance)
    .ToArray();

This works as I intended, but I'd like to further narrow it down to the closest object in that array so the Linq query returns only the single closest GO.  Linq is, however, a serious weak spot for me.  Any thoughts on how that would look?

Thanks!

sentences:
Draw the HUD just once on the canvas I am not able to draw only one HUD of my game on a separate canvas, so I do not have to redraw it to each frame, I have four functions, init(), render(), loop() and drawHUD():

init() is my function that I call when starting the game, right at the end of the script.

render() is my rendering function

loop() is my game loop function (do not notice it, I've simplified it with minimal to leave the code cleaner for reading)

drawHUD() is my function to draw HUD on Canvas HUD_CANVAS

The problem is that the code below does not work, the screen remains blank, but if I put drawHUD() inside the render() before CTX.drawImage (HUD_CANVAS, 0, 0); then it works and I can see the image on the screen, however I wish I could draw only once, not every frame, since my HUD will not always be updating.

What am I doing wrong?

  index.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Test</title>

    <style type="text/css" media="screen">
        canvas {
            padding: 0;
            margin: auto;
            display: block;
            width: 640px;
            height: 480px;
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            border: 1px solid #999;
        }
    </style>

</head>

<body>

    <canvas id="canvas" style="z-index: 0;" width="640" height="480"></canvas>
    <canvas id="hud-canvas" style="z-index: 1;" width="640" height="480"></canvas>

    <script>
    const CANVAS = document.getElementById('canvas');
    const CTX = CANVAS.getContext('2d');
    const HUD_CANVAS = document.getElementById('hud-canvas');
    const HUD_CTX = HUD_CANVAS.getContext('2d');

    function drawHUD() {
        const imgHUD = new Image();
        imgHUD.src = './hand_hud_maya.png';
        HUD_CTX.drawImage(imgHUD, 0, 0, 96, 96, 0, 0, 96, 96);
    }

    function init() {
        drawHUD();
        loop();
    }

    function render() {
        CTX.drawImage(HUD_CANVAS, 0, 0);
    }

    function loop() {
        render();
        requestAnimationFrame(loop);
    }

    init();

    </script>

</body>
</html>

Example:

https://jsfiddle.net/twkq0sn6/

  Up1:

Change that part of the function, I can see the red rectangle on the screen, so I think the problem is with the drawImage() function, but I do not know what it can be, I already tested several images, I do not think it's the image.

 function drawHUD() {
     HUD_CTX.fillStyle = "red";
     HUD_CTX.fillRect(50, 50, 50, 50);
 }

the image is loaded properly, I can see in the chrome network tab the preview of it, all OK. I do not get any errors, it's hard to figure out where I'm going wrong.

sentences: Using 4096*4096 background image in uinty tk2d I am new to Unity and I am developing a game using unity its a 2d game i am using tk2d framework. I have a big background image(4096*4096) how can I load this background so only visible part of the background has to be rendered so it wont effect the performance. How can I achive this in unity & tk2d?

sentences: What happens to a license if both the publisher and the developer are bankrupt? Is one allowed to make a similar game or even a sequel which would usually require obtaining a license? Who keeps the license in the end, i.e. who is to be asked for permission in such cases?

sentences:
Detecting a mouse click While in a Trigger Why does the following code not working? (weird, sometimes it works sometimes not )
I want to move player by touching on the screen and change  the color of gameObject when detect trigger and release mouse click.
"Drag and move" script works correctly I just add following code and sometimes it works sometimes not

  private void OnTriggerStay2D(Collider2D colider)
  {

    if (Input.GetMouseButtonUp(0) & colider != null)
    {
      colider.gameObject.GetComponent<SpriteRenderer>().material.color = Color.blue;

    }

  }

There is a full script :

  private Camera _cam;
  private Vector3 _daragOfset;
  [SerializeField] private float _speed = 4.55f;
  private bool isEntered = false;

  void Update()
  {
    if (Input.GetMouseButtonDown(0))
    {
      _daragOfset = transform.position - GetMousePos();
    }
  }

  private void OnTriggerStay2D(Collider2D colider)
  {
    if (Input.GetMouseButtonUp(0) & colider != null)
    {
      colider.gameObject.GetComponent<SpriteRenderer>().material.color = Color.blue;
    }
  }

  void Awake()
  {
    _cam = Camera.main;
  }

  void OnMouseDrag()
  {
    transform.position = Vector3.MoveTowards(transform.position, GetMousePos() + _daragOfset,_speed * Time.deltaTime);
  }

  Vector3 GetMousePos()
  {
    var mousePos = _cam.ScreenToWorldPoint(Input.mousePosition);
    mousePos.z = 0;
    return mousePos;
  }

sentences:
Does a basic game engine prototyping tool exist, for common game types? There are a lot of classic game engines out there (Real Time Strategy, Turn Based, etc), of which you can find countless variations. All of them have a basic starting point which involves units, buildings that produce units, unit/building parameters like health, damage, etc, a map canvas. These can be simulated at a very basic level, no graphics, no animations.

I want to build a Tower Defense type of game, and it would be great if i could build a very basic prototype just to simulate parameters like health, damage, speed, range, etc.

Does such a tool exist?

sentences:
Write error log on crash in libGDX? I've been having problems building my game. I've built it successfully before, until I added the LuaJava.dll and LuaJava.jar files (so I can use Lua in my game).

Now, it just briefly opens with black screen and immediately closes. Even though it works just fine in Eclipse.

What I used to do before, was set my jar file in my assets and it would just work fine. But now, it refuses to work, and I have no idea what the error is.

Is there a function I can call to output the error into a log file?

sentences:
Collision stickyness problem on multiple inputs I've been trying for a couple of days to solve an issue I'm having with top-down 2D collisions, whenever I collide with tiles that have adjacent collidable tiles my player sticks to the wall, If I collide right or left I can't move up or down, the same for the Y axis, I can't move left or right when colliding from the top or bottom. Here's a picture to represent my issue a bit better:

The gray boxes represent the collision area.

Here is my code:

            Rectangle tileRect = new Rectangle((int)tile.Position.X, (int)tile.Position.Y, tile.SourceRect.Width, tile.SourceRect.Height);
            Vector2 temporaryPlayerPosition = player.Sprite.Position - player.Velocity;
            if (player.CollisionBox.Intersects(tileRect))
            {
                if ((player.CollisionBox.Right >= tileRect.Left && player.CollisionBox.Right < tileRect.Right) ||
                    (player.CollisionBox.Left <= tileRect.Right && player.CollisionBox.Right > tileRect.Left))
                {
                    player.CollisionBox.X = (int)temporaryPlayerPosition.X;
                    player.Sprite.Position.X = temporaryPlayerPosition.X;
                }
                if ((player.CollisionBox.Bottom >= tileRect.Top && player.CollisionBox.Bottom < tileRect.Bottom) ||
                    (player.CollisionBox.Top <= tileRect.Bottom && player.CollisionBox.Top > tileRect.Top))
                {
                    player.CollisionBox.Y = (int)temporaryPlayerPosition.Y;
                    player.Sprite.Position.Y = temporaryPlayerPosition.Y;
                }
            }

If anyone could point me to the right direction I would be grateful!! Thanks again!

EDIT!!!

I changed my whole collision code so it does a forward check before handling the displacemente of the sprite, I still have the stickyness issue though. This is the new code:

Rectangle forwardCollision = new Rectangle((int)(player.CurrentPos.X + (player.Velocity.X*4)), (int)(player.CurrentPos.Y + (player.Velocity.Y*4)), player.Sprite.SourceRect.Width, player.Sprite.SourceRect.Height);
player.CanRunX = player.CanRunY = true;
foreach (TmxTile tile in tileList)
{
    tile.Update(gameTime);
    Rectangle tileRect = new Rectangle((int)tile.Position.X, (int)tile.Position.Y, tile.SourceRect.Width, tile.SourceRect.Height);
    if (forwardCollision.Intersects(tileRect) && SolidTileIds.Contains(tile.Id))
    {
        if (player.Velocity.X != 0)
            player.CanRunX = false;
        if (player.Velocity.Y != 0)
            player.CanRunY = false;
    }
}
foreach(DebugRectangle rectangle in rectangleList)
{
    rectangle.Update(gameTime);
}

if (player.CanRunX)
    player.Sprite.Position.X += player.Velocity.X;
else
    player.Sprite.Position.X -= player.Velocity.X;
if (player.CanRunY)
    player.Sprite.Position.Y += player.Velocity.Y;
else
    player.Sprite.Position.Y -= player.Velocity.Y;

player.CurrentPos = player.Sprite.Position;
player.CollisionBox.X = (int)player.Sprite.Position.X;
player.CollisionBox.Y = (int)player.Sprite.Position.Y;
player.DebugRectangle.Position.X = forwardCollision.X;
player.DebugRectangle.Position.Y = forwardCollision.Y;

sentences:
How should I prepare for pitching a game to potential sponsors? We have developed a mobile game, and are preparing ourselves for demo day. We will be presenting our game to potential sponsors, and we are having trouble deciding how to make a quality presentation.

Specifically, what are the unique challenges and opportunities in pitching a game, in contrast with product demos generally?

Being developers, we are worried we might wrongly focus on elements important to developers, but not to investors. How can we go about identifying them?

For demoing game play, in what situation should we consider switching to a separate app, embedding the game in a slide show, showing canned game footage, or something else?

sentences:
Level data for Mario or similar platform game It has become a widespread to implement a Mario-clone to practise writing platform games or in order to demonstrate how a game engine works.

For that reason I expected it to be easy to find level data for Mario.

Are the levels of Mario in a ready to use format available?

Note: Edited to narrow the scope of the question.

sentences: How can I replicate Quantum Break's distortion particle effect? Quantum Break has this fantastic particle effect, it's a distortion effect like broken glass. I want know how I can replicate this effect? You can see it below, and a full video is available on YouTube:

sentences:
Can ANGLE OpenGL ES 2.0 use the same color / depth surface as Direct3D11? Lets just assume I have some simple OpenGL ES 2.0 code that renders a box with depth writing / testing.  Is it possible to put this box in a middle of a Direct3D11 scene using angle?

The MS angle page https://github.com/Microsoft/angle/wiki/Interop-with-other-DirectX-code says that we can render to a texture, and I have tried that and it works fine.  But this only allows for 2D integration, not 3D integration, as far as I can tell.  I render my OpenGLES content to a texture (in 2d or 3d), but now I can only put a texture in the DirectX scene.  How can I have my OpenGL ES code write / read from the same depth/color surface that the DirectX11 portion is using?

sentences:
Rotation of objects from different axes in Flash AS3 In my game, I have made 4 lines with different colors to form a square but the colored lines are different objects. I want to rotate the lines in a way that the lines will still form a square. Eg:

But I'm only able to rotate them on the central axis, so, it forms a cross:

The code for leftPressed is:

if(leftPressed)
{
black.rotation -= 90;
blue.rotation -= 90;
yellow.rotation -= 90;
red.rotation -= 90;
}

So, I need to know how to rotate objects on different axes.

sentences:
Which programming language to use for tools? I use C++ as my language as choice.  However, I generally use Python to write helper utilities and tools.

My worry is that as my game engine continues to grow it's getting tedious to reimplement some of its features in Python.

There has got to be a better way.

Here are the options as I seem them

Keep on keeping on.
That is often the answer in a cooperate environment.  Maybe it has some merit.
Build bindings for Python (yuck) and have it use pieces of the engine directly.
Start building the tools using C++ instead.
I already use QT in the Python tools to provide a GUI when needed.  It doesn't seem like it'd be that much harder to use QT in C++ instead.  However I'm worried my tool productivity will go down.  I generally strive to apply much less rigidity in tool code than I would in shipping code.

So what is common practice, use the same language for tools, or use a more RAD friendly one?
What if you use a language that differs from the language of the game which do you use?
How do tools interact with the game engine link to it directly or fake it?

sentences:
How to calculate faces involved in collision (Separating Axis Theorem) I have a game engine created in javascript (https://jsfiddle.net/4gqsq8wf/) which uses collision detection via the Separating Axis Theorem. Currently, it does not have any means of resolving velocity upon the impact of multiple objects. Many posts have stated on this site that the post-collision velocity of an object is simply the angle of reflection. (For example: https://stackoverflow.com/questions/573084/how-to-calculate-bounce-angle) However, this requires knowing the angles of the surfaces contacting each other. I don't know how to figure out these, as the function I wrote only calculates the Minimum Translation Vector; how would I find the polygon faces involved in a collision?

Layman's terms would be appreciated.

Edit: Would this be the collision normal?

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: Better way than url-encoded query stings to pass data from PHP to Flash? For the turn-based browser Flash RPG I'm working on, I'm using url-encoded query stings to pass data from PHP to Flash. Basically, Flash posts a request to PHP, then PHP pulls some data from a MySQL database, does some calculations and echos something like "health=100&mana=50&strength=10" which Flash reads. It seems to work fairly well, but I'm wondering if there is a better way to do it? As I go along, the number of character stats is increasing, and after inventory slots, it will probably be around 100 variables. All that only needs to be pulled from the MySQL database through PHP once at the beginning though, with much smaller queries during gameplay.

sentences:
XNA: SpriteFont question I need some help with the SpriteFont. I want a different font for my game, other than Kootenay. So, I edit the SpriteFont xml, i.e:

<FontName>Kootenay</FontName>

or

<FontName>Arial</FontName>

No problem with Windows fonts, or other XNA redistributable fonts pack. However, I want to use other fonts, that I downloaded and installed already, they are TTF or OTF, both supported by XNA.
My problem is, I cant use them, I got this error:

  The font family "all the fonts i tried" could not be found. Please ensure the requested font is installed, and is a TrueType or OpenType font.

So, checking at the windows fonts folder, I check the properties and details of the fonts, I try all the names they have, and but never works. Maybe I need some kind of importing or installing in order to use them, I dont know, and I hope you guys can help me, thanks!

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:
Display/hide image with zoom in/out After spending a while looking through the forums, I haven't been able to find a thread that deals with transforms on an image.

Essentially, what I'm trying to do is display and hide an image at the start of a level in a game I'm working on. The image should start out large and with 100% transparency, then shrink to a certain size within the camera bounds with no transparency, idle for a second, then fade back out the way it came.

How would this be done programmatically? Thanks in advance!

sentences:
Unity higher Z position tiles rendered underneath When placing tiles in an isometric tile-map in Unity, I try to place blocks on top using the "Z Position Value" However it looks like higher Z position values get rendered underneath.

In this picture, the green cubes have a z position of 0 whereas the yellow cubes have a z position of 1. I want the yellow cubes to render on top, but they are underneath. I'm using an Isometric Z as Y tile-map and have the Transparency Sort Axis set to (x=0,y=1,z=-0.26).

sentences:
Why circles are not created if small? I have changed the scale in 3DSMax to my own and now I can't create any object, including circle, if it is of the size which is normal for my scale. Instead, I have to create big object first and then modify it to a smaller size. It looks like there is a minimal size protection is set somewhere - where is the setting for it?

UPDATE

While creating a circle, if I drag for 0.04m circle disappears after drag end. If I drag for 0.08m circle also disappears. If I drag for more than 0.1m, circle persists after drag end.

How can I set it so that it persist after 0.01m too?

sentences:
Emscripten code and three.js I would like, if it's possible, to use Emscripten code generated from C/C++ with the Javascript library three.js. For example, from emscripten code I want to pass rendering information to the three.js that will be showed in the browser.

So, can someone give me an idea of how to do that?

sentences:
Threads slowing down application and not working properly I'm making a software renderer which does per-polygon rasterization using a floating point digital differential analyzer algorithm. My idea was to create two threads for rasterization and have them work like so: one thread draws each even scanline in a polygon and the other thread draws each odd scanline, and they both start working at the same time, but the main application waits for both of them to finish and then pauses them before continuing with other computations.

As this is the first time I'm making a threaded application, I'm not sure if the following method for thread synchronization is correct:

First of all, I use two global variables to control the two threads, if a global variable is set to 1, that means the thread can start working, otherwise it must not work. This is checked by the thread running an infinite loop and if it detects that the global variable has changed its value, it does its job and then sets the variable back to 0 again. The main program also uses an empty while to check when both variables become 0 after setting them to 1.

Second, each thread is assigned a global structure which contains information about the triangle that is about to be rasterized. The structures are filled in by the main program before setting the global variables to 1.

My dilemma is that, while this process works under some conditions, it slows down the program considerably, and also it fails to run properly when compiled for Release in Visual Studio, or when compiled with any sort of -O optimization with gcc (i.e. nothing on screen, even SEGFAULTs). The program isn't much faster by default without threads, which you can see for yourself by commenting out the #define THREADS directive, but if I apply optimizations, it becomes much faster (especially with gcc -Ofast -march=native).

N.B. It might not compile with gcc because of fscanf_s calls, but you can replace those with the usual fscanf, if you wish to use gcc.

Because there is a lot of code, too much for here or pastebin, I created a git repository where you can view it.

My questions are:

Why does adding these two threads slow down my application?
Why doesn't it work when compiling for Release or with optimizations?
Can I speed up the application with threads?
If so, how?

Thanks in advance.

sentences:
Continuous translation in Unity I would like to apply a constant-speed everlasting translation to a game object (e.g a background) in Unity. Without physics.

What is the best way to achieve that?

sentences:
Existing game to virtual reality game? What kind of existing game can be taken as a good source for a 'virtual reality' game, specifically, the one you can play with any 3D VR glasses?

Why do you think this particular game or these games can be adjusted well in the new realm?

Thank you for your thoughts.

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 can I make the gun rotate and shoot like lost control and shooting all around? The shooting part I will make later. Now I'm trying to make the rotations part.

The first thing I did is to rotate the gun barrel and this is working fine.
The next thing I want to do is to rotate the gun body 360 degrees randomly so when the gun will shoot it will shoot randomly all around like lost control.

This is a screenshot of the gun barrel :

And the gun body :

By rotating the gun body 360 degrees randomly I want to create a lost control effect so it will shoot all around hitting randomly.

The script is attached to the top parent Drone :

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

public class Rotate : MonoBehaviour
{
    public Transform[] wings;
    public Transform[] propellers;
    public Transform gunBarrel;
    public Transform gunBody;
    public float propellersSpinSpeed = 50;
    public float wingsSpinSpeed = 50;
    public float gunBarrelSpeed = 50;

    private float angle = 360.0f;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        for (int i = 0; i < propellers.Length; i++)
        {
            propellers[i].Rotate(0, propellersSpinSpeed * Time.deltaTime, 0);
        }

        for (int i = 0; i < wings.Length; i++)
        {
            wings[i].Rotate(0, wingsSpinSpeed * Time.deltaTime, 0);
        }

        gunBarrel.Rotate(0, 30 * gunBarrelSpeed * Time.deltaTime, 0);

        gunBody.Rotate(Vector3.zero, angle * Time.deltaTime / 1.0f);
    }
}

I tried to do :

gunBody.Rotate(Vector3.zero, angle * Time.deltaTime / 1.0f);

But it does nothing not rotating it 360 degrees and I didn't use yet the Random.
The gun barrel keep rotating but the lost control shooting all around is not working yet not sure how to do it.

Update :

This is the current code :

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

public class Rotate : MonoBehaviour
{
    public Transform[] wings;
    public Transform[] propellers;
    public Transform gunBarrel;
    public Transform gunBody;
    public float propellersSpinSpeed = 50;
    public float wingsSpinSpeed = 50;
    public float gunBarrelSpeed = 50;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        for (int i = 0; i < propellers.Length; i++)
        {
            propellers[i].Rotate(0, propellersSpinSpeed * Time.deltaTime, 0);
        }

        for (int i = 0; i < wings.Length; i++)
        {
            wings[i].Rotate(0, wingsSpinSpeed * Time.deltaTime, 0);
        }

        gunBarrel.Rotate(0, 30 * gunBarrelSpeed * Time.deltaTime, 0);

        gunBody.localEulerAngles = new Vector3(Mathf.Clamp(gunBody.localEulerAngles.x, 0f, 90f), 0, 0);
    }
}

The gunBody is now facing down.

This is a screenshot of what I want the gunBody to do :
I changed the gunBody on X and Z rotations a bit and this is the behaviour I want it to do randomly rotating on X and Z but not to pass too much up/down and left/right degrees.

The Z to be in range more or less 150, 205 and the X range of 55,100
And make it moving smooth randomly on this ranges. I'm not sure to the float point if those are the ranges but more or less this is what I mean by randomly moving in circles 360 degrees shooting all around like lost control.

Same behaviour of a turret trying to shoot on target and rotate 360 degrees in any direction the same thing here but only looking forward not backward. This is the logic I mean moving in circles and shooting around to the front.

sentences:
How would I go about serializing my LibGDX game? I am currently using Kryo for serialization. I have a Player class, but it extends Sprite. Sprite isn't serializable. This means I can't serialize Player as a whole. Is there another way to do this? Or should I make a separate class for every object that needs to be saved, and manage all the data that needs to be saved in there?

This is my first game and I'm going for a top-down (like pokémon) RPG game. I also need to save locations of monsters and animals in certain maps etc. So I'm not sure if this would be the right way to go about it? I can't find that much about this topic for games and kryo in specific online, so hopefully someone can enlighten me a bit.

sentences:
Unity Checkpoint System that remembers NPC interactions + Environment changes? I have already implemented a checkpoint system that respawns the player at the last checkpoint they cross through. Now imagine this:

NPC A interacts with NPC B
NPC B walks over to a nearby car
A bird flies over the car and takes a dump
Player dies tragically (lol)
Player respawns at the last checkpoint X

Given that checkpoint X is achieved after watching all these NPC interactions, how can I fast forward/skip these interactions when respawning the player? The build I have right now respawned at the correct location but of course, the NPC interactions happen again even though they were supposed to end before reaching that last checkpoint (if that makes any sense  )

I understand that this can be achieved by saving all the last known locations of the NPCs, flags that indicate whether the bird took a dump (true/false). For example, this seems quite tedious for a game like Uncharted/GTA where a lot of interactions happen at the same time.

My initial thought was to somehow fast forward the entire game to a point where all these interactions are done and dusted. That way, I can safely respawn the player knowing that they don’t see something they’ve already seen.

Sorry for the detailed post  Any tips on how this can be accomplished?

sentences:
Issue With Image Rendereing I'm pretty New to the XNA Side of things,

I have built in PhotoShop a Set of frame by Frame images side by side to go through an animation class to display them frame by frame.

With this my images will not show up properly, they look more like a film reel.

Were could I Ggt good information on images for animation for XNA?

sentences:
Libgdx explain steps for beginner to create and use image as a box2d body I am basically from corona background and new to LibGdx , familiar with stage and actor from scene2D.  Now wants to use physics body from box2d  in the game besides using actor from scene2D.

But I need to use images in the game as body... not shapes..

anyone please explain me the steps to use images as a body.

Thanks..

sentences:
Balancing Attack to Defense in a text based RPG I understand that there is no correct or incorrect way of doing this, and its all down to a matter of trial and error in terms of perfecting the system.

What I am after is some advice or even get thoughts on how others have tackled a situation like this.

Right now I have a very basic attack formula

$attackPower = $baseAttack * 4;
$percent = $attackPower / 100;
$percent1 = $percent * 10; // Gets 10% of the users attack power

Using the above code I then use rand to work out a users attack power, so it varies rather than a single number

$power = rand($attackPower - $percent1, $attackPower + $percent1)

So that's the users attack power calculated.

However if I used the same formula to calculate the opponents defense, and then calculated the Attack minus Defense equals the damage

$totalDamage = $power - $defense;

This may sometimes result in a negative value (especially if the opponent has a considerably higher defense stat to the users attack)

Above I have used

$attackPower = $baseAttack * 4;

For calculating the defense would this be efficient?

$defensePower = $baseDefense * 2; // Could have this set to rand? 1 - 3??

Is there anything that could be changed to balance the stats out a bit more?
Could there be a much simpler formula?

sentences:
Collisions between moving ball and polygons I know this is a very typical problem and that there area a lot of similar questions, but I have been looking for a while and I have not found anything that fits what I want.

I am developing a 2D game in which I need to perform collisions between a ball and simple polygons. The polygons are defined as an array of vertices.

I have implemented the collisions with the bounding boxes of the polygons (that was easy) and I need to refine that collision in the cases where the ball collides with the bounding box. The ball can move quite fast and the polygons are not too big so I need to perform continuous collisions.

I am looking for a method that allows me to detect if the ball collides with a polygon and, at the same time, calculate the new direction for the ball after bouncing in the polygon.

(I am using XNA, in case that helps)

sentences: How do physics engines like Box2D detect and respond to collisions between arbitrary polygons? I've always wondered how collision detection like this was achieved, and I've always wondered what the response would be. Do they perform line-line intersection tests for each line making up the two polygons? If it'd make the question any more specific, how does Box2D handle this?

sentences:
Libgdx OrthogonalTiledMapRenderer not rendering map properly I'm using a little hack to change the coordinate system to the one i'm accustomed to (left and up is negative and right and down is positive) but this causes the tiled map renderer to render the map incorrectly, as shown below

Whereas it looks like this in the Tiled map editor

This is the "hack" I'm using to change the coordinate system:

float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();

Camera = new OrthographicCamera(w, h);
Camera.setToOrtho(true, w, h);

My render code

renderer.setView(Camera);
renderer.render();

So is there a workaround to this? Or perhaps a better way to change the coordinate system that doesn't screw up everything?

Edit: The rendered tiles are correct now but the map and everything rendering is still flipped along the y-axis. If I was drawing sprite and stuff, I could always draw them flipped but I don't know how to do it with the tiled map renderer.

sentences:
Why does the 3D window go blank on resuming from sleep/lock? I have a 3d window hosted inside a WPF program.  This is written in C#, using SlimDX.  It uses a D3DImage subclass to support dx10 & dx11 rendertargets, like this site recommends: http://jmorrill.hjtcentral.com/Home/tabid/428/EntryId/437/Direct3D-10-11-Direct2D-in-WPF.aspx

However, when I resume from sleep, or even lock & unlock the screen on Windows, the 3D window goes blank until I resize it.  What is the appropriate way to mitigate this issue?

After resuming, but while the 3D window is still blank, I've confirmed:

The window ActualWidth & ActualHeight have not changed
The device is not null
The backbuffer is not null
The draw loop is still looping
The blank screen is occurring after the unlock. To prove this I put a Thread.Sleep() in the Unlock handling code to purposely lock the UI thread. The 3D image was still visible until the thread.sleep period ended, then it went blank.

sentences:
Calling an android method from Unity3D with a JAR plugin I am developing a game with Unity only for Android platform and I am requiring to share content of my game through an intent so I have implemented a JAR plugin according to several tutorials with this code:

package a.b.c;

import android.content.Intent;
import android.os.Bundle;

import com.unity3d.player.UnityPlayerActivity;

public class UnityBridge extends UnityPlayerActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public void callShareIntent() {
        Intent shareIntent = new Intent (Intent.ACTION_VIEW);
        startActivity(shareIntent);
    }
}

The JAR is located at Assets/Plugins/Android with an AndroidManifest file which override the file created by unity, this is its code:

<?xml version="1.0" encoding="utf-8"?>
<manifest android:theme="@*android:style/Theme.NoTitleBar" android:versionCode="1" android:versionName="1.0" android:installLocation="auto" package="a.b.c"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
    <application android:label="@string/app_name" android:icon="@drawable/app_icon" android:debuggable="false">
        <activity android:label="@string/app_name" android:name="com.unity3d.player.UnityPlayerNativeActivity" android:launchMode="singleTask" android:screenOrientation="portrait" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|fontScale">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
            <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
        </activity>
        <activity android:name=".UnityBridge"></activity>
    </application>
    <uses-feature android:glEsVersion="0x20000" />
</manifest>

I just copied the manifest created by Unity and added this line:

<activity android:name=".UnityBridge"></activity>

... as you can see.

In the other hand, I have created a C# file in order to launch the share method of the plugin, this is its code:

using UnityEngine;
using System.Collections;

public class BotonCompartir : MonoBehaviour {

    AndroidJavaClass androidClass;

    // Use this for initialization
    void Start () {
        if (Application.platform == RuntimePlatform.Android) {
            AndroidJNI.AttachCurrentThread ();
            androidClass = new AndroidJavaClass ("a.b.c.UnityBridge");
        }
    }

    // Update is called once per frame
    void Update () {
        if (Input.GetMouseButtonDown (0) && Application.platform == RuntimePlatform.Android) {
            androidClass.Call("callShareIntent");
        }
    }
}

... and I have attached it to a gameobject.

When I deploy the apk to an android device nothing happens, so What am I doing wrong? Any other suggestion?

Thank you very much

sentences:
Can I use physics in Isometric map based games? I am trying to use physics in my game which is an isometric map based strategy game that the player deals with a city full of buildings, roads and people in it. I am writing the game with Swift and SpriteKit technology.

(the following picture shows a snapshot of my game)

MY GAME

I like to use Spritekit's physics library so I would be able to simulate car accidents and preventing them to go throw the buildings and other kind of stuff that physics could provide.

I am familiar with Physics and I have enough experience with Bullet and I can write a 3D game using OpenGL ES and physics, but I haven't really used physics in 2D isometric map games.

I have also wrote a 2d physic game that was really 2d (an endless runner) which was actually a sample of a book but as you can see in the following picture the gravity vector is the Y axis and every thing is pretty easy.

Here is the gravity vector that is used to create the game at the following picture.

self.physicsWorld.gravity = CGVectorMake(0, -9.8)

Someone Elses Game, Book Sample

Book Name : iOS 7 Game Development

Author : Dmitry Volevodz

You may find the book Here

However, in an isometric map game you can't just set and assign the Y axis as a gravity vector. since the method which sets the gravity vector accepts two arguments it is a big hope that I can use physics in my isometric map games. For example something like this

  I Say!!! :

As I am still using a cartesian coordinate system (perpendicular axis) X and Y axis make a 90 degree angle and if I need to project the gravity quantity over the X and Y axis it would be gCos(45),gSin(45) I haven't tested it yet.

self.physicsWorld.gravity = CGVectorMake(-9.8*0.707, -9.8*0.707)

May you please help me on setting the gravity vector and how should I define the moving objects like cars and humans and the static ones like buildings any other tips on modelling physics in isometric map are also welcome and appreciated.

The main question is: is it really possible to use physics in an isometric map based games?

sentences:
I'm making a networked game for mobile. Should I worry about cheating? I'm in the process of making a racing game for Android/iOS. I'm thinking of implementing a server/client model, should I worry about cheating and make all players communicate with a server of mine, or will I be good by letting one of the players host the game?

I'm not sure how much memory editing or packet editing is possible in Android/iOS, and that's the main reason why I'm asking this.

sentences: Good Video Game User Interface Design Books/Websites? I having been programming games for some time, but while my teachers say that my code is good and advanced, my friends say that the interface is hard to understand and not the easiest to navigate. I want to learn how to design good user interfaces so that I can program better games, and people will have a easier time getting around. Does anyone know of any good books or websites about designing video game interfaces?

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:
Which purpose do armor points serve? I have seen a mechanic which I call "armor points" in many games: Quake, Counter Strike, etc. Generally, while the player has these armor points, he takes less damage.

However, they act in a similar fashion that health points do: you lose them by taking said damage.

Why would you design such a feature? Is this just health 2.0, or am I missing something?

To me, armor only makes sense in, for example, RPG games, where it is a constant that determines your resistance. But I don't see why would it need to be reduceable during combat.

sentences:
pixel shader and vertex shader problem in visual studio 2008 I have just installed XNA for VB2008 professional, now i try to run my first game development and i get this error,

any way around this, am using windows xp sp3

my system configuration

Host Name:                 USER-PC
OS Name:                   Microsoft Windows XP Professional
OS Version:                5.1.2600 Service Pack 3 Build 2600
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Uniprocessor Free
Registered Owner:          user
Registered Organization:   user-pc
Product ID:                55274-640-1011873-23081
Original Install Date:     1/26/2011, 7:00:52 PM
System Up Time:            0 Days, 10 Hours, 31 Minutes, 22 Seconds
System Manufacturer:       Hewlett-Packard
System Model:              HP d330 uT(DC579AV)
System type:               X86-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: x86 Family 15 Model 2 Stepping 9 GenuineIntel ~
2593 Mhz
BIOS Version:              COMPAQ - 20031003
Windows Directory:         C:\WINDOWS
System Directory:          C:\WINDOWS\system32
Boot Device:               \Device\HarddiskVolume1
System Locale:             en-us;English (United States)
Input Locale:              en-us;English (United States)
Time Zone:                 N/A
Total Physical Memory:     1,527 MB
Available Physical Memory: 689 MB
Virtual Memory: Max Size:  2,048 MB
Virtual Memory: Available: 2,008 MB
Virtual Memory: In Use:    40 MB
Page File Location(s):     C:\pagefile.sys
Domain:                    WORKGROUP
Logon Server:              \\USER-PC
Hotfix(s):                 10 Hotfix(s) Installed.

sentences:
DirectX 10 - dimension of vertices passed to vertex shader I'm trying to learn DirectX programming.
Looking at different tutorials there is something about vertices that I find a bit confusing.

I know that DirectX uses vertices with four elements (x, y, z, w).
I saw many tutorials (example http://msdn.microsoft.com/en-us/library/ff729721(v=VS.85).aspx) passing XMFLOAT3 as vertices positions omitting the w component.

How does this works?
Assuming that passing XMFLOAT3 or XMFLOAT4 doesn't change DirectX behavior (true?) should I set the w to 1 in the vertex shader or does DirectX assume it to be 1 by default?

sentences:
Head rotation according to weapon sight I have a 2D game and I'm working on head rotation with my newbie coding skills. My Player has child sprite object called DefaultPistol (which is the whole arm and pistol attached to it) and it has a Weapon script. The arm turns 360 (centered from the shoulder) in the scene.
What I need is for my player turn his Head wherever arm turns (the Head is also another child sprite object attached to Player like DefaultPistol) but not like rotating the head, I just simply want to mirror the head to face left or right.
I tried setting the head's x scale to 1 or -1, but it didn't work and I couldn't find what is the problem. (I also checked the inspector if I didn't attach anything, but everything is in order as far as I can see)

Here is my Weapon. You can see where I tried to implement this in Flip. How can I fix this?
public class Weapon : MonoBehaviour {

    public GameObject projectile;
    public Transform shotPoint;
    public float timeBetweenShots;
    private Animator cameraAnim;

    private float shotTime;
    private bool facingRight;
    public GameObject head;

    private void Start()
    {
        cameraAnim = Camera.main.GetComponent<Animator>();
    }

    private void Update()
    {   //this code paragraph here is calculating the shotPoint player rotation
        Vector2 direction = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
        float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
        Quaternion rotation = Quaternion.AngleAxis(angle + 90, Vector3.forward);
        transform.rotation = rotation;

        if (Input.GetMouseButton(0))
        {
            if (Time.time >= shotTime)
            {
                Instantiate(projectile, shotPoint.position, transform.rotation);
                cameraAnim.SetTrigger("shake");
                shotTime = Time.time + timeBetweenShots;
            }

        }

    }

    private void Flip(float horizontal)
    {
        if (horizontal > 0 && !facingRight || horizontal < 0 && facingRight)
        {
            facingRight = !facingRight;
            Vector3 theScale = transform.localScale;
            head.transform.localScale = new Vector3();
            theScale.x *= -1;

            transform.localScale = theScale;
        }

    }

}

sentences:
Can i use the same name for a spell in my game that already exists in another game what does trademarks and copyrights contain.
how similar can a name be to a name that already exists.

sentences:
How do you structure an Item class? I've been thinking about the structure of an Item class.
There are many items which may or may not have effects in the game.

For example,
an item "Herb" has an effect to "Heal HP by 5". but
an item "Stone" has no effect.

As per a title, when you design a game, how do you structure the Item class?

The following is the structure I've come up with.

class Item{
    String id;
    // Status where s = HP, MP, ATK .. etc
    // Integer -> value which affects on the Status
    Map<Status, Integer> effect;
    SignType st; // +, -, *, /
}

class Player{
    Map<Status, Integer> status; // Status where s = HP, MP, ATK .. etc
}

sentences:
Select Neighboring X or Y Tiles I have a randomly generated set of tiles, and I am trying to select neighboring x or y tiles to perform functions on them based on if they are a certain value of tile, like so:

var IsometricMap = new Object();

      IsometricMap.tiles = [
        // "images/dirt.png",
        "images/dirtHigh.png",      // 0
        "images/grass.png",         // 1
        "images/water.png",         // 2
        "images/waterBeachCornerEast.png",  // 3
        "images/waterBeachCornerNorth.png", // 4
        "images/waterBeachCornerSouth.png", // 5
        "images/waterBeachCornerWest.png",  // 6
        "images/waterBeachEast.png",    // 7
        "images/waterBeachNorth.png",   // 8
        "images/waterBeachSouth.png",   // 9
        "images/waterBeachWest.png"]

var blockcount = 10;

    let generate_row = _=> Array(blockcount).fill().map(_=>Math.floor(Math.random()*3));
     IsometricMap.map = Array(blockcount).fill().map(generate_row);

    console.log(IsometricMap.map);

    for(let x = 0; x < IsometricMap.map.length; x++){

        for(let y = 0; y < IsometricMap.map.length; y++){

            if ((IsometricMap.map[x-1][y]) == 2) {
            //IF THE TILE IS WATER, DO ALL THIS:

            alert("SUCCESSFULLY SELECTED THE " + IsometricMap.map[x-1][y] + " TILE");

            //DONE WITH WATER TILES
            }

        }

    }

So far this is not yielding any results, its as if it cant find the tile I am trying to specify. Is there something wrong with my scope here?

sentences: Why is my color on my obj not showing in Unity! I've been trying to import my full-color obj files to unity for a while now, but I can't get them to be in color. All of the colors show up in Meshlab, but not in Unity. All of the youtube videos I have watched have said that I need some sort of texture file but my obj doesn't have one. It is just the obj and it somehow has color in Meshlab. Is there some sort of setting I need to change in Unity? If I need a texture file for it to work, is there a way I can extract the texture file(s) from the obj?

sentences:
Loadbalancing Questions I have been learning networking for about 4 months. Wrote a single standalone Multiplayer server and succeeded with authoritative approach. Now I want to extend it by splitting the single server into clusters to allow even more players to log in to avoid latency issues. Now I have protyped the Loadbalancing server and its running pretty good so far.

This is my architecture, I have a master server which acts as a proxy, every sub servers(chat, login, game) connect to the master server as well as all the clients. when a client connects,

Client Request: Send Request -> MS(Master) -> Decides which SS(SubServer) to forward to -> Forwards Request to SS -> SS -> Analyze Message -> Send Response to MS -> Decides which Client to forward to -> Forwards Response to Client

Well, it looks like its going through lots of stages. it takes double the time to process the message than a single server approach. i feel like my model isnt the best or i may be wrong. is there any better model or the one they use in professional games? I still want a Master-SubServer approach.

I just want to clarify that I'm going in the right direction before writing all my codes. Thanks for any answer :)

sentences:
How to customize a character with new objects (clothes, body parts) in a 3D game? how do we customize a character in a game by adding, for example, a different clothing? The character has an armature, made in Blender, if I add a new object with the game engine, I would have to copy the position for each frame, and the orientation?
Or is there a technique to make the model in Blender with different meshes, find the meshes in the .dae file (for scenekit, but it might be the same for fbx for unity), and replace it with a new object, and the orientation will be automatically copied?

Has anyone had some experience with this?

Thanks

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:
How to store and organize my data in a JRPG style game? I am trying to make a JRPG style game using Unity. See this image below to get a sense of the "feel" of the type of game I am making:

http://www.juicygamereviews.com/uploads/3/0/5/0/30501048/9185639_orig.jpg

Currently I'm struggling to find a good way to organize the data in my game.

Referring to the image above, see how each party member has stats, as shown in the UI? I'm sure the monster also has the same kinds of stats, just hidden away. Hence, I want to make a struct called Stats, that both PartyMembers and Monsters contain a reference to.

To summarize what I'm saying so far:

Right now I'm pretty sure I want two classes - one called PartyMember and one called Monster, both of them deriving from a common class - I'll call it TurnTaker - that takes turns during battle. In the TurnTaker class I want a reference to a struct called Stats, which contains HP, MP, Attack, Defense, etc.

The problem is, for player data I want the Stat class to be [Serializable] because I want to save player progress in a binary format, yet for Monsters I wish to make the Stat class inherit from Scriptable Object (SO) for easy development and editing.

Is it possible to make Stats both serializable and derive from SO in Unity? (Note: a struct cannot derive from SO; only a class can. Should I change my stats from a struct to a class? Seems a bit of a waste, just for the inheritance functionality.)

Further, I'm thinking party members have data specific to themselves (equipment, total EXP, character class, etc), as do monsters(drop items, movement type, etc.)

Should I make these two "things," I'll call them PartyMemberSpecificData and MonsterSpecificData

separate classes altogether
separate interfaces that attach themselves to PartyMember, Monster, or Stat
classes that derive from Stats

(I think I want PartyMember to contain a reference to PartyMemberSpecificData and Monster to contain a reference to MonsterSpecificData.)

Any help appreciated!

sentences: How can I randomly generate objects inside of a Complex Area? In my game, I want to generate randomize enemies inside of this green area that I made with a custom editor tool.

sentences:
Dealing with 2D pixel shaders and SpriteBatches in XNA 4.0 component-object game engine? I've got a bit of experience with shaders in general, having implemented a couple, very simple, 3D fragment and vertex shaders in OpenGL/WebGL in the past. Currently, I'm working on a 2D game engine in XNA 4.0 and I'm struggling with the process of integrating per-object and full-scene shaders in my current architecture.

I'm using a component-entity design, wherein my "Entities" are merely collections of components that are acted upon by discreet system managers (SpatialProvider, SceneProvider, etc). In the context of this question, my draw call looks something like this:

SceneProvider::Draw(GameTime) calls...
ComponentManager::Draw(GameTime, SpriteBatch) which calls (on each drawable component)
DrawnComponent::Draw(GameTime, SpriteBatch)

The SpriteBatch is set up, with the default SpriteBatch shader, in the SceneProvider class just before it tells the ComponentManager to start rendering the scene. From my understanding, if a component needs to use a special shader to draw itself, it must do the following when it's Draw(GameTime, SpriteBatch) method is invoked:

public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
    spriteBatch.End();
    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, EffectShader, ViewMatrix);

    // Draw things here that are shaded by the "EffectShader."

    spriteBatch.End();
    spriteBatch.Begin(/* same settings that were set by SceneProvider to ensure the rest of the scene is rendered normally */);
}

My question is, having been told that numerous calls to SpriteBatch.Begin() and SpriteBatch.End() within a single frame is terrible for performance and creates a number of special cases for my drawing logic, is there a better way to do this? Is there a way to instruct the currently running SpriteBatch to simply change the Effect shader it is using for this particular draw call and then switch it back before the function ends?

sentences: How can I simulate tapping on touch for Android? I'm searching on Input.Touch properties to find how can I simulate tapping on touch for Android. Something like Input.getmouseButtonDown() on mobile.

sentences:
Send regular keyboard samples OR keyboard state changes over network Building a multi player asteroids game where ships compete with each other. Using UDP.
Wanted to minimize traffic sent to server. Which would you do:

Send periodic keyboard state samples every from client every to match server physics update rate e.g. 50 times per second. Highly resilient to packet loss and other reliabilty problems. Out of date packets disacarded by server. Generates a lot of unnuecessary traffic.
Only send keyboard state when it changes (key up, key down). Radically less traffic sent from client to server. However, UDP can lose packets without you being informed. So the latter method could result in the vital packet never being resent unless I detect and resend this in a timely manner.

sentences:
How Do Shapes (Rectangles) Work in Quad Trees? I've been told that a quad tree is the ideal data structure for my game, but I'm having trouble understanding how exactly shapes work within quad trees.

I'm doing this in JavaScript, but I think these questions could apply to quad trees in any language.

I think I mostly understand how basic (x,y) points and point insertion works in quad trees, and that I could do it on paper.

Here is a JSfiddle of my experimenting with points.

Aside from one case, my tests with points are working as expected.

But my confusion starts when shapes like rectangles are involved.  When you are retrieving from a quad tree with shapes, does it check each point of the shape, and what nodes they fall into?  And how do shape insertions even work, when it accepts (x,y,width,height) parameters for each shape?  Does it use the width/height from the starting point to calculate other corner points, which are then dispensed into appropriate nodes?  If an inserted shape spans into four nodes, is that shape's data saved into all four nodes?

And when a retrieval method accepts a shape as the parameter(x,y,width,height), what is actually going on?  Is it first seeing what nodes the shape would span to if it were to be inserted, and then retrieve all the objects of those nodes?

I have a JSfiddle working with shapes, but I am utterly confused on the results of my testing.  I am getting duplicate objects being returned!

For example, the red square is a drawn equivalent of the parameters I am entering into my retrieval method.  I would think that since this red square spans all four nodes, it should return every object in the quad tree!  But it doesn't, and I am having trouble  rationalizing what it does return.  I have a number of other tests that are currently commented out, but you can un-comment and run them to see more confusing results!

As say, if I want to return all points in a quad tree, how would I do that?  A retrieve method using a shape the entire size of the bounds?  In example, retrieve(0, 0, canvas.width, canvas.height)?

The JavaScript QuadTree library I am using has been referred to by various other sources, so I assume the actual implementation is correct and reputable.

I think a lot of my confusion may stem from a misunderstanding of quad tree terminology.  Like, why do they say bounds instead of dimensions, when a "point" has width/height parameters as well?  Is it a matter of convention/short-hand, or are they completely different concepts?

Thanks for your time!

sentences:
Fixed timestep periodical "lags" I have fixed timestep code in my main thread, it looks like this:

float oldTimeSinceStart = 0;
float accumulatedTime = 0;
float maxDeltaTime = 0.1f; // 10 FPS
float fixedTime = 0.016f; // 60 FPS

while(running)
{
    float timeSinceStart = System.nanoTime();
    float deltaTime = (timeSinceStart - oldTimeSinceStart) / 1000000000;
    oldTimeSinceStart = timeSinceStart;

    deltaTime = Math.min(deltaTime, maxDeltaTime);

    accumulatedTime += deltaTime;

    while (accumulatedTime >= fixedTime)
    {
        accumulatedTime -= fixedTime;

        gamePanel.update();
    }

    gamePanel.draw(canvas);
}

I have objects on scene, which positions are updated as

position += speed;

And speed is calculated on app start as

speed = (screenWidth / 2) * fixedTime;

These codes should work well to get same objects speeds on all devices and also smooth visual. Speed works quite well, but visual appereance is bad. I'm getting periodical "lags" about each half second on my old Galaxy Ace and also on S III Mini. So it's like running smoothly - lag - running smoothly - lag...

Any ideas what could cause these lags?

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: game physics: contact constraint and relative velocity For two rigidbodies (2D boxes), A and B, I have been colliding A with B and finding the collision normal pointing towards A i.e. the direction that would separate A from B. When it comes to calculating the relative velocity for the contact constraint, does it matter which body has the edge that the collision normal is perpendicular in terms of which velocity to subtract from which?

sentences:
Why are so many games not fully voiced? I'm wondering why so many MMOs are only partially voiced? I asked makers of games (Thimbleweed Park, in their Q&A) how expensive voiceover is, and they said it wasn't especially expensive unless you hire A-list stars. So why would so much game dialogue be only present as text to be read onscreen?

The only reason I can think of is the same that exists for localization in all software: You can't record VO until all the dialogue is finished and frozen, so it is another fixed delay between finishing the rest of the game and shipping. So it doesn't seem like it's not manageable.

To be clear: I'm not looking for opinions or theories (that would only make the mods close this question) but actual reasons and experiences from people who have shipped games with partial voiceover.

sentences:
Bohemia Interactive's bio2s format Does anyone have specifications for the bio2s scripting language from Bohemia Interactive? They develop Operation Flashpoint, Armed Assault (ArmA), and Virtual Battlespace.

These scripts are sometimes called O2 or Oxygen scripts and are used in their terrain and modeling tools. Oxygen is Bohemia Interactive's modeling tool.

I found additional examples of the format in this VBS2 tutorial and this ArmA forum thread.

EDIT: I clarified the purpose of the bio2s format and provided some links to examples.

sentences:
Calculate Orbit Path/Ellipse given mass, velocity, and distance (2body) Calculate and draw the path of an orbit in a 2 body problem given the mass, current velocity, and distance of both bodies?

We're working in Unity and will be using the default rigidbody.mass to start while we craft a deterministic and event driven gravitational orbit calculation system.

We've got a lot of this done but need to know if anyone here speaking from experience can suggest the most optimal and the most accurate route for going about this.

Okay, so here's the intended system.

Objects have a collider-trigger sphere which represents their sphere of gravitational influence. When objects enter an SOI, they begin to be effected by that object's gravity. This represents an "encounter" event and this is where we grab initial values to determine the trajectory the object will take with those initial parameters. It will take this path as long as nothing changes. We only worry about "significant bodies" such as planets and large asteroids. We're not giving every ship an SOI but we do give them mass values so we can properly perform consistent calculations.
When a "path change event" occurs, the system will recalculate when the event is over and new velocities are established. This prevents the system from constantly calculating the force on objects every physics step and greatly reduces the overhead of the system.
The system has a way to "snapshot" everything for saves. positions, velocities, and paths. Basically from what I understand, we'd be getting arrays of velocities that we lerp between based on an array of position vectors. I was talking about how the system would to the motion, there.

So, instead of using Unity's built-in physics and forces, we bypass that for a much more efficient and customizable system. Instead of applying constant force to effect the positions of objects, we calculate the path ahead of time and assume the object will follow that path until something changes.

sentences:
How to make wall tiles overlap floor tiles a bit in Unity3D? Currently my tiles are very strictly placed, there are wall tiles, and floor tiles, and they don't overlap at all.

What I want to achieve is to have my walls overlap my floors a bit.

So their inner edges doesn't have to be a stright line, but a free shape, with "transparent holes" which show the floor below. Resulting in a much better feeling.

My current approach is to have multiple layers. One for the floor and wall (single) tiles), and one above this, which will have the overlapping, decorative parts of the walls.

But this methods feels slow and clunky:

For one wall tile I have to place 9 tiles/tileparts to make it look nice. (the tile itself plus the neighbours).

It would be better to place just one tile which got overlapping parts

sentences:
Why does the lighting change the objects color? I have a code that draws a sphere. Without lighting it is white, but if I enable lighting, it's drawn in gray.

I don't know why the sphere changed it's color

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

void init(void)
{
    GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
    GLfloat mat_shininess[] = { 50.0 };
    GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
    glClearColor (0.0, 0.0, 0.0, 0.0);
    glShadeModel (GL_SMOOTH);

    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
    glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);

    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_DEPTH_TEST);
}

void display(void)
{
    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glutSolidSphere (1.0, 20, 16);
    glFlush ();
}

void reshape (int w, int h)
{
    glViewport (0, 0, (GLsizei) w, (GLsizei) h);
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity();
    if (w <= h)
        glOrtho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w,
                 1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);
    else
        glOrtho (-1.5*(GLfloat)w/(GLfloat)h,
                 1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize (500, 500);
    glutInitWindowPosition (100, 100);
    glutCreateWindow (argv[0]);
    init ();
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutMainLoop();
    return 0;
}

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:
Why is my A* object resetting to (0, 0, 0), instead of following its path? I'm working on an RTS project, and I'd like to use the A* Project by Aron Granberg to navigate around obstacles. The problem is that the correct path is displayed in the scene, the unit is still walking forwards, but the unit just jumps to (0, 0, 0). As is, this as a workaround to have some progress in my build script.

Why is my A* object resetting to (0, 0, 0), instead of following its path?

I don't know where I made the mistake that leads to this behavior. Here is script responsible for the movement:

using UnityEngine;
using Pathfinding;
using RTS;

public class Unit : WorldObject
{
    public float moveSpeed;
    public Path path;
    public float nextWaypointDistance = 3;

    private int currentWaypoint = 0;

    protected override void Update()
    {
        Vector3 dir = (path.vectorPath[currentWaypoint] - transform.position).normalized;

        MakeMove(dir);

        if (Vector3.Distance(transform.position, path.vectorPath[currentWaypoint])
            < nextWaypointDistance)
        {
            currentWaypoint++;
            return;
        }
    }

    private void MakeMove(Vector3 dir)
    {
        transform.position
            = Vector3.MoveTowards(transform.position, dir, Time.deltaTime * moveSpeed);
    }
}

sentences:
Single player game into Multiplayer game I developed a Single player game in Flash (Tic Tac Toe) and in the Multiplayer mode i will be able to do both player playing on the same system with out network.

I would like to extend it and make it enable to play the Multiplayer game for two player playing it online.

How i can be made give me some ideas , How test the Multiplayer game playing along with different computers(I do not have internet connection in home).

How I able to change the single player game into Multiplayer game , any minor changes required or I have to change the code base completely.

In which way i can make it possible.

sentences:
Vive SteamVR Stereo Rendering mirror doesn't reflect lineRenderer lines steadily I'm creating a SteamVR game in Unity. I'm using the Vive SteamVR Stereo Rendering Toolkit to create the mirror effect. I also wrote a script to render three lines between headset, and two controllers, with lineRenderer. The lines are working fine, but in the mirror reflection, I can only see the lines rendered one at the time, as opposed to all three lines visible at the same time. Why is that?

Edit 1:

Add an image of what I see:

In my game, I used three balls to represent the headset, the left controller and the right controller. I see the lines between all three lines constantly (even though you can't see the ball in the headset obviously and the lines between the left/right controllers to the headset are clipped, which is fine...), but I can only see one line at a time in the reflection, either the line between the head and left controller or the line between the head and the right controller. For example, if I move the left controller, the line between the head and the left controller in the reflection is working, while the other disappear in the reflection. Also, the line between the left and right controllers never appear in the reflection.

Edit 2:

Add another image to explain what I want vs what I have now:

sentences:
How to calculate shot angle and velocity to hit a moving target? I am developing a 2D Android game and I am making an aiming algorithm for AI projectiles to hit enemies either following a path, or free moving. At the moment it just calculates where the target will be after a distance and fires a projectile to meet it at that distance. Of course this means varying the projectile speed to meet the target.

Does anyone have any tips for a simple-ish algorithm (optimal-ish) to calculate when the projectile needs to fire and where it needs to aim if it can only travel at a constant velocity? Say the projectile goes twice the speed of the target?

The only way I can think of involves searching and seems quite large.

sentences:
Terrain Navmesh build, rebuild smaller pieces of the bigger navmesh terrain. UNITY when the area is very big and AI characters are required to walk a larger distance, it would be beneficial to have the large navmesh ready for finding a path.

when we change the height of the terrain in runtime small areas of the terrain should be updated.
so the buildnavmesh method is  kind of an overkill.
and the localnavmesh builder as a large type would be inefficient.
how do we dynamically change a small part of a larger navmesh?
advice or help would be highly appreciated.

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 do I make a collision between AABBs slide? I have a room with objects inside. Each object has it's own AABB.

I know how to check for collisions between the objects with an AABB-AABB intersection.

How do I calculate an appropriate collision response to make them frictionlessly slide against each other as they collide?

sentences:
Maya .IFF plugins for Gimp Maya's preferred format for saving off a UV Snapshot is its own .IFF format, so I was hoping to find a plugin allowing Gimp 2 (Windows) to read it. I've found plenty of plugins for different linux distros, but none are win-friendly (that I can discern - admittedly I'm no whiz with Gimp). Does anyone know of one?

Alternately, .tiff seems to work just fine, so if there's no good reason to bother fiddling with IFFs, I'd appreciate the input there, too.

(sorry if this isn't on-topic)

sentences:
To move an object forward an exact distance and then stop I am using this script below to move an animated object in unity with no root-motion. it simply walks across the terrain and has a timer so it waits 60 seconds until starting.

void Update ()
{
    if (Time.timeSinceLevelLoad > 60)
    {
        transform.Translate(0, 0, Time.deltaTime);
    }
}

I want the object to travel a certain distance or certain amount of steps and then stop at an exact point and stay there, is there a simple way to add to the above code to do this? does it entail xyz position reached maybe?

sentences:
Does Phaser Arcade.Body velocity include deltaTime or not? I want to move my character along the x axis with constantly speed. I thought move depends on frame rate. So, technically I should write

sprite.body.velocity.x = speed * deltaTime

where deltaTime = game.time.elapsedMS / 1000;

But if I'm doing that - my character moves vvvvverrry slooow, even if speed = 1000.

But if I'm writing

sprite.body.velocity.x = speed

it works fine. My fps = 60;

Phaser Documentation
says:

  velocity - The velocity, or rate of change in speed of
  the Body. Measured in pixels per second.

no deltatime....

and all demos do not have deltatime

http://phaser.io/examples/v2/arcade-physics/platformer-basics

http://phaser.io/examples/v2/arcade-physics/asteroids-movement

etc.

So, I don't understand: shoud I calculate deltaTime or just use velocity.x?

sentences:
RaycastHit2D.point is acting weird when used with circlecast2d When I make circleCast2d intersects with another circle collider, I get a RaycastHit2D.point that doesn't point at the tip of the collision as it states in the documentation. Instead it always points at the centre of the intersected junction or pointC as shown in the figure below.
I checked this numerous times with different values to make sure the error was not from my end.
Is this intended? If so is there another way where I can actually find the closest point from collider(B) to the centre of collider(A) which corresponds to point(D) in the figure?
This is a picture of what looks like:
A = circleCast
B = collided object
C = where RaycastHit2D.point is pointing at
D = where I'd like it to point.

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:
How to remove Sharp Edges on Texture in Libgdx Game I am making the above Libgdx game but I have come across the problem of really sharp images for my background if I zoom out of the world.

As you can see on the screenshot there are really sharp edges that appear surrounding the texture of the purple background.

How can I make the Texture blend well with the surrounding?

sentences:
Getting Parser Error: The identifier "delta" isn't declared in the current scope. in godot this is the whole code

extends KinematicBody

signal health_updated(health)
signal killed()

var speed = 10
var acceleration = 10
var gravity = 0.2
var jump = 5

var mouse_sensitivity = 0.3

var direction = Vector3()
var velocity = Vector3()
var fall = Vector3()
export (float) var max_health = 100

onready var health = max_health setget _set_health
onready var head = $Head

func _ready():
    Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)

func _input(event):

    if event is InputEventMouseMotion:
        rotate_y(deg2rad(-event.relative.x * mouse_sensitivity))
        head.rotate_x(deg2rad(-event.relative.y * mouse_sensitivity))
        head.rotation.x = clamp(head.rotation.x, deg2rad(-90), deg2rad(90))

func _physics_process(delta):

    direction = Vector3()

    move_and_slide(fall, Vector3.UP)

    if not is_on_floor():
        fall.y -= gravity
onready var invulnerability_timer = $invulnerabilitytimer
func damage(amount):
    if invulnerability_timer.is_stopped():
        invulnerability_timer.start()
        _set_health(health - amount)
func kill():
    pass
func _set_health(value):
    var prev_health = health
    health = clamp(value, 0, max_health)
    if health != prev_health:
        emit_signal ("health_updated", health)
        if health == 0:
            kill()
            emit_signal("killed")

    if Input.is_action_just_pressed("jump") and is_on_floor():
        fall.y = jump

    if Input.is_action_pressed("move_forward"):

        direction -= transform.basis.z

    elif Input.is_action_pressed("move_backward"):

        direction += transform.basis.z

    if Input.is_action_pressed("move_left"):

        direction -= transform.basis.x

    elif Input.is_action_pressed("move_right"):

        direction += transform.basis.x

    direction = direction.normalized()
    velocity = velocity.linear_interpolate(direction * speed, acceleration * delta)
    velocity = move_and_slide(velocity, Vector3.UP)

sentences:
Collisions between sprites in SpriteKit I'm making a game in XCode using SpriteKit. The game has a player and different types of projectiles that he has to avoid. When the player collides with the projectiles, the score changes and the projectile disappears. However, when two projectiles collide, they kind of bounce away.
I want to make that every time two projectiles collide, they act like nothing happened and they keep going in their original path. What should I do?

*Note: This is not the whole code, it's just what matters.

    import SpriteKit

    struct Physics {
        static let player : UInt32 = 1
        static let missileOne : UInt32 = 2
        static let missileTwo : UInt32 = 3
    }

class GameScene: SKScene, SKPhysicsContactDelegate {

    var player = SKSpriteNode(imageNamed: "p1.png")

    override func didMoveToView(view: SKView) {

        physicsWorld.contactDelegate = self

        player.position = CGPointMake(self.size.width/2, self.size.height/5)
        player.physicsBody = SKPhysicsBody(rectangleOfSize: player.size)
        player.physicsBody?.affectedByGravity = false
        player.physicsBody?.dynamic = false
        player.physicsBody?.categoryBitMask = Physics.player
        player.physicsBody?.collisionBitMask = Physics.missileOne
        player.physicsBody?.collisionBitMask = Physics.missileTwo

        var missileOneTimer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("SpawnMissileOne"), userInfo: nil, repeats: true)
        var missileTwoTimer = NSTimer.scheduledTimerWithTimeInterval(1.2, target: self, selector: Selector("SpawnMissileTwo"), userInfo: nil, repeats: true)

        self.addChild(player)
    }

    //When contact happens
func didBeginContact(contact: SKPhysicsContact) {
    var firstBody : SKPhysicsBody = contact.bodyA
    var secondBody : SKPhysicsBody = contact.bodyB

    if ((firstBody.categoryBitMask == Physics.player) && (secondBody.categoryBitMask == Physics.missileOne)) {

        CollisionWithMissileOne(firstBody.node as SKSpriteNode, missileOne: secondBody.node as SKSpriteNode)

    } else if ((firstBody.categoryBitMask == Physics.player) && (secondBody.categoryBitMask == Physics.missileTwo)){

        CollisionWithMissileTwo(firstBody.node as SKSpriteNode, missileTwo: secondBody.node as SKSpriteNode)

    } else if ((firstBody.categoryBitMask == Physics.missileOne)&&(secondBody.categoryBitMask == Physics.missileTwo)) {

        CollisionBetweenMissiles(firstBody.node as SKSpriteNode, missileTwo: secondBody.node as SKSpriteNode)

        }

    }

//For Player and MissileOne
    func CollisionWithMissileOne(player: SKSpriteNode, missileOne: SKSpriteNode) {

        missileOne.removeFromParent()
    }

//For Player and MissileTwo
    func CollisionWithMissileOne(player: SKSpriteNode, missileTwo: SKSpriteNode) {

        missileTwo.removeFromParent()
    }

//For MissileOne and MissileTwo
        func CollisionBetweenMissiles(missileOne: SKSpriteNode, missileTwo: SKSpriteNode) {

        ???WHAT SHOULD I CODE HERE???

    }

}

sentences:
Online MMO collision detection for players & walls Let's assume the following:

I have a server which stores the player's position (float x, float y, float z)
Client sends the server it's updated position ever 250ms or so.
Server has bounding boxes for all buildings & players ( Let's say each wall has it's own AABB or OBB)
For broad-phase collision detection, I use spatial hashing based on the bounding boxes.
Client does full-on triangle level collisions locally.

My question:
- How can I quick calculate if a player has passed through a wall on the server only using AABBs or OBBs. Or, is there no way to do that without going to triangle-level collision detection. Maybe some other data structure? Any help would be appreciated.

sentences:
Best ways to navigate a single step on a hexagonal grid depending on input Problem

In my puzzle game, the player moves one step at a time on a hexagonal grid. (Not an action game.)
The sequence of steps is important for the gameplay, so it is not only about getting from A to B.
There are of course six possible move directions that I have to map my input to.
My hexagons have a pointy tip, so I do not have a North or South adjacent cell. So the ordinal directions are NW, NE, E, W, SW and SE. See the image.
I am particularly interested in ideas to accomplish this movement for mouse, keyboard and Xbox-like controllers, but feel free to post your thoughts on touch.
The main difficulty is that I am very experienced with my very clunky controls and new players are struggling to simply move the player around. Also, the movement controls cannot be accomplished via conventional square grid controls, e.g. a dpad or WASD.

What I have tried / Ideas
Keyboard

Mapping the characters around S directly to the six hexagonal directions, so W->NW, E->NE, A->W, D->E, Z->SW and X->SE. This is what I use basically.
Idea: Use WASD only. W is a North modifier, S is a South modifier and A and D correspond to East and West. Holding down the modifier will change what A/D does. Maybe show preview of current move possible with modifiers.

Controller

Flick controls: When you reach a certain threshold in displacement of the 2D left stick, this angle counts as as movement and will be mapped directly to a direction. You will see a small line/arrow pointing to the corresponding direction of the stick when you are not fully tilting the stick. Center stick to proceed.
Same as before, but you have to press A to go in that direction.

Mouse

Idea: Click on the adjacent tile to go there, maybe highlight possible moves.
Idea: Press a button and drag from that position to mimick stick controls, e.g. flicks.

sentences: Tessellation vs Geometry Shader Correct me if I'm wrong, but both the Geometry Shader and the Tessellation Shader jobs are to generate vertices in the Graphic Pipeline. What I would like to know is how they are different and when should I use one over the other?

sentences:
Unity2D - How to leave and come back to the same scene properly? I am new to game development and for exercise I made endless runner where everything is generated randomly from prefabs and both player and obstacles are being destroyed once they are off the screen. There are two scenes - Start and Game. At the Start scene you can click on Play button which will take you to the Game scene and you can mute the sound.

When I start the game and I click on the Play button it loads the Game scene perfectly and game runs and works just fine. When player dies the game over window is shown. From there two options are available - either go to the Start scene or play the game one more time.

If I choose to play one more time everything works perfectly. But if I choose to go to the Start scene and then click on Play button to play the game then once the Game scene is loaded the player and the obstacle game objects are not being generated and floor and background Quads are not being resized properly to fit the screen. And I get the following error -

MissingReferenceException: The object of type 'RecycleGameObject' 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.
ObjectPool.NextObject (Vector3 pos) (at Assets/Scripts/ObjectPool.cs:28)

My question is  - what can I do so that every time I come back to the scene everything is being loaded just like the first time?

I am currently loading scenes with this code:

SceneManager.LoadScene("Start");

And this is the ObjectPool class:

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

public class ObjectPool : MonoBehaviour {

    public RecycleGameObject prefab;
    private List<RecycleGameObject> poolInstances = new List<RecycleGameObject>();

    private RecycleGameObject CreateInstance(Vector3 pos)
    {

        var clone = GameObject.Instantiate(prefab);
        clone.transform.position = pos;
        clone.transform.parent = transform;

        poolInstances.Add(clone);

        return clone;
    }

    public RecycleGameObject NextObject(Vector3 pos)
    {
        RecycleGameObject instance = null;

        foreach(var go in poolInstances)
        {
            if(go.gameObject.activeSelf != true)//here I get the error
            {
                instance = go;
                instance.transform.position = pos;
            }
        }

        if(instance == null)
        {
            instance = CreateInstance(pos);
        }

        instance.Restart();

        return instance;
    }

}

sentences: Sea water shader using only fragment processor I have a game that runs on mobile devices (OpenGL ES 2.0) and for which I would like to create some sea water using the shaders. Now, the plane on which the sea water texture will be has only 4 vertices and I need it to remain like that (because of performance issues). So, I think, my only option is to simulate the water from the fragment shader.  At conceptual level, how should I do it? I must mention I'm a beginner with the programmable pipeline (I barely learned the language, in some extent) and have no idea where should I start.

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:
Trying to use stencils in 2D while retaining layer depth This is a screen of what's going on just so you can get a frame of reference.

The problem I'm running into is that my game is slowing down due to the amount of texture swapping I'm doing during my draw call. Since walls, characters, floors, and all objects are on their respective sprite sheet containing those types, per tile draw, the loaded texture is swapping no less than 3 to 5+ times as it cycles and draws the sprites in order to layer properly.

Now, I've tried throwing all common objects together into their respective lists, and then using layerDepth drawing them that way which makes things a lot better, but the new problem I'm running into has to do with the way my doors/windows are drawn on walls. Namely, I was using stencils to clear out a block on the walls that are drawn in the shape of the door/window so that when the wall would draw, it would have a door/window sized hole in it.

This is the way my draw was set up for walls when I was going tile by tile rather than grouped up common objects.

first it would check to see if a door/window was on this wall. If not, it'd skip all the steps and just draw normally. Otherwise
end the current spriteBatch
Clear the buffers with a transparent color to preserve what was already drawn
start a new spritebatch with stencil settings
draw the door area
end the spriteBatch
start a new spritebatch that takes into account the previously set stencil
draw the wall which will now be drawn with a hole in it
end that spritebatch
start a new spritebatch with the normal settings to continue drawing tiles

In the tile by tile draw, clearing the depth/stencil buffers didn't matter since I wasn't using any layerDepth to organize what draws on top of what.

Now that I'm drawing from lists of common objects rather than tile by tile, it has sped up my draw call considerably but I can't seem to figure out a way to keep the stencil system to mask out the area a door or window will be drawn into a wall. The root of the problem is that when I end a spriteBatch to change the DepthStencilState, it flattens the current RenderTarget and there is no longer any depth sorting for anything drawn further down the line. This means walls always get drawn on top of everything regardless of depth or positioning in the game world and even on top of each other as the stencil has to happen once for every wall that has a door or window.

Does anyone know of a way to get around this? To boil it down, I need a way to draw having things sorted by layer depth while also being able to stencil/mask out portions of specific sprites.

sentences:
Multiple images written and read from one meta-file? Short version:

I need a way to store multiple image files in one bigger file, to be used using C#, preferably easily compatible with XNA. The files will be read, written to, but also adaitional files will be added during run-time.Is there an easy way to do that?

Long version:

I'm currently working on a small student project. It's a top down RPG-strategy and we decided to make the map dynamic, meaning that portions of it will be loaded/unloaded in the background while the player character moves around.

I reckon the best way to do this is to load/generate chunks as the player comes close to them and unload them when the player goes farther. I reckon the best way to do this is to save chunk as raster graphics and then use the colour information (RGBA) to store information.

The problem is that I want certain chunks to be saved once generated so I need a way to save images, in the same way I read them, but preferably all in a single file, so as not to have the folder bloat in size with a lot of files.

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:
Getting a Ranged AI "In Range" to shoot In my game, ranged units and melee units have the same behavior. Ranged units try to maintain a fixed distance r, from their targets. If they're within r + d of the target (where d is a small value) they stop and shoot it. Note that this means the ranged unit can't be closer than r - d. Melee units are the equivalent of ranged units, but with r set to zero.

Right now, my AI for ranged units is as follows:

Find a path to the target using A*.
Walk along the path until you are within [r - d, r + d] of the target.
Stop and shoot. If the target is dead, quit.
If you are still within [r - d, r + d], goto 3.
Otherwise, move away/towards the target until you are within r + d again. Goto 4.

Here's a sort of diagram.

My problem is, if there are obstacles and the target moves, step 5 causes a lot of problems. Ranged units will end up backing into walls, unable to shoot. If instead of going to step 5 I go back to step 1 (planning a path), the problem still isn't solved, because walking toward the target will only decrease the range, not increase it.

How can I get ranged units to successfully follow and shoot their targets?

sentences: Starting out - should I make complete games or just play around? While starting out, I made clones of some arcade games (Tic tac toe, Pong, Snake, Tankwars, Breakout, Tetris, etc). Most of these games had just had the gameplay, I didn't code any of the starting screens, there were no features like high scores, etc. My question is, should I focus on polishing these games up or just start with more comlicated games?

sentences:
Box2D pixel to meter conversion I have a game that was written in pixels and now I want to change it to meters like(box2D do). How I need to do that. I have wached a lot of tutorials and all they have some SCALING FACTOR but when I implement it my game don't work as I aspected. How I need to do that? For example I have a Coin and I want to make position of that coin random. I also want that coin sprite have a CircleShape (Box2D). Here are my code where I update my coin coordinates at specific time

if(time > 1.5f && !goToWallet && setUpCoin){
                coin.setCoinPosition(-100, -100); // do not show coin on the screen
                coin.update(coin.getCoinX(), coin.getCoinY());
                cam.update();
                if(showTime > MathUtils.random(5, 20) && !goToWallet){
                    coin.setCoinPosition(MathUtils.random(50, Gdx.graphics.getWidth() - 50)/100f, MathUtils.random(50, Gdx.graphics.getHeight() - 50)/100f); // random position of the screen IN PIXELS!!!
                    coin.update(coin.getCoinX(), coin.getCoinY());
                    cam.update();
                    time = showTime = 0.0f;
                }
            }

The problem is that is very easy to do in pixels, but How I need to do that in meters?

Here's my Coin class

public class Coin {
    /*
    A lot of variables
    */

    private final float radius;
    private BodyDef body;
    private FixtureDef bodyPhysics;
    private static Box2DDebugRenderer rend;
    private static World world;
    private static CircleShape coin;

    public Coin(World world, Box2DDebugRenderer rend){
        this.rend = rend;
        this.world = world;

        body = new BodyDef();
        bodyPhysics = new FixtureDef();
        coin = new CircleShape();
        coin.setRadius(.05f);
        body.type = BodyType.StaticBody;
        bodyPhysics.shape = coin;
        world.createBody(body).createFixture(bodyPhysics);
}
public void setCoinPosition(float x, float y){
    this.x = x;
    this.y = y;
    coin.setPosition(new Vector2(x, y));
}

}

sentences:
Progress bar in Super Hexagon using OpenGL ES 2 (Android) I'm wondering how the progress bar in Super Hexagon was made.  (see image, top left) Actually I am not very sure how to implement a progress bar at all using OpenGL ES 2 on Android, but I am asking specifically about the one used in Super Hexagon because it seems to me less straightforward / obvious than others: the bar changes its colour during game play.

I think one possibility is to use the built-in Android progress bar. I can see from some Stackoverflow questions that you can change the default blue colour to whatever you want, but I'm not sure whether you can update it during the game play.

The other possibility I can think of for implementing a progress bar is to have a small texture that starts with a scale of 0 and that you keep scaling until it reaches the maximum size, representing 100%. But this suffers from the same problem as before: you'll not be able to update the colour of the texture during run-time. It's fixed.

So what's the best way to approach this problem?

*I'm assuming he didn't use a particular library, although if he did, it would be interesting to know. I'm interested in a pure OpenGL ES 2 + Android solution.

sentences:
Unity WebGL: how to copy to clipboard text from an inputField? I would like to know if there is a solution to copy/paste the text from/to an InputField  in a WebGl Unity app.
Edit: for security reason, Unity WebGL doesn't allow text copy and paste in/from browser.
Thanks

sentences:
Unity Shader Graph, set blackboard properties from code I have a Shader Graph shader with a blackboard property that I want to change from within my code. The property is called Highlight here are the things I have tried:

Color myColor = new Color(1f,0,0,1f);
material.Color = myColor;                       // throws error (as I expected)
material.SetVector("Highlight", myColor);       // Name in blackboard window
material.SetVector("HighlightColour", myColor); // Name in material property
material.SetVector("Color_8C3A526", myColor);   // Name in the shader inspector

None of these work.

Here's the shader set up:

sentences:
Why use Time.deltaTime in Lerping functions? To my understanding, a Lerp function interpolates between two values (a and b) using a third value (t) between 0 and 1. At t = 0, the value a is returned, at t = 1, the value b is returned. At 0.5 the value halfway between a and b is returned.

(The following picture is a smoothstep, usually a cubic interpolation)

I have been browsing the forums and on this answer I found the following line of code: transform.rotation = Quaternion.Slerp(transform.rotation, _lookRotation, Time.deltaTime);

I thought to myself, "what a fool, he has no idea" but since it had 40+ upvotes I gave it a try and sure enough, it worked!

float t = Time.deltaTime;
transform.rotation = Quaternion.Slerp(transform.rotation, toRotation, t);
Debug.Log(t);

I got random values between 0.01 and 0.02 for t. Shouldn't the function interpolate accordingly? Why do these values stack? What is it about lerp that I do not understand?

sentences:
PHP Quest System: Push or Polling? I want to build a quest system in PHP. My idea so far was to create quests based on a class and write two functions for every quest: One is checking if its activated, the other will check the progress.

Since I have to do this on every page reload, this might be bad performance-wise. Is it possibleto build some kind of an event/push system with PHP? How would you do it? Yes, when something happens like the users buys something, a function gets called with for example "CAR_BOUGHT_BY_PLAYER".

My problem is, I don't know how to go on from there.
Any advice?

Thanks!

sentences:
How to keep the value of angle between 0 and PI in box2d In box2d, if i rotate an object multiple times in clockwise or anti clockwise direction, the value of angle ( body.getAngle() ) keeps on increasing. Like at start it is at 0 radians, then 1.57(90 deg), after complete roatation 6.28, then after second rotation 2*6.28 .
If a player keeps on rotating for too much time, angle value becomes really big.And for multiplayer games, sending big values uses more bytes.

How can i keep the value between 0 to +-3.14.Is there any solution in box2d Or
Is it a good way of sending Sin(angle) to keep the value between -1 and 1 and doing reverse of sin at client side.

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:
Why doesn't Unity keep keydown states between scenes, and how can I change that? So basically, when my scene in Unity changes and I'm holding down, say, Right or Left, when the scene resets, my player (and Unity) doesn't even recognize that I'm still holding that button, until I lift my finger and put it back.

Any thoughts?

Sorry for any broken English or anything, I'm running off two hours of sleep.

sentences:
The best way to pass data between clients in a room I am developing a backgammon game in Unity and tried to use Photon. But I could not find a step by step help for it and I also know that photon in real-time and it syncs data over 10 times per second. but I need to sync data after each moves.

Would you please show me the best way to do that.

sentences:
How to sample a texture with specified LOD in SM 2.0? That is my question, in SM 3.0 there is the HLSL intrasic function tex2Dlod to pick a color on a texture2d at specified coords and specified level-of-detail.

But after long search on the web, I don't find equivalent in SM 2.0 (ps_4_0_level_9_3)...

sentences:
XNA + Windows Forms: How make them work together without making the trick of the custom GraphicsDeviceControl? What I've found is a solution where you have to code a custom GraphicsDeviceControl to put inside the form (the well known tutorial from the APPHub), but that's not what I'm searching for.

I would like to say that before start to write my question here, I "googled" a lot and I saw some questions here, but I couldn't find what I'm looking for.

I would like to have the Draw/Update loops completly managed by XNAFrameWork (with XNA project and so), and not by a custom component.

I hope you understand what I asked.

Thanks in advance.

Edit

What's the most important thing for me and wasn't shown in the tutorial of APPHub is: where I have to put the input handling? That's one the problems that wasn't covered by the tutorial.

sentences:
How do I organize my game into multiple classes in C#? I've made two simple 2D games while following tutorials for the XNA libraries, and I wanted to make something myself, with only the knowledge I gained from these tutorials.

This will be my first serious attempt at game development, as well as my first C#/XNA project. I migrated from Java a week ago. Now, both of the tutorials I've followed made the whole game using only one class. And while it's possible, it isn't organized enough for me, and I want most of the functions to be organized in separate classes. So, I started with Input so I can have an easy way of exiting the game during testing right away.

Here's the important bits, I think:

From my Game1.cs:

protected override void Update(GameTime gameTime)
{
    Input input = new Input();
    input.PollInput();

    // TODO: Add your update logic here

    base.Update(gameTime);
}

From my Input.cs:

namespace MyFirst2DGame
{
    class Input
    {
        Game1 game = new Game1();

        public void PollInput()
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                game.Exit();
        }
    }
}

However, when I run the project, the Back button on the XBox 360 controller does nothing. My question, is am I missing something? I have no idea how to do anything with multiple classes, as all of my Java projects were quite small and had need for only one class.

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:
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 do I apply A* to a complex and dynamic 3D environment? I've looked a bit at Breadth-First and Depth-First search algorithms and I think I've got a pretty good idea of how they work.

Now I am here : http://www.policyalmanac.org/games/aStarTutorial.htm

The problem is I don't see how a 2D grid can help with a 3D game. I suppose that wouldn't be a problem if the 3D game didn't have the AI explore multiple levels of a building, but since that is most often what occurs, I am not sure how I would "simplify" my static level geometry and my physics-dynamic changing scene into a structure that can be easily be traversed to determine a path to a goal node.

sentences:
How to make AI detect a target behind a wall, who is only partially exposed? I'm making an FPS game where, even when a target's whole body is behind a wall or box, but its finger or foot exposed, the AI should be able to detect it and shoot its finger.

So far the way I've thought of to implement this it so traverse all the targets, find who is near a wall, and compare their position with the corner of wall. But I don't know how to check whether its finger is exposed.

I could use a raycast forward from the AI's gun, but would I need to add a collider to every small body part of every target?

sentences:
How to create custom cubemap images? I managed to use cube maps in OpenGL to get reflection and refraction effects. So far I used images from this site, however, I want to create my own set of images to use in a cubemap, the idea is just to have checker-board patter on the "floor" and the rest of a solid color.

My question is, how can I create the 6 images in order to get the cube map textures?

EDIT

I want to be able to achieve something like this picture (on top) but without the cube, sphere and so on.

sentences:
Bouncing off edge in libGDX doesn't work after resizing window I have a game in which the enemy has to bounce of the edge, when it hits it. It is working fine, normally, but when I resize the window, the bouncing breaks. It doesn't bounce properly.

In the image, the red enemy is not in the screen. How would I make it bounce off properly even after resizing the window?

Here is my BasicEnemy code:

public class BasicEnemy extends Enemy {

    public BasicEnemy(Player player, float x, float y) {

        super(player, new TextureRegion(), x, y, 5, 5);
        width = 16;
        height = 16;
    }

    @Override
    public void tick(float dt) {

        wrapPos();
        if (touchesPlayer())
            player.setHealth(player.getHealth() - 1);

        x += velX;
        y += velY;
    }

    @Override
    public void render(SpriteBatch batch, ShapeRenderer renderer) {

        renderer.setColor(Color.RED);
        renderer.rect(x - width/2, y-height/2, width, height);
    }
}

Here is my Enemy code:

public abstract class Enemy extends Entity {

    protected Player player;

    public Enemy(Player player, TextureRegion region, float x, float y,
        float velX, float velY) {

        super(region, x, y, velX, velY);
        this.player = player;
    }

    @Override
    protected void wrapPos() {

        if (x > Gdx.graphics.getWidth() - width /2 || x < width/2) {

            //Here we flip the speed, so it bounces the other way.
            velX = -velX;
        }

        //Same as above, but with on the y-axis.
        if (y > Gdx.graphics.getHeight() -height/2 || y < height/2) {

            velY = -velY;
        }
    }

    protected boolean touchesPlayer() {

        return getBoundingBox().overlaps(player.getBoundingBox());
    }
}

sentences:
Why can't I see how many installs my game has on its Google Play page? I made an Android game, and I uploaded and published it to Google Play. Then, I installed it on my phone.

Why can't I see the install count, on its Google Play page?

sentences:
OnTriggerEnter doesn't detect collision until at least one of the two colliders move I'm having trouble coding a melee attack script.

I've set up an attack hitbox that toggles enabled/disabled whenever you press a button (The hitbox itself doesn't move, it just blinks in and out) and I'm trying to have it hit an unmoving target. The first hit gets registered, but the next do not unless I move either the static target (by pushing it) or the player itself.

Both the hitbox and the hurtbox have kinematic rigidbodies in them. They are separate BoxCollider2Ds in their own "Hitbox" and "Hurtbox" layers, which only interact between themselves. My hit detection code is as follows:

void OnTriggerEnter2D(Collider2D col) {
    Debug.Log(col + " got hurt");
}

Here's a graphical example of what's going on. You can see how hit detection doesn't work until I nudge Test Monster. When I try to attack it without moving it, detection stops working.

sentences:
What is the best way to follow this book using XNA 4.0 instead of XNA 2.0 I found a reference to this book on the Microsofot Indie games forums: http://www.amazon.com/dp/1430209798/ref=pe_385040_30332200_pe_309540_26725410_item

I'm really interested in it, because the example project is very close to the style of gameplay I'm looking for in my next game. The downside is, I was hoping to write the game in XNA 4.0 and maybe even Monogame.

Would the best option here be to just follow along with the book using xna 2.0, and then try to rewrite/update the app in xna 4 or monogame? Or, would it be better to start my project as an XNA 4.0 project, and then code along with the book, fixing any discrepancies as I come across them?

sentences:
2d water animation is jagged and not smooth As a solution for this question I implemented the shader with a test program:

import com.badlogic.gdx.ApplicationAdapter
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.backends.lwjgl.LwjglApplication
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration
import com.badlogic.gdx.graphics.GL20
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.Sprite
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.ShaderProgram

class ShaderTestApp : ApplicationAdapter() {
  lateinit var batch: SpriteBatch
  lateinit var noiseTexture: Texture
  lateinit var sprite: Sprite
  lateinit var shaderProgram: ShaderProgram

  private val vertexShaderString = """
    attribute vec4 a_position;
    attribute vec4 a_color; //required by libgdx
    attribute vec2 a_texCoord0;

    uniform mat4 u_projTrans;

    varying vec4 v_color;
    varying vec2 v_texCoords;

    void main() {
      v_color = a_color;
      v_texCoords = a_texCoord0;
      gl_Position = u_projTrans * a_position;
    }
  """.trimIndent()

  private val fragmentShaderString = """
     #ifdef GL_ES
      precision mediump float;
  #endif

  varying vec4 v_color;
  varying vec2 v_texCoords;

  uniform sampler2D u_noise;
  uniform sampler2D u_texture;
  uniform mat4 u_projTrans;

  uniform float u_noise_scale;
  uniform vec2 u_noise_scroll_velocity;
  uniform float u_distortion;
  uniform float u_time;

  void main() {
          vec2 waveUV = v_texCoords * u_noise_scale;
          vec2 travel = u_noise_scroll_velocity * u_time;
          vec2 uv = v_texCoords;
          uv = uv + (u_distortion * (texture2D(u_noise, waveUV + travel).rgb - 0.5));
          waveUV += 0.2;
          uv = uv + (u_distortion * (texture2D(u_noise, waveUV - travel).rgb - 0.5));
          vec3 color = texture2D(u_texture, uv).rgb;
          gl_FragColor = vec4(color, 1.0);
  }
  """.trimIndent()

  override fun create() {
    batch = SpriteBatch()
    val img = Texture("background/water-surface-reflection-withBg.png")
    img.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat)
    noiseTexture = Texture("background/gradient.png")
    noiseTexture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat)
    sprite = Sprite(img)
    sprite.setSize(Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat())

    shaderProgram = ShaderProgram(vertexShaderString, fragmentShaderString)
    if (!shaderProgram.isCompiled) {
      println(shaderProgram.log)
    }
  }

  var time = 0f
  override fun render() {
    time += Gdx.graphics.deltaTime
    Gdx.gl.glClearColor(1f, 0f, 0f, 1f)
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)

    batch.begin()
    noiseTexture.bind()
    shaderProgram.setUniformf("u_noise_scale", 0.1f)
    shaderProgram.setUniform2fv("u_noise_scroll_velocity", floatArrayOf(.006f, .007f), 0, 2)
    shaderProgram.setUniformf("u_distortion", 0.04f)
    shaderProgram.setUniformf("u_time", time)
    batch.shader = shaderProgram
    batch.draw(sprite, sprite.x, sprite.y, sprite.width, sprite.height)
    batch.end()
  }
}

object ShaderTestLauncher {
  @JvmStatic
  fun main(arg: Array<String>) {
    val config = LwjglApplicationConfiguration()
    config.samples = 2
    config.width = 640
    config.height = 640
    LwjglApplication(ShaderTestApp(), config)
  }
}

Which looks like this:

sentences:
How to fix odd artifacts at the edges of textures in DirectX 11? In my DirectX 11 project, when I have textures they have odd artifacts at the edges. I've seen it before and searched online, but I can't find any DirectX examples that I can get to work.

You can see it on the skybox too. I'm assuming this is caused because the texture is too small and it's being expanded. I'm using the sampler state filter D3D11_FILTER_MIN_MAG_MIP_LINEAR. How can I fix this?

sentences:
SpriteRenderer color not responding to script! I have written a simple c# class that is supposed to change the color of the Player Renderer.
But, there seems to be a problem! whenever I call the function OnCallFun() ... the color stays put and does not change.
I have looked into the solution for quite some time now but no hope.
does anyone have a solution?
using UnityEngine;

public class ChangeColor : MonoBehaviour
{

    // Reference to Sprite Renderer component
    private Renderer rend;

    [SerializeField]
    private Color colorToTurnTo = Color.white;

    // Use this for initialization
    void Start()
    {

        rend = GetComponent<Renderer>();

        // Change sprite color to selected color
        rend.material.SetColor("_SpecColor", colorToTurnTo);
    }
}

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:
How common is automated testing in game development? Do gamers developers use to write unit and integration tests? How common is it among puzzle developers? And among developers of MMORPGs and FPSes?

(I have no background in game development neither am I cogitating about working with it - it is just a doubt that occurred to me. So, no need of trying to convince me to write them, even because I already like to write automated tests.)

sentences: Unity map size limit? Does Unity have a map size limit and if there is what is the limit? Is there a way to work around it? I am making a open world zombie survival world and I want to make a really big map. Thanks!

sentences:
Unity: Cannot access variable of C# script from another object I have already found similar questions on stackexchange.com related to accessing variables from another object. But my question seems to have a slightly different context and the answers from those questions are not working.

I have the following (stripped off) scene comprising the standard FPS character:

Scene001
  |
  |--FPSController
       |
       |--FirstPersonCharacter

My (stripped off) Assets hierarchy is as follows (folders are enclosed with <> brackets):

<Assets>
  |
  |--<Scripts>
  |     |
  |     |--Actions.cs
  |
  |--<Standard Assets>
        |
        |--<Characters>
              |
              |--<FirstPersonCharacter>
                   |
                   |--<Scripts>
                         |
                         |--FirstPersonController.cs

Now FirstPersonController.cs is attached to FPSController by default and Actions.cs is attached by me to FirstPersonCharacter.

Excerpt from FirstPersonController.cs is as follows:

...
namespace UnityStandardAssets.Characters.FirstPerson
{
     ...
     public class FirstPersonController : MonoBehaviour
     {
          ...
          private void GetCharacter()
          {
               GameObject _obj = GameObject.Find("FirstPersonCharacter");// ok here
               bool is_acted = _obj.GetComponent<Actions>().is_acted; // error here, please see below
          }
          ...
     }
}

Excerpt from Actions.cs is as follows:

public class Actions: MonoBehaviour {
    ...
    public static bool is_acted;
    ...
}

All I want is to access bool is_acted variable of Actions.cs from FirstPersonController.cs.

Error is as follows:

Assets/Standard Assets/Characters/FirstPersonCharacter/Scripts/
FirstPersonController.cs(63,38):error CS0246: The type or namespace
name `Actions' could not be found. Are you missing an assembly reference?

To me this seems to be a problem of namespace or folder location!!?

Any help is highly appreciated. Thanks in advance.

Updated above

Changed Action to Actions.
Corrected typo ().

Sample project:

https://ufile.io/knmxj

sentences:
Get a Vector2 Based on Object Rotation in Unity I feel like there is an obvious answer to this but I can't find it. Is there a function in unity that gives you a Vector2 (or 3) based on the rotation of an object.
for example:
z rotation = 0 ---> (0,-1)
z rotation = 90 --> (1,0)
z rotation = 180 -> (0,1)
z rotation = 270 -> (-1,0)
I could just write this in my script the long way, but I feel like there might be a function for it in unity

sentences:
Image 1 becomes image 2 with sliding effect from left to right? I would like to show a second image appearing while a "door" is closing on my character. I've got my character in the middle of the screen and a door coming from the left. When the door passes my character, I would like to have this second image appearing little by little.

So far, I've gotten by with fadingOut the character and then fadingIn my second image of the character at the same position when the door is completely closed, but I would like to have both of them at the same time. (the effect that image 1 becomes image 2 when the door is sliding from left to right). Would you know how to do this with Cocos2d?

Here are the images :

at first, the character is blue, and the door is coming from the left :

Then, behind the black door, the character becomes red, but only behind this door, so it stays blue when the door is not on him, and will become completely red when the door passes the character :

EDIT : with this code, the black door hides the red and blue rectangles : (And if i add each of my layers at a different depth, and only use GL_LESS, same thing)

blue.position =  ccp( size.width*0.5 , size.height/2 );
        red.position =  ccp( size.width*0.46 , size.height/2 );
        black.position =  ccp( size.width*0.1 , size.height/2 );

        glEnable(GL_DEPTH_TEST);

        [batch addChild:red z:0];
        [batch addChild:black z:2];

        glDepthFunc(GL_GREATER);

        [batch addChild:blue z:1];

        glDepthFunc(GL_LESS);

        id action1 = [CCMoveTo actionWithDuration:3 position:ccp(size.width,size.height/2)];
        [black runAction: [CCSequence actions:action1, nil]];

sentences:
Why is the IntelliSense not working when I open a new script in Visual Studio? The strange thing is that opened scripts or newly opened ones are working fine. It's the new created C# scripts that are not working.

With not working, I mean the MonoBehaviour is not in light blue color it's in black color.
In this screenshot I took, I marked it with a red circle.

What have I tried so far? I have closed Visual Studio and started over again.
Since it didn't solve it, I closed the unity editor and started it over again, to no avail.

I pressed 'clean solution', I pressed 'rebuild solution', I pressed 'build solution'.

What else can I do ? And why are the other scripts working fine? If I type gameo...it will auto complete it to GameObject but in this specific script it's just not working.

This is a screenshot of the editor. I have in the Hierarchy a Ladder object.
In the Assets I created a folder name Ladder and a script name Ladder. But this Ladder script is not working.

This is the Ladder script and this script was working before but once I created another script inside the ladder folder name Raise empty script the Raise script didn't work and now the Ladder is not working either. But other scripts are working fine.

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

public class Ladder : MonoBehaviour
{
    public Transform charcontroller;

    private bool inside = false;
    private float heightFactor = 3.2f;

    private void OnTriggerEnter(Collider other)
    {
            inside = true;
    }

    private void OnTriggerExit(Collider other)
    {
            inside = false;
    }

    private void Update()
    {
        if (inside == true && Input.GetKey("w"))
            charcontroller.transform.position += Vector3.up / heightFactor;
    }
}

sentences:
How can I fix this error about loading .wav assets in MonoGame 3.2? I'm trying to add a music file to my project, but I get the error "Could not load EpicScores.wav asset!"

I load the music file like this:

Song sound1 = Content.Load<Song>(@"EpicScoreCreatorOfWorlds.wav");

I've tried both with and without the .wav ending.

My file is added to the Content folder, and I've made sure my file properties are set to the "Content" build action and to "copy always."

Why do I get this error and how can I fix it?

sentences:
How can I get the texture file name for my polygon? I have a problem with the FBX SDK. I read in the data for the vertex position and the UV coordinates. It works fine, but now I want to read for each polygon to which texture it belongs, so that I can have models with multiple textures. Can anyone tell me how I can get the texture file name for my polygon? My code to read in vertex position and uv coordinates is the following:

int i, j, lPolygonCount = pMesh->GetPolygonCount();
FbxVector4* lControlPoints = pMesh->GetControlPoints();

int vertexId = 0;
for (i = 0; i < lPolygonCount; i++)
{

    int lPolygonSize = pMesh->GetPolygonSize(i);

    for (j = 0; j < lPolygonSize; j++)
    {
        int lControlPointIndex = pMesh->GetPolygonVertex(i, j);
        FbxVector4 pos = lControlPoints[lControlPointIndex];
        current_model[vertex_index].x = pos.mData[0] - pivot_offset[0];
        current_model[vertex_index].y = pos.mData[1] - pivot_offset[1];
        current_model[vertex_index].z = pos.mData[2]- pivot_offset[2];

        FbxVector4 vertex_normal;
        pMesh->GetPolygonVertexNormal(i,j, vertex_normal);

        current_model[vertex_index].nx = vertex_normal.mData[0];
        current_model[vertex_index].ny = vertex_normal.mData[1];
        current_model[vertex_index].nz = vertex_normal.mData[2];

        //read in UV data
        FbxStringList lUVSetNameList;
        pMesh->GetUVSetNames(lUVSetNameList);

        //get lUVSetIndex-th uv set
        const char* lUVSetName = lUVSetNameList.GetStringAt(0);
        const FbxGeometryElementUV* lUVElement = pMesh->GetElementUV(lUVSetName);

        if(!lUVElement)
            continue;

            // only support mapping mode eByPolygonVertex and eByControlPoint
        if( lUVElement->GetMappingMode() != FbxGeometryElement::eByPolygonVertex &&
            lUVElement->GetMappingMode() != FbxGeometryElement::eByControlPoint )
            return;

        //index array, where holds the index referenced to the uv data
        const bool lUseIndex
            = lUVElement->GetReferenceMode() != FbxGeometryElement::eDirect;
        const int lIndexCount= (lUseIndex) ? lUVElement->GetIndexArray().GetCount() : 0;

        FbxVector2 lUVValue;

        //get the index of the current vertex in control points array
        int lPolyVertIndex = pMesh->GetPolygonVertex(i,j);

        //the UV index depends on the reference mode
        int lUVIndex = pMesh->GetTextureUVIndex(i, j);
        lUVValue = lUVElement->GetDirectArray().GetAt(lUVIndex);
        current_model[vertex_index].tu = (float)lUVValue.mData[0];
        current_model[vertex_index].tv = (float)lUVValue.mData[1];

        vertex_index ++;
        }

    }

    float v1[3], v2[3], v3[3];
    v1[0] = current_model[vertex_index - 3].x;
    v1[1] = current_model[vertex_index - 3].y;
    v1[2] = current_model[vertex_index - 3].z;

    v2[0] = current_model[vertex_index - 2].x;
    v2[1] = current_model[vertex_index - 2].y;
    v2[2] = current_model[vertex_index - 2].z;

    v3[0] = current_model[vertex_index - 1].x;
    v3[1] = current_model[vertex_index - 1].y;
    v3[2] = current_model[vertex_index - 1].z;

    collision_model->addTriangle(v1,v2,v3);

sentences:
How can I create an orthographic display that handles different screen dimensions? I'm trying to create an iPad/iPhone game using GLES2.0 that contains a 3D scene with a heads-up-display/GUI overlaid on the top. However, this problem would also apply if I were to port my game to a computer and run the game in a resizable window, or allow the user to change screen resolutions...

When trying to make the 2D GUI/HUD work I've made the assumption that all I'm really doing is drawing a load of 2D textured 'quads' on the screen and am trying to treat the orthographic projection as an old-style 2D display with 0,0 in the upper left and screenWidth,ScreenHeight in the lower right.

This causes me all sorts of confusion when I rotate my ipad into Landscape mode since I can't work out what to put into my projection and modelview matrices to turn everything around the right way. It also gets messy if I want to support the iPad's large screen, an iPhone or a Retina display since I have to then draw three sets of textures for everything and work out which ones to use.

Should I be trying to map the 2D OpenGL co-ords 1:1 with the screen? While typing out this question it occurs to me that I could keep my origin in the centre, still running -1/+1 along the axes. This would let me scale my 2D content appropriately on the different screen sizes, but wouldn't I end up with the textures being scaled and possibly losing quality?

I'm using OpenGLES 2.0 and have a matrix library that has equivalents to the GLES1.1 glOrthof() and glFrustrum() calls.

sentences:
Vertex normals in the geometry shader using directx I'm in directx 11 with the geometry shader.

Is is possible to calculate vertex normals? Just one like segment per vertex? In the geometry shader?

I did vertex normals per face, this is what I got,

My exercise in the book wants something like

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:
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:
Is there a typical career path to learn game development "on the job"? The extended version of the question is: what is the typical career paths that a developer without specific experience in game development should take if he/she wishes to work in the game development industry? In other words, what are the positions such a programmer might aspire to get hired for, in the game industry?

I am asking because it seems to me that - even without direct experience with 3D modelling, physics engines, shaders, etc... - for as much complex as these topics might be - they are still "just" top layers one can learn "on the job" if he/she has already good programming skills and experience in software design (for example during peer-programming sessions).

I have no knowledge whatsoever of the game industry, so maybe I am being naïve here, but for all the other programming jobs I previously took, I learned most of the specificics while working on concrete projects... so I wonder if there is a chance to do the same with game development.

Thanks for your time and advice! :)

PS: I don't know if this is important or not for answering the question, but scripting languages are the languages I am more proficient in.

sentences:
Cannot add key in matinee for static meshes (UE4) My problem is the following:
I was trying to make a sliding door based on a video tutorial, I had the static mesh, which was the door itself, and I added a Matinee for that door, so I went 'Add New Empty Group -> Add Movement Track', so I had the door with a movement track, but when I tried to add a key, I couldn't.
This was the error message: "Nothing to keyframe, or selected object can't be keyframed on this type of track."
And I only get this message when I try to add keys in the movement track of a static mesh. When it's a camera, everything is fine.
Any idea why this is happening, and how I can solve this?
Thanks for your help

sentences: Unity using Animation and Ragdoll The question is simple, but I can't resolve it for a couple of days. I have an enemy model with ragdoll attached and also a couple of animations(e.g. idle, walk, run). It seems that ragdoll work only when animator is stopped and vice versa. What I want is when the animation is playing all the forces are applied too, e.g. when I shoot enemy he still walking by animation and and ragdoll corresponds with AddForce(). I tried to find appropriate tutorial for that, watched ton of youtube videos and read a lot of unity forums, but no success. Any help is appreciated. Thanks in advance.

sentences:
Xbox 360 Network Communications So I read in another thread that:

  ...the Xbox is a closed system. Forget any direct TCP/IP interaction, you can only communicate with other consoles present in the Xbox Live! network, and you can't do raw HTTP connections.

This makes me curious as to how an app like Last.fm for Xbox LIVE works.  I would think it would require network communications with Last.fm servers, for user identification and for receiving audio streams.

Any ideas?  Thanks in advance.

sentences:
MMO architecture - Highly Scalable with Reporting capabilities A friend of mine is asking me to help out on a project of his, I have done a small amount of game development before, but mainly do application and enterprise development these days.

He is asking me to look into some of the networking part of his game. I know that a huge part of this is going to involve reporting/analytics as well as scalability, so it isnt as simple as spamming a server and instantly getting responses.

In the enterprise app/web world we tend to use CQRS pattern or some other similar approach when we need to scale quite well and also take into account reporting on interactions etc.

So I imagine that most typical MMO style games (lets assume mmorpg games akin to WoW), they must employ a heavily distributed and scaleable system. So do they end up using a node system with a messaging fabric behind the scenes?

Sorry for being a bit vague but are there any sort of articles on people discussing the overall architecture for these style games?

sentences:
Drawing chunks, and positioning the camera I've seen many questions and answers regarding how to draw tiled maps but I can't really get my head around it. Many answers suggest either loading the visible part of the map, or loading and unloading chunks of the map. I've decided the best option would be to load chunks, but I'm slightly confused as to how this would be implemented.

Currently I'm loading the full map to a 2D array of buffered images, then drawing it every time repaint is called. Q1: If I were to load chunks of the map, would I load the map as a whole then draw the necessary chunk(s), or load & unload the chunks as the player moves along, and if so, how?

My second question regards the camera. I want the player to be in the centre of the X axis and the camera to follow it. I've thought of drawing everything in relation to the map and calculating the position of the camera in relation to the players coordinates on the map. So, to calculate the camera's X position I understand that I should use cameraX = playerX - (canvasWidth/2), but how should I calculate the Y position? I want the camera to only move up when the player reaches cameraHeight/2 but to move down when the player reaches 3/4(cameraHeight). Q2: Should I check for this in the same way I check for collision, and move the camera relative to the movement of the player until the player stops moving, or am I thinking about it in the wrong way?

sentences:
Is Unity 2017 random number generator deterministic across platforms given the same initial seed? Is unity engines random number generator deterministic across platforms given the same initial seed or should I implement my own?

I know there have been some modifications to the random number generator recently.

Answers are appreciated, I don't have the devices on hand to perform any tests and I haven't yet found a direct statement on the matter.

sentences:
Is my technique for client-side character movement in an MMORPG reasonable? I started an MMORPG game, and I can already make a character move around the map and see other characters. But I have doubts about my architecture.

I have a loop which, every x milliseconds, request from the database the actual position of all characters around the main character. After that, I remove all the objects from the screen and redraw them based on the data retrived from database. Is this reasonable, or is there a better solution?

sentences:
How to play and pause animation I want to make play and pause buttons to play and pause sound and also I want it to play and pause animation ,how should I do that?

//function
 public void TogglePlay()
    {
        if (audio.isPlaying)
        {
            audio.Pause();
        }
        else
        {
            audio.Play();
        }
    }

sentences:
In a Sonic-esque platformer, how to tell if the chracter is upside-down or not? In a Sonic-esque platform game, how do you know if the player's character is currently upside down?
Let's say the character is running to  the left:

At a certain point the character will begin to supposedly run on the ceiling. How do I keep track of this since the chracter is touching both the ceiling and the floor of the tunnel?know

I need some way to know where the character's feet are positioned, keep track of it and allow this to change when the character is moving fast across curved surfaces.

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:
Can you remove Steamworks DRM from your own game after release? Is it possible to remove Steamworks DRM from a Steam game after release? I'm sure that some developers have accidentally used DRM, without fully understanding the drawbacks for a consumer (the Steam client has to be running during gameplay, forced online checks etc.). Using DRM is optional, you can release your game on Steam without copy protection of any kind.
I haven't released a game on Steam, I'm asking for someone who has to answer.

sentences:
OUYA and Unity set up problems I'm having trouble with the Unity / OUYA plugin.

I'm using Unity 4 with the latest update on a Windows 7 machine.

When I open the starter kit and try to compile the plugin I get the following error:

  Picked up _JAVA_OPTIONS: -Xmx512M

And if I try to Build and Run I get this error:

  Error building Player: ArgumentException: Illegal characters in path.

I'm stumped, I've gone through lots of forum posts here and on stackoverflow and I can't seem to resolve it.

My environment variables look like this:

PATH - C:\Users\dave\Documents\adt-bundle-windows-x86_64-20130219\sdk\tools;
       C:\Users\dave\Documents\adt-bundle-windows-x86_64-20130219\sdk\platform-tools\

JAVA_HOME - C:\Program Files (x86)\Java\jdk1.6.0_45\

Everything in the OUYA Panel is white

Any ideas?

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:
What score/level function is often used? In many games you raise a level when you reach a certain score, and later levels are harder to reach than in the beginning.

I am suspecting that it is some sort of exponential function that is used in e.g. WoW.

Does anyone know of a good exponential function for this purpose?

sentences:
XNA/MonoGame and Game Studio/MonoDevelop First off, I have a bit of programming experience in Java and have always programmed using ViM (even though I recently moved to Sublime Text 2) and I'm trying to learn C# and the MonoGame framework. My question is whether or not I REALLY need MonoDevelop.

So, do I really need Visual Studio/MonoDevelop to develop games in C# and MonoGame?

sentences:
Skeletal animation 3d models I'm building a skeletal animation system. My goal is to make it as efficient as I can.

Is there a place where I can download some 3d models (preferably from real games) So I could see if my system animates them efficiently?

The current model I'm testing on has 12500 faces overall and 57 bones. My FPS drops from 60 when there are 10~ animated instances of it running. I don't know if it's okay or bad.

Any other help and tips for benchmarking my system will be highly appreciated.

sentences:
Android Opengl: Alternate values for gl_FragColor I'm writing an Android application that utilizes opengl to perform some changes to the camera output.  I've written my code in such a way that I finally figured out what is causing the performance issue.

#extension GL_OES_EGL_image_external : require
precision mediump float;
uniform samplerExternalOES sTexture;
uniform vec4 vColor;
const int MAX_COLORS = 6;
uniform float vHues[MAX_COLORS];
uniform float vOffsets[MAX_COLORS];
varying vec2 v_CamTexCoordinate;

float rgb2hue(vec4 c) {
    vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
    vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
    vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));

    float d = q.x - min(q.w, q.y);
    float e = 1.0e-10;
    return abs(q.z + (q.w - q.y) / (6.0 * d + e));
}

bool isInRange(float a1,float a2, float vOffset) {
    if(a2 < 0.0) {
        return false;
    } else if(abs(a1-a2) < vOffset) {
        return true;
    } else if( a1 > a2) {
        return (1.0 - a1 + a2) < vOffset;
    } else {
        return (1.0 + a1 - a2) < vOffset;
    }
}

vec4 getGrey(vec4 c) {
    float grey = (c.r + c.g + c.b) / 3.0;
    return vec4(grey, grey, grey, c.a);
}

void main() {
    vec4 c = texture2D(sTexture, v_CamTexCoordinate);
    bool hasColor = vHues[0] >= 0.0;
    float hue = rgb2hue(c);
    vec4 test = getGrey(c);
    for(int i=0; i < MAX_COLORS; i++) {
       if(isInRange(hue, vHues[i], vOffsets[i])) {
          //If I uncomment this line the performance gets terrible
          //test = c;
       }
    }
    gl_FragColor = test;
}

There is a significant hit to performance (a lot of frames are skipped) when I uncomment the line above.  I basically want to use the original color sometimes and a different color depending on some condition.  It works but is there a more efficient way to do this?  Also, why does this perform so poorly?

sentences:
"Binding" script functions to C++ functions I appreciate the answer to this question might be a little too broad for SE, but hopefully someone can point me in the right direction.

I'm developing a small scripting language for use in my game engine, and naturally in order to do really useful things with it, it needs to hook into actual C++ functions in my game.

For example, say I have an Inventory class, with a public function, checkItem(itemID) that is designed to check whether a certain item is in the current inventory or not.

I'd love to be able to define a scripting function that calls the built-in checkItem function for its value during some script's lifetime. Is there a standard / simple-to-implement procedure for doing this? Something that has a similar effect to LuaBind, for example?

I can of course add instructions to my scripting VM that call the functions internally, but this will make the VM a bit of a mess and require implementing separate operations for each function I wish to call.

sentences:
How to synchronize the speed of spawned object and spawning time interval? I want a stream of enemies coming from the top of the screen one behind other in a line, with their speed (speed of the whole stream i.e. every enemy) increased over time.

When I simply increased their speed, a continuous stream of balls (which will be my enemies) is lost since objects are spawned at a fixed time interval irrespective of the varying speeds of the spawned balls.

To maintain the continuous flow of balls what I wanted is to generate balls rapidly as the speed increases. So there should be a direct relationship between spawning interval and speed of the stream.

How can I do that?

sentences:
dual contouring concept and term translations I am working on a 3D sandbox mmo with destructible terrain, using Java and LWJGL. I looked at most options to achieve this and found that dual contouring would probably be the best option for me. I've read about every paper i could find on the internet about how to implement such a thing and, since i have a very basic experience in game/3d/complex programming, I've had quite a hard time. but I think I've found the solution i was looking for and would like to check with some more experienced programmer if my solution seems right and if I really successfully wrapped my mind around some of those pesky terms that were haunting my nights for the last few months;

Edit: I will try and add some more precise detail as to what i already do here in bold

so, first of all, I've created an object called voxel when I say object, i refer the the user side's way of handling the data received from the server. I already compress the data as to have it fit a byte or a short and use bitwise operations. Voxels are loaded once from the server then stored to memory unless the server returns a change to that voxel (not sending entire chunks for a small change), a voxel knows it's type and it's "integrity" (in this case, how much that stone voxel has been mined for example. I think it refers the the volume i often read about?). Those voxels "will" be created from a pre generated world map for a persistent world. Yes, the world will have overhangs and most of all, tunnels players can mine.

then i got a chunk, composed of at most 32x32x32 voxels. A chunk knows it's world position and has a 3D array of voxels passed from the server when first loaded to memory, then the client/server only updates the voxels that have changed since the last update. A chunk also knows it's neighbors (if such neighbors have been loaded into memory, or creates a default chunk of 32x32x32 air voxels)

To find the surface, inside a chunk, i check every voxel from the bottom,left,near (I think it is the right order to fit with the way OpenGL read it's coordinates?) to the top,right,far. each time, i take the current voxels and all it's 7 neighbors in a cube shape and check whether their is a type change from solid to air in any of them, indicating a surface running through that cube. If there's a type change, i compare every edges to see if there's a type change and if so, place the entersection of that edge using and average of both corners integrity. doing so for all 12 edges allows me to average all the planes to a single point inside that cube and create a vertex and store it in an array.

The point where I'm confused is this: what should i do next? I think I should check along one edge that displays a type change to find the 3 other cubes that has the same edge and find their vertices. Since i know what direction the ground is (comparing the type change along the edge axis) I can deduce the front and back of the quad. taking 3 of those 4 vertices should allow me to get a normal from their dot product and from there, go around that normal CCW and send those vertices to the GPU for the rendering phase. I guess the real question here is: How do I get the right order of vertices to form triangles that OpenGL can draw correctly from that large collection of vertices generated while finding the surface?

In theory, in my mind, it makes sense! but I find it so much simpler than all those papers I've found, that i fear I've missed the boat completely! I get lost when it comes to Isosurface (I guess here, the formula they're talking about would be the average of integrity along any type change?) and hermite data (here, should i read voxel collection instead?) and most maths are slightly beyond my understanding yet (working on it tho and I progressed quite a bit) please, can you help me out here and guide me a bit?

sentences:
Dynamically change shader syntax with the help of C++ I'm starting with the programmable pipeline and the shaders in C++ for OpenGL 3.0+, i would love to be able to change some settings on the fly, for example replacing a function with another function, supposing that i have a shader with an operation like

var = A + B

my goal is replacing + with any other operation on the fly with my C++ program, maybe with a GUI, but in general terms with C++, the problem is that until now i'm able to run a shader only after compiling it, so i have something like a static approach.

The same goal applies to the values of the vars that i would also like to change through C++.

It's possible with a programmable pipeline? I'm not interested in performance, just if is possible for the C++ to dynamically communicate and exchange data with the OpenGL pipeline.

sentences:
Why do my sprites jitter when moving diagonally? I am working on an low resolution, isometric, pixel game in which several objects move from tile to tile. I do this with this simple interpolation:

let percent = elapsedTime / SPEED

vec.x = start.x + ( (dest.x - start.x) * percent )
vec.y = start.y + ( (dest.y - start.y) * percent )

This seems to work fine except when moving diagonally. It starts to jiggle pretty heavy. Is there a way to smooth this out?

I am using a 32x16 tile size.

edit: added video for better understanding: (video deleted)

edit: for anyone interested. I've solved it using this:

let
percent = elapsedTime / SPEED,
num = Math.round( (dest.x - start.x) * percent )

vec.x = start.x + num
vec.y = start.y + Math.floor(num / 2)

This works only for diagonal movement with 1:2 ratio tiles. I also added some stuff to make it work for all 4 diagonal directions.

sentences:
2D Collision in Canvas - Balls Overlapping When Velocity is High I am doing a simple experiment in canvas using Javascript in which some balls will be thrown on the screen with some initial velocity and then they will bounce on colliding with each other or with the walls.

I managed to do the collision with walls perfectly but now the problem is with the collision with other balls. I am using the following code for it:

//Check collision between two bodies
function collides(b1, b2) {
    //Find the distance between their mid-points
    var dx = b1.x - b2.x,
        dy = b1.y - b2.y,
        dist = Math.round(Math.sqrt(dx*dx + dy*dy));

    //Check if it is a collision
    if(dist <= (b1.r + b2.r)) {
        //Calculate the angles
        var angle = Math.atan2(dy, dx),
            sin = Math.sin(angle),
            cos = Math.cos(angle);

        //Calculate the old velocity components
        var v1x = b1.vx * cos,
            v2x = b2.vx * cos,
            v1y = b1.vy * sin,
            v2y = b2.vy * sin;

        //Calculate the new velocity components
        var vel1x = ((b1.m - b2.m) / (b1.m + b2.m)) * v1x + (2 * b2.m / (b1.m + b2.m)) * v2x,
            vel2x = (2 * b1.m / (b1.m + b2.m)) * v1x + ((b2.m - b1.m) / (b2.m + b1.m)) * v2x,
            vel1y = v1y,
            vel2y = v2y;

        //Set the new velocities
        b1.vx = vel1x;
        b2.vx = vel2x;
        b1.vy = vel1y;
        b2.vy = vel2y;
    }
}

You can see the experiment here. The problem is, some balls overlap each other and stick together while some of them rebound perfectly. I don't know what is causing this issue. Here's my balls object if that matters:

function Ball() {
    //Random Positions
    this.x = 50 + Math.random() * W;
    this.y = 50 + Math.random() * H;

    //Random radii
    this.r = 15 + Math.random() * 30;
    this.m = this.r;

    //Random velocity components
    this.vx = 1 + Math.random() * 4;
    this.vy = 1 + Math.random() * 4;

    //Random shade of grey color
    this.c = Math.round(Math.random() * 200);

    this.draw = function() {
        ctx.beginPath();
        ctx.fillStyle = "rgb(" + this.c + ", " + this.c + ", " + this.c + ")";
        ctx.arc(this.x, this.y, this.r, 0, Math.PI*2, false);
        ctx.fill();
        ctx.closePath();
    }
}

sentences:
Isometric coords to cartesian coords I'm new to the tilemap feature of Unity, and I'm having a hard time with all those coords.

I created a new project, added an isometric tilemap and left all values to their default. In the Unity Editor (and in-game at runtime as well), the coordinates of the cells are like this:

This is pretty disturbing to me and it will be to most players (not programmers) too I guess.

I would like something like this:

However, I can't figure out how to do the transformation.

I tried this:

Vector3 currentWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3Int currentCellPos = _grid.WorldToCell(currentWorldPos); // This gives the coordinates as in the Unity Editor except for z
currentCellPos.z = 0; // Set z to 0 so the coordinates of the cell are exactly as in the Unity Editor
Vector3 cartesianCellPos = new Vector3((2 * currentCellPos.y + currentCellPos.x) / 2, (2 * currentCellPos.y - currentCellPos.x) / 2, 0); // Try to transform the Unity coordinates into cartesian coordinates: WRONG RESULT

But this calculation gives weird results, not what I expect at all.

Do you know how I could transform the Unity coordinates shown in the first screenshot into the coordinates shown in the second screenshot?

sentences:
Building different game objects (EG Spells, Items,) for an rpg game I believe the best way to manage item data would be to use xml?

For spells would the best option be to create a class (EG Fireball) and define all of the parameters inside of that class? Like Initilize Update and Draw? Then have a class called ParticleEngine and define Inside of fireball the type of particles to use?

Something like ParticleEngine Effects = new ParticleEngine(texture1,texture2,texture3,amountofparticles,offset,delay,life)

Or is there a better way to handle all of this?

What are some different stuctures and or what is the most efficient way of handling all of that data?

sentences:
How to get characters to be aware that their path is obstructed? I'm using Unity with Arongranberg's A* pathfinding project to move my characters. However, it appears that my characters are contending for a position on the terrain when they are told to move together to a same position.

For example, I have 5 characters being told to move to PositionA. They will move together based on their waypoints to PositionA. One of the characters, call it CharacterA, will reach PositionA before the rest. Now, the other 4 characters who arrived later will continue to keep walking and "sliding" around CharacterA. They seem to stop only when CharacterA moves away from PositionA so that they could reach their destination to break out of the loop. Even so, only one character can be in PositionA while the rest will continue to contend for the place.

So, how can I get the characters and objects to know that they have reached their destination and should stop beside the other characters instead of contending for the same place?

A naive method could be I get the characters to detect if they are blocked by something straight ahead of them. If they are, break out of the loop and stop the walking state. But at times when the character hasn't reached his destination yet and is blocked by an object, say another character, breaking out of the waypoint loop will stop him at the wrong destination. I can't recalculate for a new path from his current position either since the blocking object is another character, which the initial pathfinding grid scanning did not take into account. One way is I re-scan the whole terrain for a new grid of nodes with the characters in the scene taken into account. But this wouldn't be efficient and will lag a whole ton.

sentences:
how to move character move on a circular surface in only one direction? Making a 2d game:

I want to move character on circular surface only in one direction?

Script attached to child object is:

    public GameObject ball;
    float speed=2f;

    // Start is called before the first frame update
    void Start()
    {
        GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {
        Left();
    }

    void Left()
    {
        if(Input.GetKey(KeyCode.LeftArrow))
        {
            ball.GetComponent<Rigidbody2D>().AddForce(Vector3.forward * speed);
            //transform.Rotate(Vector2.left);
        }
    }

Note:
character will move on a circular surface in only one direction...

Image reference:

sentences:
Why released games usually contain their scripts sources? AFAIK people like scripting because it's easier, and it makes development cycle faster. But what about when games are shipped. No one expects shipped binaries to be changed, unless there is an update or a DLC. So why developers don't compile their script files before shipping?

Potential benefits:

Faster run time
Obfuscating binary a little mode

and I can't think of any possible draw backs.

Examples:

Civilization 5 had lots of lua scripts inside their assets folder.
Angry birds also had a lot those scripts along side binary.
Age of Mythology had lots of xs scripts for their AI.
Civilization 4 had lots of python scripts.

I'm pretty sure the list could have gotten a lot longer if I had more games installed on my device.

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:
Collision detection against specific sprite shape using XNA with Farseer Physics? I am making a 2D XNA Game, using Farseer Physics for collisions.

I need collisions to be resolved against the actual shape of the sprite image, ignoring transparent pixels, rather than against the edge of the bounding rectangle.

sentences:
Encode world matrix as 2 float4s? On one of the slides of their presentation "Batch, Batch, Batch!" guys from NVidia suggest encoding animation matrices for pallet skinning into two float4s as:

• axis/angle
• translate/uniform scale

I wonder how can that be done (including decoding) and why do they say that this leads to:

Video memory overhead: model replication

sentences:
How to render a large tile-based 2D world efficiently (using JavaFX/ScalaFX or more generally) I have a file tileset.png containing a dozen 32*32 tiles. When my game starts, it generates the world randomly with the available tiles and the size of the world can be changed, so I cannot have a hard-coded world texture.

So I have an \$n \times m\$ matrix, each of its element being a Tile. For the moment a so-called Tile is an ImageView(in JavaFX), which basically is a portion of my tileset (note that I only load the tileset image once and then generate all my tiles using it).

Now the very basic method that I'm using is, I store a boolean for each tile saying whether it is currently displayed on the screen. I also keep track of the total scale, that is the total amount of pixels that have been dragged yet. From this, for each tile that is to be displayed on the screen, I compute its \$(x,y)\$ position given the total offset and I add it to the scenne. Also for each tile that was displayed at the previous "iteration" but is not anymore, I remove it from the scene.

It is however quite laggy, especially when a lot of tiles need to be displayed at the same time or when dragging the map a lot.

I am sure I can drastically improve the performances but I cannot find how. I guess that having a different object for each tile isn't very efficient, yet as said before, I cannot have the entire map as a single image as it is randomly generated. So.. I still need each tile to be an object somehow?

I also saw a few things about using meshes or UV-mapping but I didn't really understand how to make it work here. Also, it was help for Unity. If anyone knows how to implement this in JavaFX/ScalaFX I would be glad to know, but otherwise I think I could adapt a general method in this specific library.

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:
Simplst possible TBN-Matrix giving weird results I'm implementing normal mapping and was trying different techniques of doing that. All seemed not to give me a correct result (e.g. the normals point in weird directions). To find the problem, I broke everything down to the simplest possible solution, but I cant find the problem.

Here is a picture of my scene outputting only the world-space normals:

And here is the scene outputting the transformed normals with the normal map:

As you can see, the normals are not pointed the way they should be (green should be to the right, for example).
Here is the way I caluclate the TBN-Matrix (I know, its not the correct way of doing that, but I tried the "correct" ways too).

vec3 tangent = cross(worldspaceNormal, vec3(0,0,1));
vec3 biTangent = cross(tangent, worldspaceNormal);
mat3 tbn = mat3(tangent, biTangent, worldspaceNormal);

vec3 map = texture(normal, texCoord).rgb;
map = 2 * map - vec3(1);

outNormal = vec4(tbn * map, 0.0);

The worldspaceNormal is just the normal of the surface multiplied by the model-matrix, with w-component 0.0, of course.

sentences:
Position vs Destination Rectangle I'm new to programming, and I finally delved into XNA/MonoGame for wanting to practice coding game logic.

I'd like to know what the difference is between a Position (Vector2) and a Destination Rectangle (Rectangle), when it comes to positioning a sprite.

sentences:
Shoot projectile same direction weapon faces I want to be able to shoot a projectile from a weapon mounted on a vehicle. Right now I am able to do it but only in front of the vehicle. I managed to rotate the weapon to the direction the mouse is facing, but the projectile still goes straight.

I believe that the issue is that the velocity of the projectile is the problem here. Right now I have it like this:

if (playerShooting || NPCShooting)
{
    if ((timer >= cooldown) && hasEnergyAvailable())
    {
        timer = 0;
        GameObject intantiatedProjectileContainer = Instantiate(projectileContainer, transform.position, transform.rotation) as GameObject;
        Rigidbody instantiatedProjectile = intantiatedProjectileContainer.GetComponentInChildren<Rigidbody>();

        if (playerController)
        {
            instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0, 0, speed + transform.root.GetComponent<PlayerController>().getZSpeed()));
        }
    }
}

Where speed is the projectile speed and it's added to the vehicle speed.

I thought that this should shoot forward but with the parent rotation, can someone tell me what I'm missing here?
Thanks!

sentences:
How can I render a font in C with OpenGL? What I tried:
I was testing some things in order to render text with stb_truetype.h and OpenGL in C.
I took as a reference the example that appears here.
Basically, this example, loads a .ttf file and returns the raw information in bytes, that can be used to generate a texture in OpenGL.
I adapted the example, mentioned before, into modern OpenGL, because, the example uses OpenGL deprecated functions, like glVertex2f. The only thing I get to output on screen was this kind of noise of strange colors:

The code I use:
texture_t fnt_texture;
GLuint fnt_shader;

unsigned char ttf_buffer[1 << 20];
unsigned char temp_bitmap[512 * 512];

stbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs

#define FONT_VS\
    "#version 330 core\n"\
    "layout(location = 0) in vec3 m_Position;"\
    "layout(location = 1) in vec2 m_TexCoords;"\
    "out vec2 TexCoords;\n"\
    "void main() {\n"\
    "TexCoords = m_TexCoords;\n"\
    "gl_Position = vec4(m_Position, 1.0);\n"\
    "}\n"\

#define FONT_FS\
    "#version 330 core\n"\
    "in vec2 TexCoords;\n"\
    "uniform sampler2D Texture;\n"\
    "void main() {\n"\
    "gl_FragColor = texture(Texture, TexCoords);\n"\
    "}\n"\

void font_init(void)
{
    fread(ttf_buffer, 1, 1<<20, fopen("c:/windows/fonts/times.ttf", "rb"));
    stbtt_BakeFontBitmap(ttf_buffer, 0, 32.0, temp_bitmap, 512, 512, 32, 96, cdata); // no guarantee this fits!

    glGenTextures(1, &fnt_texture[3]); // My texture type, is an array that saves the texture on the 3rd position.
    glBindTexture(GL_TEXTURE_2D, fnt_texture[3]);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, temp_bitmap);
    glGenerateMipmap(GL_TEXTURE_2D);

    // can free temp_bitmap at this point
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    glBindTexture(GL_TEXTURE_2D, 0);

    fnt_shader = shader_init(FONT_VS, FONT_FS);
}

void font_render(model_t model)
{
    shader_bind(fnt_shader);
    texture_bind(fnt_texture, 0);

    model_begin(model);
    model_draw(model, GL_TRIANGLES); // The model (vao, vbo, ibo) is rendering the whole buffer, not individual glyphs
    model_end();

    texture_unbind();
    shader_unbind();
}

Can someone tell me what I'm doing wrong, and, how I'm suposed to render correctly text, with modern OpenGL, with textures and buffers, in order to read the .ttf file and create the necessary information with stb_truetype.h and, then, render the text?

sentences: Back to front drawing in an Unorginized array of tiles I have an Array of tiles in no particular order. How would I do a isometric back to front rendering on it? Do I HAVE to order it?

sentences:
Is showing a collision in slow motion computationally relaxing? In a lot of racing games (Burnout Paradise, for example) when a collision is about to happen, the game play automatically switches to slow motion and carries on in slow sequence until after the collision is complete.

I always thought this was for the effects. You don't want to miss any part of the collision! But one of my friends recently suggested that this is done to make sure there is not an overwhelming rate of processing required when a collision happens.

Now I think it is actually the other way round. When a collision happens, so many details are shown in slow motion, I am sure there is an overhead on the computing and rendering pipeline.

What is correct?

Does a slow motion scene increase CPU / GPU usage, or decrease it?

sentences:
Clarification on RenderTargetUsage in XNA 4.0 I'm trying to understand the exact meaning of RenderTargetUsage.DiscardContents. The documentation says:

  Determines how render target data is used once a new render target is set.

  DiscardContents - Always clears the render target data.

Does calling GraphicsDevice.SetRenderTarget(null) to return to the back buffer count as setting a new render target (therefore clearing discarding any previous one)?
Are the contents discarded either way at the end of the frame (i.e. when the graphic device presents), or do they persist into future frames even in this mode?

sentences:
How do I rotate a gameobject towards a point in world space? I wanted to create a very simply turret.
This turret should aim at the point on the screen where the mouse pointer is currently located.
I have added a cube to serve as a very simple turret in my scene.
To visualize its aiming direction, I'm drawing a ray from it.

To rotate the "turret" to the mouse pointer position, I have created a script and added it to the "turret" gameobject:
void Update()
{
    var mousePos = Input.mousePosition;
    mousePos += Camera.main.transform.forward * 10f; // Make sure to add some "depth" to the screen point
    var aim = Camera.main.ScreenToWorldPoint(mousePos);

    transform.LookAt(aim);

    RaycastHit hit;

    int layerMask = 1 << 8;
    layerMask = ~layerMask;

    Color color;
    if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, layerMask))
    {
        color = Color.green;

    }
    else
    {
        color = Color.red;
    }

    Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 10000, color);
}

However, there must be something wrong in my code.
In this screenshot, I have added a red arrow that points to the position of the mouse pointer:

The mouse pointer is over that orange tool. However, the turret is rotated towards the floor while it should be rotated upwards to the orange tool.
I do believe that my turret is well positioned (the blue arrow points forward):

How do I change my code so that it aims correctly, and what is my mistake?
I guess the problem is in these 2 lines, but I don't see what's wrong about it:
    mousePos += Camera.main.transform.forward * 10f; // Make sure to add some "depth" to the screen point
    var aim = Camera.main.ScreenToWorldPoint(mousePos);

Thank you.
Edit:
I finally understand what Kevin wanted to tell me.
I made a thinking mistake, and really need the Raycast to determine where my Worldspace point actually is.
Here is why:

Even though the Y screen coordinate of the mouse position is just a few pixels different in each game window on the right side, the worldspace point is totally different (as can be seen in the scene view window on the left side).
I thought in 2D space, while I should have thought in 3D space.

sentences:
Networking Client Server Packet logic (How they communicate) I want to know what is the logic behind server client communication through packets for a real time game.
for example the server sends x packets then the client receives x packets and processes them..

Basically what is the process to keep the client and server in sync and able to receive and send packets.

more in depth example of what I want to know:

client

step 1 wait for a packet

step 2 read x packets

step 3 process x packets

step 4 send x packets

and so on...

I need to know the very basic outline of the communication.

Big questions are:

1) do I send and read packets all at one time? i.e for loop though the incoming packets array list and read them all or one every server loop or what...

2) what order should I do things i.e first receive then read then process then send etc..

3) what I asked above a step by step of what the server / client should do..

Thanks!

sentences:
Looking for a tournament system for the group of semi-anonymous players some of which may ignore specific matches. How can I do that? I need to implement a tournament system for a one-time tournaments between a finite sets of anonymous players.

Single-elimination or a Groups-system tournament (for a bigger number of players) would have been enough, but there is a twist.

When the match is assigned, the participants are free to organize it in a place or time they agree on.

If the game was assigned to be played by two participants and it didn't happen in a predefined amount of time (say, a week), than we need to expire it and move on to the next round so as to not to delay the tournament overall.

But with our implementation of getting the match results (external API), we can't tell if one of the supposed players of this game ignored the challenge while another was looking for him to play the match. And if one did, which one of the two did it. So just writing the game off as a draw seems extremely unfair for the player who was looking to play the game, since in a non-anonymous tournament with the set dates of matches and attendance control, he would have been judged a winner due to opponent's absence.

So we are looking into round-robin systems giving points for matches (3 for win, 1 for draws, and so on), considering the possibility of giving a variable amount of points for the "expired" matches depending on their quantity.

Like, if you only missed one match, while your opponent for that match have missed three others, than chances are high that it was you who showed up, so you get 2 points while he gets 0. But even that approach seems questionable and open for abuse.

I am looking for the algorithm that will allow me to implement the tournament system like that without sacrificing too much fairness. Maybe it is a known solved problem so I won't need to invent a mathematical bicycle here?

sentences:
How the game engine handles camera view in DirectX I am quite confused with how the game engine handles camera view in DirectX. I know all the matrix stuffs, but where the projection matrix goes finally seems rarely mentioned.
I looked up in the sample project by microsoft https://msdn.microsoft.com/en-us/windows/uwp/gaming/tutorial--create-your-first-metro-style-directx-game
in the GameRenderer::CreateWindowSizeDependentResources() method, the projection process is implemented
XMFLOAT4X4 orientation = m_deviceResources->GetOrientationTransform3D();

        ConstantBufferChangeOnResize changesOnResize;
        XMStoreFloat4x4(
            &changesOnResize.projection,
            XMMatrixMultiply(
                XMMatrixTranspose(m_game->GameCamera()->Projection()),
                XMMatrixTranspose(XMLoadFloat4x4(&orientation))
                )
            );

        d3dContext->UpdateSubresource(
            m_constantBufferChangeOnResize.Get(),
            0,
            nullptr,
            &changesOnResize,
            0,
            0
            );

However I can't figure out what the UpdateSubresources method has anything to do with projection (yet such projection in the UpdateSubresources method exists in some other samples I found). But wouldn't it be absurd to change the entire buffer every frame for projection? Isn't the data in the buffer in world view coordinates?
The vertex shader seems also take the task of projection
PixelShaderInput output = (PixelShaderInput)0;

    output.position = mul(mul(mul(input.position, world), view), projection);

I do think this one is more plausible for the task.
So the questions are:

Which one exactly is the process of projection, and how does it come along in two places?

If it happens in UpdateSubresources, what should I do with dynamic buffer?

If it happens in the shader, where does the world, view, projection matrics come from?

How should I use it with SharpDX

sentences:
Flipped model has wrong triangle order I have list of models and transform matrix for each of them. Some of models are flipped along X or Y or Z axis. This meshes will be rendered wrong, back face is rendered instead of front.

I tried to use glFrontFace(GL_CW) and that makes wrong models fixed but previous correct models are wrong.

How can I fix this?
Can I detect from transform matrix which models need glFrontFace switch?

Right cube and sphere are normal and left are flipped

sentences:
3-hit combo system plays first attack animation every time So the new input system is out, and we're using it for our game. The next hurdle I'm trying to get over is implementing a melee combo  ( E->-E->E). Not 100% sure how to get the new system to execute something like that. Right now my trigger isn't resetting. Images of the animator graph at the bottom

public class PlayerController : MonoBehaviour
{
    Rigidbody2D _rigidbody;
    SpriteRenderer _renderer;
    Animator _animator;
    public float fallMultiplier = 2.5f;
    public float lowJumpMultiplier = 2f;

    PlayerInputActions inputActions;
    Vector2 movementInput;
    public bool inInteractionZone;
    public int attackCount = 0;
    public float attackTimeout = 0.5f;

    bool touchingWall;
    private void Awake()
    {
        HRHEventHub.OnPlayerDeath += HRHEventHub_OnPlayerDeath;
        inputActions = new PlayerInputActions();
        inputActions.Player.Move.performed += ctx => movementInput = ctx.ReadValue<Vector2>();
        inputActions.Player.Interact.performed += InteractPressed;
    }

    private void InteractPressed(InputAction.CallbackContext obj)
    {
        //TODO add attack timeout
        //Check if we are inside a interaction zone
        if (inInteractionZone)
        {
            //TODO implement
            return;
        }
        if (attackCount == 0 && _grounded)
        {

            attackCount++;
            _animator.SetTrigger("Attack");
            //_animator.SetBool("ATK1", true);
        }
        else
        if (attackCount == 1 && _grounded)
        {
            attackCount++;
            _animator.ResetTrigger("Attack");
            _animator.SetTrigger("Attack");

        }
        else
        if (attackCount == 2 && _grounded)
        {
            attackCount = 0;
            _animator.ResetTrigger("Attack");
            _animator.SetTrigger("Attack");

        }

    }

}

sentences:
Can Cloud Functions be used for a multiplayer game server? I'm building a turn-based online multiplayer game with Unity for both desktop and mobile.

Traditionally, I would build a Java socket server, host it in Google Compute Engine or similar, and have players connect to it. Since this works with sockets I can easily notify players of relevant events, such as matchmaking, chat, enemy turn, etc.

I've been curious about Serverless Functions for a while, such as Google Cloud or Amazon Lambda.

However, at first glance it doesn't seem to me like that would work for my game: because there ins't a constant connection (with sockets), I can't notify players of relevant events in realtime - or can I?

For mobile I realize I could probably use something akin to push notifications (so the serverless code may push messages to the relevant player's phone). But that doesn't seem as simple for desktop games.

Well, what if the players poll for messages? Like every second, call a Cloud function and ask them if there's anything for them.

I'd image that would work, but that seems rather overkill - with as little as a couple thousand players, calling the same function every second for prolonged times (the game's matches are long) sounds like it would easily increase expenses.

Is there something I am missing? A coding practice that would make serverless code feasible for a cross-platform online multiplayer game? I want to make it work, but it would seem like a socket server is still my only option.

sentences:
Simple Line Formation I'm working on the first formation for my game's troops. These should simply stand on land, facing the same direction.

To achieve this, I tried to create offsets towards a pivot-unit, that is approximately the unit in the center of the formation.
The units are (temporary) elements of a squad list withing the Squad class.
I divide the List by 2 and get the closest integer, that should be the pivot point of the formation. Now I generate offsets for all units on the left side (Unit 1 to pivot-1) and right (pivot+1 to last unit) based on the distance/gaps.

This is the code for the line formation. Sadly, the units are only forming a very stange line with no visually detectable system:

int count = (int)(squadMembers.Count / 2);
pivot = squadMembers[count];
center = pivot.transform.position;
switch (type) {
    case FormationType.Line:
        int space = 5;
        for (int i = 0; i < squadMembers.Count; i++) {
            Unit tmp = squadMembers[i];
            int dist = 0;
            if (i > count) {
                dist = (count + 1) * space;
                center.x -= dist;
            }
            if (i < count) {
                dist = (count - 1) * space;
                center.x += dist;
            }
            tmp.StartMove(center);
        }
        break;
}

It also appears that this only works along the x axis, any idea how i can realize this with the walking/facing direction ov the pivot?

Is there any (obvious) error? How can I improve this script?

PS: Any idea, how I can transform this into a double line (2 Lines behind with half spacing)

sentences: Unity using 40% GPU for just a UI interface on ultra but 90 on low? So I made some software using unity for my FRC team. All this application is, is just a User Interface with labels, input fields, buttons, etc... When I choose the quality to be on Ultra, I will get about 50% GPU usage but when on very low, I got 90%, close to 100%. How can I optimize my software to use much less of the GPU(Preferably less than 15%)? I am measuring with the Task Manager Performance Menu

sentences:
How do I get the Oculus Rift's position and rotation? I'm looking for the functions to get the position and rotation data of the rift headset itself in Unity.

I have the Oculus integration SDK installed and want to avoid using any pre-fabs.

sentences:
How can I "grow" regions representing countries in a 2D grid? My friend started to make a 'country-generator' type of thing. We have some starting points, and we want to 'grow' countries from them randomly until the whole area is filled. What's is an effect effective way to create something like this?

This is an image of a desired possible end result:

sentences:
Unity 2019.2.5: Convert Mouse Rotate/Pan/Zoom camera to touch I have a Unity C# script that uses the mouse to rotate/pan/zoom a camera around a scene with a main focal point (PC Build). It works very well for me, but I need to convert it for a kiosk touch screen (windows Surface Pro) and have had no luck modifying the script or finding answers. Would some kind soul please save me from this hell!

My current working mouse script is below.

Any assistance is GREATLY appreciated!

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

public class MouseOrbit : MonoBehaviour {
    public Transform target;
    public float maxOffsetDistance = 2000f;
    public float orbitSpeed = 15f;
    public float panSpeed = .5f;
    public float zoomSpeed = 10f;
    private Vector3 targetOffset = Vector3.zero;
    private Vector3 targetPosition;

    // Use this for initialization
    void Start() {
        if (target != null) transform.LookAt(target);
    }

    void Update() {
        targetPosition = target.position + targetOffset;

        if (target != null) {
            targetPosition = target.position + targetOffset;

            // Left Mouse to Orbit
            if (Input.GetMouseButton(0)) {
                transform.RotateAround(targetPosition, Vector3.up, Input.GetAxis("Mouse X") * orbitSpeed);
                float pitchAngle = Vector3.Angle(Vector3.up, transform.forward);
                float pitchDelta = -Input.GetAxis("Mouse Y") * orbitSpeed;
                float newAngle = Mathf.Clamp(pitchAngle + pitchDelta, 0f, 180f);
                pitchDelta = newAngle - pitchAngle;
                transform.RotateAround(targetPosition, transform.right, pitchDelta);
            }
            // Right Mouse To Pan
            if (Input.GetMouseButton(1)) {
                Vector3 offset = transform.right * -Input.GetAxis("Mouse X") * panSpeed + transform.up * -Input.GetAxis("Mouse Y") * panSpeed;
                Vector3 newTargetOffset = Vector3.ClampMagnitude(targetOffset + offset, maxOffsetDistance);
                transform.position += newTargetOffset - targetOffset;
                targetOffset = newTargetOffset;
            }

            // Scroll to Zoom
            transform.position += transform.forward * Input.GetAxis("Mouse ScrollWheel") * zoomSpeed;

        }
    }
}// CLASS ```

sentences:
Moving a rotated model in XNA This seems like a simple problem with an equally simple solution that is invisible to me.

I have a model that spawns at the origin and looks at my player model wherever it goes.

I would like it to move forward where it's going. Whenever I try to translate it, it disappears. What am I doing wrong and how do I fix it?

public override void Update()
{
    //Glo is a global class, where I store the player's world.
    targetShip = Glo.world.Translation;
    targetShip.Normalize();

    //Rotates the model to face the player's position
    rotation = RotateToFace(targetShip, pos, Vector3.Up);
    pos += Vector3.Normalize(targetShip - pos) * 20f;

}

public override Matrix GetWorld()
{
    // return  rotation * translation * world ;
    return Matrix.CreateFromQuaternion(rotation) * Matrix.CreateTranslation(pos);
}

UPDATE:
When I replace:

translation *= Matrix.CreateTranslation(direction);

with

translation *= Matrix.CreateTranslation(Vector3.Forward);

It now moves forward.

It does not correctly face me, however. It still thinks it's at the origin, and is rotating accordingly.

Here is the edited RotateToFace function
The original just returns a Matrix.

Quaternion 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);
    Quaternion rot2 = Quaternion.CreateFromRotationMatrix(rot);
    return rot2;
}

Draw code:

public void Draw(Camera camera)
{
    Matrix[] transforms = new Matrix[model.Bones.Count];
    model.CopyAbsoluteBoneTransformsTo(transforms);

    foreach (ModelMesh mesh in model.Meshes)
    {
        foreach (BasicEffect be in mesh.Effects)
        {
            be.EnableDefaultLighting();
            be.Projection = camera.projection;
            be.View = camera.view;
            be.World = GetWorld() * mesh.ParentBone.Transform;

        }

        mesh.Draw();
    }
}

sentences:
What is the most effective way to work with a friend on the same game? We need something where we can check files out, edit them, check them back in and then build from the them.

Something like Google Docs where we can edit the same code at the same time would be a ideal.

We are both using Visual Studio 2010.

sentences:
How to convert strict limit in position into gradual slow down? The player moves a spell object, the spell must stay withing a certain range of the player.  The spell is moved using a physics system and it has mass and velocity.  Currently when the spell goes out of range of the player it's being moved back into range, this has the effect stopping the spell abruptly at the edge.  I want to smooth out this abrupt stop so that it gradually slows down.  I tried to apply an easing function but because the time and distance change every frame I couldn't figure out the formula.

Is there some sort of physics or easing formula I can use to gradually slow down the spell before it gets to the edge of its range, while at the same time guaranteeing that it never leaves the range?

Additional Info:

The spells range is a circle.  I only care about the center of the spell object.  Movement forces are continually being applied to the spell.

sentences:
How to use mount points in MilkShape models? I have bought the Warriors & Commoners model pack from Frogames and the pack contains (among other formats) two animated models and several non-animated objects (axe, shield, pilosities, etc.) in MilkShape3D format.

I looked at the official "MilkShape 3D Viewer v2.0" (msViewer2.zip at http://www.chumba.ch/chumbalum-soft/ms3d/download.html) source code and implemented loading the model, calculating the joint matrices and everything looks fine.

In the model there are several joints that are designated as the "mount points" for the static objects like axe and shield. I now want to "put" the axe into the hand of the animated model, and I couldn't quite figure out how. I put the animated vertices in a VBO that gets updated every frame (I know I should do this with a shader, but I didn't have time to do this yet). I put the static vertices in another VBO that I want to keep static and not updated every frame.

I now tried to render the animated vertices first, then use the joint matrix for the "mount joint" to calculate the location of the static object. I tried many things, and what about seems to be right is to transpose the joint matrix, then use glMatrixMult() to transform the modelview matrix. For some objects like the axe this is working, but not for others, e.g. the pilosities.

Now my question: How is this generally implemented when using bone/joint models, and especially with MilkShape3D models? Am I on the right track?

sentences:
Reopening Unity project after two week break, project is trashed I've spent about 6 months using Unity nearly every day. Then I take a two-week break, re-open my project, and the entire build is trashed.
There are 166 errors, here are a few:
Assets\TextMesh Pro\Examples & Extras\Scripts\ChatController.cs(6,14): error CS0101: The
namespace '<global namespace>' already contains a definition for 'ChatController'

private Renderer renderer;Assets\Scripts\Board\Tile.cs(23,22): warning CS0108: 'Tile.renderer'
hides inherited member 'Component.renderer'. Use the new keyword if hiding was intended.

Assets\TextMesh Pro\Examples & Extras\Scripts\ObjectSpin.cs(8,18): error CS0101: The namespace
'TMPro.Examples' already contains a definition for 'ObjectSpin'

I've re-imported Text Mesh Pro Examples & Extra, restarted my project multiple times, to no avail. This is very concerning to me because it makes me feel like Unity is not a stable plaform ... Are Unity projects attacked by gremlins if not used every couple days?

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:
3D model rendered in halftone I am writing a 3D renderer that would render 3D models as if they had been drawn in halftone.
Feature-wise I need nothing fancy - no colors, just pure 3D geometry and basic lighting like here:
Image credit: https://blenderartists.org/forum/showthread.php?438820-Suzanne-Sketch

Notes:

I have written a basic 3D renderer in the past, however, I am really inexperienced when it comes to shaders (again, I do know basics) and I have absolutely no idea where to start with this.
The example image has been created in Blender, but I am writing my custom renderer.
This is not a duplicate of "How can I make a shader effect that looks like a lightly shaded pencil drawing?", as my input is a 3D model, whereas the OP in the linked question used an image.

sentences:
Opengl occlusion culling huge performance drop Hello I tried to implement occlusiong culling to my engine in opengl using java & lwjgl. Occlusion works but... performance drop is huge I mean from 60-70 fps to 3-6 fps. Here is my question what I'am doing wrong ? Here is my code:

                    //this code is after frustrum culling if object passed

                    glColorMask(false, false, false, false);
                    glDepthMask(false);

                    glBeginQuery(GL_SAMPLES_PASSED, query_id);
                    //renderable is cube not normal object
                    renderable.render();
                    glEndQuery(GL_SAMPLES_PASSED);

                    int iSamplesPassed = GL15.glGetQueryObjecti(query_id, GL15.GL_QUERY_RESULT);
                    if(iSamplesPassed == 0) {
                        //object is not visible don't render it
                        renderable.setVisible(false);
                    }
                    glColorMask(true, true, true, true);
                    glDepthMask(true);

query_id is simply:

query_id = glGenQueries(); //it is called only once on start

I look on some examples and I don't see any diffrences in code. Only diffrence is their and my framerate.

sentences:
In Unity, what's a better solution than having a bunch of singleton static managers? (SceneManager, UIManager, SfxManager, PfxManager) I always hand a bunch of public static manager classes in my game:

GameManager (singleton) for reading and writing persistent data and gamestate across scenes
SceneManager for holding scene data (coins picked up, score, are we in a cutscene)
UIManager for dealing with HUD stuff
SfxManager for sound effects
PfxManager for particle effects

On the gameobject that holds these manager classes, there are also subordinate classes (e.g. HUDManager, a smaller class that managers tasks specific to HUD, and then delegate those tasks into other smaller scripts) in order to avoid monolithic manager classes.
Is this method frowned upon in Unity game development and if so, what are some better solutions than this approach?

sentences:
Why do I get errors cs1502 and cs1503 in my Destroy object script? I have a script that lets the player place blocks (like in Minecraft), but I also want to be able to destroy those blocks. I keep getting error messages cs1502 and cs1503.

Could anyone take a look at the script and tell me what is wrong?

using UnityEngine;
using System.Collections;

public class TestForCube : MonoBehaviour {

  Ray ray;
  RaycastHit hit;

  // Use this for initialization
  void Start () {
  }

  // Update is called once per frame
  void Update () {

    ray = Camera.main.ScreenPointToRay (Input.mousePosition);

    if (Physics.Raycast (ray, out hit)) {

      if (Input.GetKeyDown (KeyCode.Mouse0)) {

        Vector3 position = hit.transform.position + hit.normal ;
        Quaternion rotation =  Quaternion.FromToRotation( Vector3.up , hit.normal );
        GameObject Placement = GameObject.CreatePrimitive( PrimitiveType.Cube );
        Placement.transform.position = position;
        Placement.transform.rotation = rotation;
      }

      {
        if (Physics.Raycast (ray, out hit)) {
          if (Input.GetKeyDown (KeyCode.Mouse1)) {
            DestroyObject( PrimitiveType.Cube);
          }
        }
      }
    }
  }
}

sentences:
p2.js body position is NaN when spawned inside of each other I'm working on a project for which I need a physics engine. At the moment I'm playing around with p2.js but I'm running into a problem:

When I try to create multiple bodies (circles and/or boxes) which overlap the positions are set to NaN as soon as world.step() is called. The bodies have a mass of 5 and are dynamic.

In very rare occasions it does actually work. How can I make sure it works every time? Do I have to wait for the bodies to be initialized?

4 circles before the simulation starts, once world.step is called the positions of these circles is NaN:

var world = new p2.World({
    gravity: [0, 9.82]
});
function PhysicsBody(type, x, y, widthOrRadius, height) {
    this.body = new p2.Body({
        mass: 5,
        position: [x, y],
    });
    this.type = type;
    if (this.type == 'rectangle') {
        this.shape = new p2.Box({ width: widthOrRadius, height: height });
    }
    else if (this.type == 'circle') {
        this.shape = new p2.Circle({ radius: widthOrRadius });
    }
    this.body.addShape(this.shape);
    world.addBody(this.body);
}
var bod1 = new PhysicsBody('circle', 0, 0, 32);
var bod2 = new PhysicsBody('circle', 10, 0, 32);

sentences:
Sound Synthesis from object collision in Virtual Reality Environment I have a project whose subject is "Sound Synthesis from object collision in Virtual Reality Environment" First of all, I have to define some objects with certain attributes (like shape, mass, material) and then I have to create sound from the collision of these objects in C++ according to their attributes, area of collision etc. I think I have to use some sort of Physics Engine like Bullet or ODE but I'm not sure how to start this project. Is there any Physics Engine specialized in Sound Synthesis?

I've come up with PhyA but I don't know how to download it and implement it. http://www.tech.dmu.ac.uk/~dylan/z/phya/

P.S. I intend to use CHAI3d or H3dApi because I have to use the Falcon device.

sentences:
How do I crop a camera's viewport? I'm making an Android game using LibGDX. I would like to render a cropped version of the camera's viewport.

Here's an original camera view (in 3ds max):

I can get the same view in LibGDX without any problems, with this code:

perspCam = new PerspectiveCamera(40, screenHeight, screenWidth * h / w);
perspCam.position.set(1, 6, 18f);
perspCam.lookAt(1, 3, -1f);
perspCam.update();

Now the tricky part: I actually want to see this view in-game:

It's basically just a crop of the camera viewport, keeping the original perspective and other camera properties.

Could someone explain the general concept? (No need for working code.)

sentences:
Should I use procedural animation? I have started to make a fantasy 3d fps swordplay game and I want to add animations. I don't want to animate everything by hand because it would take a lot of time, so I decided to use procedural animation.

I would certainly use IK (starting with simple reaching an object with hand ...).
I also assume procedural generation of animations will make less animations to do by hand (I can blend animations ...).
I want also to have a planner for animation which would simplify complex animations; those which can be split to a sequence - run and then jump, jump and then roll - or which are separable - legs running and torso swinging with sword -.

I want for example a character to chop a head of a big troll. If troll crouches character would just chop his head off, if it is standing he would climb on a troll. I know that I would have to describe the state ("troll is low", "troll is high", "chop troll head" ..) which would imply what regions animation will be in (if there is a gap between them character would jump), which would imply what places character can have some of legs and hands or would choose an predefined animation.

My main goal is simplicity of coding, but I want my game to be looking cool also. Is it worthy to use procedural animation or does it make more troubles that it solves? (there can be lot of twiddling ...)

I am using Blender Game Engine (therefore Python for scripting, and Bullet Physics).

sentences:
Fbx SDK Importer issue (texture / uv related) I am using the latest autodesk FBX Importer SDK, but whatever I do, I am unable to get the uvs right. Some parts are textured properly while others are not.

I am using Direct3D9 and Direct3D11 (same result in both).

Image:

360 image: https://i.gyazo.com/5a2e5f6e127521915508c9c300eb03e5.mp4

The model uses a single texture and a single material shared among 4 meshes.

Is there someone who sees immediately what the problem could be? Or is there someone who can replicate the issue for me and figure out what I am missing?

FBX Test File: http://www.4shared.com/rar/o_WG0Crpce/Peach64FBX.html

My UV reading method:

int vertexCounter = 0;
for (int j = 0; j < nbPolygons; j++) {

    for (int k = 0; k < 3; k++) {

        int vertexIndex = pFbxMesh->GetPolygonVertex(j, k);

        Vector2 uv;
        _readUV(pFbxMesh, vertexIndex, pFbxMesh->GetTextureUVIndex(j, k), uv);

        pVertices[vertexIndex].uv.x = uv.x;
        pVertices[vertexIndex].uv.y = 1.0 - uv.y;
        vertexCounter++;
    }
}

void _readUV(fbxsdk::FbxMesh* pFbxMesh, int vertexIndex, int uvIndex, Vector2& uv) {

    fbxsdk::FbxLayerElementUV *pFbxLayerElementUV = pFbxMesh->GetLayer(0)->GetUVs();

    if (pFbxLayerElementUV == nullptr) {
        return;
    }

    switch (pFbxLayerElementUV->GetMappingMode()) {

        case FbxLayerElementUV::eByControlPoint:
        {
            switch (pFbxLayerElementUV->GetReferenceMode()) {

                case FbxLayerElementUV::eDirect:
                {
                    fbxsdk::FbxVector2 fbxUv = pFbxLayerElementUV->GetDirectArray().GetAt(vertexIndex);

                    uv.x = fbxUv.mData[0];
                    uv.y = fbxUv.mData[1];

                    break;
                }

                case FbxLayerElementUV::eIndexToDirect:
                {
                    int id = pFbxLayerElementUV->GetIndexArray().GetAt(vertexIndex);
                    fbxsdk::FbxVector2 fbxUv = pFbxLayerElementUV->GetDirectArray().GetAt(id);

                    uv.x = fbxUv.mData[0];
                    uv.y = fbxUv.mData[1];

                    break;
                }
            }

            break;
        }

        case FbxLayerElementUV::eByPolygonVertex:
        {

            switch (pFbxLayerElementUV->GetReferenceMode()) {

                // Always enters this part for the example model
                case FbxLayerElementUV::eDirect:
                case FbxLayerElementUV::eIndexToDirect:
                {

                    uv.x = pFbxLayerElementUV->GetDirectArray().GetAt(uvIndex).mData[0];
                    uv.y = pFbxLayerElementUV->GetDirectArray().GetAt(uvIndex).mData[1];

                    break;
                }
            }

            break;
        }
    }
}

I am doing V = 1.0 - uv.y because I am using Direct3D11.

NOTE: the MappingMode is always eByPolygonVertex and ReferenceMode is always eIndexToDirect

Rendering Info:

Rendered as a Triangle List
Uv wrapping mode: Wrap (Repeat)
Culling: None

sentences:
How to draw HUD in DirectX12? I would like to draw reference frame to see how my camera moves around scene. I want these arrows to always be on the top of other geometry. How can I achieve it?

I think I need to disable depth test for this draw calls. Should I use just another PSO with changed DepthStencilState?

EDIT: Well, it works for me like that.

// opaquePsoDesc defined somewhere above
D3D12_GRAPHICS_PIPELINE_STATE_DESC opaqueHudPsoDesc = opaquePsoDesc;
opaqueHudPsoDesc.DepthStencilState.DepthEnable = false;
THROW_IF_FAILED(g_device->CreateGraphicsPipelineState(&opaqueHudPsoDesc, IID_PPV_ARGS(&psos_["opaque_HUD"])));

And then before drawing your HUD you can:

commandList->SetPipelineState(psos_["opaque_HUD"].Get());

I'll leave this answer here, in case someone will need it.

Well, that works fine if you don't want depth test for the HUD objects.

sentences:
Is my game "shovelware" if it uses images from Google Image searches? I think this is a stupid question, but i want to know.

I just read Wikipedia about Steam software and i found a new word for me, that is Shovelware. Wiki says that :

  Low-budget, poor-quality games, released in the hopes of being purchased by unsuspecting customers, are often referred to as "shovelware".

So, let's say that i want to make a games. I have no budget, i use free game engine, free software and using free texture from internet (maybe from dedicated texture website like Textures.com or Poliigon.com) or download free image from google and make my own texture + material with that image using free software like GIMP.

Is my game considered as "shovelware" ?

sentences:
Hammer Editor - How to fix harsh lighting between brushes I'm working on an old Half-Life 2 map that I haven't worked on in many years. I changed some textures on the map and for some reason, lighting between the old textures and the ones I now just changed is very harsh.

There are no errors during map compilation. Any ideas what may be causing this issue or how to fix it?

sentences: computer language like arduino language for visualization or game development Is there a language similar to Arduino language (c++ language with fewer functions) for software visualization?

sentences:
LibGDX - Move camera not working I'm starting with LibGDX and I loving it so far, but I have found some troubles and I'm getting a little frustrated. I've searched a lot for a solution and tried many things, but nothing seems to work. What I want to accomplish is basically a 2d map with a rts-like camera, in other words, a map/world bigger than the viewport where I can move the camera freely. The problem is I can't make the camera move, and I'm not even sure if my world is bigger than my viewport. How can I get these two things done? I'm sure I'm doing something wrong, but I can't figure what it is. Any help would be really appreciated.

These are my classes:

GameMain

public class GameMain extends Game {

private SpriteBatch batch;

@Override
public void create () {
    batch = new SpriteBatch();
    ScreenManager.getInstance().initialize(this);
    ScreenManager.getInstance().showScreen(ScreenEnum.WORLD);
}

@Override
public void render () {
    super.render();
}

public SpriteBatch getBatch() {
    return this.batch;
}
}

AbstractScreen

public abstract class AbstractScreen extends Stage implements Screen {
protected AbstractScreen() {
    super(new ScreenViewport(new OrthographicCamera()));
}

// Subclasses must load actors in this method
public abstract void buildStage();

@Override
public void render(float delta) {
    // Clear screen
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // Calling to Stage methods
    super.act(delta);
    super.draw();
}

@Override
public void show() {
    Gdx.input.setInputProcessor(this);
}

@Override
public void resize(int width, int height) {
    getViewport().update(width, height, true);
}

@Override public void hide() {}
@Override public void pause() {}
@Override public void resume() {}
}

ScreenEnum

public enum ScreenEnum {

WORLD {
    public AbstractScreen getScreen(GameMain game, Object... params) {
        return new WorldScreen(game);
    }
};

public abstract AbstractScreen getScreen(GameMain game, Object... params);
}

ScreenManager

public class ScreenManager {

// Singleton: unique instance
private static ScreenManager instance;

// Reference to game
private GameMain game;

// Singleton: private constructor
private ScreenManager() {
    super();
}

// Singleton: retrieve instance
public static ScreenManager getInstance() {
    if (instance == null) {
        instance = new ScreenManager();
    }
    return instance;
}

// Initialization with the game class
public void initialize(GameMain game) {
    this.game = game;
}

// Show in the game the screen which enum type is received
public void showScreen(ScreenEnum screenEnum, Object... params) {

    // Get current screen to dispose it
    Screen currentScreen = game.getScreen();

    // Show new screen
    AbstractScreen newScreen = screenEnum.getScreen(game, params);
    newScreen.buildStage();
    game.setScreen(newScreen);

    // Dispose previous screen
    if (currentScreen != null) {
        currentScreen.dispose();
    }
}
}

WorldScreen

public class WorldScreen extends AbstractScreen {

private GameMain game;
private Texture map;

public WorldScreen(GameMain game) {
    this.game = game;
    map = new Texture("sprites/maps/map.jpg");
}

@Override
public void buildStage() {

}

@Override
public void show() {

}

@Override
public void render(float delta) {
    super.render(delta);

    game.getBatch().begin();
    game.getBatch().draw(map, 0, 0);
    game.getBatch().end();
    this.getCamera().translate(+500, +500, 0);
    this.getCamera().update();
}

@Override
public void resize(int width, int height) {

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {

}
}

I debugged the camera and it's changing its value position, but it's not being reflected in the screen.

Also, is there a way to prevent the map texture from being scaled when resizing?

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:
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:
Dealing with disconnected users Just a strange question. I was thinking about it today. About a poker game website/apps or any online gaming platform with money being involved.

What would be the best way to deals with disconnected users trying to avoid a loss or maybe real disconnection.

I doubt pausing the game until that player comes back is very suitable.

Any ideas? Suggestions?

sentences: How can I create an "afterimage" effect like this one? How can I make an effect like this? With a particle system?

sentences:
Isometric Architecture Map Game Data I'm not sure this kind of question has been answered yet, if so i'm sorry to duplicate it.

My question is rather simple :

I'm creating a simple Isometric game with libgdx, i'm using Tiled but only to design the map and render it with OrthographicMapRenderer.

The map is a static map of 6864 * 6880 pixels, one tile is 59*43 pixels

I wanted to do some pathfinding to my game, so I decided to store my map data into a simple 2D array like this : int cells[i][j] which would contains 0 if the tile is walkable or 1 if it's not, it is as simple as that !

Currently I've simply using basic formula to convert world cartesian coordinate to Isometric coord, and formula to get tile pos based on iso pos, (eg : you input a iso coord, the function return a vector like <2,5> which is the 2nd x tile and 5th y tile.

It perfecttly work as execepted, I also make it that iso tile coord is always positive ( <0,0> is at the top left corner of my world )

But here is my Question or doubt : How to handle correctly the game data tile ? Does a 2D array is sufficient, if yes, how to, for exemple write a function that get if a tile is walkable or no based on tile coord ? ( example : I click on my map, the coordinate is translated to tile coord ( < 4,5> for example,) how to check if this tile is walkable ?, i dont get on how to do it i'm really lost.

EDIT : Ive successfully implemented the isometric logic : I can convert world coordinate to tile coorinate ( eg : (5075;4851) -> (203;28)) and the reverse but i'm confused on how to fill the 2d Array, use it for A* algorithm and make the bridge between these coordinate and the 2D array

Thank you for you help,
Regard

sentences:
Import and run LibGDX project in IntelliJ I followed this guide to import a demos project, but when I set the class path of the module to the desktop, then click on the button of the main class field and select the DesktopLauncher class, there is no desktop module in the list. I can't run the imported project, because I have to create a custom run configuration named "Desktop" with the module "desktop" and the main class "DesktopLauncher".

How do I import and run a LibGDX project in IntelliJ?

sentences:
(LibGDX) Set actor to fixed position on TiledMap How can I set an actor to an absolute / fixed position on my TiledMap, such that it does not follow the camera when I pan around?

Currently my code looks like:
camera = new OrthographicCamera();
rootGroup = new Group();

castleMap = new TmxMapLoader().load("castleMap.tmx");
isoMapRenderer = new IsometricTiledMapRenderer(castleMap, 1/32f);

...

final FitViewport fitViewport = new FitViewport(worldWidth, worldHeight);
stage = new Stage(fitViewport);
rootGroup.setSize(stage.getWidth(), stage.getHeight());
stage.addActor(rootGroup);

barracks = new Barracks(barracksIcon, self);
rootGroup.addActor(barracks);

From there, whether I try to position the barracks actor using
barracks.setPosition(x, y);

or using
Vector2 vector = new Vector2(x, y);
vector = stage.screenToStageCoordinates(vector);
vector = rootGroup.stageToLocalCoordinates(vector);
barracks.setPosition(vector.x, vector.y);

I get the same result.
I emphatically do not want to use Tables.
Thanks in advance!

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:
Calculating size and position of Tilemap for camera bounds I'm new to Unity and I'm following a series of tutorials covering off building a 2D Zelda-like game. I'm at a stage where I have two Tilemaps side by side and I'm working on a transition between them, triggered when the player collides with a trigger at the edge of Tilemap 1.
I have a basic camera movement script which follows the player and constrains the camera within the bounds of Tilemap 1 - it's constrained by two Vector2 fields (a min and a max). I got the values for these two Vector2 fields manually in the Scene editor by moving my camera to the desired edges, noting its transform position and entering in those values to the camera movement script.
For the transition, I will change these min and max Vector2 values in the camera movement script to then constrain the camera to Tilemap 2. I could just hard code these in again, but it seems like a good learning opportunity to try and calculate these values dynamically.
My room change script stores a reference to the camera movement script so that it can amend the min and max values itself. In an attempt to get it to calculate the next room's bounds dynamically, I added a public Tilemap field to the room change script so it can examine it and determine the bounds of the next room itself. I then set this field in the Inspector to point to Tilemap 2.
I've so far been unable to calculate these new bounds from the Tilemap reference. The cellBounds property looked promising: Position (-44, -7, 0), Size: (19, 20, 1) - the size is right, but the actual origin position I calculate manually by moving my camera in the scene editor is -35.14, -2.02. As a result, setting the bounds off of what cellBounds tells me does not work. I've made sure that I've used the 'Compress Tilemap Bounds' too.
I've tried accessing individual tiles within the Tilemap and using CellToWorld - this only seems to give me the Tile's position relative to the Tilemap (?).
The transforms for all of the Tilemaps in my scene - and their parents (which are Grids) - are set to 0, 0, 0.
Basically, I know I should calculate a value of approximately -35.14, -2.02 for my new min position, but I can't see any way to calculate that. How do I go about achieving this, and the same for max?
Here is what my scene looks like:

Main Camera [Camera, Audio Listener, Camera Movement (script)]
Player [Sprite Renderer, RigidBody 2D, Box Collider 2D, Player Movement (script), Animator]
Room1 [Grid]

Ground [Tilemap, Tilemap Renderer]
Collision [Tilemap, Tilemap Renderer, Tilemap Collider 2D, RigidBody 2D, Composite Collider 2D]

Room2 [Grid]

Tilemap [Tilemap, Tilemap Renderer]

RoomTransfer [Box Collider 2D, Room Move (script)]

sentences:
Cannot assign values to variables (?) I wouldn't say i'm new to unity or programming in general.. but right now i feel so stupid.

I have a simple enemy script. I instantiate object with another script, calling SettingUpCreep and giving it a list of waypoints. Then happens update object should move from one waypoint to another.
But look at information in Console.

What's wrong with waypoints.Count in Update? Why does it increased?
And it works only if list and nextPos are public. If i set it to private then other methods can't access it. There's nothing in it.

What's happening and why? I can't understand.
Have i've done something wrong or just need more sleep?

List<Vector3> waypoints;
Vector3 nextPos;
int currentPoint = 1;

private void Update()
{
    moveToNextWaypoint();
}

void moveToNextWaypoint()
{
    Debug.Log("Update");
    Debug.Log("WP.count " + waypoints.Count + " NP" + nextPos);

    if (transform.position == nextPos)
    {
        if (currentPoint == waypoints.Count)
        {
            gameObject.SetActive(false);
        }
        else
        {
            currentPoint++;
            nextPos = waypoints[currentPoint];
        }
    }
    transform.position = Vector3.MoveTowards(transform.position, nextPos, 5 * Time.deltaTime);
}

public void SettingUpCreep(List<Vector3> list)
{
    Debug.Log("list.Count " + list.Count);
    List<Vector3> waypoints = new List<Vector3>(list.Count);

    for (int i = 0; i < list.Count; i++)
    {
        waypoints.Add(list[i]);
    }
    nextPos = waypoints[1];
    transform.position = waypoints[0];

    Debug.Log("WP.count " + waypoints.Count + " NP" + nextPos);
}

sentences:
How can the Server send a message to a single Client? I'm trying to send an Rpc, or any sort of message, to a specific client instead of to them all.

I'm completely at the loss trying to associate a NetworkConnection with its own authoritative spawned player (from playerPrefab).

If I let the NetworkManager auto-spawn it, then I don't know how to get the connection from the player object.

If I override OnServerReady and I spawn it myself, then it has no authority on the client and I don't know how to give it.

I've browsed all sort of documentation but I couldn't find anything useful. Obviously there must be a way to do that, but I really can't find it.

sentences:
How to pass arguments with BungeeCord/Bukkit plugin messaging I am trying to send a plugin message from Bukkit, to BungeeCord, but can not figure out how to send arguments.
Here is the code from the Bukkit plugin, which sends the message:

  ByteArrayDataOutput out = ByteStreams.newDataOutput();
  out.writeUTF("BungeeCord"); out.writeUTF("Argument");

  // If you don't care about the player // Player player =
  // Iterables.getFirst(Bukkit.getOnlinePlayers(), null);
  // Else, specify them
  Player plr =  Bukkit.getPlayerExact("spacegeek224");

  plr.sendPluginMessage(p, "BungeeCord",
  out.toByteArray());

Here is the code in the main class of my BungeeCord plugin:

@Override
    public void onEnable() {
        this.getProxy();
        ProxyServer.getInstance().getPluginManager().registerListener(this, new ChannelListener());

        this.getProxy();
        ProxyServer.getInstance().registerChannel("Return");
    }

And finally, here is the code for the ChannelListener:

package net.spacegeek224.metro.util;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;

public class ChannelListener implements Listener {

    @EventHandler
    public void onPluginMessage(PluginMessageEvent e) {
        if (e.getTag().equalsIgnoreCase("BungeeCord")) {
            DataInputStream in = new DataInputStream(new ByteArrayInputStream(e.getData()));
            try {
                String channel = in.readUTF(); // channel we delivered
                if(channel.equals("BungeeCord")){
                   ProxyServer.getInstance().broadcast(new ComponentBuilder(e.getReceiver().toString()).create());

                } else {
                    ProxyServer.getInstance().broadcast(new ComponentBuilder(e.getReceiver().toString()+":"+channel).create());

                }
            } catch (IOException e1) {
                e1.printStackTrace();
            }

        }
    }

    public void sendToBukkit(String channel, String message, ServerInfo server) {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        DataOutputStream out = new DataOutputStream(stream);
        try {
            out.writeUTF(channel);
            out.writeUTF(message);
        } catch (IOException e) {
            e.printStackTrace();
        }
        server.sendData("Return", stream.toByteArray());

    }
}

I have tried many things, including Google, and looking at what other methods are available, but have come up with nothing.

sentences:
Android game scrolling background I'm just trying to figure out the best approach for running a scolling background on an android device. The method I have so far.... its pretty laggy. I use threads, which I believe is not the best bet for android platforms

@Override
    public void run() {
        // Game Loop
        while(runningThread){
            //Scroll background down
            bgY += 1;

            try {
                this.postInvalidate();
                t.sleep(10);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    }

where postinvalidate in the onDraw function simply pushings the background image down

canvas.drawBitmap(backgroundImage, bgX, bgY, null);

Thanks in advance

UPDATE & SOLUTION

Thank you for everyone helping me. I came across this:

post https://stackoverflow.com/questions/1430741/how-to-draw-lots-of-bitmaps-on-screen-in-an-android-game-without-slow-performance

Helped my problem a lot. However, Seemed I was creating bitmaps in the onDraw every time is was caused, meaning that was doing 95% of the slowing down. oops :)

Below is my inner class in my surfaceview for reference purposes

class MapThread extends Thread{
    private Map map;
    private SurfaceHolder holder;
    private boolean run = false;

    public MapThread(Map map, SurfaceHolder holder){
        this.holder = holder;
        this.map = map;
        setRunning(true);
    }

    public void setRunning(boolean run){
        this.run = run;
    }

    @Override
    public void run(){
        while(run){
            try{
                Canvas c = null;

                 try {
                       c = holder.lockCanvas(null);
                       synchronized (holder) {
                            map.onDraw(c);
                     }
                 } finally {

                     if (c != null) {
                         holder.unlockCanvasAndPost(c);
                     }
                 }
        }
    }
}

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:
Multi-textured Terrain? How would I accomplish multi-textured terrain? I need to know how to write the HLSL shader for it. The world already UV maps itself and I can get it to do 1 texture at a time. But I want more than 1 texture being displayed on my screen.

Here is my vertex declaration.

D3DVERTEXELEMENT9 Decl[] =
    {
        {
            0,
            0,
            D3DDECLTYPE_FLOAT3,
            D3DDECLMETHOD_DEFAULT,
            D3DDECLUSAGE_POSITION,
            0
        },
        {
            0,
            0,
            D3DDECLTYPE_FLOAT3,
            D3DDECLMETHOD_DEFAULT,
            D3DDECLUSAGE_TEXCOORD,
            0
        },
        {
            0,
            0,
            D3DDECLTYPE_FLOAT3,
            D3DDECLMETHOD_DEFAULT,
            D3DDECLUSAGE_TEXCOORD,
            1
        },
        D3DDECL_END()
    };

I am also using D3DFVF_XYZ and D3DFVF_TEX2

My variables for for each vertex are X, Y, Z, U1, V1, W1, U2, V2, W2

sentences:
Changing Unity Rigidbody.centerOfMass throws off AddRelativeTorque() calculations This is an odd one, that has me kind of stumped. If I execute the code:

void FixedUpdate()
{
    rigidbody.AddRelativeTorque(0, 1000, 0);
}

I get this:

Normal, expected behavior. The (car in this case) rotates fine around Y. But if I try and change the center of mass,

void Start()
{
    rigidbody.centerOfMass = new Vector3(0, -0.2, 0.9);
}
void FixedUpdate()
{
    rigidbody.AddRelativeTorque(0, 1000, 0);
}

The car spins on all 3 axis. AddTorque has the same problem. It is as if AddRelativeTorque/AddTorque are not accounting for the moved position of the center-of-mass. This was done in an empty Scene with the car floating at 0x 0y 0z.

sentences:
Why is my player still moving down when I set its gravity to 0? I'm writing Lode Runner like platformer game. I'm trying to solve player sprite slowly moving down when on ladder by setting player.body.gravity.y = 0. I have arcade physics gravity y set to 900 in game config. But game gravity settings seems to override player.body.gravity settings.

I even log player.body.gravity.y to console. It shows 0 when player is on ladder. But it still slowly moving down.

sentences:
Updating games for iOS 6 and new iPhone/iPod Touch Say I have a game that runs full-screen on iPhone 4S and older devices. The balance of the game is just right for the 480 x 320 screen and associated aspect ratio. Now I want to update my game to run full-screen on the new iPhone/iPod Touch where the aspect ratio of the screen is different.

It seems like this can be challenging for some games in terms of maintaining the "balance". For example if the extra screen space was just tacked onto the right side of Jet Pack Joyride the balance would be thrown off since the user now has more time to see and react to obstacles.

Also it could be challenging in terms of code maintenance. Perhaps Jet Pack Joyride would slightly increase the speed of approaching obstacles when the game is played on newer devices. However this quickly becomes messy when extra conditional statements are added all over the code. One solution is to have some parameters that are set in once place at start-up depending on the device type.

What are some strategies for updating iOS games to run on the new iPhone and iPod Touch?

Edit - more info: I wonder what happens with a game like Plants vs Zombies? There's quite a bit of artwork that's probably sized to the 320x480 screen. Perhaps the lawn background's width can be increased while the size of the zombies and the row heights stay the same.

sentences:
How do I do 3d collisions in isometric game? I've wondered how to get basic collision detection working in an isometric game. I'm using panda3d which has very comfortable support for bullet, ode and a small builtin physics framework. The problem is that these naturally don't work with flat images. I'm using dynamically generated quads as canvases in the 3d coordinate system. Every image or texture is mapped on one of these. The idea is to create tiles with images and place them in 3 dimensions to let panda3d do the rendering.

In order to place a tree on the screen I would generate one of the dynamic flat quads and map a texture with an image of the tree on it. Then I would move the quad to the desired position and everything's fine. Panda3d manages the correct rendering order.

Up to now the player object simply walks through the environment. I need to implement basic collision detection in order to solidify the trees. Browsing through previous questions I've found this one How do I handle Isometric collision detection? Unfortunately the question only targeted collisions to prevent the player from falling through the ground and allowing him to jump on platforms. This can be done comfortably with panda3d's builtin physics.

Here's a picture to show you what I want:

The ground itself is composed of a 10x10 grid of tiles. I've used the same texture for all of them. The tree is not a sprite that's rendered in 2d. It's actually a flat rectangle with a partially transparent tree texture. The white rectangle is my player object. With the standard 3d physics I could prevent the player from walking through the quad but the tree would still be perfectly flat. I thought about adding a "dummy mesh" to have 3d collisions but that would surely come pricey in terms of performance and would spoil the neat implementation of my 3d canvases.

Is there a canonical way to get 3d collisions in an isometric game ?

How would you do this ? Please answer this second question on behalf of panda3d.

I know that this is probably rather complicated. A link to a good article would be perfect. If you want to have a look at my code, you might want to read this question: How do I use setFilmSize in panda3d to achieve the correct view?

UPDATE:

Here's another picture that might depict the problem better

sentences:
Convert gl_TexCoord[0].st to match version #330 I'm currently working on a sfml based library where I'm implementing widgets with shaders. I'm defining an quad with position and texcoord in sfml to make the shader apply to the object like this:

quad[0].position = sf::Vector2f(100, 100);
quad[0].texCoords = sf::Vector2f(0, 0);
quad[1].position = sf::Vector2f(410, 100);
quad[1].texCoords = sf::Vector2f(1, 0);
quad[2].position = sf::Vector2f(410, 410);
quad[2].texCoords = sf::Vector2f(1, 1);
quad[3].position = sf::Vector2f(100, 410);
quad[3].texCoords = sf::Vector2f(0, 1);

This way I'll make gl_TexCoord[0].st ready to use without dividing with resolution to make it in rage [0, 1]. But when I'm adding #version 330 I get a deprection error. Since I'm using OpenGL 3.3, I'm looking to stick with the moder shader methods and to avoid deprecated stuffs.

Here's how my shader looks like and works without version definition:

void main() {
     vec2 pos = gl_TexCoord[0].st; // deprecated since #120
     gl_FragColor = vec4(pos.y, pos.x, 1.0, 1.0); // also deprecated too
 }

sentences: What does Unity's "Speed of Sound"-option do? I've been reading Unity's manual on the AudioManager's properties.  Speed of Sound is the only undocumented option. What is it for?

sentences:
Casting every received packet as struct? What is the best performant solution to handle received data from socket, in a MMORPG game? Is it good to have something like:

[StructLayout(LayoutKind.Explicit, Pack = 1)]
public struct LoginPacket
{
    [FieldOffset(0)]
    public int size;
    [FieldOffset(4)]
    public int opcode;
    [FieldOffset(32)]
    public int someOtherImportantOffsetInPacket;
}

And then when every packet is received I create the correct struct for the received packet, to access its information easier?
Or the best performant solution is if I just pass the byte[] to the function and use functions like BitConverter.ToInt32 ? I know BitConverter is slow, but I already have my own class that does the same thing in a faster way.

sentences:
Hide original video file in XNA game I want to play some videos in my XNA game. I have looked at this tutorial. I have tried it. It creates XNB file but also copies original WMV file into output content directory.

Is there some simple solution, how can I pack/hide original WMV file? I don't want user get it.

Thanks for any help.

sentences:
Why do we multiply perspective * modelview * point? A common line in vertex shaders is:

gl_Position = projection_matrix * model_view_matrix * object_space_vertex;

I've seen this a lot, why isn't it written like

gl_Position = object_space_vertex * model_view_matrix * projection_matrix;

?

That would be more intuitive I suppose. Is it mathematically wrong?

sentences:
Skybox texture artifact on edge I have strange problem with drawing skybox texture on Mac. On iPhone everything is going fine. I have tried to change near and far planes value with no success.

It is a skybox of six textures, and for every texture I set this:

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_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

What could be the problem?

Screenshot:

EDIT:

I have tried to set background color to red, to ensure if it is bleeding through the texture

I have also tried to change coords of the texture to this:

float err_corr = 0.5 / TEXTURE_SIZE;

GLfloat vertices[24] = {
        -1.0f - err_corr, -1.0f - err_corr,  1.0f + err_corr,
    1.0f + err_corr, -1.0f - err_corr,  1.0f + err_corr,
    -1.0f - err_corr,  1.0f + err_corr,  1.0f + err_corr,
    1.0f + err_corr,  1.0f + err_corr,  1.0f + err_corr,
    -1.0f - err_corr, -1.0f - err_corr, -1.0f - err_corr,
    1.0f + err_corr, -1.0f - err_corr, -1.0f - err_corr,
    -1.0f - err_corr,  1.0f + err_corr, -1.0f - err_corr,
    1.0f + err_corr,  1.0f + err_corr, -1.0f - err_corr,
    };

And the box is drawn in this order:
GLubyte indices[14] = {0, 1, 2, 3, 7, 1, 5, 4, 7, 6, 2, 4, 0, 1};

SOLUTION:

The solution is to set GL_CLAMP_TO_EDGE for the cubemap itself!

glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

sentences:
How to get the center of a rotated rectangle regardless of point of rotation I need help working out the centre coordinate of a rotated rectangle regardless of the point of rotation (i.e. the rectangle doesn't rotate around its center). I do not know the coordinates of the corners, so it's not a simple case of dividing those.

It's easier to show than tell, so here's example 1:

http://gametest.mobi/rotate/index.php?f=point1.js&d=tests

Click to start/stop the rotation.

In this example I've got my sprite with the rotation point set to the bottom-right corner of it. If you click you'll see it rotate around that. I need to find a way to work out the coordinates of the center of the rectangle (represented by the middle red cross-hairs.)

Here is another example, this one is set to rotate at 0.3 x 0.8 into the rectangle:

http://gametest.mobi/rotate/index.php?f=point3.js&d=tests

You can see I added the circle into each demo, this is positioned on the sprites x/y coordinate and the radius was calculated from the distance of the center of the rectangle to the rotation origin.

I can visually see the correlation between the point of rotation and the circle, and I can see it tracks the centre of the rectangle beautifully on the circles perimeter! But I'm falling at the last hurdle in trying to calculate the actual value, so desperately need a fresh set of eyes on it please.

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:
Gameobject rotation around anchored pivot I'm looking for the best way to rotate the Camera(EYES) around a center of my character (Player Prototype) because if I turn around, the Camera enter inside the character.
My FPS script is attached to Player Prototype, but the Camera isn't because i have to make particular rotation. So I don't know what I have to do.

Have will I make the parent? If I will make it, Eyes will sum rotations to those of the parent.
Or maybe I have to handle this in LateUpdate()?
With RotationAround() I don't understand how to pass the second argument which is a Vector3, but I have a Quaternion.Euler.

So at this point I accept all the advice or examples of what I can do to solve it.

sentences:
Drawing sprite shapes with triangles instead of textures If I want to use no textures in a game (ie. no png images), could I just break down my drawing into triangles, combined into the shape I want to draw, and draw those triangles instead?

For example, I found this in Google Images, showing how an "arrow" graphic could be drawn as a triangle mesh instead of a textured sprite:

sentences:
LWJGL 3 - problem with flickering when rendering terrain with colors For while now I m trying to built a terrain generator for my game engine and again I'm stuck with problem.

I'm trying to generate a terrain using colors, so no textures. In short my problem is flickering. Hope this pictures will describe better my problem.

The way I'm generating this is using shared vertices. If I'm generating 2*2 terraing, I'm actually only creating 9 points.
Something like this.

For color , I made that every second point will get slightly darker green.

When I add height generation, there is no flickering.

EDIT:
It probably got something to do with using shared points. I now tried using all unique points for each square and no flickering.

EDIT:
I found was the cause. I was generating indices wrong way.

    public void generateSharedIndices(int rowVertices,int columnVertices){
    for(int row = 0; row < rowVertices - 1 ; ++row){
        for(int column = 0; column < columnVertices -1 ; ++column){
            int leftDownPoint = ((row * columnVertices) + column);
            int rightDownPoint = leftDownPoint + 1;
            int rightUpPoint = rightDownPoint + columnVertices;
            int leftUpPoint = rightUpPoint - 1;

            addNewValueToCurrentPointer(leftDownPoint);
            addNewValueToCurrentPointer(rightDownPoint);
            addNewValueToCurrentPointer(rightUpPoint);
            addNewValueToCurrentPointer(rightUpPoint);
            addNewValueToCurrentPointer(leftUpPoint);
            addNewValueToCurrentPointer(leftDownPoint);
        }
    }
}

In the end indices should look like this
( 0  1  5  5  4  0  )
( 1  2  6  6  5  1  )
( 2  3  7  7  6  2  )
( 4  5  9  9  8  4  )
but I made mistake and it was generating them wrong.

sentences:
How to make switch work with enum? C# Unity I'm working on a script to fade UI elements in Unity, similar to a selector, where you can select the type of fading, and duration, and image to fade

I found that enum is the best option to achieve that result, but I have a problem, when I run the code only element of the enum work and the other don't, no matter if I use switchor if just the first statement run, I don't know what's wrong with the code

Please explain your answer
Please explain why the code is wrong
Please give feedback on how to improve

I'm using Unity version 5.3.5f1 and Visual Studio Community 2015

Goal

Make the enum work properly using either switch or if
Be able to use the variables inside the FadeOperations class to make
the calculations inside the Test class
Select from an array the type of desired operation
Select an UI element from Heriarchy and fade it

Steps

Create new Unity project (2D or 3D)
Create UI Image
Create Empty game object
Create new C# script (I called it Test)
Attach new script to empty game object

Code

Here's my code so far...

using UnityEngine;
using UnityEngine.UI;

 public enum FadeManager
 {
     fadeIn,
     fadeOut
 };

 [System.Serializable]
 public class FadeOperations
 {
     [Tooltip("Type of fading")]
     public FadeManager fadeType;

     [Tooltip("Duration time of the fading")]
     public float duration;

     [Tooltip("Select the image to fade")]
     public Image fadeImage;
 }

 public class Test : MonoBehaviour
 {
     [Tooltip("Select your type of fade")]
     public FadeOperations[] fadeOperations;

     //Reference to the class FadeOperations
     private FadeOperations _fo = new FadeOperations();

     //Loop for debug
     private void Update()
     {
         switch (_fo.fadeType)
         {
             Debug.Log(_fo.fadeType)
             //This statement works
             case FadeManager.fadeIn:
                 Debug.Log("Fadein"); //Only this piece of code works
                 break;

             //This statement doesn't work
             case FadeManager.fadeOut:
                 Debug.Log("Fadeout");
                 break;
         }
      }
  }

The result of the Log (_fo.fadeType) before the switch

fadeIn
UnityEngine.Debug:Log(Object)
Test:Start() (at Assets/_Scripts/Test.cs:34)

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:
Camera position and angle different when running inside Unity and when running on Android On Windows, running Unity 4.6.1p5, my simple game with only a cube, camera and light looks like this

but under Android (Gingerbread on a 5 inch Galaxy Player) the cube appears lower down, slightly different angle and smaller (relative to the screen size).  Sorry couldn't get a screenshot with my screenshot app...

Any ideas why please?

sentences:
How to read ARGB pixel data from SDL2 surface and store them in an array? I've been trying for hours now to figure out why this piece of code is giving me seg fault, but can't figure out why.
 void pixel::Texture::LoadTexture(const char* filepath)
 {
    SDL_Surface* image = IMG_Load(filepath);
    SDL_Surface* formattedImage = SDL_ConvertSurfaceFormat(image, SDL_PIXELFORMAT_ARGB8888, 0);

    textureBuffer = new Uint32[formattedImage->pitch * formattedImage->h];

    width = formattedImage->w;
    height = formattedImage->h;
    pitch = formattedImage->pitch;

    SDL_LockSurface(formattedImage);

    Uint32* pixels = (Uint32*)formattedImage->pixels;

    int bpp = formattedImage->format->BytesPerPixel;

    for(int y = 0; y < height; y++)
        for(int x = 0; x < width; x++)
            textureBuffer[(formattedImage->pitch * y) + (x * bpp)] = pixels[(formattedImage->pitch * y) + (x * bpp)];

    SDL_UnlockSurface(formattedImage);

    SDL_FreeSurface(image);
    SDL_FreeSurface(formattedImage);
 }

Essentially, what I'm doing is I have an array of unsigned 32 bit integers called the texture buffer. All I do is load an image into a surface then convert it's pixel format to ARGB then start reading each pixel and storing it inside my texture buffer array but for some reason the pixels array gets an out of bounds error at some point in runtime and I can't figure out exactly why.

sentences: Why are transform values in inspector different from animation tab? I’m trying to make animation in timeline. But transform values in animation tab and inspector are different from each other. It causes problem when ı try to rotate player. It doesn’t rotate the way I want.

sentences:
C# XNA AABB vs AABB collision resolution, AABBs ghost through each other I've been learning a bit of collision resolution through a tutorial here and I can't seem to get the AABBvsAABB resolution working, I have CirclevsCircle and AABBvsCircle resolution working with the same method,ResolveCollision

Essentially what happens is I have a test scenario where two AABBs collide with each other. The collision gets detected however, the AABBs will just keep going through each other. If two circles collide, they show the correct response.

If you need the full code you can nab it from my github. This has both Windows and Linux versions.

Here is the data class that is passed to the AABBvsAABB method:

public struct Manifold
{
    public PhysicsObject A, B;
    public float PenetrationDepth;
    public Vector2 Normal;
    public bool AreColliding;
}

Here is the code for testing the collision between the AABB and AABB

public static bool AABBvsAABB (AABB a, AABB b, ref Manifold m)
{
    m.A = a;
    m.B = b;
    m.Normal = b.Position - a.Position;

    //Calculate the extent on the X axis
    float aExtent = (a.Right - a.Left) / 2;
    float bExtent = (b.Right - b.Left) / 2;

    //Find the X overlap
    float xExtent = aExtent + bExtent - Math.Abs (m.Normal.X);

    //SAT Test on X
    if (xExtent > 0) {
        //There was overlap on the X axis, now lets try to Y
        aExtent = (a.Bottom - a.Top) / 2;
        bExtent = (b.Bottom - b.Top) / 2;

        //Calculate Y overlap
        float yExtent = aExtent + bExtent - Math.Abs(m.Normal.Y);

        //SAT Test on Y axis
        if (yExtent > 0){
            //Find which axis has the biggest penetration ;D
            if (xExtent > yExtent){
                if(m.Normal.X < 0)
                    m.Normal = new Vector2(-1,0);
                else
                    m.Normal= Vector2.Zero;
                m.PenetrationDepth = xExtent;
                m.AreColliding = true;
                return true;
            }
            else {
                if(m.Normal.Y < 0)
                    m.Normal = new Vector2(0,-1);
                else
                    m.Normal= Vector2.Zero;
                m.PenetrationDepth = yExtent;
                m.AreColliding = true;
                return true;
            }
        }
    }
    return false;
}

Lastly here is the ResolveCollision Method.

public static void ResolveCollision(Manifold m)
{
    Vector2 relVelocity = m.B.Velocity - m.A.Velocity;
    //Finds out if the objects are moving towards each other.
    //We only need to resolve collisions that are moving towards, not away.
    float velAlongNormal = PhysicsMath.DotProduct(relVelocity, m.Normal);
    if (velAlongNormal > 0)
        return;
    float e = Math.Min(m.A.Restitution, m.B.Restitution);

    float j = -(1 + e)*velAlongNormal;
    j /= m.A.InvertedMass + m.B.InvertedMass;

    Vector2 impulse = j*m.Normal;
    m.A.Velocity -= m.A.InvertedMass*impulse;
    m.B.Velocity += m.B.InvertedMass*impulse;
}

sentences:
What games benefit strongly from using motion controls? A lot of games use motion controls, be it Wii, Kinect or otherwise, but for most of them, this control scheme seems forced. What are the games that benefited the most from using motion controls (as in, if they were to be controlled by a traditional controller, it would detract from the experience)? Having such examples could help one make the decision of whether those controls are beneficial for what they are developing

For example, Super Mario Galaxy is a great game, but its use of shaking the remote to jump is quite arbitrary and does not add to the experience. On the other hand, Flower uses sixaxis in such a way as to make it part of a great experience.

(I know this question borderlines Gaming SE, but their FAQ prohibits "Catalogues". I decided to put it on this SE, as having good examples of how to do things well is a valuable resource for anyone hoping to achieve similar greatness.)

sentences:
Repeat texture in a scrolling game The bottom region of the screen is filled by a repeated texture:

grassTexture = new Texture(Gdx.files.internal("images/grass.png"));
grassTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
grassSprite = new Sprite(grassTexture, 0, 0, width,grassTexture.getHeight());

However, The grass should also be scrolled to the left (looping texture from edge to edge).
I have got this in the render() method:

scrollTimer += 0.0007f;
if (scrollTimer > 1.0f)
        scrollTimer = 0.0f;
grassSprite.setU(scrollTimer);
grassSprite.setU2(scrollTimer+1);
grassSprite.draw(spriteBatch);

The scrolling part now works. However, the grass texture is not repeated anymore. It looks like this:

sentences:
Problem with grid generation in Unity 5.1 Using Unity 5.1 and was following a tutorial for generating a grid for a Minesweeper-style game. Link to the tutorial for reference: http://gamedevelopment.tutsplus.com/tutorials/build-a-grid-based-puzzle-game-like-minesweeper-in-unity-setup--cms-21361

Tutorial is Unity 4, but I don't think it should matter.

Here's my code:

public GameObject tilePrefab;
public int numOfTiles = 10;
public float distanceBetweenTiles = 1f;

void Start () {
    CreateTiles();
}

void CreateTiles () {
    float xOffset = 0f;

    for (int tilesCreated = 0; tilesCreated < numOfTiles; tilesCreated++) {
        Vector3 positionVar = new Vector3(transform.position.x + xOffset, transform.position.y, transform.position.z);
        xOffset += distanceBetweenTiles;
        Instantiate(tilePrefab, positionVar, transform.rotation);
    }
}

Essentially, the problem is that when I coded the spacing algorithm, Unity decided to ignore the spacing of 1f, but instead do 10,000. No matter the number I substitute for "distanceBetweenTiles", Unity spaces the cubes by 10,000 points. I'm assuming it has to do with how Unity is handling the float numbers, but I'm not quite sure, considering the number I substitute doesn't seem to matter. I've included a screenshot of Unity running the script and the inspector view of the giant X position. Thanks so much in advance]1

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:
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:
How to invert a damage formula? I have created simple damage formula based on source percent, which return fixed percent of damage.

DAMAGE_PERCENT = Exp(Log(100) * (1 - (100 - SOURCE_PERCENT) / 150)

Here is the result:

percent[0]: 4.641589
percent[1]: 4.786301
percent[2]: 4.935525
....
percent[98]: 94.04449
percent[99]: 96.97654
percent[100]: 100

How can I make it return same results but with reversed SOURCE_PERCENT value?

So percent[0] should return 100 and percent[100] return 4.641589?

sentences:
Implementing rubber rope I'm using LibGDX to implement rubber rope in which player can fly and launch. I know I could use Box2D as physics engine and I'm going to one day, but I'd like to learn it myself for now.

I've already got it working, but some unexpected movements are sometimes noticeable and I don't understand why. I feel like I haven't thought of something important. So I figured you guys might find a flaw in my implementation.

For starters, it looks like this:

My maths is basically taken straight from the physics class. There are two forces applied to the bird, because there are two fractions of the rope. Their sum is the actual force.

Both forces are obviously laid along the corresponding rope fractions. Magnitude of the force is |F| = kx, where k is some constant and x is how much this fraction had to stretch. I cache its initial length at the beginning of collision, then measure it each frame and calculate the difference. The code:

private void calculateForces() {
    //A and B are blue circles in the picture; M and Z are red

    //Negative number means no extension, hence Math.max call
    float modifierA = Math.max(0, A.dst(M) - mLengthA);
    float modifierB = Math.max(0, B.dst(Z) - mLengthB);

    mForceA.set(A.x - M.x, A.y - M.y).setLength(K*modifierA);
    mForceB.set(B.x - Z.x, B.y - Z.y).setLength(K*modifierB);
}

What am I not taking into consideration?

EDIT:

As requested, I made a video. You can see some weird movement at the end of second swing, and the third one is completely wrong.

I also tried getting rid of Math.max() call changing line to float modifierA = A.dst(M) - mLengthA;  and, suprisingly, it looks much better. Video. The question is why. Isn't it logical for the rope not to apply any force when it's not being stretched?

sentences:
How can I make the overlapping object's outlines merge and not display on top of other objects that have the outline shader? This is what I am trying to achieve. I was following https://www.youtube.com/watch?v=SlTkBe4YNbo but the outlines show on top of other if the objects overlap. I tried looking through various outline shaders but couldn't find much. I found that it has something to do with Z-Depth but I am not sure how.
My reason for doing this was to replicate the Unity Editor's object selection in the project. I somehow got the gizmo partially working(using a 2nd camera) and am now stuck on object highlighting on selection.

sentences:
abstracting window and move semantics I am using GLFW to manage OpenGL context and as such, delegate this task to a GLFW window. For managing the pointer to a window instance, I am thinking a class like this:

class window_t {
public:
    using win_handle = GLFWwindow*;

    window_t(size_t width, size_t height, const std::string &title)
    {
        // Initialize GLFW
        if (!glfwInit())
            std::exit(EXIT_FAILURE);

        // Set up OpenGl core profile
        ...

       // Open the window
       w = glfwCreateWindow(width, height, title.c_str(), NULL, NULL);

       if (!w) {
            glfwTerminate();
            std::exit(EXIT_FAILURE);
       }

        glfwMakeContextCurrent(w);
    }

    void swap_buffers()
    {
        glfwSwapBuffers(w);
    }

    void poll_events()
    {
        glfwPollEvents();
    }

    void terminate()
    {
        glfwTerminate();
    }
    bool about_to_close()
    {
        return glfwWindowShouldClose(w);
    }

private:
    win_handle w;
};

Think something similar. In my display_t class, I have an instance of window_t and an instance of scene_graph. Functions on my scene graph are like render(window_t), handle_input(window_t) etc. What would my strategy should be in passing around these window instances? These are actually a handle to GLFW window and OpenGL context. It is not desirable to copy them because some parts of these context variables are living in VRAM and relates to GPU state. So if I want to change the context variables on say handle_input(window_t), copying the window would defy the purpose. On the other hand, I don't want to pass raw pointers around. I can do a singleton maybe, considering I probably won't have multiple windows and OpenGL contexes. I am not really sure about this one though. And they say, singleton is as good as a global variable.

Maybe I should make window_t moveable but not copyable, making it hold a unique_ptr or something like that. I want to use value semantics as much as I can.

I really don't know the correct abstraction here. What would you suggest? Should I get rid of passing a handle to window to each object in scene graph? I am actually looking for a way to do this but all render calls, input handling etc. modifies the context variables. Want to hear your suggestions on this.

sentences:
What graphics library should I use for line rendering for a raycasting renderer? I want to develop simple RPG with ray casting rendering. I chose SDL for graphics and input. The problem is there is no native line drawing in it, which I need to start prototyping a ray casting engine.

I know about SDL_gfx, which can do this, but I am asking if there is any alternative to SDL with primitives drawing functions for C++, which is easy to learn, and is also used by indie game developers?

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:
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:
Blender model doesn't show up in monogame I have a problem getting blender models to show in monogame on windows. Using latest monogame 3.4, fresh blender 2.76b, developing in Visual Studio 2010 using OpenGL Monogame template.

What I'm trying to do is to create a simple model in blender - a sphere, export it as FBX, getting it properly into Monogame Pipeline - here it compiles fine. But then it's invisible in the application. I load it this way:

model = Content.Load<Model>("MyBall");

I draw it this way:

model.Draw(Matrix.Identity, camera.View, camera.Projection);

Also tried other drawing method with enumerating meshes.

The code seems to work in general, because I can see a model which I downloaded from Internet. However I got one or two working, with tens of other downloaded models which don't work and tens which the Pipeline tool will not accept.

I can move around in my app to make sure I' m not inside a model. Also tried adding material in Blender but with no luck. But I'm still learning Blender.

Also tried Autodesk FBX converter, but didn't help anything.

Where's the catch?

sentences:
How to stretch screen image to fit higher res monitors set to lower resolutions with Unity? Using Screen.SetResolution(width, height, windowMode); , how might I stretch the image to match the monitor size? I've noticed this problem occurs both with this line of code and also the default unity configuration launcher.

No body seems to discuss this issue which is odd to me.

sentences:
How is tile offsetting accomplished in 2d side scrollers? The idea is to work with tiles that together make up a larger image, or world so to speak.

but im confused as to what the methods used are to offset the tiles, and whether is a good idea to draw offscreen.

For example

var backgroundScroll = 0
update() {
 backgroundScroll++
}
render() {
graphics.draw( resource: BACKGROUND, screenX: -backgroundScroll, screenY: 0)
}

while there's no tiles seen here for the sake of simplicity,
im simply emphasizing that we are drawing off screen.

As such the question is, how is this background offsetting accomplished, more specifically, without trying to render outside of the screen, as the framework may or may not know how to handle drawing to areas beyond that of the screen.

In essence the game's world will be comprised of an array of tiles

var cells[map_w][map_h]

and each cell is 32 px wide and 32px height

the idea is to scroll the map but cutting corner cells 1px per unit of speed,
but altering the logic so that no negative numbers are entered into the draw function.

I could probably figure something out on my own but i really want to hear how other people are accomplishing this rather popular task

sentences:
Game Slowed by Particles in XNA I am developing an XNA game and am trying to improve the performance of the game by hiding objects that are not visible to the user.

My first thought was to use a BoundingFrustum based on the camera's view and projection matrices, and then only draw objects whose BoundingBox collides or is inside the frustum. However, trying to do this gave me very unpredictable results, with objects disappearing before going out of view and sometimes not showing at all at certain camera angles.

Has anyone else implemented a successful solution to improve their game's performance?

sentences: What is isometric game? There is an understanding like isometric or 2.5D games. As I understand those are the same things. But I could not understand completely what is it. Is it about how the art for the game is drawn? I mean if art is drawn such that you see the game scene from the angle (visible from a top-down perspective or side view [from wiki]) and not perpendicular, is this isometric? Or there are some programming tricks that make game isometric, such as ability of the hero to move in 3 dimensions whereas it actually moves only in 2D like in old Nintendo games (Ninja Turtles or Double Dragon). Please explain this understanding.

sentences:
Data structure for collecting entities for instanced rendering My game, a citybuilder, has many simple entities that rendered via glDrawArraysInstanced. A large city has over 600,000 entities, but most of those entities are one of a few hundred meshes. Every frame, I need a way to collect all those entities so that every entity with the same mesh, texture, and shader pass can be rendered with one draw call. Since my game thread is separate from my render thread, I currently use a data structure, which I call the draw buffer, to collect a plan for what order to draw things in.
This data structure has become a real problem. It's essentially a three dimensional chain of pointers to dynamic arrays, with the first dimension being shader pass, the second mesh, and the third texture. Every frame, the game goes through all entities (which are not in any particular order), filters out the ones that aren't in the view frustum, and inserts that mesh's data into the data structure. The draw buffer takes up a lot of memory and is highly fragmented.
I feel like this isn't the right approach, but I'm not sure what the right approach is. I'm trying to figure out if there is a way to do it without storing what I plan to do, but I do think that can be done without multiple passes on the entity list. Maybe I can keep a master version of the data structure without view frustum culling and compute view frustum culling somewhere else. Then I wouldn't have to rebuild the data structure every frame. Instead I would have to update the data structure every time something is added or removed -- fortunately entities never change shader pass, texture or mesh, so entities will always stay in the same place in the master data structure.
I hope this makes sense to someone because it barely makes sense to me. The question is, can I solve this problem with a better data structure, or should I consider a different approach entirely? Thanks for any advice you guys have.

sentences:
SVG—rendering performance I have created a jump'n'run browser-game based on SVG. The »World« grew large (~80px * ~20000px, before scaled to viewport height) and rendering went slow. In consequence I included  a range searching algorithm to exclude elements from the render tree, if they are out of the visible area. To get all elements inside the viewport, I am using a range query on a AVL-Tree.

Basically the approach was very effective and increased the performance up to 40%, unfortunately it also results in flickering of the graphic if the player is in motion.

The initialization looks like this:

//for each element of type: path, rect, polygon, line, circle, polyline,use,text or tspan

var box = bbox.call(this, element, mtr),
  data = {
    style:    element.style,
    x1:       box[0].x,
    x2:       box[1].x,
    visible:  false
  }
this.tree.insert(box[0].x, data);
this.tree.insert(box[1].x, data);
element.style.display = 'none';

whereby bbox() creates gets the bounding box in global coordinates.

Each time at rendering the following is done:

var x1      = this.viewBox.x - 1,
    x2      = this.viewBox.x + this.viewBox.width + 1,
    result  = this.tree.query(x1, x2),
    visible = this.visible,
    i       = 0,
    n       = result.length,
    data;

for (; i < n; i++) {
  data = result[i];
  if (!data.visible) {
    data.style.display = 'block'
    data.visible = true;
  }
}

for (i = 0, n = visible.length; i < n; i++) {
  data = visible[i];
  if (data.x1 > x2 || data.x2 < x1) {
    data.style.display = 'none';
    data.visible = false;
  }
}

this.visible = result;

As mentioned above, the framerate increased between 20% and 40% on each platform, but flickering and kind of sloppy rendering began.

What could I do to gain a more fluent rendering?

sentences:
Finding relative x and y value on a sprite [Gamemaker] I'm having a little conundrum that may just result from a lack of knowledge of Gamemaker's functionality. I've attached two images to aid explanation.

I have a sprite of a turret (with a gun barrel), attached to a turret object, and at certain points in gameplay this object will spawn another object on top of it (let's call it the 'bullet object').

I would like the bullet object to spawn at the x and y coordinates at the end of the gun barrel. This would be easy to find as a pair of coordinates if the sprite was always stationary, in this configuration. Alas, it is not. It rotates like billy-oh. This means that the x and y coordinates at the end of the gun barrel are constantly different.

How do I find this constantly changing x and y coordinate? I imagine (though am most likely wrong) that there the initial x and y coordinates of the sprite are saved and can be found even if rotated; is there a function that does this? Or do I need to write a script and then call it every time I want to spawn the bullet object?

Thanks for your help.

sentences:
Twine disabling style characters not working when using Harlowe format According to the Twine documentation, if a word has asterisks around it, it's rendered in italics:

Italics = *Italics*

If I want to literaly show the asterisks, then I need to put some extra characters around it:

*Boom!*   == ``*Boom!*``

What is ` ?

Is it '? Because I don't get the desired results when writing ' '*Boom!*' ' or "*Boom!*".

In fact, ''text'' seems to be equivalent to **text** even though it doesn't say that on the doc pages the program links me to.

sentences:
Is database necessary? Hi I have studied c# for good few months and I'm at intermediate level at the moment.
And few days ago I decided to make simple 2D Games like "Mr Jump" after studying Unity.
So my question is as follow :

1)Should I study database to make simple mobile games? and if so what would be good language to study?

2)And if you have played "Mr.Jump", can you tell me if that game required complicated database coding and a lot of knowledge?

3)Also when we play the game, our best score and new characters get saved in our phone. Is that something to do with database?

4)Could tell me examples of database in games?

5)Should I study database as much as c#?

sentences:
Blender / Unity - Which one do I paint on? low poly or high poly I created two versions of my object. One high poly and one low poly. I sculpted the high poly one and plan on baking a normal map so that my low poly one can have more detail.

My question is, once all the sculpting is done and I get everything ready to create a normal map. Which object do I begin painting on the high poly (sculpted) or low poly(non sculpted)?

sentences: how can i create a snake with a single piece look I want to create a 3d snake with a single piece look, i have tried separate head and body parts following each other with Vector3.SmoothDamp but some quaternion issues occurred (when y axis >90, pieces turning upside). What I want is exactly like in the video https://youtu.be/uWlMvHU2wfQ Could you tell me the unity components I need to know/research? Are the snake models in the video rigged?

sentences:
Porting an HLSL 3.0 shader to 2.0? I have a couple of .fx files from a Shader-Based 2D Shadows example. I want to utilize the same kind of technique with XNA 4.0's Reach profile, which if I understand correctly needs to have HLSL 2.0 shaders. I am not familiar with shaders, so obviously I need to learn HLSL, but what I'm wondering right now is how to tell what shader code is 3.0 and what is 2.0, because I need to port those shaders to 2.0 and utilize them in my project. Can FX Composer be used to know such a thing?

A sub-question - Is it possible that they would not perform well when ported to 2.0? If I want to utilize a similar effect to what is presented in the link, do I need to bump my project up to the HiDef profile and use HLSL 3.0, or should I be able to get away with 2.0?

sentences:
How to add isometric (rts-alike) perspective and scolling in unity? I want to develop some RTS/simulation game. Therefore I need a camera perspective like one knows it from Anno 1602 - 1404, as well as the camera scrolling.
I think this is called isometric perspective (and scrolling).

But I honestly have no clue how to manage this. I tried some things I found on google, but they were not satisfying.

Can you give me some good tutorials or advice for managing this?

Thanks in advance

sentences:
Why are my triangles not being drawn in the color I define? I render a simple mash structure with Tao (don't think this is relevant) using DisplayList.

Following code appears between

int displayList = Gl.glGenLists(1);
Gl.glNewList(displayList, Gl.GL_COMPILE);

and

Gl.glEndList();

Simplified version of the code, with removed unrelevant parts:

Gl.glBegin(Gl.GL_TRIANGLES);

for (int i = 0; i < triangles.Count; i++)
{
    var triangle = triangles[i];

    bool ok = false;
    var normal = triangle.GetNormal(out ok); //get normal of TRIANGLE

  //this method just retrives correct color information here
    var visualData = GetVisualData(visual,
                      visual.RenderSettings, triangle,null, false);

    //Set the color for the vertex here. Color is always the same in THIS case
    Gl.glColor4f(m_colors[visualData.color.R],
                     m_colors[visualData.color.G],
                             m_colors[visualData.color.B],
                                 visualData.transparency);

    //for every vertex in triangle
    for (int vtx = 0; vtx < triangle.Vertices.Length; vtx++)
    {
         var v = triangles[i].Vertices[vtx];
         Vertex3 v3 = v.Coord;
         Gl.glVertex3d(v3.x, v3.y, v3.z); //set vertex
         Gl.glNormal3d(normal.x, normal.y, normal.z);  //set normal

    }

}

Gl.glEnd();

Accoring to documentation if I set the same color for all 3 vertices of the triangle it must have the solid color. But what I get is:

As you see the colors are not uniform across different triangles, but I'm pretty sure that in this loop the color is not changed, it remains static (I even tried to set constant int values as color , but  result is always the same)

Q:

What can be possible reason of this rendering behaviour?

sentences:
How to make user move in virtual reality with Google Cardboard and Unity? I am working on a virtual walkthrough using Google Cardboard in Unity 5.3.5.

I have a building, and I need to move around inside the room using google cardboard. How can I do that? Is it possible to move around when we walk holding the Google Cardboard? I have done movement using arrow key. I am able to turn around the building with Google Cardboard.

sentences:
jumping and movement with rigidbody2d.velocity, gravity problem i'm making a 2d platformer and i move my character with rigidbody2d.velocity swiping up to jump and moving while holding the left or right side of the screen.

the problem is that when i jump and i try to move left or right in the air, my character falls very slowly. i've read that the reason why that happens is because rb.velocity overrides gravity at every frame, is there a way to move left or right in the air with normal gravity?

my full code is

{
 Rigidbody2D rb;
public float speed = 1f;
public float jumpforce = 3.5f;
private Vector3 mouseDownPos;
private float startTime = 0f;
public float holdTime = 0.15f;

void Start()
{
    rb = GetComponent<Rigidbody2D >();
}

void Update()
{

 if (Input.GetMouseButtonDown(0))
    {

        mouseDownPos = Input.mousePosition;
        startTime = Time.time;
    }

    if (Input.GetMouseButtonUp(0))
    {

        if ( startTime + holdTime > Time.time & Input.mousePosition == mouseDownPos)// tap
        { Debug.Log("T A P");}

    if (Input.mousePosition.y > mouseDownPos.y + 100 )//jump
        {

            rb.velocity = new Vector2(rb.velocity.x, jumpforce);
        }

    }

    if (Input.GetMouseButton(0) & startTime + holdTime <= Time.time)///move while grounded
    {
        if (Input.mousePosition.x < Screen.width / 2)
        {
            Debug.Log("Left click");
            rb.velocity = transform.right * speed;

        }
        else if (Input.mousePosition.x > Screen.width / 2)
        {
            Debug.Log("Right click");
            rb.velocity = transform.right * speed;

        }

        if (Input.mousePosition.x < Screen.width / 2)/// move while in the air
        {
            Debug.Log("Left click");

            rb.velocity = new Vector2(-speed, rb.velocity.y);

        }
        else if (Input.mousePosition.x > Screen.width / 2)
        {
            Debug.Log("Right click");

            rb.velocity = new Vector2(speed, rb.velocity.y);

        }

    }

}

the rigidbody2d of my character is

sentences:
Loading textures as a method I want to load a texture when I need it, so I'd need a method in order to do so.

      LoadTexture(string fileName)

I'd only use that one parameter, but what would I put in the method? So far I've only ever loaded content at startup with something like

    content.Load<Texture2D>("blah");

But I want to move away from loading everything at startup and only load content when I need it.

EDIT: In order to explain what I'm going for, I'll give more detail. Say I have a chunk of blocks 50x50x50. Most of these won't be drawn, so it doesn't make sense to load the texture for the cubes not drawn. This is why I want a method that I can call whenever the  texture needs to be loaded for the cube. Instead of loading 6 textures for 6 sides for 125,000 cubes, I cut back the amount of loading to only the visible cubes.

sentences:
How do I query a server with visible map tiles? In my game, I need to retrieve data of items in the visible tiles based on what tiles are visible in the viewport. I am planning to make a batch AJAX request with the visible tiles, containing image tags like Google Maps. The item information will be in JSON format.

What is the best approach for this? I currently have a class that determines the visible columns/rows and offsets relative to the visible area shown.

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:
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:
Which 3D Authoring Application to Decide for I have read a lot individual information about three key 3D Graphics Authoring Applications: Softimage, 3DS Max, Maya.

To me, it looks like each of them has its own way to accomplish the same goal, which brings me to the question, is any of them better than the other ones?

In other words, if am free to decide which one of the three tools to use as my primary graphics development tool (for games graphics, web, commercials, animations..) and if I depend to nobody, which application should I decide for? What criteria should I evaluate those three applications in accordance to?

As I have read a lot about Softimage, which is so far the most attractive to me because of its user interface and ICE, I came to question: Is the future of Softimage bright? is it not going to be merged or vanished over time? Lastly I checked, Autodesk offered Softimage as part of its key two packages: Maya, Max. It was not offered as standalone and competitive package to Max and Maya anymore.

sentences:
Can I develop a game using C++ and deploy to XBOX 360? I'm a C# developer and an enthusiast of XNA, but I'm really disappointed with the game engines available for XNA.

I was using Torque X, which is really good, but GarageGames no longer supports Torque X for XNA 4.1. I searched for other engines, but only the sunburn was worth it and would have to pay - I already spent money with Torque.

Based on this, I'm thinking about starting to develop in C++. Can I develop with some C++ engines and deploy to XBox 360?

sentences:
LibGDX player movment I'm working on a project in LibGDX.
It's a 2d platform game; you can say it's like Super Mario.

So this is how I move my player to the right:

if (Gdx.input.isKeyPressed(Input.Keys.RIGHT)){
    player.b2body.applyLinearImpulse(
               new Vector2(0.1f, 0),
               player.b2body.getWorldCenter(),
               true);
}

When I release the key, the player is still moving a bit. (It still has a "Linear Impulse" force on its physical body, I think).

How can I make it stop?

My question could be simple as:
What is the best way to move a physical body on LibGDX in one direction while holding a key. When I release the key, the body stops immediately.

I have tried with "setTransform" and it's causing issues when the body is touching other objects - plus the shape comes "before" the rest of the game in the screen (you can see it on debug)

Thanks.

sentences:
Should I create a Lua wrapper classes for my C++ classes, or should I bind them directly? I have a fairly standard architecture like this:

GameObjects have Transform, and can have Renderer, Rigidbody, Camera, LightSource, etc, and all of these classes have their corresponding methods.

GameObject has GetName, SetName, etc. and its own Transform.
Transform has GetPosition, SetPosition, etc.
Renderer has SetTexture, SetMaterial, etc. and references a Transform/GameObject.

If I want to implement Lua scripting using LuaBridge, and I would like to achieve an API similar to this...

function update()
    local gameObject = this()
    local renderer = gameObject:GetRenderer()
    renderer:SetTexture("Brick")
    local rigidbody = gameObject:GetRigidbody()
    rigidbody:SetMass(10)
    local transform = gameObject:GetTransform()
    transform:SetPosition(1, 10, -5)
end

...then which of these should I choose?

Solution A:

I bind every C++ class directly to Lua classes.

In this way I have to implement some extra scripting quality-of-life methods for the classes, so no big deal.
But it's not so easy to see whether a method is callable in Lua script, or is only available in native code. (for example I need to name method XYZ as LuaXYZ)
Methods which are only created so that scripting is made easier, are mixed with core functionality.

Solution B:

I create a wrapper class for every required class, like: Renderer->RendererHandler, Transform->Transform Handler, GameObject->GameObjectHandler, etc.

Lua and core functionality is separated, much easier to see what is the scripting API and what is not.
For every class I have to create another similar class which got a lot of methods, which are just calling the calling the same method in the wrapped class. Like GameObjectHandler->GetName() just calls GameObject->GetName()

Thanks in advance.

Summary:

In my opinion, Solution B is the best. That is the easiest to handle, the most transparent, and the most separated.
But I got lots of new classes and new dependencies, which messes up my clean architecture. Solution A makes expanding functionality much easier to handle (I dont have to create a lua interface class for new components).
But error handling is worse, because I don't have to care about if a scripter uses a NULL pointer (like a non existent component)
But if that happens due to my engine implementation I'll have to handle it seriously. (And how can I signal whether a NULL pointer in a method is "don't care type" or "serious problem" type?)
So currently I think that the best solution is this:

class GameObject {
   ...

   GetName()
   SetName()

   Lua_getName()
   Lua_setName()

   ...

I don't have to create "Lua interface" classes, and handle that mess that comes with it.
I directly bind the Lua functions to the classes, but I create new methods in that class for scripting purposes.
For example I implement GetName() for "InEngine" functionality, and a Lua_getName() which is bound to Lua functions and used only in scripts.
The problem here is that, yeah you can't call InEngine methods from Lua because it's not bound. But what about calling Lua_getName() instead of GetName()?

There is no compile check for that, and if the developer is tired and makes this mistake, it will be hell to debug that.

sentences:
Will points on path with width intersect I want to be able to check if a list of points will hit a screwed rectangle (rhombus i think).

I start out with 2 point P and T, i want to create a rectangle between the 2 points. I have used https://stackoverflow.com/questions/7854043/drawing-rectangle-between-two-points-with-arbitrary-width to do this. This gives me 4 points A, B, C and D of the new rectangle.

I then want to check if the point M is withing this rectangle.

The two black dots are my points P and T, the black box is the rectangle i want to generate between the two dots, being X wide.
I then want to test if the red dots are withing the black box.

sentences:
Vulkan: Unable to render using multiple view ports I have been trying to enable multiple viewports in my Vulkan Pipeline but have been unsucsessfull. I used this code sample as a reference point. The problem is that when I attempt to draw two side by side (splitscreen) views of a scene I am unsuccessful.

Pipeline Initialisation

// Viewport state
VkPipelineViewportStateCreateInfo viewport_state = initializers::PipelineViewportStateCreateInfo(CameraComponent::GetCameraCount(), CameraComponent::GetCameraCount());

// Dynamic shader stages
std::vector<VkDynamicState> dynamic_states = {
    VK_DYNAMIC_STATE_VIEWPORT,
    VK_DYNAMIC_STATE_SCISSOR,
    VK_DYNAMIC_STATE_LINE_WIDTH,
};
VkPipelineDynamicStateCreateInfo dynamic_states_info = initializers::PipelineDynamicStateCreateInfo(dynamic_states);

(Using the debuger shows that CameraComponent::GetCameraCount() is 2)

Command Buffer

vkCmdSetViewport(cmd, 0, CameraComponent::GetCameraCount(), CameraComponent::GetViewports());
vkCmdSetScissor(cmd, 0, CameraComponent::GetCameraCount(), CameraComponent::GetScissors());

(Here CameraComponent::GetCameraCount() is 2 aswell as the viewport and scissor methods returning valid data)

When Using Nvidia NSight we can see that both Scissors and Viewports are detected

As well as there position data existing within the gpu

But when it comes to the result, all that is visible is half of the screen.

When I flip the cameras around within the code, the second half is rendered instead showing that the first camera is being rendered but not the second one.

sentences:
How to find and send data about on-screen players to a client in a real-time multiplayer game? I'm surprised I couldn't find much information on this.

I am making a top-down browser game in which the players see a small section around their player (see the image). Since the player doesn't need to render the players far away that they can't see, it would be unnecessary to send data about them. I want to know how the server should calculate who is near enough to the client that they appear on their screen and therefore receive data from the server about those players.

The way my problem differs from what I have found is that I need to track many players (at least 50 and preferably up to 100) and many can be on screen at one time (assume a maximum of 10 on screen at any one time).

Some assumptions/considerations that are made:

The players are always moving and positions constantly changing
Must handle at least 50 players at one time (preferably up to 100)
Players can drop in and out at random locations so should be able to adapt to this quickly
Screen sizes vary
Player input is just movement (but there should be scope for other simple actions)
Data sent over TCP as will be browser based
Node.js server

Initially I thought about sending data for all the positions of the players to each player but this seems like a terrible idea with so much unnecessary data being sent - from what I understand the server should be sending as little as possible.

My current strategy (shown in the image) is to have the server periodically (every second for example) calculate the distances between all players to determine those near enough to each other to appear on screen. For the next second, data will only be sent to the client regarding those near it. After the next second, new distances are calculated to decide what to send (and render) for each player.

Some problems to take into account:

A lot of calculations must be performed by the server for all the players
Extra information would need to be sent about players just outside the screen to account for any movement between updates
Interpolation would probably be required
Different screen sizes will mean that some players can see more than others (the fairness isn't the issue here, but tracking to what distance to let players see)

The main issue is the ability of the server to process all of this with everything else that it must already do.
I am not convinced this is a very good way.

This is trivial for off screen entities in a single player game, however for multiplayer games with many players moving at once this becomes much more difficult.

How can I figure out what players are on screen efficiently and what data should be sent regarding this?
Or please point me to where I can find information on this.

sentences: LibGDX , Scale button with animation when it is pressed I am developing game using LibGDX . I want to create beautiful menu and to scale buttons when they are pressed but not in this way , when it is pressed scale it 1.5f , I want to scale it with animation . I am using imagebuttons .

sentences:
Unity 2D Sprite Bending between Hinge Joints I've created a tentacle that consists of multiple game objects, each attached to eachother using HingeJoint2D's. Gameplay wise this multiple segmented approach is great because I can use Unity's built-in physics, but it doesn't look very good art wise.

Is it possible to 'bend' 2D sprites, so the tentacle segments look like they're attached to eachother? Or perhaps take a single image and bend it using splines of some sort?

I would prefer to keep using multiple game objects to represent the tentacle.

sentences:
How to handle multiple effect files in XNA So I'm using ModelMesh and it's built in Effects parameter to draw a mesh with some shaders I'm playing with. I have a simple GUI that lets me change these parameters to my heart's desire. My question is, how do I handle shaders that have unique parameters? For example, I want a 'shiny' parameter that affects shaders with Phong-type specular components, but for an environment mapping shader such a parameter doesn't make a lot of sense. How I have it right now is that every time I call the ModelMesh's Draw() function, I set all the Effect parameters as so

foreach (ModelMesh m in model.Meshes)
        {

            if (isDrawBunny == true)//Slightly change the way the world matrix is calculated if using the bunny object, since it is not quite centered in object space
            {
                world = boneTransforms[m.ParentBone.Index] * Matrix.CreateScale(scale) * rotation * Matrix.CreateTranslation(position + bunnyPositionTransform);
            }
            else //If not rendering the bunny, draw normally
            {
                world = boneTransforms[m.ParentBone.Index] * Matrix.CreateScale(scale) * rotation * Matrix.CreateTranslation(position);
            }

            foreach (Effect e in m.Effects)
            {
                Matrix ViewProjection = camera.ViewMatrix * camera.ProjectionMatrix;
                e.Parameters["ViewProjection"].SetValue(ViewProjection);
                e.Parameters["World"].SetValue(world);
                e.Parameters["diffuseLightPosition"].SetValue(lightPositionW);
                e.Parameters["CameraPosition"].SetValue(camera.Position);
                e.Parameters["LightColor"].SetValue(lightColor);
                e.Parameters["MaterialColor"].SetValue(materialColor);
                e.Parameters["shininess"].SetValue(shininess);

                //e.Parameters
                //e.Parameters["normal"]

            }
            m.Draw();

Note the prescience of the example! The solutions I've thought of involve preloading all the shaders, and updating the unique parameters as needed. So my question is, is there a best practice I'm missing here? Is there a way to pull the parameters a given Effect needs from that Effect?

Thank you all for your time!

sentences:
Simulate parallel dimensions / subspaces in Unity without colliding coordinate systems I've built an online game with Unity with a very large open world.  The server (which can be a local player, or run as a standalone application without a local player) simulates everything around players - so for example if there is an object or NPC at coordinates (100,34,20) but there aren't any players nearby then the object is not simulated.  Objects are streamed dynamically from a database or generated procedurally depending on the object.

Problem

I want to enable players to go to other worlds.  Of course it is impractical if not impossible to have global coordinates shared across all of these different worlds due to floating point limitations. I'll have to share the limited coordinate system for each simulated world.

The issue is the server would still need to render and handle physics of multiple worlds but could now potentially have conflicts with objects and/or people on one world appearing in other worlds.  Essentially I need a way to divide up these "worlds" into parallel dimensions that are executed simultaneously on the same server (in one Unity scene).

Parallel Dimensions

A partial solution would be to have some sort of indicator, such as an integer (I'll call it "worldIndex") on each object to indicate which "world" that object exists in.  This would work for clients since the server would be able to tell the clients only about objects that are on their world.

There would still be a problem on the server itself.  Every world needs to be simulated in the same coordinate space.  For a local player I could use the "worldIndex" to hide objects that aren't in the local player's current "world".  But I still need to simulate physics for every world.

Unity's Layers could be used to mask physics interactions between objects.  However I would then need to have at least one layer per world - and I already use multiple layers for various different interactions.

My thoughts are I would need something like a layer I could specify on each GameObject or some way to group a bunch of GameObjects together and instruct the physics system to only allow interactions within the group.  But as far as I know no such mechanism exists within Unity.

Subspace Pockets

Another thought I've had is rather than using the Unity coordinate space directly, I could slice it up into "subspaces" or pockets.  Each player would be in their own subspace, unless a player physically enters the same space that is already being simulated by another player, in which case that player would join the same subspace.  But then I would have shift around the coordinate systems and it would increase complexity of merging players into and out of these subspaces.  I would also have to generate subspaces dynamically as players enter new areas that are not currently being simulated.

Even if each world is extremely large, it is not necessary to use the entire Unity coordinate system around each player - a few thousand kilometers is more than enough.

Overall I think something along these lines is probably the best solution.

Multiple Servers

I could run one server per "world" and have a hand off process to make it transparent to players.  But then I'd have to run multiple server instances and players would not be able to host their own server - at least not without a lot of additional overhead.

Question

So my question is: what is the best method for essentially running multiple, parallel simulations within a single Unity scene?

sentences:
VBO = glGenBuffers() IllegalStateException i'm kinda noob in OpenGL but I have this problem: I get an IllegalStateException at this code:

int vboVertex = glGenBuffers();

In-detail exception:

Exception in thread "main" java.lang.IllegalStateException: Function is not supported
at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)
at org.lwjgl.opengl.GL15.glGenBuffers(GL15.java:116)
at Mesh.initVbo(Mesh.java:49)

OpenGL version:
2.0.5819 WinXP Release

Thanks for support and sorry for the horrible english.

sentences:
What's the purpose of OpenGL's Vertex Array Objects? I've just started out with OpenGL I still haven't really understood what Vertex Array Objects are and how they can be employed.

If Vertex Buffer Object are used to store vertex data (such as their positions and texture coordinates) and the VAOs only contain status flags, where can they be used? What's their purpose?

As far as I understood from the (very incomplete and unclear) GL Wiki, VAOs are used to set the flags/statūs for every vertex, following the order described in the Element Array Buffer, but the wiki was really ambiguous about it and I'm not really sure about what VAOs really do and how I could employ them.

sentences:
Is it better to import photoshop files or illustrator files into flash? I was wondering what would be better to import into flash for when I animate.
My intention is to animate my characters and objects and then export as a png sequence and make a sprite sheet then take into cocos2d.

Illustrator like flash is vector based but I will have to turn it into pixels anyway to play on a screen.

So I was just wondering what would be better or easier or does it not matter either way?

Additional information:
I have all the adobe software above at CS5.
I am slightly more comfortable working in Illustrator.
My intention was to make the graphics in illustrator so that I could easily resize my graphics for multiple devices, sometimes I may have to rasterize my illustrator file and add final touches in photoshop.

As I'm sure you can tell i'm pretty new to flash and iphone development so any help or advice would be greatly appreciated, sorry for all the questions.

sentences:
Is It Better To Generate A Pre-Generated Map or A Randomly Generated Map When Using Tile Properties? So I am contemplating whether or not to add a Pre-Generated Map or a randomly generated map into my game. But I also need to add Tile properties into the map (i.e. so that water tiles aren't being walked on by the player, etc.). Which way is better, to add tile properties to an existing image file or to add tile properties to a randomly generated map?

I want to make it so that I can add Tile properties to a pre-generated map as I already have one ready to go, but is it even possible to add tile properties to a pre-generated map?

I am using Java and the Slick2D gaming engine.

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:
Calculating the weights of matrices/bones in opengl/glsl I have a basic shape that I want to render. Nothing too complex, just a tall cube. And I want to attach 2 bones to it. Not only that, but I also want one of the bones/matrices to influence the cube more than the other bone, say 60-40 ratio. Can someone show or explain how to do this? I've been trying to find an explanation for this the past few days without luck. How to calculate the weight of a bone/matrix and how (much) effect it will have on the vertex transformation.

Im just using basic c++/opengl for this, looking for an explanation about how weights are calculated in, especially if there are multiple bones.

sentences:
SFML game only runs smooth at high framerate (Windows 10) I am trying to make my game smooth on low and high fps. Right now, it only runs smooth when I don't limit the framerate. If I run it at 60, then my sprite is noticeably "sluggish". I believe this happens because of the FPS spikes like crazy. It goes from 20-65 FPS and sometimes to the thousands.

I tried to implement a fixed timestep as per this tutorial: http://gafferongames.com/game-physics/fix-your-timestep/, which made it better. However, you can still notice that it is not smooth if the framelimit is limited.

So it only runs smooth like this:

window.setFramerateLimit(0);
window.setVerticalSyncEnabled(false);

Otherwise, it doesn't.

I do believe, though, this is only being caused on Windows 10. I had someone try it on their Linux machine with a Nvidia graphics driver and they said it ran smooth even with a framelimit. I have a Nvidia graphics driver as well but my OS is Windows 10.

Here's the code:

Game.h: https://gist.github.com/anonymous/4dce9df0ee983016466f19d4fd43940d

Game.cpp: https://gist.github.com/anonymous/9724aa1336c231b3cf96b726316ba14b

Player.h: https://gist.github.com/anonymous/610ffaecdd85c741058afec32eace912

Player.cpp: https://gist.github.com/anonymous/cf0a6e3e7ffaeaa39088a6e92c069556

Whole project (6 files with code): https://dl.dropboxusercontent.com/u/735021/Spritesheet.zip

Any help would be appreciated! Thank you!

sentences:
Where can I find the library for org.newdawn.slick.opengl.Texture I started making a game in Java, and someone on stackoverflow recommended me LWJGL.
I found some examples, and they worked. Later I wanted to test sprites and every example that I found that loads images imports org.newdawn.slick.opengl.Texture. I can't find that library anywhere. Is there a better alternative, or where can I find this one?

sentences:
Unity animations not playing where they are suppose to be Hello to all those Unity Developers out there, I am having a big issue with my game, what I am trying to do is to make a cutscene but when I change camera it just goes in a completely different spot.
There are no scripting errors and the only thing that I have on the camera (Blender model) is an animator component that plays the animation when the DCT (Drone, Camera, Thing) flies into the room.
Should I try to not equip the camera with the DCT model or should I remove the animator component?

sentences:
Does the order of vertex buffer data when rendering indexed primitives matter? I'm building a 3d object's triangles. If I can write them to the buffer in the order they are calculated it will simplify the CPU code. The vertices for the triangles will not be contiguous.

Is there any performance penalty for writing them out of order?

sentences:
Camera is centered on character, but doesn't show character in game window I'm using Unity 4.6.3. I create an animation from sprite. When I press Play button, I see animation plays on scene window, but on Game Window, I don't see anything.

Here is Inspector for main camera:

Here is Inspector for Player:

I have checked that both z = 0 when execute. Please tell me which part I config wrong ?

sentences:
How do I apply a texture over a material in OpenGL ES? How can I apply a texture over a material?

I've set up an object with the following material:

GLKBaseEffect *effect;
effect.colorMaterialEnabled = false;
effect.material.ambientColor = GLKVector4Make(251.0/255.0, 95.0/255.0, 96.0/255.0, 1.0);
effect.material.diffuseColor = GLKVector4Make(251.0/255.0, 95.0/255.0, 96.0/255.0, 1.0);

and it is correctly rendered with a pink color.

However, when I apply a texture with:

GLKTextureInfo * info = [GLKTextureLoader textureWithCGImage:...];
effect.texture2d0.name = info.name;
effect.texture2d0.enabled = true;

the material seems to disappear and I just see the texture; the object is transparent where the texture is not visible, instead of being pink.

Here's an example:

The texture is created with the following code:

- (UIImage*)generateTexturefromText:(NSString*)text {
    NSError *error;

    UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
    myLabel.text = text;
    myLabel.font = [UIFont fontWithName:"Helvetica" size:50];
    myLabel.textAlignment = NSTextAlignmentLeft;
    myLabel.textColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1];
    myLabel.backgroundColor = [UIColor clearColor];
    myLabel.numberOfLines = -1;
    myLabel.lineBreakMode = NSLineBreakByCharWrapping;

    UIGraphicsBeginImageContextWithOptions(myLabel.bounds.size, NO, 1.0);
    CGContextTranslateCTM(UIGraphicsGetCurrentContext(), 0, 0);
    CGContextScaleCTM(UIGraphicsGetCurrentContext(), 1.0, 1.0);
    [myLabel.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *layerImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    if (error) {
        NSLog(" Error loading texture from image: %",error);
        return nil;
    }

    return layerImage;
}

Why is no color visible where the texture is transparent?

sentences:
How do I determine if one value is within a certain range of another in Python I've been working on the attacking in my RPG.
The problem I have recently encountered is, I have to be in Exactly the same x coordinate as the Enemy. When I want to attack the enemy this is what happens:

 ...

    elif event.key == pygame.K_SPACE:
                    attack = True

if attack == True:
    if enx == x: #this is the line my qeustion is about
        endead = True

attack = False # I put this in so attack doesn't stay true forever

...

if endead == False:
            screen.blit(Enemy, [enx, eny])

How do I make it work if the enemy's position (enx) is equal to within a certain number of pixels to the player's position (x)?

So if I'm close but not Exactly the same place it works

(I know this only takes the x coords into account I'll add y later)

sentences:
How to obtain a camera stream from Unity without rendering it to the player's screen? I'd like to stream the output of two cameras to a separate process. Right now, it looks like the best way to do that is to grab the rendered camera views from the screen via platform specific screen capture hooks then compress them real time with h.264. Is there a way to grab the input of the cameras within unity and avoid rendering them to the screen?

One solution I'm considering involves using Unity's multiplayer capability to run the game on a separate machine and grab it from that screen buffer, unbeknownst to the player.

sentences:
How can I get my physically based sky to be blue all the way down? I'm rendering with a physically based sky. I want to get a very simple light blue background but below the horizon the sky becomes grey/brown. How can I get it so that the sky is blue all the way down? As if the edge of the city was the edge of the world.
I also want to make the blue sky brighter, especially at the bottom.

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:
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:
bullet raycast vehicle - understanding coordinate system Bullet world space coordinate system is the same as opengl world coordinate system. I have noticed that raycast vehicle has the following function:

virtual void btRaycastVehicle::setCoordinateSystem(int rightIndex,
                                                   int upIndex,
                                                   int forwardIndex)

How does that function work ?

By default raycast vehicle has the following parametets:

forward vector: [0, 1, 0]
forward axis: 1
right axis: 0
up axis: 2

Does it mean that y axis is swapped with z axis ?

After calling:

raycastVehicle.setCoordinateSystem(0,1,2);

I get the following parameters:

forward vector: [0, 0, 1]
forward axis: 2
right axis: 0
up axis: 1

which makes more sense to me but I'm still confused why a default setup is other (not compatible with world coordinate system) and how to interpret it.

sentences: Adding actors/musicians/famous people in a videogame Let's say I want to make a videogame with several famous characters in it, you can't copyright a name and a face, right (I'm talking about names and surnames, not branded ones)? How does it work? Are there any royalties to pay? To whom? If there are royalties, can I get away by making my names similar to original ones?

sentences:
Selection with region (when rendering with shaders and VAO) I am currently render my geometry using "Modern OpenGL" approach (with shaders and buffers). I have already implemented picking of single primitives using glReadPixels. Now I am faced with problem how to implement selection of multiple objects. I cannot use glReadPixels because maximum (and it seems meaningful for me) number of objects that I could select with 10x10 box is 100. But it is really necessary for my purposes to have ability to select thousands of objects in small selection area.

I already read answer to similar question where was recommended to test each point against selection rectangle. But it gives new problems: all my vertices are already stored in buffers and it looks like huge performance to test each point on CPU.

Could someone help with such issue?

sentences:
Black screen when trying to render multiple textures I generate an array for two textures:

int[] textureID = new int[2];
glGenTextures(1, textureID, 0);
glGenTextures(1, textureID, 1);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureID[0]);
glBindTexture(GL_TEXTURE_2D, textureID[1]);

Render:

int Position = glGetAttribLocation(Shader.program_Image, mPosition);
glEnableVertexAttribArray(Position);
glVertexAttribPointer(Position, 3, GL_FLOAT, false, 0, vertexBuffer);
int TexCoordLoc = glGetAttribLocation(Shader.program_Image, atexCoord );
glEnableVertexAttribArray (TexCoordLoc);
glVertexAttribPointer (TexCoordLoc, 2, GL_FLOAT, false, 0, uvBuffer);
int mtrxBackground = glGetUniformLocation(Shader.program_Image, mbackground);
int mtxObj = glGetUniformLocation(Shader.program_Image, mobj);
glUniformMatrix4fv(mtrxBackground, 1, false, m, 0);
glUniformMatrix4fv(mtxObj, 1, false, m, 0);
int mSamplerLoc = glGetUniformLocation (Shader.program_Image, bTexture);
int mSamplerLoc1 = glGetUniformLocation (Shader.program_Image, sTexture);
glUniform1i (mSamplerLoc, 0);
glUniform1i(mSamplerLoc1, 1);
glDrawElements(GL_TRIANGLES, background.getIndices().length, GL_UNSIGNED_SHORT, drawListBuffer);

My fragment shader is like this.

precision mediump float;
varying vec2 v_texCoord;
uniform sampler2D b_texture;
uniform sampler2D s_texture;
void main() {
    gl_FragColor = texture2D(b_texture, v_texCoord );
    gl_FragColor = texture2D(s_texture, v_texCoord );
}

I have no error message, but when I run the application, I only see a black screen.

The app runs correctly with just one texture, but doesn't with more than one. What's wrong in my code?

Do I have to add another set of coordinates and update the vertex shader? Because I have only one “rectangle” constructed from two triangles.

sentences:
What is the point in using real time? I understand that using real time frame elapses (which should vary between 16-17ms on average) are provided by a lot of frameworks.  GetTimeElapsedSinceLastFrame, and it gives you the wall clock time.

But should we use this information in basic physics simulation?  It looks to me to be a bad idea.

Say there is a slight lag on the machine, for whatever reason (say a virus scanner starts up).  The calculations all jump, and there is no need for this.  Why not use a virtual second and ignore wall clock time?  For gameplay on the level of Commander Keen, shouldn't you always use the virtual second and not real-time?  (Besides stopwatch timing for race games) I don't see a need to use real time and not a fixed 16ms time step.

sentences: LibGDX normal vector of a plane I'm currently developing a 3D game with LibGDX, and I'm a bit stuck, and couldn't find any definitive answer. I have a plane, part of a bigger g3db file, to which I'd like to get a normal, to calculate which side of that plane the camera currently is. Is there a method built in to LibGDX to achieve this, or should I calculate the normals from the first three vertices of the plane's mesh?

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:
How to put the game object to the upper left corner of the screen in Unity and make it visible entirely on all screens of mobile devices I have game object which displays health indicator in my 2d video game in Unity. This gameobject contains a lot of sprites and i put it into left/top corner of the screen. In my game editor it is visible entirely but on my mobile device is visible only half of it. How can i make it visible entirely on all screens? Can anyone help me to solve this problem please.

P.S.
I have some ideas how to do this:
1. Create health indicator from GUITexture elements. But it is not good for me, because health indicator consists of a lot of small elements and it will take a lot of time for me to resize every GUITexture according to my needs.

Put my gameobject with health indicator into another gameobject with zero transform, and then put parent GO into top/left screen using Camera.main.WorldToViewport method.

But may be there is more easy way to do this?

sentences:
Scrolling Box2D DebugDraw I'm developing a game using Box2D (javascript implementation - Box2DWeb), and I would like to know how I can pan the debug draw. I know the usual answer is - don't use debug draw, it's just for debugging. I'm not, however not all my objects are on the same screen, and i'd like to see where they are in the physics representation.

How can I pan the debug drawing?

As you can see the debug draw stuff, is show on the top left, but it only shows a small part of the world.

Here is an example of what I mean:
http://onedayitwillmake.com/ChuClone/

The game is open source, If you'd like to poke through and note something that perhaps i'm doing something that is obviously wrong:
https://github.com/onedayitwillmake/ChuClone

Here's my hacky way that I'm using now to scroll the b2DebugDraw view, in which I added a property offsetX and offsetY into b2DebugDraw

sentences:
Calculating/Predicting a way I'm just starting with physics, so I'm not always sure about what I'm doing. It's a 2D project but I'm using 3D physical objects like SphereCollider etc..

What I have:

Objects floating in space and affecting each other through gravity:

protected virtual IEnumerator OnTriggerStay(Collider other) {
    yield return new WaitForFixedUpdate();

    if(other.attachedRigidbody) {
        Vector3 offsetVector = this.transform.position - other.transform.position;
        float distance = offsetVector.magnitude;
        float gravityForce = (other.rigidbody.mass * mass) / Mathf.Pow(distance, 2);
        // Clamp gravity.
        if(gravityForce > 1.0F) {
            gravityForce = 1.0F;
        }
        other.attachedRigidbody.constantForce.force = offsetVector.normalized * gravityForce;
    }
}

There are controllable objects on which the player can click and drag a line away from the object in order to give it a force (shoot) in the opposite direction.

What I want to achieve:

The player should see a rough prediction of the way while aiming. That means that the way-prediction needs to take in account the current velocity, the force which would be applied when the player release the mouse button and the gravity of the surrounding objects.

What I have tried so far:

For testing purposes I just save the computed/predicted positions in an array and draw those positions in OnDrawGizmos().

I wrote a method which returns the gravity influence for a certain position called computeGravityForPosition(Vector3 position).

And thats how I try to calculate the positions:

private void drawWayPrediction() {
    Vector3 pos = this.transform.position;
    // The offsetVector for the shooting action.
    Vector3 forceVector = pos - Camera.main.ScreenToWorldPoint(Input.mousePosition);
    forceVector.z = 0.0F;

    // The predicted momentum scaled up to increase the strength.
    Vector3 force = (forceVector.normalized * forceVector.magnitude);

    // 1. I guess that this is wrong, but don't know how to do it properly.
    momentum = this.rigidbody.velocity + force;

    for(int i = 0; i < predictionPoints.Length; i++) {
        float t = i * Time.fixedDeltaTime;
        momentum += computeGravityForPosition(pos);
        pos += momentum * t * t;
        predictionPoints[i] = pos;
    }
}

At the beginning, when the objects just slowly approaching each other it looks okay. After the first shot, the prediction is completely wrong. I guess it is because of 1. in the code. Just adding the force to the velocity is probably horrible wrong.

Thank you very much for your time.

EDIT:

I removed seemingly unnessecary parts.

I still think that the main problem lays in 1. in the code. I just don't know how to mix up the current movement of the object (from which I only have the current velocity as far as I know the physics engine of unity) with the new created force:

Vector3 forceVector = pos - Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3 force = (forceVector.normalized * forceVector.magnitude);

sentences:
What is better: One texture per model or assigning multiple models to one single huge texture? If I'm making a low-poly car pack of multiple cars for mobile platforms, should I:

Make a large texture like of 2048x2048 and unwrap all the models to it
Make separate, smaller (256x256) textures for all cars

Will there be a difference in performance? Which way of texturing is preferred? I've never seen any PC game have one large texture for all the cars, instead every car has its own set of textures and materials.

sentences:
Creating a simple countdown timer in unity Hello's I was looking for a way to do a countdown timer in unity and stumbled across this solution :
public float timeRemaining = 10;

private void Update()
{
    if (timeRemaining > 0)
    {
        timeRemaining -= Time.deltaTime;
    }
    else
    {
        WinGame();
    }
}

Which at first seemed pretty elegant and easy to use, however, I was thinking about it, and wouldn't this be inconsistent for players with different FPS?
For example, if the player has 60 FPS vs 30 fps it would take longer for the player having 60 FPS to reach 0 on time remaining.

sentences:
How to update libgdx scene2d Label text dynamically? I display a BitmapFont on the screen, update its text and the font is updated dynamically on the screen as well.
I seem to fail to do the same with a scene2d Label added as actor to a Stage.
The act(delta) and draw() methods are being called in the render() method.
My code basically looks as follows:

public void init() {
    Label label = new Label(text, labelStyle);
    stage.addActor(label);
}

public void update() {
    updateText(text);
}

@Override
public void resize(int width, int height) {
    /* do some resizing */
    label.setPosition(newPositionX, newPositionY);
}

@Override
public void render(float delta) {
    /* do some rendering */
    stage.act(delta);
    stage.draw();
    update();
}

Do I need to do anything other than setting the Label text, adding it to the Stage as actor, and then updating the text elsewhere? The label displays its original text, though the text updating works fine.

Thanks.

sentences: "Marching cubes" voxel terrain - triplanar texturing with depth? I am currently working on a voxel terrain that uses the marching cubes algorithm for polygonizing the scalar field of voxels. I am using a triplanar texturing shader for texturing. say I have a grass texture set to the Y axis and a dirt texture for both the X and Z axes. Now, when my player digs downwards, it still appears as grass. How would I make it to appear as dirt? I have been thinking about this for a while, and the only thing I can think of to make this effect, would be to mark vertices that have been dug with a certain vertex color. When it has that vertex color, the shader would apply that dirt texture to the vertices marked. Is there a better method?

sentences:
Photon disconnected without any error/warning message I'm making online game with Photon and Unity. It was working fine, but suddenly players are disconnected without any warning or errors.

It just happens sometimes fast, sometimes slow, but always happened.

Before user disconnected, it seems it's little laggy and soon player disconnected.

So I changed the log level to all, and saw this message was printed right before player disconnected.

  DisconnectByServerLogic current State: Joined

What is meaning of this? I changed Photon App to new one, but didn't worked. I spent hours to figure out why this is happening, but no progress.

There is only one part that disconnects player, it's event function that invokes user pressed exit game, but it never called and there is no more function that disconnects.

If this causes from my code, I can fix it, but there is no code for disconnect and also there is no information why user keep disconnected.

Only information that I found was just above message but I don't know what that means. Is that mean Photon forcely disconnects player?

I'm stuck here in almost day but I couldn't find any problem in my code.

I'm using Free photon plan, and result of analysis:

4 CCU
1 Rooms Max(I don't know what this means)
15,558 Msg/s per Room Max
895.0 MB Bandwidth
0 Rejected Players

If someone who knows this problem, it will be very appreciate it gimme some advice. Thanks.

sentences:
ASSIMP OpenGL collada and Skeletal Animation first of all i would like to say that i read everything out there and still did not figure it out quite yet.

In my project i need to implement a skinning technique, but before going there i need to get the standar Linear Blend Skinning working.

I'm using assimp to load my model. For testing purposes my model is a cylindre with a single mesh and 2 bones. There are no animations, the goal of my demo is to manually move the bones.

I read every tutorial/article outhere about assimp and skeletal animation. So i think i got the loading part right. I got the mTransformation from the nodes and got the offsetMatrix from the meshes with the same name (i used a map to store the bones/names).

i did some printing to verify my structure and i'm loading the correct info, i'm getting identity matrices everywhere (wich i think is normal since there is no animation and it's just a simple mesh).

The part i could not figure out still , is how i apply these transformations to my vertices. This point affects the loading too ,when i apply a scale/translation on a mesh in blender i can't get it in my renderer.

in my bones i store 2 matrices and i have a third one that represents the final transformation. I did not understand how i would compute this one, i saw some people using and inverse of the root transform and i have a hard time coding something i don't understand.

struct Weights
{
    uint vertexID;
    float weight;
};

struct Bone
{
    Bone():parent(nullptr){}
    ~Bone()
    {
        for(auto p: children)
                delete p;
    }

    std::string name; // bone name

    QMatrix4x4 nodeTransform; //Transformation of the node
    QMatrix4x4 offsetMatrix;    // Going into the bone's space
    QMatrix4x4 finalTransfrom; // where we store the final transfrom

    QVector<Weights> boneWeights; // bone wheights

    Bone *parent; // pointer to the parent node nullptr if root
    QVector<Bone*> children; // storing pointers to the children
};

thank you for help !

sentences:
Camera angle for dimetric projection I have a simple 3D engine and I want to make a isometric(dimetric) game, but where tiles are not real 3D planes, but 2D images like this one:

As I understand this tile is drawn in dimetric 1:2 projection
But I can't get right camera angles in order to have view, where all given tiles would fit perfectly by pixel.
After reading this page
I've tried rotating camera relatively to itself by x=26.565deg y=45deg but that gave me bad result.

It's clearly visible, that tiles don't fit together nicely.
I've tried different value, by just handpicking them, and the closes one was x:30deg y:45deg angles.

But there is a problem with gaps between tiles. It maybe somehow related to problem, that I don't know how to calculate length of one tile edge in world space, currently when I put tiles in scene I space them by 45units, which also is a handpicked value.

You would ask, "Why do I try to do this in 3D engine?". I want to mix 2D tile and object sprites with simple 3D objects in one game. I've already did isometric terrain with 2D engine, where everything can be simply calculated and doesn't need to position a camera.

sentences:
How to calculate object speed so it accelerates exponentially? Think a rocket or a missile. Completely don't know how to make it start slow and then get progressively faster in an non-linear fashion, given max speed and base acceleration. Curve like this would look best.

 ^                       .
S|                       .
 |                      .
 |                    ..
 |                ....
 |         .......
 | ........
 +------------------------>
                         T

sentences:
Inertial quantities in 3D physics I'm writing a little 3D physics engine and everything is peachy except that to have constraints behave correctly, I'm having to artificially scale up the inertia tensors. Worse--the amount that I have to do so seems to vary from constraint to constraint.

I'm implementing constraints according to Erin Catto's sequential impulses paper. It does make sense to me that it's trickier to get things to behave well rotationally via discrete time impulses, but not sure what sort of approach to take to improve performance that isn't so hand-wavy; e.g. would satisfying the constraints at the acceleration level in addition help?

Open to any advice, even if it's that there's potentially something fundamentally wrong with my implementation or that I'm being too prissy about not wanting hacky solutions, etc.

sentences:
Xna winform scaling and mouse position I am attempting to create a simple 2d level editor using xna and winforms.

I have used the app hub win form samples as a starting point. At first I was having trouble with the mouse coordinates but after setting the mouse handle to the control,  it is working fine.

But now I want to implement scaling into the editor. I want the level editor to always be 720p. I have accomplished this by rendering to a render target set to 720 and then draw this using sprite batch to the back buffer. This also works great with letter boxing to keep the right ratio. I used the technique detailed here https://stackoverflow.com/questions/7591466/xna-resize-window-without-increasing-resolution.

However because of the letting boxing my mouse coordinates are now wrong again. Can someone help work out how to solve this? I tried getting the size of the letter box and subtracting that from the mouse coordinates but that didn't work.

Has anyone got any suggestions?

sentences:
Unity: add InputTracking to my script I'm new to unity and 3D world developement so I'm following Unity's tutorial for beginners right here. And I'm in the section with title "Camera Nodes" where they gave me a c# script to attach it to the camera object.
I did attach it to the camera but the problem with the script when I debug it I get an error of undefined class:

The name 'InputTracking' does not exist in this context

And this is the script:

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

public class UpdateEyeAnchors : MonoBehaviour {

    GameObject[] eyes = new GameObject[2];
    string[] eyeAnchorNames = { "LeftEyeAnchor", "RightEyeAnchor" };

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        for (int i = 0; i < 2; ++i)
        {
            // If the eye anchor is no longer a child of us, don't use it
            if (eyes[i] != null && eyes[i].transform.parent != transform)
            {
                eyes[i] = null;
            }

            // If we don't have an eye anchor, try to find one or create one
            if (eyes[i] == null)
            {
                Transform t = transform.Find(eyeAnchorNames[i]);
                if (t)
                    eyes[i] = t.gameObject;

                if (eyes[i] == null)
                {
                    eyes[i] = new GameObject(eyeAnchorNames[i]);
                    eyes[i].transform.parent = gameObject.transform;
                }
            }

            // Update the eye transform
            eyes[i].transform.localPosition = InputTracking.GetLocalPosition((VRNode)i);//--the error is this line
            eyes[i].transform.localRotation = InputTracking.GetLocalRotation((VRNode)i);//--and this one
        }
    }
}

This is the link of the class InputTracking in Unity's API, but I don't know how to add it to my script :)
Thanks in advance.

sentences:
Perspective projection and ultrawide resolution The problem I'm going to describe did not occur to me until very recently, when I got a super ultra-wide monitor (32:9 aspect ratio) and tried playing videogames on it.

TL;DR: the scenery is stretched near the left and right edges of the screen due to how projection onto a plane works. Question: why isn't the standard to use "spherical" canvas instead of a plane?

I tried several games and I noticed that the objects displayed far left and far right on my screen are stretched and appear way too closer than they actually are. I could not figure out any general setting (field of view, focal distance...) to mitigate this uniformly, until I realized how projection works.

The way 3D objects are displayed on a 2D canvas is as follows: the camera consists of a point (focal point) and an infinite plane (canvas). To calculate where another point in front of the camera will be displayed, this point is connected to the focal point and the point drawn on the canvas corresponds to the intersection of this line with the canvas.

No wonder the far left and far right parts of the screen are so stretched! The rays from these vertices intersect the canvas at a very small angle.

This problem would be eliminated if we chose the canvas to be a sphere, ideally with the same curvature as the monitor (in case the monitor is flat, the sphere degenerates into a plane and we have the same situation as before). That way, if we choose a correct position for the focal point (depends on our screen setup, curvature, aspect ratio etc.), no stretching should occur, since the focal point is literally "surrounded" by the canvas, instead of the canvas running away from it in all directions.

So my question is, why isn't the standard to implement this "spherical" projection instead of "planar"? Is it because it happens on such a low level of coding that developers don't care, or the code with spherical projection would be a serious bottleneck compared to what is done now? Or the market with super ultra-wide resolution is so niche that they don't care, but we should expect to see it sometime in the future? Or the standards are so baked in that nobody cares about implementing something new, even if it would make more sense?

Sorry in case this question doesn't quite fit in here, I actually don't know anything about making videogames, but this strikes me as it's more about geometry than actual game-making.

sentences:
How to optimize collisions I'm building a 2D MORPG using JavaScript, Node JS and socket.io

To prevent cheating, I have to run all collisions for all players on my server.

I'm currently doing fairly simple square collisions like this:

  for (var i = 1 ; i < collidables.length ; i++) {
    if (y < collidables[i].y + collidables[i].z &&
        x < collidables[i].x + collidables[i].z &&
        x + z > collidables[i].x &&
        y + z > collidables[i].y) {
          // Handle collision
    }
  }

When a player collides with a wall I halve their speed and bounce them back.
This is not working optimally, but it's fine for now.

The same logic is used to check bullet collision and possibly collision with monsters in the future.

I'm currently using 3 different loops for the follwing:

Player vs Terrain collisions
Bullet vs Terrain collisions
Bullet vs Monster collisions

Since all of them have slightly different logic.

Should I put them all in the same loop or is using multiple loops fine? I feel like using multiple loops will slow down my server a lot once there will be some more terrain / players / monsters.

I chose square collisions because I think they are a lot faster than any other type of collision checking, and my game will have a LOT of collision checking.

I think I will allow between 50-100 players on a single server, with most likely hundreds of monsters and thousands of bullets flying around.

There will also be a rather big map that has to stay loaded on the server. But since the server doesn't actually have to draw anything this should be fine?
Client-side the map is split up into smaller parts and only loads the parts near the player.

My game is working fine for now, but there's no real way to test with 50 players until people actually start playing.

I'm afraid I will find out way too late that my collision checking is taking up way too much server memory and/or cpu.

How can I improve the efficiency of my collision checks?

...

Here's a preview of my game in pre-alpha, it should make my question less abstract.

http://185.115.218.199:3000/

If I need to post any more info / code, please let me know and I will do so!

I'm currently running this game on a very small test-server with 512MB RAM and 1 VCPU (can't find the specifications)
This is scalable to up to 16GB RAM and 8 VCPU's and probably beyond that.

sentences:
How can i call a thing a lot of times (game: dodger) Hey I am new to coding and i want to know how to get the same thing to hapen until i "say" stop.

The game is that you need to dodge stuff that is falling, i was thinking that i could use a while loop and Push the object in the list like the following:

Var i = 0;
Var theObjects = [ ];
While ( i < 100)
{
    theObjects.push();
    i ++;
}

But that would be 1. Spawn them at the same time and the it would be 2. This only works for x amount of time.

How can i make the object spawn til i say stop and spawn at difrent times

Sorry for my bad english.

sentences:
Accelerometer input for flying game I'm trying to create an infinite flying game where the gameobject (a plane) keeps moving forward and at a particular height throughout the game. I want to be able to
roll and pitch the plane but not move it up/down. I added a rigid body to the plane and selected "y" position constrain. However the plane doesn't stay in the 'y' position but starts move up or down. I just have a script that translates the plane in the z direction. Not sure how to implement the mobile input and keep at the same "y" position throughout.

Update

Here is the code for the plane. Its very basic as I'm not sure how to use the accelerometer:

public class Player : MonoBehaviour {

public float speed = 1.0f;

void Update () {
    float tempx = Input.acceleration.x;
    float tempy = Input.acceleration.y;
    float tempz = Input.acceleration.z;
    transform.Translate(0, 0, 10); // move forward in z
    transform.Rotate( 0,  tempy * speed, tempz * speed);
}

As for the freezing of the 'y' position, I'm just selecting the y constraint available in the inspector that comes along with the rigidbody.

sentences:
Will function-local objects affect my performance over time? This is a very simple question.

Let's say my render loop runs at 60Hz, in each call to render(), I draw all my game's buildings, characters and scenery to make the current frame ready. Each of these entities are drawn using its own instance of a RectangleShape, which is a class able to render a texture to the screen. (I am using OpenGL but it shouldn't be relevant)

RectangleShape is a class that once allocated, generates geometry for the "sprite" to be drawn, has some properties to configure and then renders itself using OpenGL.

The problem is, for each entity, I am allocating the RectangleShape object, configuring and rendering it inside render(). So, in practice, there are dozens if not hundreds of blocks like this inside render():

// pseudocode
RectangleShape entitySprite;
entitySprite.setSize();
entitySprite.setTexture();
entitySprite.render();

I am aware I have a performance decrease by not using a pre allocated RectangleShape, already configured, which I only call render() on. I know that is the optimal path to go, but my question is:

Will so many allocations/deallocations of RectangleShape (hundreds, 60 times a second) fragment memory over time, decreasing the performance of the whole program? Or can I be safe that despite the performance hit by on-demand allocation is constant and will not degenerate as time passes?

I am not using any kind of custom allocator for anything. Also, please have in mind that the RectangleShape constructor internally resizes a std::vector, which I think implies a heap allocation.

Thanks

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: How do I allow a player to manager several games at once with different players using game center? I wish to do a turn based multiplayer game like Words with friends on the iphone. I would like to know the approach for the implementation to allow the user to continue games that are currently still active even after a couple of days. Is this even possible using Game Center?

sentences:
Mobile Game: Google Play no supported dev country and capitalization alternatives (no policies violation or suspicious behavior)? If my country is listed as not supported as a developer country (for payments), this mean developer can upload app but no make any money with it. If I understood correctly, not even in app ads are allowed (I have my doubts about ads because It has no sense they aren't allowed).

Is there any mean, friendly with Google policies, to monetize the app?

For example:

Desktop version is free to play. Optional content requires a payment.
Mobile version is free to play. Optional content requires you to log in with same account you used to purchase it on desktop. No ads and no in-app purchase in mobile version.

Is the above scenario OK? Which are the alternatives?

Notes:

To me, no ads has no sense. After reading Developer Console documentation I assumed that ads are OK but after doing some research It turns on that many people thinks that ads are not OK.

sentences:
How to use CC photos from Wikimedia properly? Here is the situation: I want to create a (perhaps commercial) offline trading card game. Like Magic: The Gathering. My game will be about animals. So I want to use CC photos from Wikimedia as an art for each card.

Photos on Wikimedia are under different CC licenses (CC BY 2.0, CC BY-SA 2.5, CC BY-SA 3.0, CC BY-SA 4.0 and so on). I'm not a lawyer, I just want to try to create a game, so before I start I want to be sure:

Can I use such photos in a commercial product?
How to properly attribute each photo? According to Wiki hints, the usual photo should be attributed in this way:

"By AUTHOR NAME from CITY NAME, COUNTRY NAME - PHOTO CAPTION Uploaded by USERNAME, CC BY 2.0, FILE URL"

It's not enough space on the card for so long text. Can I print a short text on each card (like "Photo by AUTHOR NAME") and also make the web page with full credits for all cards' arts? Or credits should be printed and distributed with each booster?

Thanks in advance!

sentences:
What torque should I apply in Bullet to maintain a vertical orientation? I have a RigidBody in Bullet. Each frame, I want to apply torque to correct its orientation toward an upright position (i.e. near-zero pitch and roll). I know its angular velocity and orientation.

Bullet is not very well documented. I don't even know what the parameters to btRigidBody::applyTorque() mean.

How should I approach this?

sentences:
UI Button OnClick not playing AudioClip on gameObject Basically, I am loading an Audio Clip onto a game object's Audio Source in the Awake function when the game starts. When I click on the game object a UI comes up that basically has a Play button attached and all I want to do is play the Audio Clip on the Audio Source. The problem is I can see that there is an Audio Clip on the Audio Source at runtime and I can play it in the inspector at runtime but, when I click the button nothing happens. I have tried just referencing the gameObject in the OnClick() of the UI button and that doesn't work and I have also tried going through and getting the gameObject through GameObject.Find

public void PlayMe()
    {
        GameObject[] objs = GameObject.FindGameObjectsWithTag("Voice_log");
        foreach (GameObject obj in objs)
        {
            if (obj.layer == LayerMask.NameToLayer("Selected"))
            {
                Debug.Log("Found it");
                if (obj.GetComponent<AudioSource>().clip.loadState == AudioDataLoadState.Loaded)
                {
                    obj.GetComponent<AudioSource>().Play();
                    Debug.Log("Should Play");
                }
            }
        }
    }

Both of my Debugs print when I click the Play button.

sentences:
Script of trajectory without itween I use itween for trajectories of car.
I do not want to use him anymore because I find him very heavy.( more 100 cars in my scène)
I found scripts but all one a variable speed to turn around points.
It is always necessary to find the good compromise in the speed of the car and the rotation speed so that the car does not turn non-stop around a point
It is not easy with a car which goes to 90 kmh and a distance of point of 5 m.
I did not arrive this day and in spite of several tried scripts there.

I look for a script where we give the speed, the path.

Thank you

sentences:
How can I create a copy of an object in Unity? I'm new to unity.

How can I make some copies of my GameObject in Unity by scripting?

I have tried this by the way:

public GameObject stone_3;

void Start ()
{
  for (int i = 0; i < 10; i++)
    Instantiate(stone_3, new Vector3(i * 2.0f, 0, 0), Quaternion.identity);
}

I can't really understand why it's not working.

sentences: How to make sure that a GameObject which gets a certain tag first, is allowed to do something first? I have created a trigger zone to make sure that only one gameobject should pass through the trigger zone at once. Other gameobjects approaching the trigger zone are made to stop just outside the trigger zone if there is already a gameobject in the trigger zone. I could get things working up until here. Now, I need to make sure that the gameobject that got to the trigger zone first and started to wait first is allowed to pass first while others wait and then the second gameobject is allowed to pass and so on. I am stuck at this part.

sentences: Same noise generator for C# and Javascript I'm writing a 2D web racing game with procedural generated maps using perlin noise(as a university project). The server is written using C# and the client using Javascript. I've developed procedural generating of maps on the server but I've realized that's so time consuming. I've thought that players can generate maps and the server can validate some key points so server doesn't have to do both. The problem is that I don't know how to generate same map on the client (in JS) and the same map on the server (in C#). I've read some about deterministic random number generators which are platform independent. But I'm not sure how to search noise generators with them. Do you know where can I find some, especially in programming languages I'm using? Do I have to write own noise generator?

sentences:
Best way to handle tick-based resource generation in an online multiplayer strategy game I'm building an online multiplayer strategy game. The game has no offline mode and requires syncing up to a server. Part of this game is constructing buildings which will generate resources each second. These resources would be generated whether the player is online or offline.

If this was a purely offline game, this would be easy: get the delta between when the app was closed and when it was opened again and multiply by resources per second and just fast forward everything.

Since it's an online game, and other players can be affected by the resources an offline user has, these calculations have to occur on the backend.

My question is: if I have 10,000 players, each with 20 buildings generating resources on a per second basis, how on earth should I handle 200,000 things all at once and syncing to a database?

sentences:
Telling which side of a voxel was hit by an object In XNA, I have an axis-aligned BoundingBox representing the object's hit box, and a Vector3 representing the object's velocity. I also have a stationary 1x1x1 axis-aligned BoundingBox representing a voxel. Using object.box.intersects(voxel.box), I can tell that they intersect. However, I do not know which side of the voxel was first hit by the object.

I am assuming you can just take the direction from the center of the player to the center of the voxel and use that to determine which face it hit. However, my brain is not working right now and I can't figure out the math.

I already know how to respond when you learn which face was hit (from my previous question). I just don't know how to figure out which face the player hit.

sentences:
What's the rationale for different coordinates systems? Could someone explain to me why Blender and other 3D modeling apps switch axes?

If I export model with Blender, then exporters do following things for the same model:

The 3DS format applies this transform matrix:

     [ 1.0, 0.0, 0.0, 0.0 ],
     [ 0.0, 0.0, -1.0, 0.0 ],
     [ 0.0, 1.0, 0.0, 0.0 ],
     [ 0.0, 0.0, 0.0, 1.0 ]

The Collada format applies this transform matrix:

     [ 1.0, 0.0, 0.0, 0.0 ],
     [ 0.0, 0.0, -1.0, 0.0 ],
     [ 0.0, 1.0, 0.0, 0.0 ],
     [ 0.0, 0.0, 0.0, 1.0 ]

The OBJ format (default) transforms axes just like a transform matrix was applied, but OBJ format (Forward Y, Up Z) gives the original values that I see in Blender. The PLY format also does nothing and I get same values I see in Blender.

PS

Question was edited. I do not ask why there are different coordinate systems.
I understand that.

I do not understand why Blender and other switch axis silently when model is exported.

People in comments say:

It is easy to fix model after export
There are people who needs that.

Actually I never seen these people and if it easy to fix then it is more easy to switch axis for those who really need that switch.

I would love to hear someone who say that axis switch is important and he/she needs in real work (not in theory)

sentences:
Object doesn't instantiated right spot I have weird glitch in my game. When player shoot the gun, bullet is instantiated something called "ShootPoint" transform.

This is the ShootPoint's position:

And this is the code of firing bullet:

RigidbodyProjectile CreateBullet() {
    GameObject bullet = Instantiate(bulletPrefab, shootPoint.position, shootPoint.rotation);
    RigidbodyProjectile projectile = bullet.GetComponent<RigidbodyProjectile>();

    projectile.rigidbody.AddForce(shootPoint.forward.normalized * bulletSpeed, ForceMode.VelocityChange);

    return projectile;
}

Simple script to just instantiate bullet prefab in ShootPoint.transform.

However when I run the game, bullet generated totally wrong place:

That picture captured right after creation, even before push the bullet. Here's the updated code for capture that moment, I intentionally throw the error so that makes game stop:

RigidbodyProjectile CreateBullet() {
    GameObject bullet = Instantiate(PrefabManager.GetPrefab("bullet"), shootPoint.position, shootPoint.rotation);

    // Throw the exception
    throw new System.Exception("DIE");

    // So codes under here will not work
    RigidbodyProjectile projectile = bullet.GetComponent<RigidbodyProjectile>();

    projectile.rigidbody.AddForce(shootPoint.forward.normalized * bulletSpeed, ForceMode.VelocityChange);

    return projectile;
}

I don't get it, why my bullet doesn't generated in ShootPoint.transform? I literally removed all components in Bullet and tried again but still had same problem.

Funny thing is that this is not always happening, it only happens in certain angles, especially looking down. I already checked hundreds that ShootPoint pointing something wrong direction or reference of ShootPoint was wrong, but no, there was no problem at all!

What should I check in this case? It's really annoying issue, because when I shoot little lower angle, it always hit the ground almost instantly after fire.

Anyone who knows about this issue, if could be great what should I check, thanks.

** Additional Info about Bullet **
I forgot to mention about bullet. It has parent and child, and parent has rigidbody and child has mesh to display. This is because basically bullet wasn't pointing forward so I rotated it to pointing forward and wrapped by empty game object so that eventually it pointing forward direction even mesh is rotated.

Here's the screenshot to explain this:

sentences:
AudioSource not working. Empty Exception I'm trying to load and play an wav file that exists in my Application.dataPath but when the game gets to the line _GoAudioSource.PlayOneShot(audioLoader.audioClip); It justs throws a empty exception and no sound is played.

I've already checked if the path is correct and it is. I've also tried uploading this wav file to an FTP and loading it via HTTP instead of File:/// but nothing changes.

This is my full code:

     private IEnumerator WriteResponseAudio(ResponseModel res)
     {
         File.WriteAllBytes(Path.Combine(Application.dataPath, FILENAME_RESPONSE), Convert.FromBase64String(res.intent.audio.content));
         string path = "file:///" + Application.dataPath + "/" + FILENAME_RESPONSE;
         WWW audioLoader = new WWW(path);
         yield return audioLoader;
         try
         {
             _GoAudioSource.PlayOneShot(audioLoader.audioClip);
         } catch (Exception ex)
         {
             Debug.LogError("Erro: " + ex.Message);
         }
     }

This is the version with HTTP request:

     private IEnumerator WriteResponseAudio(ResponseModel res)
     {
         File.WriteAllBytes(Path.Combine(Application.dataPath, FILENAME_RESPONSE), Convert.FromBase64String(res.intent.audio.content));
         string path = "http://www.raphaelrosa.com/response.wav";
         WWW audioLoader = new WWW(path);
         yield return audioLoader;
         try
         {
             _GoAudioSource.PlayOneShot(audioLoader.audioClip);
         } catch (Exception ex)
         {
             Debug.LogError("Erro: " + ex.Message);
         }
     }

This is the console:

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:
Unity 5 - Mouse Disappears during runtime My mouse cursor disappears during runtime. When I click esc, it appears and the moment I click on something, it disappears again. This is what I have done so far to fix this. I have added this to a script on an empty gameobject in my scene.

void Start()
{
    Cursor.visible = true;
}

The problem persists and so I added the code to the update function. Still the same. I do not understand what am I missing here. Why is the cursor disappearing the moment I click and why doesn't it appear automatically onStart during runtime? I have also tried to implement a custom cursor and the same problem again. I am using 5.3.2f. I hope someone can point me in the right direction. Cant find a solution in any forums.

sentences:
How do I draw a context menu next to my object? I want to show a menu next to an item in an inventory. This is what I try to rebuild:

I do this by placing a canvas in 3D world space next to the inventory:

As I don't want the menu to be rotated, I rotated the menu the opposite X value as the camera. The camera has an X rotation of -11, so I rotate the menu by 11 to make it look straight:

Since I don't want the menu to get stuck in the case, I move it closer to the camera:

One can see that the menu is now offset to the left and to the top because of the camera perspective.

How could I offset the menu in such a way that it still aligns with the right top corner of the item?

Thank you!

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 - Autoscroll when selecting buttons out of viewport I have a ScrollView element, that contains many buttons. I want that when I select buttons (via arrow keys), the panel scrolls so that the selected button is contained within the viewport.

How could I achieve this?

UPDATE

This is example of my structure (with 2 buttons only, but you get the gist...)

sentences:
Limit the boundary of Touch a game that I currently working on is in a way that player should actually draw a rainbow on the screen by tap and drag gesture in order to make a hills for the car.

but the issue that i currently facing on is if the player wants to pause the game by touching the right most button on the screen above, the game will stop but the hill that he was drawn will remove. I actually not have any idea how can i put exception for that button on the screen because everytime i calculate the whole pixels on the screen for drawing hills.
do you have any idea how can i solve this issue ?

btw, this is my code if it's required : http://pastebin.com/VnLAQbzW

sentences: Different collision effects on different objects I'm a beginner to Corona and game development. I am using a variety of objects in my game. On collision, they all perform the same function. I want them to do different things, and also want some objects to only collide with certain other objects. How would I go about doing this?

sentences:
How to color each letter text in Phaser.js? I have a text created with text object (game.add.text) and I would like to color each letter differently if that is possible.
If not, how can I achieve this?

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:
Bullets Are Spawning Weirdly in my Java/LibGDX Plane Shooting Game What I'm trying to do

Have bullet's spawn in the center ( or close enough, the exact number can be played with after ) of my player sprite.

What's going wrong:

They're spawning super weirdly. The first one always spawns at the bottom left corner. Than they spawn all over the place though not completely random. If I shoot on only the right side of the screen, bullets don't spawn on the left side.

How I'm doing it:

Creating a New Bullet and Managing them , Methods:

Method Placement:

Drawing (In Batch):

Also:

I know that I'm not using LibGDX arrays, or objects, or array of objects, or sprites for the bullets. ( I used sprites for the player ) though I was going through confusing complications and this strategy with batch drawing seems inefficient but simplified for my development ability.

I also haven't made a bullet disposal/reset system yet. I'm still working on this part first.

Anyone know what I'm doing wrong or a solution?

EDIT: ManageBullets is just so the bullet's go up once they spawn. ( Shooting )

sentences:
Error instantiating Texture2D in MonoGame for Windows 8 Metro Apps I have an game which builds for WindowsGL and Windows8. The WindowsGL works fine, but the Windows8 build throws an error when trying to instantiate a new Texture2D.

The Code:

var texture = new Texture2D(CurrentGame.SpriteBatch.GraphicsDevice, width, 1); // Error thrown here...
texture.setData(FunctionThatReturnsColors());

You can find the rest of the code on Github.

The Error:

SharpDX.SharpDXException was unhandled by user code
  HResult=-2147024809
  Message=HRESULT: [0x80070057], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: The parameter is incorrect.

  Source=SharpDX
  StackTrace:
       at SharpDX.Result.CheckError()
       at SharpDX.Direct3D11.Device.CreateTexture2D(Texture2DDescription& descRef, DataBox[] initialDataRef, Texture2D texture2DOut)
       at SharpDX.Direct3D11.Texture2D..ctor(Device device, Texture2DDescription description)
       at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Int32 width, Int32 height, Boolean mipmap, SurfaceFormat format, Boolean renderTarget)
       at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Int32 width, Int32 height)
       at BrewmasterEngine.Graphics.Content.Gradient.CreateHorizontal(Int32 width, Color left, Color right) in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Graphics\Content\Gradient.cs:line 16
       at SampleGame.Menu.Widgets.GradientBackground.UpdateBounds(Object sender, EventArgs args) in c:\Projects\Personal\GitHub\BrewmasterEngine\SampleGame\Menu\Widgets\GradientBackground.cs:line 39
       at SampleGame.Menu.Widgets.GradientBackground..ctor(Color start, Color stop, Int32 scrollamount, Single scrollspeed, Boolean horizontal) in c:\Projects\Personal\GitHub\BrewmasterEngine\SampleGame\Menu\Widgets\GradientBackground.cs:line 25
       at SampleGame.Scenes.IntroScene.Load(Action done) in c:\Projects\Personal\GitHub\BrewmasterEngine\SampleGame\Scenes\IntroScene.cs:line 23
       at BrewmasterEngine.Scenes.Scene.LoadScene(Action`1 callback) in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Scenes\Scene.cs:line 89
       at BrewmasterEngine.Scenes.SceneManager.Load(String sceneName, Action`1 callback) in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Scenes\SceneManager.cs:line 69
       at BrewmasterEngine.Scenes.SceneManager.LoadDefaultScene(Action`1 callback) in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Scenes\SceneManager.cs:line 83
       at BrewmasterEngine.Framework.Game2D.LoadContent() in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Framework\Game2D.cs:line 117
       at Microsoft.Xna.Framework.Game.Initialize()
       at BrewmasterEngine.Framework.Game2D.Initialize() in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Framework\Game2D.cs:line 105
       at Microsoft.Xna.Framework.Game.DoInitialize()
       at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
       at Microsoft.Xna.Framework.Game.Run()
       at Microsoft.Xna.Framework.MetroFrameworkView`1.Run()
  InnerException:

Is this an error that needs to be solved in MonoGame, or is there something that I need to do differently in my engine and game?

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:
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:
When should I publish my Steam page? I developing my game, which still in alpha, and plan to sell it via Steam. I already applied to Steam partnership program and want to publish my 'coming soon' Steam page to start gather wishlists, but it on hold for now.
I don't have any promotional material yet, but people on social media positively reacting to gifs of my game. Is it good idea to publish Steam page right now with temporary thumbnail and screenshots of current version and then change everything later? Or should I make my page appealing first?

sentences:
LibGDX - how to change FreeType Font color and screen coordinates How can I change my FreeType Font color? I want to set custom color. I tried do this by using Color color = new Color() but don't work.

And second: can I change my screen coordinates? I use two different cameras. First camera for game and second for text. When I draw text in the (0,0) position, my text is in the center of the screen but I want to have (0,0) in the lower left corner. How do that?

sentences:
Combining pathfinding with global AI objectives I'm making a turn-based strategy game using Java and LibGDX. Now I want to code the AI.

I haven't written the AI code yet. I've simply designed it. The AI will have two components, one focused in tactics and resource management (create troops, determine who have strategical advantage, detect important objectives, etc) and a individual component, focused in assign the work to each unit, examine its possibilites and move the unit.

Now I'm facing an important problem. The map where the action take place is a grid-based map. Each terrain has different movement cost. I read about pathfinding and I think A* is a very good option to determine a good route between two points.
However, imagine I have an unit with movement = 5 (i.e, it can move 5 tiles of movement cost = 1). My tactical AI has found an objective at a distance d = 20 tiles (Manhattan distance) from my unit.

My problem is the following: the unit won't be able to reach the objective in one turn. So the AI will have to store a list of position and execute them in various turns. I don't know how to solve this.

PS. In my unit code, I have a list called selectionMarks which stores all the possible places where the unit can go in this turn. This places are calculated recursively using a getSelectionMarks function.

sentences:
how to script a match 3 game without waiting for matches to finish I have developed a full match 3 game without the ability of making another move until all cascading is finished.

I was stuck trying to figure out how to do it with the ability of making moves even if the previous moves have not finished yet. I can't figure out the programing logic behind it, I tried different approaches with no luck so far, the results came up messy.

Can any one help.

Thanks in advance.

sentences:
SVG graphic in Android My question is about scalable vector graphics focused on Android.

I know that the advantage of using vector images instead of png is that you can draw it in almost every device without modifying it. The drawback is that they're very slow.

But if you convert them into png images during the runtime and then you serialize them? You obtained all the advantages without drawbacks? Or there are other reasons to avoid svg?

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:
Is multiple material on same mesh cause low perf? I'm making something like "Low poly" style game. For that, I'm using multiple materials for each mesh without uv mapping and texturing.

Luckily, only weapon does this, others not. Also it's first person shooter so most of time, it just 7~8 materials requires for rendering.

However, I heard that lots of materials causes more rendering for GPU and it cause performance issue. My target platform is Android, and that could be a big problem.

Should I change all my weapons to have single material each?

This is the screenshot of my game. As you can see, single weapon uses 6 materials.

sentences:
How to generate interresting procedural terrain I work on a voxel-like game, and I have finally managed to create some basic terrain generation using simplex noise. Heres what it looks like:

Sure I can generate different kind of terrains (more or less hilly/aggressive), but there wont really be any variation.

At the moment I only know one way to make it more interesting, and that would be to add stone blocks under the grass (I would simply check the above block).

So my questions are: What techniques would I need to use, to generate different kind of terrains, which still kind of blended together at the edges. And how would I go about caves and rivers? And lastly how would I make a better variation of blocks?

If any could lead me in the right directions, I would appreciate it a lot.

Ps. It's not a valid answer to say that I just need to mix a lot of noises, to generate it. How?

sentences: how to apply force/impulse perpendicular to the moving direction in box2d How can i apply or impulse to an object perpendicular to its moving direction in a top down game. Like if object is moving up, i press left or right, then force or impulse should be applied to left or right direction(object can be at any angle).

sentences:
Unity3d app immediately goes to background after starting up on iOS So the iOS build of my game started doing this today and I have no idea why. The only think I can think of is that I added this line :

Application.runInBackground = true;

but this should not force it to go to the background on startup. Other games run just fine on the phone. It's very unlikely that the game itself is using too much resources. It does not crash it just goes into the background and when you select it from there it stays on for like a second and then goes back. Has anyone experienced this before ?

sentences:
Voxel river flow simulation I am making a Voxel game and I'd like to add rivers that can be redirected. So I thought that if a player replaces a river block or digs up a block next to a river block the river would repath itself to the sea. The rivers path would have a direction and a speed in that direction.

The rivers path would be determined by these rules:
If the river can go down in its direction it will and then pick up speed.
or if it has a speed under 2 and it can go sideways and down it will and keep its direction. Otherwise it will keep going in its direction until blocked, where it will pick a new direction. If the river can't go anywhere it will fill up the layer its on like a bathtub and go up.
Repeat until it reaches the ocean.

However I can't figure out how you can know what to fill. The data would be stored in some sort of height map. 1 = same level, 0 = down a level, 2 = up a level

For example:

222222
211112
211112
211112
211112
222222

I can tell that the 2s completely surround the 1s meaning that all the 1s should get filled with water if the river goes up. But how can a computer tell?

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:
If raycast hit nothing my object stay at end of the ray? How to make an object stay at end of the raycast if the ray hit nothing ?!
Here is my script

using UnityEngine;
using System.Collections;

public class ray : MonoBehaviour {

public float howFar;
public Vector3 loaction;
public Transform spot_position;
public Vector3 loaction_air;

void Start() {

}

void FixedUpdate()  {
    Vector3 fwd = transform.TransformDirection(Vector3.forward);
    RaycastHit hit;

    if (Physics.Raycast(transform.position, fwd, out hit, 100)) {
        print("Ray hit something !");
        loaction = hit.point;
        howFar = hit.distance;
        spot_position.transform.position = hit.point;
    }
    else {
  //            howFar = ....
 //         spot_position.transform.position = ...
        print (" Nothing ");
    }

    loaction_air = new Vector3(spot_position.transform.position.x,spot_position.transform.position.y,spot_position.transform.position.z);
}

}

sentences:
3D-Physics of a Rubber Ball (Squash) I'm trying to simulate the environment on a Squash Court on Android with my own physics and using OpenGL for visualization. Basically, its about a rubber ball bouncing around in 3d, not just on the floor but also on the walls.

What I'm not quite sure about is what kind of physical concepts are altering the movement of the ball or how much they are.

Obviously there's gravity...
Also, air friction, but I'm not sure how to calculate air friction of a rubber ball that is roughly 40mm in diameter. I've tried different formulae but I wasn't happy with them (eg. some were linear to speed and some were quadratic lol) and I was missing some material-dependant constants.
Then there's the normal force applied from the solid shape on which the ball bounces. I don't think I need to alter any values as the normal force is "taken into account" by changing the ball's direction. I mean, if the solid shape where the ball bounces is vertical, normal force is zero but the ball still changes direction. Correct?
Now, every collision reduces the kinetic energy as it emits sound and warms the ball. I assume that this reduction is greater if the ball hits the solid shape on a tighter angle. Is there a way to quantify it? So far, all I could do was use values "to make it look like it might be".
Furthermore, I suspect that the angle at which the ball hits the shape is not equal to the angle in which it leaves the ball. Obviously, if the ball hits at 90° (orthogonal), then it will leave at 90°. On the other hand, if the ball hits at, say, 45°, it might leave at 30° (compared to the solid shape eg. the floor).
There is spin which I have not spend much thought on but if anyone knows where I might find something about that I'd be greatful.
Other forces/effects on the trajectory of the ball...??

Thanks in advance :)

Edit: To summarize, I am looking for (1) an applicable formula that represents air friction with possible constant values depending on the rubber-ball-scenario, for (2) a confirmation that my way of handling normal force is correct, that (3) a way of quantifying energy loss of the ball in a collision, (4) how (if) the angle after the collision is altered, with regard to the incoming angle, and lastly (5) how to handle spin.

sentences:
What's the difference between UnityEngine.Random and System.Random? What's the different between this

int randomNumber = UnityEngine.Random.Range(0, 10);

and this

// on top of the class
private System.Random _rnd = new System.Random();

// inside a methode of the same class
int randomNumber = _rnd.Next(0, 10);

I know System.Random must always be initialized on the top of your class what's by UnityEngine.Random is not needed. I know also that System.Random works with a intern "clock" and the "random" number is based on that.

My question is now are there some other difference between UnityEngine.Random and System.Random and witch code is better to use for an Unity project?

sentences:
Entity Component Architecture - initialization between multiple components I'm starting work on an game set in an isometric world, and I'm having a bit of trouble understanding how to implement certain aspects of the entity component system idea.

Here are the Components and Systems I have so far:

WorldData (only one ever used, contains map and cell sizes)
Camera (currently also only one ever used, though that could change I guess)
WorldPosition (just contains X and Y values, in world space)
Renderable (contains the image to draw, screen position values + offset, and a depth)
Floor (contains the type of flooring and a walk speed)

Now If I create an entity with WorldPosition, Floor and Renderable components, where do I put the logic to enforce certain rules. For example, if Floor.FloorType is set to 'Grass', I want the image in the Renderable component to be set to 'floor-grass.png'. Should this go in something called 'FloorSystem', which checks every entity that has a Floor and Renderable component and updates them? And if so, do I need some sort of 'dirty' flag on Floor to say when it has changed, so that FloorSystem knows to update it and is not updating every floor tile in every frame? Or do I instead create a 'Dirty' component which I attach to that entity when it changes?

Any guidance would be much appreciated! I love the general elegance of this architecture and I think it will work well in my game once I get a better handle on it.

sentences:
How do I check if an iOS subscription is active? How do I check if an iOS subscription is active?  Subscriptions are the only type of purchase available; however, there are several subscription lengths.  I have scoured the internet, but all I can find is receipt verification.

The following code seems to work for Android:

var products = storeController.products.all;
bool subscribed = products.Where(p => p.hasReceipt).Count() > 0;

(although I am not sure if it takes the subscription's expiration date into account.)

But this does not work for iOS.  How can I check to see if they have a valid iOS subscription?

sentences:
TRON: Game A.I algorithm? Lightcycles or whatever it was called like.

Given a 2d array representing the game map, where each element can be either 0 or 1 (0 representing blank space and 1 representing filled space), what is the algorithm used for TRON enemy A.I?

sentences:
Box2D: Efficient method to create b2Chainshapes for a tile-based map? I'm working on a platforming game with tile based levels. I store the collision model for my tileset in an array.

This is how the collision model for a 4x4 tilesheet would look like (I can't post pictures yet so this link will have to suffice: Tileset example). The red dots are the vertices of the b2ChainShape.

When I load a level, I look up the collision model for each tile and create a b2Body at the corresponding place. The problem is that between the tiles, my character can experience a "bump" because it gets stuck on the edge of the shape of the next tile's body.

Is there an existing algorithm to connect the bodies of neighbouring tiles to a single b2ChainShape? Or should I ditch the idea of tile-based collision models all together and simply create the collision model for the whole map with the Tiled map editor? I don't create the the collision map with the Tiled map editor at the moment, because it is very time consuming for slopes and hills.

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:
What are some current techniques for rendering deformable landscapes? What are the current techniques than can be used for efficiently rendering 3D heightmap-based deformable landscapes?

For example, in the non-deformable landscape problem, ROAM used to be the way to these landscapes, but as GPUs advanced it lost favour to the newer geomipmapping/clipmaps (which is not as CPU-bound; but still had big enough wins for current generation GPUs).

Has there been any advancement in terms of deformable landscape rendering?  Not only in terms of rendering, but also throughput during deform operations.

Although I am personally targeting SM3.0/DirectX 9.0c, please don't restrict your answers to that.

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:
2D AABB collision response I'm making a simple platformer, and I wanted simple collision handling. So I gave all my objects an AABB hitbox and tried to resolve collisions. However, I can't get it to work.

My main character has a 32x32 hitbox and my walls have a 16x16 hitbox. I've used the separating axes solution to resolve the collision, like so (unoptimized):

Vec2 Box::Collides(Box* a_Other)
{
    Vec2 sum_extents;
    sum_extents.x = (m_Max.x - m_Min.x) + (a_Other->GetMax().x - a_Other->GetMin().x);
    sum_extents.y = (m_Max.y - m_Min.y) + (a_Other->GetMax().y - a_Other->GetMin().y);

    Vec2 double_center_to_center;
    double_center_to_center.x = (a_Other->GetMin().x + a_Other->GetMax().x) - (m_Min.x + m_Max.x);
    double_center_to_center.y = (a_Other->GetMin().y + a_Other->GetMax().y) - (m_Min.y + m_Max.y);

    bool result = (fabsf(double_center_to_center.x) < sum_extents.x) && (fabsf(double_center_to_center.y) < sum_extents.y);

    if (result)
    {
        return (
            Vec2(
                ((sum_extents).x - (double_center_to_center).x) / 2.f,
                ((sum_extents).y - (double_center_to_center).y) / 2.f
            )
        );
    }

    return (Vec2(0.f, 0.f));
}

My character just falls down onto the floor. I check the object I want to check against every other object and just see which one has the smallest intersection area.

Object* Scene::Collides(Object* a_Test, Vec2& a_Difference)
{
    float smallest_area = 10000.f;
    Object* closest = NULL;
    Vec2 final;

    std::vector<Vec2> check;

    for (uint32 i = 0; i < s_ObjectTotal; i++)
    {
        if (a_Test == s_Objects[i]) { continue; }

        Vec2 test = a_Test->GetCollision()->Collides(s_Objects[i]->GetCollision());
        float area = test.x * test.y;
        if (area > 0.f)
        {
            check.push_back(test);

            if (area < smallest_area)
            {
                smallest_area = area;
                final = test;
                closest = s_Objects[i];
            }
        }
    }

    if (closest)
    {
        a_Difference = final;
    }

    return closest;
}

The hitbox for the player is (32, 229.999995)(64, 261.999994) and the hitbox for the floor is (48, 256)(64, 272). So, the resulting movement (to resolve the collision) is (16, 5.9999930). The y is correct, the x is not. As a result, the player character hits the floor, stays above it and slides to the right very fast.

How do I resolve this collision?

sentences:
Focus object with specific Rotation in unity C# I have different kind of objects with variable dimensions and placed at different position in a scene. I want to focus/display each object with the camera with a hard code rotation (north rotation). Like with specific camera rotation I want to focus the object that it completely show to the camera and center of the screen. For this reason, I have write this code snippet that
1

Get the position behind the specific focus object using
TransformPoint
Provide the elevation using the largest extent of the bound so that it display maximum area of the object.
Assign the position and the fixed rotation

 Vector3 dest = destination.transform.TransformPoint(0, 0, behindPositionDistance);// GetBehindPosition(destination.transform, behindPositionDistance, elevation);
 Debug.Log(dest);
 float eleveMax = Mathf.Max(destination.GetComponent<MeshRenderer>().bounds.extents.x, destination.GetComponent<MeshRenderer>().bounds.extents.z);
 dest = new Vector3(dest.x, eleveMax, dest.z);
 camera.transform.position = dest;
 camera.transform.rotation = lookNorth;

But the problem is, it is not accurately working with all objects as every object is at different position and dimension. I want to focus the full object using the camera but without changing the rotation.

sentences:
What is used for border parameter? I'm learning OpenGL and have a question. I read about Texturing and found border param in glCopyTexImage and glCompressedTexImage functions. In book: "OpenGL Programming Guide" wrote that border is reserved and must be zero? If it reserved why they place it into parameter?

P.S.: I have one idea, is it used for border texture? Like don't read data below that border, isn't it?

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:
Unity - SpriteRenderer. Trying to make sprite from code using Texture2d.whitetexture I have been trying to write a method that fills a rectangle with a color. I've tried it as a new 2D and 3D project just in case, but this gives the same results.

Basically, i want the script to make a new GameObject, give it a SpriteRenderer component and then fill the given rectangle with the given color.

I have tried to work from the Unity docs and other sources of info, but no matter how much I look around, this now looks correct to me but doesnt work.

The result (as pictured) shows the new object with the sprite renderer and even shows the right size (there are blue 'corner' icons in the scene view I can see but no sprite or rectangle of any kind.

using UnityEngine;

public class GameBoard : MonoBehaviour
{
    const ushort cellCount_x = 10;
    const ushort cellCount_y = 24; // only 20 will be visible to player
    const ushort cellsize = 50;

    GameObject testBlock;
    SpriteRenderer testBlockRen;

    private void Start()
    {
        testBlock = new GameObject();
        testBlockRen = testBlock.AddComponent<SpriteRenderer>();
        testBlockRen.sprite = CreateRectSprite(new Rect(0, 0, cellsize, cellsize), Color.red);
    }

    Sprite CreateRectSprite(Rect rect, Color color)
    {
        Texture2D tex = Texture2D.whiteTexture;
        tex.SetPixel(0, 0, color);
        tex.Resize((int)rect.width, (int)rect.height);
        Sprite sprite = Sprite.Create(tex, rect, Vector2.zero);
        return sprite;
    }
}

By the way: I have made sure the camera 'z' is less than 0 (it's -10). And the camera is centred where the sprite is supposed to appear.

Note: I can get a sprite to render fine if I create a texture in gimp and then use Resources.Load() . But I am trying to create the sprite using no source texture whatsoever (other than Texture2d.whitetexture)

sentences:
How to correctly set window size in Libgdx scene2d.ui dialog In my libGDX application I am using the scene2d.ui classes to render my game's GUI. One of the things I render via these classes is a dialog window with a background image set. I have created the uiskin.json file accordingly, and the dialog is shown correctly with the background image.

There is one catch however: The size of the dialog window is exactly set to fit the text elements, but not more. If not much text is shown on the dialog, then the background image is rendered much smaller than it really is.

I can override or hard-code the window size by overriding getPrefWidth() and getPrefHeight() in my custom Dialog class. But that does not feel right.

My question: What is the correct way to set a scene2d.ui dialog with a background image to be as large as that background image, regardless of how much text is being shown?

sentences: Generate static 2D Tilemap from array How do I generate a 2D tile map from an array like in this tutorial for XNA ? I basicly want to generate a static map based on my tile prefabs.

sentences:
What is involved in creating a real-time multiplayer platformer game? I'm creating a platformer game that has a "co-operative" feature which I'd like to work over networks / the internet.

Now I've read up on network game programming including articles like What every programmer needs to know about game networking and so I understand the difference between techniques like Peer-to-Peer lockstep and Server-Client prediction architectures:

I've concluded that for any real-time game that is going to be played over the internet, Peer-to-Peer lockstep simply isn't an option.
I'm also concerned that even for a platformer a simple client-server architecture (without some sort of client prediction) would result in degraded gameplay due to the delay between action and reaction caused by a round-trip to a server. (Having said that I want to eliminate the need for a central server, and so only one of the players, the client, will actually experience this lag).

This leaves client prediction, but even for a simple game like a platformer this still sounds pretty complex.

How would I go about creating a working client predictive system for a multiplayer platformer game?

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:
Shader and Texture Scrolling depending on Direction I am trying to scroll a texture using its uv in Unity but I don't get the result I need.

The aim is to have two components, the speed and the direction. I would like to define the direction in normalized values and the speed should influence the velocity of the scrolling according to the direction.

If I change the speed at runtime, I don't want to have some hiccups but maybe this should not be handled but the GPU.

How can I do that in a better way, maybe using matrix ?

Here is an example but the result is not as good as expected.

uv.xy = uv.xy + frac(_Time.y * float2(_Direction.x, _Direction.y));

sentences:
HTML5 clicking objects in canvas I have a function in my JS that gets the user's mouse click on the canvas.

Now lets say I have a random shape on my canvas (really its a PNG image which is rectangular) but i don't want to include any alpha space.

My issue lies with lets say i click some where and it involves a pixel of one of the images. The first issue is how do you work out the pixel location is an object on the map (and not the grass tiles behind).

Secondly if i clicked said image, if each image contains its own unique information how do you process the click to load the correct data.

Note I don't use libraries I personally prefer the raw method. Relying on libraries doesn't teach me much I find.

sentences:
DOM for GUI - display animated objects I'm creating an HTML5 game using Canvas, but want to use DOM for the GUI for the reasons mentioned in there articles:

http://blog.sklambert.com/html5-game-tutorial-game-ui-canvas-vs-dom/
http://www.html5gamedevs.com/topic/29569-how-do-you-guys-build-your-ui/
http://www.html5gamedevs.com/topic/802-gui-methodologies/

That being said, we have a component on the GUI that needs to be animated which will be through a sprite. Is it possible to render sprite animations through a DOM element?

sentences:
How does a segment-based rendering engine (as in Descent) work? As far as I know Descent was one of the first games that featured a fully 3D environment, and it used a segment based rendering engine.

Its levels are built from cubic segments (these cubes may be deformed as long as it remains convex and sides remain roughly flat). These cubes are connected by their sides. The connected sides are traversable (maybe doors or grids can be placed on these sides), while the unconnected sides are not traversable walls. So the game is played inside of this complex.

Descent was software rendered and it had to be very fast, to be playable on those 10-100MHz processors of that age. Some latter levels of the game are huge and contain thousands of segments, but these levels are still rendered reasonably fast. So I think they tried to minimize the amount of cubes rendered somehow.

How to choose which cubes to render for a given location? As far as I know they used a kind of portal rendering, but I couldn't find what was the technique used in this particular kind of engine. I think the fact that the levels are built from convex quadrilateral hexahedrons can be exploited.

sentences:
android 2d bullet-spawn (shooting) This will be a quick question since Im pretty sure I'm overlooking something small that I for some reason cant see.

My sprite is moved using a joystick, and I want my sprite to be able to shoot. I've got the direction and speed of my bullet working, but I cannot get it to shoot from the right place (my sprites location).

Code for moving sprite:

    angle = Math.atan2(touchingPoint.y - inity,
                touchingPoint.x - initx) / (Math.PI / 180);

        pointerPosition.y += Math.sin(angle * (Math.PI / 180))
                * (touchingPoint.y / 90); //Sprites y-position
        pointerPosition.x += Math.cos(angle * (Math.PI / 180))
                * (touchingPoint.y / 90); //Sprites x-position

Current code for moving bullet:

    if(shooting){
        bulletPos.y += Math.sin(angle * (Math.PI / 180)) * 2;
        bulletPos.x += Math.cos(angle * (Math.PI / 180)) * 2;
    }

Since the angle is calculated using constants I get why my bullet only spawns at one place, even tho Im moving my sprite around. My question is, how do I fix this?

First time working with vectors like this and all I can find on stack is logic for tower-defence games, if there is a duplicate of this question I apologise but really cannot find it.

sentences:
Adobe Air turn based multiplayer Game, sockets vs http bandwidth I am developing an Adobe Air multiplayer game for iPad.
It is turn based and not realtime. It is like checkers game.
I want to use a client server model.
I have found 2 options to connect to server so far:  socket connection and http requests

My question is:
Is the bandwidth requirement for socket connection vs http requests different?
I need the game to work with very low speed internet connections

sentences:
How to calculate rotations for an object with scaling transformations? I am working on implementing scaling transformations into a game engine (C++), which previously assumed only translations and rotations. Visually, the scaling works, but a lot of the game logic started to break.
For example: I have a turret, which is a composite object (turret base --> weapon). I need to change the turret's yaw and pitch so it faces the target when it fires. To do this, I first get the target position in object space by inverting the object transformation matrices (taking into account that the gun may be offset from the turret base), and I use the resulting point to calculate the necessary yaw and pitch.
void Rotate_Turret(Turret t, Vec4 targetPos)
{
    // Get the TF matrices
    Mat4 turretBaseTf = Get_Tf(t.TurretBase);
    Mat4 turretGunTf = Get_Tf(t.TurretGun);

    // Calculate target in the turret base space (for yaw)
    // "inv" transposes the rotation part and inverts the translation
    Vec4 baseSpaceTarget = inv(turretBaseTf) * targetPos;

    // Calculate yaw
    float relativeYaw = atan2(baseSpaceTarget.Y, baseSpaceTarget.X);

    // Get the offset of the gun from the base
    Vec4 gunOffset = inv(turretBaseTf) * turretGunTf.Translation();

    // Get the XY plane component of the base space target vector
    float targetDistanceXYBase = sqrt((baseSpaceTarget.X * baseSpaceTarget.X) + (baseSpaceTarget.Y * baseSpaceTarget.Y));

    // Get the vector components for the gun, taking the offsets into account
    float targetDistanceZGun = baseSpaceTarget.Z - gunOffset.Z;
    float targetDistanceXYGun = targetDistanceXYBase - gunOffset.X;
    float relativeTilt = atan2(targetDistanceZGun, targetDistanceXYGun);

    // Set the rotations
    t.Rotate(relativeYaw, relativeTilt);
}

This works fine at 1:1 scale, but as soon as I upscale the turret at the root level, it keeps shooting consistently above the target. I tried inverting the scale in the matrices in the above process, but it doesn't seem to work. What am I doing wrong?
Thanks in advance for the help!

I double-checked every bit of the math by calculating the angle directly between the weapon and the target position, and I compared that to the results of the code described above. I'm pretty sure I'm getting the correct results, so I don't get why it doesn't tilt the weapon correctly (the Z angle is correct, i.e it turns exactly toward me, but doesn't tilt the gun low enough).
The only thing I can think of is that somehow the resulting tilt angle itself needs to change based on scale, since a scaled matrix will have another rotation matrix applied to it afterward (i.e when I apply the rotation to the turret weapon to make it aim at the target)

sentences:
Move gameObject in its facing direction I have the following four gameObjects, they have, respectively, the rotations: -90, 0, 90, 180. I want them to move as denoted in the image below

This is what I got so far:

public class Projecttile : MonoBehaviour
{
    public float speed;

    private void Update()
    {
        transform.Translate(transform.up * speed * Time.deltaTime);
    }
}

The result of my code is the following:

Why does my code result in this outcome, and how can I make each gameObject move in the direction it's facing?

sentences: Shortest path from BitmapSource to DX11 Texture2D Does anyone know a way to get from (WPF) System.Windows.Media.Imaging.BitmapSource to a DX11 Texture2D without going to System.Drawing.Bitmap? I'm trying to strip out all System.Drawing references as this code it for WPF only.

sentences:
Intellisence doesn't show the ECS API Summaries I am not sure if this is more of an ECS topic problem or packages in general. but it would be really helpful for ECS programming with all the summaries the Unity has provided. For unity engine methods, intelligence show me descriptions and summary of classes and methods, but it doesn't work on packages I guess.

I have tested this with all IDEs, AutoComplete doesn't show the description for methods and classes. However, I can go to the declaration of packages source code and see the summary. for example, Below you can see a screenshot in the Jetbrain Rider IDE, as you see when I mouse over OnCreate method it doesn't show the description.

sentences:
samplerCube for point light shadow map has dark corners relative to screen aspect ratio / size? I almost have point light shadows working but the corner of the samplerCube that I use for the shadow map has corners that get darker depending on the main camera. Is this something to do with a transform into a different space somewhere? I followed learn-opengls tutorial on this and they don't seem to have this issue or it just didn't come up in their simple example.

Here a YouTube video of the problem because it is kinda hard to explain... https://youtu.be/FXpwgyJh1ZA

That shows the depth map sampler not the shadows by the way.

This also happens when the radius is almost 0 and the cube map is completely white.

float PointLightShadow(
    vec3 NegL, // FragWorldPos - pointLights[i].Position
    float R)   // radius of light
{
    if (mat_hasShadowMap2 == 0) {
        return 1.0f;
    }

    float closestDepth = texture(mat_shadowMap2, NegL).r;
    float currentDepth = length(NegL);

    float bias = 0.05;
    float shadow = R * closestDepth > currentDepth - bias ? 1.0 : 0.0;

    return closestDepth; // for this example
}

Sending light position to shader

...
m_lightData.PointLights[i].Position = lights[i]->Position(); // setting in world space
...

and for the FragWorldPos

...
out vec3 FragWorldPos;
...
vec4 worldPos = model * vec4(vert, 1);
FragWorldPos  = worldPos.xyz;
...

and then the fragment shader has a matching in variable.

I think like 99% of this is working, I just don't understand why the cube map seems to have these dark corners. They change aspect by changing the screen also suggesting that they are in some type of camera space, but I don't see where that would happen. Let me know if you need more context for the code snippets, these are the only important parts I think though.

sentences:
Will an XNA "XBox 360 Project" also work on Windows? I understand that an XNA project for XBox 360 will use a specialized version of the .NET Compact Framework.  But let's say I want to release for both XBox 360 and Windows.

Will the XBox version (using compact framework) still work if distributed for Windows, or would I need to rebuild against the regular framework (or the non-Xbox CF) in order to distribute?

sentences:
Raycast implementation in order to optimizate collision-detection I want to know if a gameobject (a plane) is facing another one to prevent collisions. Right now I have an array that contains all planes in the scene and, for each one, compare position in order to detect if is facing it or not. The number of planes is small, but I want to increase it and this method is a little... Mean.

I was thinking to implement a raycast to detect if the gameobject has another one in front of it. Is it worth? Will it be less expensive? I think that raycast it's very expensive. In addition, I think that I will have to run three raycasts for every plane.

Obviously this is not executed every frame, but every two seconds.

sentences:
Unreal Engine: Third person example project and multiplayer I was fiddling around with multiplayer stuff in Unreal Engine. I looked into events that run only on server, multicasting events, replication of variables...

But there is something that I dont quite understand: When I load the Third Person example proyect, and enable more than one player, I can see the position and movements of the players being replicated on all clients.

While I understand that the position and the rotation of the players being replicated successfully (since the replication option is enabled in the pawn's blueprint option), I don't really understand why the animations are being replicated. I don't see any reference in the blueprint making animations replicated over the network.

Are pawn animations implicitly replicated on clients when replicating the actor's position? Am I missing some option/configuration I'm missing?

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:
Making a border around a translucent shape in LibGdx The recommended method for making a border around a shape using LibGdx is to draw a larger version of the shape to serve as the border, then draw the shape over the larger image.

shapeRenderer.setColor(borderColor);
shapeRenderer.circle(x, y, radius + borderWidth);
shapeRenderer.setColor(shapeColor);
shapeRenderer.circle(x, y, radius);

This works well most of the time, but if you want shapeColor to have any opacity less than 1, it fails.  The problem is that you can see the borderColor through the shape, and the colors are blended.

Is there anyway to fix this issue?

sentences:
Bold black bar on right side of game in Unity (Android) I am trying to create an endless runner. I have already created a system to generate infinite backgrounds from an array of some. However, on running the game, I get huge black bar on the right side of the screen, both on PC and on Android phone.

Here are the screenshots :

One more thing, on Android, it doesn't even display the left side of the game, i.e, where the character is. It looks like the things are displaced towards left.

Also, the game is a scrolling on and everything is scrolling but behind that bar. It just doesn't go.

I hope I can get some help. Ask me if you need any piece of code.

EDIT :

"CameraFollow" script

 using UnityEngine;
using System.Collections;

public class CameraFollow : MonoBehaviour {

    public GameObject targetObject;
    private float distanceToTarget;

    // Use this for initialization
    void Start () {
        distanceToTarget = transform.position.x - targetObject.transform.position.x;

    }

    // Update is called once per frame
    void Update () {

        float targetObjectX = targetObject.transform.position.x;

        Vector3 newCameraPosition = transform.position;
        newCameraPosition.x = targetObjectX + distanceToTarget;
        transform.position = newCameraPosition;
    }
}

My "GeneratorScript"

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

public class GeneratorScript : MonoBehaviour {

    public GameObject[] availableRooms;

    public List<GameObject> currentRooms;

    private float screenWidthInPoints;

    // Use this for initialization
    void Start () {
        float height = 0.0f * Camera.main.orthographicSize;
        screenWidthInPoints = height * (Camera.main.targetDisplay);
    }

    // Update is called once per frame
    void Update () {

    }

    void FixedUpdate()
    {
        GenerateRoomIfRequred ();
    }

    void AddRoom(float farhtestRoomEndX)
    {
        int randomRoomIndex = Random.Range (0, availableRooms.Length);

        GameObject room = (GameObject)Instantiate (availableRooms [randomRoomIndex]);

        float roomWidth = room.transform.FindChild ("floor").localScale.x;

        float roomCenter = farhtestRoomEndX + roomWidth * 3.0f;

        room.transform.position = new Vector3 (roomCenter, 0, 0);

        currentRooms.Add (room);
    }

    void GenerateRoomIfRequred()
    {
        //1
        List<GameObject> roomsToRemove = new List<GameObject>();

        //2
        bool addRooms = true;

        //3
        float playerX = transform.position.x;

        //4
        float removeRoomX = playerX - screenWidthInPoints;

        //5
        float addRoomX = playerX + screenWidthInPoints;

        //6
        float farhtestRoomEndX = 0;

        foreach(var room in currentRooms)
        {
            //7
            float roomWidth = room.transform.FindChild("floor").localScale.x;
            float roomStartX = room.transform.position.x - roomWidth * 6.0f;
            float roomEndX = roomStartX + (roomWidth * 13.0f);

            //8
            if (roomStartX > addRoomX)
                addRooms = false;

            //9
            if (roomEndX < removeRoomX)
                roomsToRemove.Add(room);

            //10
            farhtestRoomEndX = Mathf.Max(farhtestRoomEndX, roomEndX);
        }

        //11
        foreach(var room in roomsToRemove)
        {
            currentRooms.Remove(room);
            Destroy(room);
        }

        //12
        if (addRooms)
            AddRoom(farhtestRoomEndX);
    }

}

(I tried playing with the numbers on GeneratorScript, but nothing seemed to help.

sentences:
Render in a imGui Window How do i render my game scene into an imgui window?

I want to get from this:

to this :

sentences:
Google Play Services somehow authenticates without internet connection This question is asked in the context of the Google Play Services plugin for Unity.

Following the documentation for the Google Play Services plugin for Unity, I called the Social.localuser.Authenticate() function in my game to check if the player is authenticated (ie: logged in to google play services).

Here is the authentication code that I am currently calling:

void Awake ()
{
    PlayGamesPlatform.Activate();

    Social.localUser.Authenticate((bool success) => {
        if (success)
        {
            GetLeaderboardData("FirstLoad");
        }
        else
        {
            loadingText.text = "Failed to connect to Google Play Services.";
            StartCoroutine("WaitAndStart");
        }

        authenticated = success; //success returns true even without an active internet connection
    });
}

This works fine with an active internet connection. However, if the player has logged in before, and then launch the game without an internet connection, this function somehow returns true. It doesn't make sense (at least not to me) that the player can authenticate without an active internet connection. Does anyone know if this was intended? (Or if I made a mistake of some sort somewhere?)

Should it have been indeed intended (and the method is checking against a cache of some sort), is there no method to check if the player has an active connection to google's servers? Something along the lines of PlayGamesPlatform.CheckConnection()?

sentences:
Is reinforcement learning overkill for a vehicle steering bot? I'm slightly familiar with the reinforcement learning (through this edx.org MOOC). Also I'm aware of reactive planning technique. I want to write a vehicle bot for a racing game, where cars have to complete laps and avoid collisions.

Is it sensible to use reinforcement learning for steering? Or should I stick with reactive planning?

sentences: What is the fastest way to work out 2D bounding box intersection? Assume that each Box object has the properties x, y, width, height and have their origin at their center, and that neither the objects nor the bounding boxes rotate.

sentences:
GL_EXT_shadow_samplers killing my shader I have the following fragment shader for my scene

#extension GL_EXT_shadow_samplers : require
...
vec4 color = texture2D(uTextureUnit0, varTexCoord0);

if (colorTransformEnabled != 0) {
    vec3 transformedColor = colorTransform * color.rgb;
    color = vec4(transformedColor, color.a);
}
gl_FragColor = color;

this works like expected.

Now I add this line:

float shadow = shadow2DProjEXT(uShadowTexture, varShadowCoord);

and boom my shader does not produce any output at all.
GL_COMPILE_STATUS and GL_LINK_STATUS do not return any error messages. Any idea where to go from here to debug this?

Edit:

I'm on iOS and GL_EXT_shadow_samplers is supported.

Edit:

I forgot to check for error at some point. Now I get a GL_INVALID_OPERATION on glDrawElements. Any idea what could cause this problem? Since I do not get the error when I don't use the shadow2D functions.

Edit:

The following state change overview might help some more:

Where GL_TEXTURE0+1 is the depth texture and GL_TEXTURE0 is the objects texturea

Edit:

I found out that it produces the error as soon as the shader contains a call to shadow2DProj the invalid operation error is thrown. Although the shadow2DProj function is never called in the shader. And it still throws the error if shadow2DProj is called.

sentences:
LibGDX - Sending event to a button behaves differently from actually clicking it I have a button on screen, and I want the user to be able to dismiss it by either clicking on it, or hitting space. The button is constructed as follows:

button = new TextButton("RESUME", skin);
button.setVisible(false);

button.addListener(new InputListener(){
  @Override
  public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
    return true;
  }

  @Override
  public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
    button.addAction(
      Actions.sequence(
        // send out of the screen
        Actions.moveTo(WORLD_WIDTH / 2 - button.getWidth() / 2, -button.getHeight(), 0.2f),
        Actions.hide(),
        Actions.run( () -> {
          resumeGame();
        }),
        Actions.removeActor()
      )
    );
  }
});

...
table.add(button);
stage.AddActor(table);
...

So if I make the button appear and click on it, everything is fine. I can repeat the sequence "button appear/click" at will, and each time the button will move offscreen to the bottom and will be removed from the table. I want the button to do exactly the same when the user hits space, so I did:

private void clickButton(TextButton button){
    InputEvent inputEvent = new InputEvent();
    inputEvent.setRelatedActor(button);

    inputEvent.setType(InputEvent.Type.touchDown);
    button.fire(inputEvent);

    inputEvent.setType(InputEvent.Type.touchUp);
    button.fire(inputEvent);
}

// then:

stage.addListener(new InputListener(){
  @Override
  public boolean keyDown(InputEvent event, int keycode) {

    if (keycode == Input.Keys.SPACE){
      clickButton(button);
      return true;
    }
}

Now when the button is shown and I hit space, it looks like it works, but if I make the button appear again, it's shown briefly then it disappears (it's removed from the table). It's like the final Actions.removeActor() in the button listener is not executed when the button is "clicked" using space, and it's then executed the next time when the button appears again, making it disappear immediately.

EDIT: this is indeed the case. I put a debug print statement right before the Actions.removeActor() action, and upon mouse click the text is printed, but using clickButton() it's not (and it's printed instead when the button is shown again and readded to the table).

Am I doing something wrong here? What's the "correct" way to click a button programmatically (yes, I've already seen https://stackoverflow.com/questions/25870645/programatically-perform-click-on-actor-libgdx)

sentences:
Moving character on x axis I am new to unity scripting.

I am trying to move my character towards right side(on x-axis) to create a running effect, I've imported the character from blender which contains two animations, "jump" and "run". What I want to do is I want my character to move on x-axis for which I've written following code

void Update () {
    transform.Translate(5f * Time.deltaTime, 0f, 0f);
}

But I am facing one problem, if I set my character's y-axis rotation to 90 degrees in order to make him look towards right side I am getting strange results. That is, in play mode instead of moving towards right side(on x-axis) it move on x-axis and z-axis simultaneously & if I set the y-axis rotation to zero it behaves like I want it to. Please see the attached image for detail. How can I solve this problem?

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:
since unity upgrade, OnSceneLoaded not getting called on scene start I upgraded my unity project to 2018.3.11f.  Since that upgrade, the OnSceneLoaded event is not getting called, even though I am registering the event handler.

Here's the class:

public class SceneSwitcher : MonoBehaviour
{
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        print("scene loaded: " + scene.name);
    }

    void Start()
    {
        print("SceneSwitcher.Start() called");
        print("adding event handler to SceneManager");
        SceneManager.sceneLoaded += OnSceneLoaded;
    }
}

here's the console output:

SceneSwitcher.Start() called
UnityEngine.MonoBehaviour:print(Object)
SceneSwitcher:Start() (at Assets/Scripts/SceneSwitcher.cs:45)
adding event handler to SceneManager
UnityEngine.MonoBehaviour:print(Object)
SceneSwitcher:Start() (at Assets/Scripts/SceneSwitcher.cs:46)

scene loaded: 3 is never in the console output.

I see others have had this problem, with no answers.

This code worked before the upgrade.  Now I am stuck.  Not sure what I can do.  Any help is appreciated.

Thnx

sentences:
Synchronization between several glDispatchCompute with same SSBOs Let's say I have one compute shader A which writes to an SSBO, and then a second compute shader B which reads from the same SSBO.

Do I need to do anything special to ensure that A has finished executing before B starts?

sentences:
How does MMO flash games works? I want to know how does MMO flash games work, for example: Dofus and Club Penguin.

I want to know if by ony using Adobe Flash and ActionScript you can do MMO games, or if there is other way to work with ActionScript and Flash beyond Adobe Flash.

sentences:
Libgdx - accelerating string displaying My renderBoard is slow and it's because of font.draw function. I read that I should use stringBuilder instead of string, but it didn't help at all. I suppose I'm using it wrong. Could you guide me to the right way?

public void renderBoard(SpriteBatch sb, BitmapFont font) {
    int L = 0;
    String string;
    ...
    // "size" is a private variable of the class, the same goes for "stringBuilder"
    for(int k = - size + 1; k <= size - 1; k++) {
        for (int j = 1; j <= size - Math.abs(k); j++) {
            string = L + "";
            for(int g = 0; g < string.length(); g++) {
                stringBuilder.setCharAt(g, string.charAt(g));
            }
            sb.draw(
                    this.getTexturesArray().get(L),
                    x_j_k_position,
                    y_j_k_position
            );
            font.setColor(Color.WHITE);
            font.draw(
                    sb,
                    stringBuilder,
                    x_j_k_position,
                    y_j_k_position
            );
            L++;
        }
    }
}

If I comment out the font.draw line, the game accelerates, so I guess here lies the problem.

sentences:
Everything turning black when pitching down Just a quick questions about something that's occurring in my world. Every time I pitch my camera downward, everything starts turning black, and if I pitch upward, everything sort of intensifies.

I'm multiplying my normals by the normal matrix in the shader, and I'm multiplying my lights direction by the model view matrix.

If I leave the normal and light dir in world space everything ends up fine.

I thought putting them both in view space would not cause those weird things to happen?

sentences:
Keeping simulations in sync over long periods of time I'm working on a multiplayer game which involves a huge amount of predictable AI enemies, and a few other players. The enemies are the most important to be accurate, because the game involves pixel perfect dodging.

In deciding how to network this game, there are two main objectives:

Smallest possible bandwidth usage.
Game remains playable over bad connections, like wifi & mobile.

I have thought of this system:

On connection, send full server state to client.
Client & server both simulate all enemies.
Server sends updates on what tick it is currently on, and anything that's non-predictable (other player movement, etc), but does not include the enemy details.
Ensure simulation is deterministic by sharing implementation, using fixed timestep, share random seed, etc.
If client gets out of sync, can re-sync by requesting all information again. Can check via tick number or via some checksumming mechanism.

The problem:

How to deal with clients & servers going out of sync due to tick rate discrepancies?

Normally I'd use a delta based on the last tick for the simulation, but the need for a fixed timestep (to avoid floating point error) means that's impossible. If the client or server is running slightly slow or fast, it'll get more and more out of sync. If the sync gets bad enough, we can re-sync.

My basic testing with a Chrome client shows that skew can happen fast and consistently, getting about a tick out of sync every second (at 30fps). Even 1 or 2 ticks off can really ruin the game experience since it's a pixel perfect avoidance game. It seems we'd need to resync every second or so, which may also be jumpy and look weird, though interpolation could smooth it out.

Is my system fundamentally flawed, or is this something that can realistically be smoothed out?

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:
How to draw textured tile map in opengl I am trying to create a textured hexagonal tile map in opengl. I have the VBO and respective index buffer. Additionally I have a texture atlas for texturing individual tiles. I'm attempting to create a distinct texture for each hex without mixing the textures.

I understood that one should use a pair of (U,V) texture coordinates for each vertex. Now if the tile map would not be indexed and have the overlapping vertices, I could just set the texture coordinates for each vertex and get each hex rendering the correct texture. However, with indexing the overlapping vertices are gone and I can only set single pair of texture coordinates for each vertex which results in the textures mixing inside the hexes. Is there a way to texture tiles with indexing or another alternative approach to creating hex maps with different textures?

sentences: Godot: Possible to create a 2D tilemap and set it as a texture for a 3D surface? If I created tilemap of some sort of pattern or image and wanted to set it as the texture of a 3d surface or 3d model, how would I do it?

sentences:
Circular dependency when creating entities I have the following problem:

I have a a class called Stage, that keeps an list of entities, which it iterates over every update loop, and updates them.
One of these entities might be a weapon (PEW PEW!) that when updating spawns new entities (projectiles, KA-ZOOM, KER BANG!).
How do I add these new entities to the list in of entities in Stage?
Currently, I have Stage as an singleton with global access, so that the entities which in turn spawns entities just calls the instance of Stage's addEntity method, but that feels silly.

Stage -> Entity (weapon) -> Stage again?

I have a similar problem when creating enemies:

Stage -> Entity (enemy wave) -> Stage again

I've been thinking about passing the List into all entities that can create other entities, but then I'd have to change the update method for the base Entity class so that it takes this list, a list which most entities have no need of.
Also, when adding an entity to Stage, Stage must be made aware of a number of graphics components for that entity, in order for Stage to be able to tell the renderer (which has an OpenGL context) to load the appropriate resources for those graphic components.

Any ideas what I should do?
Am I doing it the wrong way now?

Also, while we're at it, why is Singletons so frowned upon?

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:
Unity look at rotation on one axis only problem Hey I would like an object to look at another object only at one axis, when I rotate the white cube all around the gray cube (gray has look at script), the gray cube flips as soon as the target passes the middle and is on the right side. How can I fix this, so that rotation is normal.

Below is when the cube (target, white).

Below is what happens when the cube (target) passes on the other side, as you can see by the texture the gray cube flips horizontally.

Below is how it should be (texture shows difference)

Code:

    Quaternion lookAngle = Quaternion.LookRotation(targetPos, Vector3.up);

Thanks in advance!

sentences:
Fullscreen FPS slowdown in Linux I've got a homemade game engine that supports both Windows and Linux using Win32 and Xlib, respectively. By default, the engine will create the window and then switch it into fullscreen mode. When running in Linux, the main game loop updates with a very low framerate (2-7 FPS) that slowly keeps ticking downwards. If I alt-tab out and then alt-tab back in, the game will shoot up to and stay at a consistent 60 FPS.

Since my time since last tick (dt) keeps increasing during this time, my thought is it has something to do with the game not being properly registered as "fullscreen" when it's initially opened, leading the CPU scheduler to not give it full priority. That being said, that's entirely speculation. Does anyone have any idea what the cause of this could be? I can provide code samples if requested.

System info:
Linux Mint 17 Cinnamon 64-bit
Intel Core i7 @ 3.40GHz x 4
8GB DDR3 RAM
Nvidia GeForce GTX 680 with proprietary driver

Edit
My update loop is as follows:

while (gameIsRunning) {
    auto currentTime = std::chrono::steady_clock::now();
    auto dt = std::chrono::duration<float>{currentTime - lastFrame};
    if (dt >= engine->getFrameInterval()) { // getFrameInterval returns (1 / the target framerate) in seconds; in this case, 1/60s
        if (dt >= engine->getFrameInterval() * 2) {
            lastFrame = currentTime;
        } else {
            lastFrame += std::chrono::duration_cast<decltype(currentTime - lastFrame)>(engine->getFrameInterval());
        }

        // input, update, draw...
    }
}

After fooling around with it a bit, this creates a situation where the framerate will jump back up to 60FPS, tick down until it hits about 30FPS, and then jump back up to near 60FPS before ticking down again.

sentences:
What values to construct "Projection Matrix" from? I am curious to what standard values I should use to create a camera's projection matrix, as well as if certain measurements need to be taken if I want to represent a very small world or a very big world and make it feel natural.

What values (field-of-view, nearplane, farplane) to construct a projection matrix should be used if:

1 unit to represent 1 meter?
1 unit to represent 1 cm?
1 unit to represent 100 meter?

sentences:
C++ friend class, rendererer and mesh I often hesitate to use friend classes in C++. Since it often does not feel right, or just seems to be an indicator of bad design. Though, in this case I think a friend class might improve the design. Let me explain:

Let us say I have a very simple mesh class:

class Mesh {
    friend class Renderer;
public:
    using Vertices = std::vector<Vertex>;
    Vertices::iterator begin() {
        return vertices_.begin();
    }
    Vertices::iterator end() {
        return vertices_.end();
    }
    void invalidate(){
        valid_ = false;
    }

private:
    Vertices vertices_
    bool valid_;
}

The renderer looks something like this:

class Renderer {
public:
    void render(Mesh & mesh){
        if (!mesh.valid_){
            //The mesh has changed, update internal data.. GL buffers etc.
            mesh.valid_ = true; // Mesh becomes valid again.
        }
        //render...
    }
}

So, this is of course a very simplified example. My question is, if this is a good design in this case? Clients can only call invalidate() on meshes. And only the renderer is allowed to "validate" a mesh again. Without a friend class, A public setter would have to be used in the Mesh class. Hence providing a "leaky" interface. Allowing clients to "validate" meshes, which I do not want.

Edit to clarify

A valid mesh in this sense means that its corresponsing data in other subsystems is the same. The renderer has its own mesh data in its own form (a GL buffer). Therefore, only the renderer should be able to validate, since it knows about its own mesh data. Clients can edit meshes, and invalidate them only.

sentences:
Rotate a point in 3D space with sine and cosine I got my camera controlled by the mouse. Now I want a sphere to be always in the center of my view(just for testing). I tried that by assigning the sine of the Y rotation of the camera times 10 as the X coordinate and the same for the Y coordinate but with cosine:

SphereX = 10 * math.sin(YRotation)
SphereY = 10 * math.cos(YRotation)

But now I would like to know how to set the Z position. I can set the proper height of the sphere by doing that:

SphereZ = 10 * math.sin(XRotation)

But the problem is, that the sphere is only moving up and down and the moving towards the camera is ignored. How can I fix that?

sentences:
UnityIAP Subscription Purchase Basically I want to setup UnityIAP for implementation of weekly or monthly subscription for apple store game. I completely read following article given by Unity:

Integrating Unity IAP In Your Game

After this I become aware with actual implementation but i have following questions arise:

how we can get information about subscription already purchased by this user?
how we track time for auto renewable subscription purchase?

Please give me some information about this.

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

Chromadepth answer

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

I am using this texture

The result for far.

Shader "Unlit/ChromaDepthEdge"
{

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

          struct appdata
          {
              float4 vertex : POSITION;
          };

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

          float4x4 _InverseViewMatrix;

          float _Threshold;

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

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

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

              float2 uvDist = 3 * _MainTex_TexelSize.xy;

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

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

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

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

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

    }
}

What did I miss ?

Thanks in advance.

sentences:
2D Matrix Transformation (with a Player and Ground) I have a simple game that I'm trying to do for learning purposes, but Matrices are a bit hard, especially in DirectX.

I currently have a tilesystem that renders tiles at the screen and a character position at the center (on startup)

When the player move to the left, the ground should move to the right so he's always at the center of the screen. I use a Sprite to transform the Tiles and the player, but having trouble because the ground is moving and the player stands still on the ground still positioned at the center.

This is a topdown 2D game so I only need to transform Position (and perhaps rotation)

My Camera class has this method:

D3DXMatrixTransformation2D(&View, NULL, 0, &Scale, &Center, D3DXToRadian(Rotation), &Position);

I've also tried (for the Camera):

D3DXMatrixTranslation(&View, Position.x, Position.y, 0);

then when I render the ground sprite I set it to transform to the camera, but the Player has it's own Matrix that I use when he's moving.

Exactly like the one above but with his position, rotation and such...

What am I missing and what do I need?

I only have a tilesystem that fits the width/height of the screen so I should see when he's moving but he's standing still at the center and the ground and the player is moving.

Do I need to invert the matrix so that the ground moves in the opposite direction?

sentences:
PHP Browser Game Private Messages? First off, I'm asking this question here because gaming and messaging are intimately connected.  Why win if you can't gloat?  Nevertheless, I won't be offended if this needs to be moved to overflow.

I need a PM system for my browser game, which already has a user and authentication system (To clarify: the game already has a user system).  Specifically, I'm wondering if a PHP library already exists that I can use to save some time.  Better yet, if anyone knows of a nice Codeigniter library for messaging, that would be perfect.

I already have a good idea on how I would approach this if I have to write my own, but it seems like something that would already exist in a robust form (despite my failed Google searches).

Requirements:

Messages can be sent to individuals,  multiple users, and guild mates (which is essentially just multiple users with server-side selecting who to target).
Users can reply to individual or all recipients
Messages appear in sender's outbox and receiver's inbox.
Utilizes some 2-table design to handle marking read / deleting messages on a user-by-user basis
Messages are semi-threaded.  I.e. I won't necessarily have them appear in the GUI as threaded, but previous messages should be included at the bottom of a reply.  Maybe better to say, previous messages are identifiable and accessible.  (This, I'm not yet 100% sure how I would design if I write my own.  I.E. whether to include the text of the previous message into the new message or somehow remember the previous message's database ID to link later)

Technology in Use: PHP, Codeigniter, Javascript, JQuery, Ajax, Sqlite

Note:
I have seen that there are some similar questions on overflow, but they were very little help in the answer department. Otherwise, people were looking for either chat boxes or more umm.. like social media site threads, which I find a bit different than something you would find in a game.

sentences:
What is the correct way to seperate (react) view from state? I would like to know the correct implementation to declare game logic and view logic:

I see 3 ways of implementing this:

1.Storing (eg writing preprocessing to store the change to a property) property changes to data entities that are dispatched to listener(s) of the data entity. The main listener being the view, where the view contains the declared rendering logic (ie changing the entities animation based on a property change, changing the entities render object position).

  State Model (x,y,z,state) -> View (listens to change in
  x,y,z,state)->Scene graph object (x,y,z,animation, gets set by the View)

The issue with this is that it becomes evident that game engines are executing a lot of char[] switch statements (eg the names of properties) in the View.

2.Declaring the view as updating to the entirety of the model. Eg, instead of saving the changes as specified in 1) the view updates the render objects on every tick by inspecting the entire model, as opposed to the provided changes of 1). The tradeoff between 1 and 2 is the necessity of the additional execution of storing the property changes on the state tick.

3.Declaring animation logic in the state logic. Eg, instantiated member render objects are dummy objects when rendering is not performed.

The questions:

As specified in the title, what is the correct implementation to reacting to the game state  in the sense of where should one declare display/rendering/animation (view) logic that reacts to the game state?
What is the implementation used in most game engines that facilitate large projects? (if possible, please specify for specific engines: SupremeCommander/clones, SC2, Unreal, ID, Frostbite, Anvil)
Which implementation do studios implement to architect projects using said engines? It's apparent that it is possible to not seperate model from view in the above engines. Eg, if you implement an entity, you would presumably want it to be viable in multiplayer, coop, and single player.

The questions regarding other engines deals with the fact that perhaps it has been evaluated that it is not a sufficiently optimized implementation to consume the state in a View as opposed to executing direct calls to render objects.

So, on tick we update the game data simulation. For example:

  The state of a unit's weapon is updated to firing. However, updating
  the view of the weapon to firing (by for example, setting the animation of the weapon and animating the hand) is not necessary in all
  instances of the simulation.

sentences:
Will changing the scale of objects in Unity have adverse effects? Relative to what they are by default, I mean. For example compared to the character controllers that come with Unity. If I make the character 4 times the size, will that cause problems, with the physics and everything? Or are there just changes in a couple values that I'd need to make?

Does Unity expect that 1 unit will always be around 1 meter?

sentences:
CopySubresourceRegion results in no-op I'm having some trouble copying a subregion from a source texture (2D) to a destination texture.

Both textures are mipmapped 2D textures, with dimensions (at mip 0) of 512 x 32.

Rather than tell you about each parameter, it's easier to show you, according to the Visual Studio debugger, at the call site:

So, question 1: Is there anything wrong here that would cause CopySubresourceRegion to fail? There is nothing in the Debug window (the debug layer is enabled). The destination texture is a Staging resource with the CPU Read access flag.

If that seems okay to you, here's the rest of the question:

I'm making this call as part of a unit test, and attempting to read the data right out of the destination texture immediately after. If I replace the CopySubresourceRegion call with a CopyResource instead, the answer is wrong, but there is definitely data copied across. However, after making the call to CopySubresourceRegion and then using a Map/Read/Unmap chain, the data that comes back is all zeroes. The texel type is R32G32B32A32_FLOAT (or whatever it is).

I realise that the call is made asynchronously, so I added the following code between the copy and the read:

for (UINT i = 0U; i < numDeferredContexts; ++i) {
    CHECK_CALL(deferredContextPtrArr[i]->FinishCommandList(FALSE, &outCommandList));
    immediateContextPtr->ExecuteCommandList(outCommandList, FALSE);
}

And still, all zeroes. So I went one further, and changed it to the following (desperate) code:

for (UINT i = 0U; i < numDeferredContexts; ++i) {
    deferredContextPtrArr[i]->Flush();
    CHECK_CALL(deferredContextPtrArr[i]->FinishCommandList(FALSE, &outCommandList));
    immediateContextPtr->ExecuteCommandList(outCommandList, FALSE);
}
immediateContextPtr->Flush();
Sleep(10000);

But still nothing. Finally, I turned off the multithreaded rendering so it all executes on the immediate context, but even then, still zeroes.

So I'm totally stuck, and any ideas are appreciated: How can I make CopySubresourceRegion actually copy the data?

sentences:
How to prevent a hacked-server from spoofing a master server? I wish to setup a room-based multilayer game model where players may host matches and serve as host (IE the server with authoritative power). I wish to host a master server which tracks player's items, rank, cash, exp, etc.

In such a model, how can I prevent someone that is hosting a game (with a modified server) from spoofing the master server with invalid match results, thus gaining exp, money or rankings.

Thanks. -Cody

sentences:
How do I calculate hex coordinates from a ring and index? I am trying to implement field of view (FOV) in a hex grid. I am using the cube coordinate system from here. Then, I am using shadow casting to find FOV as from here.

I have a system like in the image, below. The numbers at the corners are coordinates. The numbers in the center are formatted as [Ring index],[Hex Index].

I need to used both ring index and hex index to calculate angles used for shadow casting. I spent several days on it, but I still cannot find a way to make these two sets of numbers convertible.

How do I calculate hex coordinates from a ring and index?

sentences: Remove tutorial projects from learn tab in Unity In Unity I downloaded one of the tutorial projects in the learn tab. However I don't need it anymore. What should I do to get rid of it?

sentences:
How to protect source code when game is developed in HTML5/Javascript Possible Duplicate:
  How do you prevent your JavaScript / HTML5 web game from being copied or altered?

If a game client is developed in Javascript, the source code can be found in browser. It's dangerous, because it's easy to hack the game, and patent can't be protected.

Are there any good ways to avoid this, e.g Javascript can be compiled to binary file then browser load and run the compiled javascript?

sentences:
High Performance Vector Graphics Solutions I'm looking for a high performance vector graphics library I can use in my games.

I'm thinking along the lines of vector graphics such as those that can be made with SVG.

I'll consider any language at the moment (but must run on Windows).
A solution that takes advantage of GPU hardware would be great.

Thanks in advance.

sentences:
How do I have to take into account the direction in which the camera is facing when creating a first person strafe (left/right) movement This is the code I am currently using, and it works great, except for the strafe always causes the camera to move along the X axis which is not relative to the direction in which the camera is actually facing. As you can see currently only the x location is updated: [delta * -1, 0, 0]

How should I take into account the direction in which the camera is facing (I have the camera's target x,y,z) when creating a first person strafe (left/right) movement?

    case 'a':
        var eyeOriginal = g_eye;
        var targetOriginal = g_target;
        var viewEye = g_math.subVector(g_eye, g_target);
        var viewTarget = g_math.subVector(g_target, g_eye);
        viewEye = g_math.addVector([delta * -1, 0, 0], viewEye);
        viewTarget = g_math.addVector([delta * -1, 0, 0], viewTarget);
        g_eye = g_math.addVector(viewEye, targetOriginal);
        g_target = g_math.addVector(viewTarget, eyeOriginal);
        break;
    case 'd':
        var eyeOriginal = g_eye;
        var targetOriginal = g_target;
        var viewEye = g_math.subVector(g_eye, g_target);
        var viewTarget = g_math.subVector(g_target, g_eye);
        viewEye = g_math.addVector([delta, 0, 0], viewEye);
        viewTarget = g_math.addVector([delta, 0, 0], viewTarget);
        g_eye = g_math.addVector(viewEye, targetOriginal);
        g_target = g_math.addVector(viewTarget, eyeOriginal);
        break;

sentences:
Rendering Texture Quad to Screen or FBO (OpenGL ES) I need to render the texture on the iOS device's screen or a render-to-texture frame buffer object. But it does not show any texture. It's all black.

(I am loading texture with image myself for testing purpose)

//Load texture data

UIImage *image=[UIImage imageNamed:@"textureImage.png"];

    GLuint width = FRAME_WIDTH;
    GLuint height = FRAME_HEIGHT;

    //Create context
    void *imageData = malloc(height * width * 4);
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    CGContextRef context = CGBitmapContextCreate(imageData, width, height, 8, 4 * width, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
    CGColorSpaceRelease(colorSpace);

    //Prepare image
    CGContextClearRect(context, CGRectMake(0, 0, width, height));
    CGContextDrawImage(context, CGRectMake(0, 0, width, height), image.CGImage);

    glGenTextures(1, &texture);
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

Simple Texture Quad drawing code mentioned here

//Bind Texture, Bind render-to-texture FBO and then draw the quad

const float quadPositions[] = {  1.0,  1.0, 0.0,
                                -1.0,  1.0, 0.0,
                                -1.0, -1.0, 0.0,
                                -1.0, -1.0, 0.0,
                                 1.0, -1.0, 0.0,
                                 1.0,  1.0, 0.0 };
const float quadTexcoords[] = { 1.0, 1.0,
                                0.0, 1.0,
                                0.0, 0.0,
                                0.0, 0.0,
                                1.0, 0.0,
                                1.0, 1.0 };

// stop using VBO
glBindBuffer(GL_ARRAY_BUFFER, 0);

// setup buffer offsets
glVertexAttribPointer(ATTRIB_VERTEX, 3, GL_FLOAT, GL_FALSE, 3*sizeof(float), quadPositions);
glVertexAttribPointer(ATTRIB_TEXCOORD0, 2, GL_FLOAT, GL_FALSE, 2*sizeof(float), quadTexcoords);

// ensure the proper arrays are enabled
glEnableVertexAttribArray(ATTRIB_VERTEX);
glEnableVertexAttribArray(ATTRIB_TEXCOORD0);

//Bind Texture and render-to-texture FBO.
glBindTexture(GL_TEXTURE_2D, GLid);

//Actually wanted to render it to render-to-texture FBO, but now testing directly on default FBO.
//glBindFramebuffer(GL_FRAMEBUFFER, textureFBO[pixelBuffernum]);

// draw
glDrawArrays(GL_TRIANGLES, 0, 2*3);

What am I doing wrong in this code?

P.S. I'm not familiar with shaders yet, so it is difficult for me to make use of them right now.

sentences:
Separating Axis Theorem Duplicate Axis I am building a physics game engine from the ground up and currently stumped with my SAT implementation. The situation I am having is in regard to Edge cases, if I remove all parallel / duplicate Axis from the possible 15, I run the risk of removing an edge case as seen in the attached photo.

Hoping you guys can give me some pointers, Thanks!
edit: I should state that the way I have my SAT implemented is I have 0-5 cases being the Face contact and 6 - 14 being Edge cases. When I dont remove parallel cases, situations such as the picture below get treated as an edge case

edit: Probably shouldve added this in the beginning but here is the code where I am establishing my Axes to test.
The GetAxisFromEdge function simply takes two vectors and crosses them
The RemoveParralels function loops through the established axis and removes them if there exists a duplicate.
The FixAxes function is something of a patch to fix a greater problem where I needed the axis to face in the direction of one object for uniformity.
std::vector<glm::vec3> AxesToTest;

        glm::vec3 Obj1Edge1, Obj1Edge2, Obj1Edge3, Obj2Edge1, Obj2Edge2, Obj2Edge3;

        Obj1Edge1 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[0]);
        Obj1Edge2 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[2]);
        Obj1Edge3 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[5]);

        Obj2Edge1 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[0]);
        Obj2Edge2 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[2]);
        Obj2Edge3 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[5]);

        AxesToTest.push_back(this->Objects[x]->TransformedNormals[0]);
        AxesToTest.push_back(this->Objects[x]->TransformedNormals[1]);
        AxesToTest.push_back(this->Objects[x]->TransformedNormals[2]);

        AxesToTest.push_back(this->Objects[y]->TransformedNormals[0]);
        AxesToTest.push_back(this->Objects[y]->TransformedNormals[1]);
        AxesToTest.push_back(this->Objects[y]->TransformedNormals[2]);

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge3)));

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge3)));

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge3)));

        glm::vec3 toCenter = this->Objects[x]->Position - this->Objects[y]->Position;

        RemoveParallels(AxesToTest);
        //FixAxes(AxesToTest, toCenter);

sentences:
Lights system with shaders in OpenGL? In more than just 1 occasion, i read about 2 ways of doing a light's system in OpenGL:

normal way? i don't know how to call this one
with the shaders ( GLSL )

The problem is i don't get the difference in terms of rendering performance and system usage, what are the pros and cons for each one ?

Thanks.

sentences:
Libgdx fbx converter doesn't write meshes to g3dj file LibGDX FBX converter doesn't write meshes nor materials to g3dj file.

This happens with blender 2.8 when exporting model to FBX then converting it to g3dj. meshes will result in an empty block.

2.8 blender settings

and when converting...

g3dj file..

{
   "version": [  0,   1],
   "id": "",
   "meshes": [],
   "materials": [],
   "nodes": [
       {
           "id": "Cube",
           "rotation": [-0.707107, -0.000000,  0.000000,  0.707107],
           "scale": [ 10.000000,  10.000000,  10.000000]
       }
   ],
   "animations": []
}

I tried to convert a fbx written with blender 2.76 with these settings...

and meshes and materials are written in g3dj file successfully. I'm thinking this has to do with FBX version, but it seems you can't change FBX version in blender 2.8

sentences: What programming language were PS1 games written in? Is there any common language that is used to create Play Station 1 Games? Or how can I find out what programming language is used for one of those games?

sentences:
Why do i get this error in VS2017 but game compiles and works as expected? I have this error, yet the game works and that variable ActorThatOpens get assigned correctly.

In my header the includes are:

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Engine/TriggerVolume.h"
#include "OpenDoor.generated.h"

As far as I can tell from the docs Components/ActorComponent.h contains the function  GetWorld().

I have to go work now, but been scratching my head over this for an hour or so, and will continue to when i get home later. If anyone can see what I am doing wrong and can help I will be so grateful.

(As you can probably tell I am completely new to C++) THANKS!

sentences:
Advanced dice probability I want to find a formula to get the probabilities of dice roles in the game Infinity. In this game people are rolling a set number of 20 sided die against another number of 20 sided die, hoping to roll the higher number. In addition each person has a set target number that limits how high a die value he can use. So if my target number is 13 any number I roll above a 13 does not count.

For example if I am rolling 3 dice (20 sided) and need to roll a 11 or below, and my opponent is rolling 1 die (20 sided) and needs a 14 or below. What are my chances of getting a higher number than him without going over 11?

sentences:
Is Pushdown Automata better for user input than Hierarchical State Machine? I saw an example of code using HSM for user input, but to me it seems that Pushdown Automata would be a better fit. I'm confused.

If I'm right, then after Hierarchical State Machine exits a superstate via substate, and comes back, it must start at a default state and cannot return to the substate it left earlier(unless of course, that default state is the substate). And then, if I'm right, Pushdown Automata could replace that need, as it can return to an older state via its stack and discarding of states.

Say I have an actor I control, and it has several states that use user input as transitions. It supports jumping, ducking, standing and walking. When you are standing or walking, you can jump or duck, after which you return to the state you were in, thus standing or walking. If I were to use an HSM to prevent the duplication of code, I could not return to the last state. But if I used a Pushdown Automata, I could put jumping or ducking on top of the stack and discard them after they are done, and that way I could return to the state I was in.

Correct me if I'm wrong, and suggest me better options for user input than these two, if there is. Also, please don't post options like duplicating the FSM as the amount of states could vary and my question is related exactly to how to prevent that duplication.

Thanks,

me.

sentences: How should I track players' real-time positions in an MMO? How do you keep track of the positions of the players in a MMORPG? I read that you can use either a database or you can store the coordinates in files. I tried using a database but it was slow. How can files be used to keep track of players positions?

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:
Switching between meshes vs Loading only specific mesh I am currently developing an online multiplayer game on Unity. In the game, the character of each player will be assigned its mesh after the game receives parameters (their meshes' names) for each character from the server. Assigning each character's mesh can happen after the main scene is loaded. I am wondering whether:

I should make each character's object the same by having every mesh possible loaded into it and only activate the corresponding mesh for that player.
I should create a class that holds every mesh possible (like, mesh manager) and tell each character to use its mesh from that class.
I should delay the characters' meshes loading to wait for the parameter from the server first. Then, load the mesh after the scene has been loaded.

I am not sure if specific assets can be loaded outside of its scene in Unity. If anyone has any different solutions, feel free to suggest. Thanks in advance.

sentences:
How to handle hitboxes/hurtboxes in animations? I'm curious how I should go about structuring hitboxes and hurtboxes for my actors. For context, I'm developing a game engine in OpenGL, using C# and OpenTK. I have developed a working skeletal animation system, which loads animations using Assimp, and then passes BoneIDs, BoneWeights, and Transform matrices to the Vertex shader, which calculates all vertex deforms appropriately for the current animation keyframe (or current interpolation between keyframes).

Is there a set standard for calculating collision in animations? I'd prefer to continue using Assimp, which means using standard, recognizable animation formats that my engine can load in, so I'd rather not store any collision data in the animation files, unless there is a precedent for this or room for metadata or something.

My current thoughts: One option would be to calculate the hitboxes and hurtboxes upon loading an animation, and have a mapping that determines which meshes are hitboxes and which are hurtboxes. The second option would be to create a new file format where I store my hitboxes and hurtboxes in a way that is similar to animation files (minus bone weights, since I'll just be transforming the scale/position of axis-aligned rectangles), where I can determine keyframes for hitboxes and hurtboxes, then interpolate based off of these to get the current collision box for each frame. I could combine the two options by automatically generating these files from the animations, then editing them manually until they are reasonable.

Am I on the right track, or are there smarter ways of going about this? I don't want to reinvent the wheel if there are better options available.

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:
Does interleaving in VBOs speed up performance when using VAOs You usually get a speed up when you use interleaved VBOs instead of using multiple VBOs. Is this also valid when using VAOs?

Because it's much more convenient to have a VBO for the positions, and one for the normals etc. And you can use one VBO in multiple VAOs.

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: Pros and Cons of making geometry not only leaf in scene heirarchy I was wondering why most game and graphics engines prefer to make geometry/mesh class only as a leaf in the scene hierarchy; more precisely they are not allowed to have children. So what are the pros. and cons of making it able to have children from performance and software design point of view?

sentences:
How do I lock drawn lines to be orthogonal to an existing one? I'm making a 2D game in Corona for Android/iPhone that is similar to Volfied. In my game, the user has to touch the screen to draw a line for the character to move along. How can I force the lines to be orthogonal, as opposed to being free-drawn?

I can detect the swipe's direction with atan2 and the difference of X and Y, but I am having trouble determining the pivot points of the line. How can I determine when the line should make a turn?

You can see what I am trying to accomplish in this video of Volfied gameplay.

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:
Trying to subdivide an ISO tile I have code that calculates where the user clicked inside an iso tile in an isometric map. The tile has a width of 1 unit and a height of 0.5 units. My code calculates where they touched inside the tile in these same units. The goal is to then decide where that click falls if you sub-divided the iso tile into a 4x4 grid. The picture below shows how all this is supposed to look.

I have found ascreen co-ordinates to iso formula and it makes sense but for whatever reason, when I try to use it with my data above I get wrong outputs. When clicking from the top corner to the right corner, only the X iso output should change but both the X and the Y change.

I feel like this should be pretty simple but after hours of banging my head against this I can't figure out what I am doing wrong.

Source for screen to iso formula:
How would I translate screen coordinates to Isometric coordinates?

Any help would be greatly appreciated.

float touchedX;
float touchedY;
//below 0.125 represents the tile height because the whole thing
// is 0.5 and its 4 tiles high so 0.125, 0.5 is 2*width which
//is (1 / 4.0) * 2
float gridPointLedftDown = (touchedY / 0.125f) + (touchedX / 0.5f);
float gridPointRightDown = (touchedY / 0.125f) - (touchedX / 0.5f);

sentences: Is it possible to use Metal and SceneKit at the same time? All the tutorials that I've found online speak about using Metal alone, without any other supporting library. But I don't understand if it's possible to create a SceneKit game and then use a Metal layer just to make some optimizations.

sentences:
How to calculate 1st, 2nd, 3rd place and draw conditions in local multiplayer game? I have a local multiplayer game with an end of round screen that pops up after each round. I'm trying to figure out the logic to calculate the 1st, 2nd, 3rd place from a maximum of 4 players. I also want draw/tie conditions. It's possible for 2 or 3 players to get the same score. The score is just an int for each player. I've been struggling with this for a while... Any help appreciated, even if its just some pseudo code to point me in the right direction. Also, I'd like to avoid using Linq if possible, as I've heard it doesn't play nice with Unity. Thanks

Edit:

Below is what I've managed to come up with for determining the draw conditions. Doesn't seem to hold up in all cases though... Surely there's a simpler approach?

         PlayerScore[] orderedScores = m_scores.OrderByDescending(ps => ps.score).Take(4).ToArray();

        _1stPlacePlayers.Add(orderedScores[0].playerNumber);

        if (orderedScores[0].score == orderedScores[1].score)
        {
            // 2 player draw 1st place
            _1stPlacePlayers.Add(orderedScores[1].playerNumber);
            if(orderedScores[0].score == orderedScores[2].score)
            {
                // 3 player draw 1st place
                _1stPlacePlayers.Add(orderedScores[2].playerNumber);
                if(orderedScores[0].score == orderedScores[3].score)
                {
                    // 4 player draw 1st place
                    _1stPlacePlayers.Add(orderedScores[3].playerNumber);
                }
            }else if (orderedScores[1].score == orderedScores[2].score)
            {
                // 2 player draw 2nd place
                _2ndPlacePlayers.Add(orderedScores[2].playerNumber);
                if (orderedScores[1].score == orderedScores[3].score)
                {
                    // 3 player draw 2nd place
                    _2ndPlacePlayers.Add(orderedScores[3].playerNumber);
                }
            }
            else if (orderedScores[2].score == orderedScores[3].score)
            {
                // 2 player draw 3rd place
                _3rdPlacePlayers.Add(orderedScores[3].playerNumber);
            }
        }

        else if (orderedScores[1].score == orderedScores[2].score)
        {
            // 2 player draw 2nd place
            _2ndPlacePlayers.Add(orderedScores[2].playerNumber);
            if (orderedScores[1].score == orderedScores[3].score)
            {
                // 3 player draw 2nd place
                _2ndPlacePlayers.Add(orderedScores[3].playerNumber);
            }
        }
        else if (orderedScores[2].score == orderedScores[3].score)
        {
            // 2 player draw 3rd place
            _3rdPlacePlayers.Add(orderedScores[3].playerNumber);
        }

sentences:
How to measure skill in a pinball game? I am trying to come up with a system to measure or estimate the skill of a player at a single player game (so no head-to-head rating system help here). Specifically, it is a pinball game, but I do believe it is similar to most point-based single player games.

I have thought of 3 approaches:

total points scored with a threshold for each skill level
average points scored over all time
average points scored over last X games

All of them use points, which I think is probably the right metric: anything a player does in pinball grant points, with the most difficult objectives worth more points. Points also take into account all of the rare combination of objectives (like score multiplier + multiball) that would be hard to track manually.

However, I am not sure which approach to use and I bet other games have implemented similar skill-measuring system that I can use as a guide, so I'd appreciate any and all help on this.

sentences:
What game objects can have a "material"? In Unity, I created an empty GameObject called "Person". I created some child objects to it, such as "head" (a sphere), "body" (a capsule), "leg" (a box), etc. Then, I wanted to change the person's color, so I created a material. However, I could not drag & drop it on the person - I could only drag and drop it on each child object separately.

My question is: what game objects in Unity are allowed to have a "material" on them? And, is there a way I can put a material on a parent object, and let it affect all its child and descendant objects?

sentences:
Is it possible to mod a GameMaker game? I been google searching on how to mod Game Maker games (Hyper-Light-Drifter to be more specific) but so far everyone says it's impossible to mod the files. The reason I want to do this is I want to learn to program by modding first and seeing examples that is already made, I also really like this game.

If there is a more better place/website to ask this question please tell me.

sentences:
How to change Vectors due to change in it's dependent Base Vector? PLOT :

I have been developing a game where the player falls down on Y axis and the camera is a Top-Down view camera. The camera, player (main character in the game) movements etc. have all been implemented based off the idea/notion that the player is falling down Y axis. Hence I used to feed in the vectors based of it. The player is always acted upon gravity.

DESIGN CHANGE :

Now after all these months of developing it, I am changing the design. Now the player who was falling down, upon reaching the ground is going to take off and fly parallel to the ground

PROBLEM :

As I am changing the entire scenario, it creates a complication with vectors I used to feed in for the camera and player. Also due the constraint that the experience should be exactly similar to that off the "falling towards the ground" I have to change the gravity accordingly. Now how do I accomplish this when I have vectors all over the place based off the top down view. Please forgive if I am confusing you here. Give me a min.

To break it into the most primitive segment - I input Vector A, B etc to the camera and the player when the gravity is (0,-1,0). Now if I change the gravity to (1,0,0), how should I change the Vector A, B etc. Is there a way to formulate the Vectors A, B etc when I know the gravity has been shifted from (0,-1, 0) to (1,0,0). All the vectors are normalized. If you ask me the relationship of Vector A, B etc with the gravity (0,-1,0) - I have to say there is no relationship. As it was a game, I supplied the Vectors on how I need the Player and Camera's to work.

CODE :

    // The required Force applied in Flap mode
    void ForceToBeApplied()
    {
            //HORIZONTAL FORCE
            if(!HNEXT)
            {
                    rigidbody.AddRelativeForce((Vector3.right) * DeltaTime * LeftDrag * 3);
                    if(LeftDrag < 400)
                            LeftDrag += ToTarget(DefaultDrag,TurnSine);
                    rigidbody.AddForce(2,(-LeftDrag/50),0);
            }

            if(HNEXT)
            {
                    rigidbody.AddRelativeForce((-Vector3.right) * DeltaTime * RightDrag * 3);
                    if(RightDrag < 400)
                            RightDrag += ToTarget(DefaultDrag, TurnSine);
                    rigidbody.AddForce(-2,(-RightDrag/50),0);
            }

            //VERTICAL FORCE
            if(!VNEXT)
            {
                    rigidbody.AddRelativeForce((Vector3.forward) * DeltaTime * UpDrag * 3);
                    if(UpDrag < 400)
                            UpDrag += ToTarget(DefaultDrag,TurnSine);
                    rigidbody.AddForce(0, (-UpDrag/50),-2);
            }
            if(VNEXT)
            {
                    rigidbody.AddRelativeForce((-Vector3.forward) * DeltaTime * DownDrag * 3);
                    if(DownDrag < 400)
                            DownDrag += ToTarget(DefaultDrag, TurnSine);
                    rigidbody.AddForce(0,(-DownDrag/50),2);
            }
    }

IF you happen to look into the above module, I add force to the rigidbody. Those forces were added when the gravity was (0,-1,0). Now if I change my gravity to (say) (1,0,0), how should I change the forces applied to the rigidbody.

TYPE OF APPROACH I THINK :
What if I could create a static class which could take those vectors and convert them to equivalent vectors for the current gravitational force.

Simple Diagrammatic Expression of The Problem :

I hope I am clear in the problem I am facing.

Thank you..

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:
Objective-c Cocos2d moving a sprite I hope someone knows how to do the following with cocos2d:

I want a sprite to move but not in a single line by using

[cocosGuy runAction: [CCMoveTo actionWithDuration:1 position:location]];

What I want is the sprite to do some kind of movements that I preestablish. For example in some point i want the sprirte to move for instance up and then down but in a curve. Do I have to do this with flash like this documents says?

http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:animation

Does animation in this page means moving sprites or what?

thanks

sentences:
GLSL default shaders I've been arming my engine with error checking code. I'll try to describe this situation to my best abilities. Whenever i load a shader and there's an error (file doesn't exist, compilation error, anything that could go wrong) i delete the shader and set the pointer to 0 (can't think of annother way to make sure i don't try to attach or delete trash by accident). I don't want to stop the program if this happens, because somebody might delete or modify a single file by accident in the game folder and don't want to render the whole game unusable because of that.

Now the thing is, is there a default behavior in the situation where i attach shaders to a program that have the pointer equal to 0?

In my program, if i attach a vertex shader equal 0 and a fragment shader equal 0, then OpenGL will use the default program (will display everything white):

This is a rotated cube that's dimensions are in clip space already, rendered without perspective projection or depth checking. It's loaded from an .obj file.

Now, if i attach a proper fragment shader, but the vertex shader will be 0, i get this:

Which is what i would expect, all the fragment shader does is outputs a vec4(1.0, 0.3, 0.7, 1.0), there's no vertex shader so OpenGL uses the default one (is this a correct assumption?).

Now, however, if i attach a correct vertex shader, but i attach a fragment shader equal to 0 (or i won't attach a fragment shader at all) i'll get this mess:

Something you can't see is that this model is contantly being painted different colors, so on my screen it looks like an acid trip with black horizontal lines going through.

I'm confused a bit, because i would expect the cube to just be white. I'd like to point out that my shader code is bare bones, i'm not exchanging any variables between vertex and fragment shaders. Checking if the pointer is not equal to 0 doesn't change anything, the linked program acts the same as if i gave it a pointer equal to 0. The weirdest thing to me is that it's always nicely shaded, it's not just trash.

EDIT: Maybe the default fragment shader expects a gl_ value from the vertex that i'm ommiting to set? That would kind of explain why the surface is nicely shaded, the fragment shader expects a smooth in, but that value is just trash, because i didnt' set it.

Now is this an "undefined behavior" or is this how it's suppoused to work?

sentences:
Drawing rectangle around a target on screen I am just started with Unity and C#. I need in my work to do rectangle on a scene. I have a 3D scene, say some warehouse and there is an object. Camera is animated and moving towards the object. Is it possible to draw a rectangle around the object on the camera screen while the camera is moving unless the object on the screen? The task is like keeping target in war-flight games.
This is my code, where I tried to draw rectangle anywhere:

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

public class MY_getting_images : MonoBehaviour
{
    // Start is called before the first frame update
    public GameObject pallet;
    public Camera color_cam;
    public Vector3 pos;
    LineRenderer l;
    void Start()
    {
        pallet = GameObject.Find("PalletWood01");
        l = pallet.AddComponent<LineRenderer>();
        List<Vector3> ps = new List<Vector3>();
        ps.Add(new Vector3(0, 0));
        pos = pallet.transform.position;
        ps.Add(new Vector3(10,10));
        l.startWidth = 1f;
        l.endWidth = 1f;
        l.SetPositions(ps.ToArray());
        l.useWorldSpace = true;
        /* Finding camera in a scene: tag needed camera, for example "Player", and then GameObject.FindWithTag("Player").GetComponent<Camera>();
         * Tag the camera another way for deployment
               */
        color_cam = GameObject.FindWithTag("Player").GetComponent<Camera>();
        /*pos = color_cam.transform.position;
        pos = pallet.transform.position;
        Debug.DrawLine(Vector3.zero, new Vector3(0, 0, 5), Color.red);
        Debug.Log(pos);*/
    }

    // Update is called once per frame
    void Update()
    {
        Debug.Log(pos);
        /*pos = color_cam.transform.position;
        Debug.Log(pos);*/
    }

}

The scene now looks like on the image above:

I want 2d rectangle around the pallet drawn on the screen.

sentences:
How do I tell if an object is currently colliding with another object? I can't figure out how to tell if a GameObject is currently colliding with another in Unity. I've looked online and can't find any tutorials or answers that work.

Also, what's the difference between a Collision and a Collider w.r.t. Unity?

My dilemma:

I have a third person controller set up and want it to wall jump. I already have an isGrounded function, I just need to test if I'm hitting anything other than the floor. Otherwise I want it to wall jump backwards.

I've already tried:

if (this.OnCollisionEnter){
     ...
}

if (Collider.OnCollisionEnter){
     ...
}

But it did not work. I now tried:

function OnCollisionStay(){
   Debug.Log("Collision");
}

I checked my logs, console and still can't find anything.

sentences:
How do I check collision when firing bullet? I'm currently creating 2D game from top perspective. I'm having problems with bullets. Yes, I currently simulate their movement so user can see them (about 2x ). Moving them with

// this is static
Direction = new Vector2(mouse.X, mouse.Y) - new Vector2(player.x, player.y);
Direction.Normalize();
Speed = 900f;

//this is called in Draw(GameTime gameTime)
Position += Direction * 9f * Speed * (float)gameTime.ElapsedGameTime.TotalSeconds;

actually it's working perfectly, however, they're too fast so I can't check their collision each frame and I need to re-play their way each frame. How would I do it? And how would I do this available for both server (which doesn't use XNA as I want to port it to Linux later) and client (using XNA)?

Here's an image which shows the problem (1. bullet is before target 2. bullet is behind target, so it can no longer intersect the target. My goal is to calculate whether it intersected the target before)

I have almost forgot to mention! These objects are moving, these are player, that means that user can get out of the bullet's trace

sentences:
OpenGL Insanely Slow I'm learning C++, and I'm writing my first OpenGL program. Unfortunately, it seems to be defaulting to Software Rendering (CPU uses bounces, GPU uses stays at 1%). I'm using SDL as the Windowing system. I've got no idea why, but when there is significant scaling, the program grinds to a halt. My PC should be able to handle it - I'm using an 8800GTX. My texture is 1024x1024, 32 bit RGBA and loaded with DevIL,  and glGetString(GL_VENDOR) is returning "NVidia Corporation". Any ideas?

I'm sorry to be dumping all the code, but I've got absolutely no idea at all what is doing it. I'm very new to OpenGL.

#pragma once
#include "SDL.h"
#include "SDL_opengl.h"7
#include "IL/il.h"
#include "IL/ilut.h"
#include <math.h>

const int SCREEN_WIDTH = 1024;
const int SCREEN_HEIGHT = 768;
const int SCREEN_BPP = 32;
const int FPS = 60;
const int XSIZE = 1024;
const int YSIZE = 768;

int main( int argc, char *argv[] )
{
    bool quit = false;

    SDL_Init(SDL_INIT_EVERYTHING);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);

    SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_HWSURFACE |  SDL_OPENGL);

    glEnable(GL_TEXTURE_2D);

    const GLubyte * Vendor = glGetString(GL_VENDOR);

    glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Clear the background of our window to red
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity ();
    glOrtho(0, XSIZE, YSIZE, 0, 0, 1);
    glMatrixMode (GL_MODELVIEW);

    glDisable(GL_DEPTH_TEST);

    GLuint image;

    ilInit();
    ilutRenderer(ILUT_OPENGL);

    ILuint texid;
    ILboolean success;
    ilGenImages(1, &texid);
    ilBindImage(texid);

    success = ilLoadImage("Textures.png");
    if (success)
    {
        success = ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE);
        if (!success)
        {
            SDL_Quit();
            return -1;
        }
        glGenTextures(1, &image);
        glBindTexture(GL_TEXTURE_2D, image);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
        GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
        GL_NEAREST);
        glTexImage2D(GL_TEXTURE_2D, 0, ilGetInteger(IL_IMAGE_BPP), ilGetInteger(IL_IMAGE_WIDTH),
          ilGetInteger(IL_IMAGE_HEIGHT), 0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE,
          ilGetData());
        ilDeleteImages(1, &texid);
    }
    else
    {
        SDL_Quit();
        return -2;
    }

    SDL_Event event;

    float x = 0.0f;

    while (!quit)
    {
        while ( SDL_PollEvent(&event) )
        {
            switch (event.type)
            {
                case SDL_QUIT:
                    quit = true;
                    break;
            }
        }

        glClear(GL_COLOR_BUFFER_BIT);

        glLoadIdentity();
        glTranslatef(200.0f, 200.0f, 0.0f);
        glRotatef(x,0.0f,0.0f, 1.0f);
        glScalef(1.0f+x, 1.0f+x, 1.0f+x);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 0.0f);
        glVertex2f(-100, -100);
        glTexCoord2f(0.0f, 0.119140f);
        glVertex2f(-100, 100);
        glTexCoord2f(0.091797f, 0.119140f);
        glVertex2f(100, 100);
        glTexCoord2f(0.091797f, 0.0f);
        glVertex2f(100, -100);
        glEnd();

        x += 0.1f;

        SDL_GL_SwapBuffers();
        glFlush;
    }

    return 0;
}

Edit : (24/04/2011 9.22 PM AEST)
When run on an ancient card, on an ancient computer, it maintains ~60FPS.

sentences:
Emissive material from white texture I have texture with black and white shapes.

I would like that white parts are emissive and black parts are transparent/glass.

How to make such material ?

sentences:
Game clock Synchronization in python I am working on a network game project in python which we want to keep synchronized. I would assume we should use Network Time Protocol to cater for different levels of lag.

That being the case, is there an implementation for Network Time Protocol in python?

sentences:
How to make a custom inspector component I have a script component, but I want to know how I can add things like sliders buttons etc.

I wrote a grid system that generates at the start of my script but I want to run it in editor when I push a button to not to force calculations, lessen load times for my game and even see result of my work in editor. How can I do that?

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:
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 to apply physics when you have sub frame state changes? I'm currently calculating my physics every 1/100th of a second and using a state machine to manage the current state of the player.
In my main loop I'm checking user input and transitioning the state as needed and then my physics code checks the state to apply the appropriate forces.

Pseudo:

if (fsm.state == walking) {
    velocity += walkVelocity;
}

However, the issue I think I've noticed with this is; what if a full state transition occurs between two physics frames. For example the user taps jump so quickly they transition from jumping to falling happens so quickly that the physics code hasn't got a chance to see that a jump was requested and therefore doesn't apply the change in velocity.

This is a simple example, but I'm feeling that states maybe shouldn't be used this way. Maybe the key presses themselves need to be fed directly into the physics code (so that it can have access to durations and order of events) and then it (the physics code) updates the states accordingly.

Is this the common way of arranging flow? Or am I missing something? I.e. should it be:

  Input -> state change -> physics

Or should it be more like:

  Input -> physics -> state change

I've seen state machines used with event systems before. So state changes are raised as events which subscribers can respond to. However the physics code still needs to run at fixed timesteps so it needs to be able to query for 'things which have occurred'.

sentences:
Main camera transform.forward becomes up and down when looking from above The camera script is a 3rd person orbit camera, when I look straight it does what it supposed to do which is walk in the direction the camera is pointing, but when the camera is looking down from above the player, the camera's forward is now up. This means when I press W to go forwards I go into the ground and when I press S it goes upwards.

Here is my movement script:

    private void FixedUpdate()
    {
    float x = Input.GetAxisRaw("Horizontal");
    float z = Input.GetAxisRaw("Vertical");

    Vector3 moveDirection = Vector3.zero;
    moveDirection += Camera.main.transform.right;
    moveDirection += Camera.main.transform.forward;
    moveDirection.y = 0;
    // Rotation
    if (x != 0 || z != 0)
    {
        anim.SetBool("Walking", true);
        if (x != 0)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(moveDirection), 0.4f);
        }
        else
        {
            transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, Camera.main.transform.localEulerAngles.y, transform.localEulerAngles.z);
        }

    }
    else
    {
        anim.SetBool("Walking", false);
    }
    // Moving
    if (Input.GetKey(KeyCode.LeftShift) && !idle)
    {
        anim.SetBool("Running", true);
        rb.position += z * Camera.main.transform.forward * Time.deltaTime * runSpeed;
        rb.position += x * Camera.main.transform.right * Time.deltaTime * runSpeed;
    }
    else
    {
        anim.SetBool("Running", false);

        rb.position += z * Camera.main.transform.forward * Time.deltaTime * moveSpeed;
        rb.position += x * Camera.main.transform.right * Time.deltaTime * moveSpeed;
    }
}

while I'm asking, the movement script gets doubled when two keys are pressed, how do I fix it while keeping the same functionality of my current movement script?

sentences:
Matrix for 2D perspective I'm trying to determine whether what I'm attempting to achieve is even possible mathematically. I'm obviously not a seasoned game developer so I'm having trouble even coming up with the terminology to pose this question.

My 2D game (and I must stress that it is 2D) has a perspective such that the "camera" looks down at the game world from 45 degrees. Here's a rough sketch describing the look I'm trying to achieve:

As objects move from foreground to background (such as the red box pictured), they not only get smaller but are moved towards the center of the screen. So whilst the on-screen representation is rectangular, the actual game world has this shape:

Now I suspect I can do all this without using a matrix. I've already got the scaling working and don't think it would be too difficult to offset on the x axis objects according to their distance from the camera.

However, what I'd really like to know is whether I can encompass this perspective inside a simple matrix. I've had a look around the web but have got lost in a sea of nomenclature that I don't understand and information that doesn't appear to be relevant to me (such as 3D camera positioning, etcetera).

Can anyone tell me whether I'm barking up the wrong tree? If it is possible, can someone point me towards some articles or blog posts that describe this in detail?

sentences:
MMOFPS Choosing protocol for high-traffic network (UDP or TCP)? my question about the player position sender protocol. In this article, he says "Never use TCP for networking a multiplayer game". Ok but UDP datas are not ordered. In this case, if somebody walking, his position will be received and sent to other players. While walking other players can see the player's NPC teleporting like movement. Some positions will be incorrect. Otherwise TCP isn't suitable, I agree but how can we use UDP? (UDP reliability?)

  EDIT (Question): There is an other problem. If player1 send his data to server this data can be lost. Otherwise if data received by
  server, server will send it back to other clients. In this case some
  datas can be lost again. Namely UDP creates an undefined position
  update (namely everybody -clients- can see player at different
  positions). What can we do about that?

EDIT: Oh, I'll use TCP for login-room like request because they are important (must be reliable) datas. There is no problem about this.

EDIT2: I don't know how can I use UDP for player positions.

sentences:
Font rendering, how do you align glyphs of a font? I'm trying to render text quad using texture generate by BitmapFontWriter of libgdx.
For the font I can get size, PaddingTop, PaddingRight, PaddingBottom, PaddingLeft, LineHeight, CapHeight, Baseline, Ascent, Descent.

For each glyph I can get u, v, width, height, x offset, y offset, x advance

The chars rendered are OPQZ[\\]^_`abcdefg你好,. If I just render the quad. I get:

Q, g and the `are definitely incorrect. The brackets and notdef are a little large.
The only thing that I find meaningful for me is y offset. If I shift the quad with it, I get:

Q is not changed at all. g gets slightly better. Lots of them get worse.

sentences:
How to detect when two bitmaps intersect in Android I made two bitmaps based off of two ImageViews using this code:

playerimage.buildDrawingCache();
Bitmap bplay1 = playerimage.getDrawingCache();
brickimg.buildDrawingCache();
Bitmap bbrick1 = brickimg.getDrawingCache();

I tried getting the height and width of each bitmap for collision detection, but it made the app crash. This is what I used for it:

int w1 = bplay1.getWidth();
int h1 = bplay1.getHeight();
int w2 = bbrick1.getWidth();
int h2 = bbrick1.getHeight();

Is there a different way to get the coordinates of a bitmap to test collision detection?

sentences:
Recommended 3D camera settings and model sizes for an FPS I'm making a simple FPS and I can't decide on the size of my models and my camera settings. Could someone please recommend a good combination of:

camera field of view
near and far planes
model proportions (such as 1 unit = 1 meter)

so that the game looks realistic enough and the numbers are easy to work with?

EDIT: I know I can use whatever dimensions I want, but I'd like to know what is most commonly found in games.

sentences:
Which free HTML5-based game engine meets these requirements? I am experienced with traditional JS and HTML but new to HTML5. I want to develop games in HTML5 so that it can work on all devices and browsers, including IE. Additionally, I require the following features:

Physics Engine
Animation
Some AI
Vector drawing and manipulation
Better user/player controls, et cetera

I know there are many options, but just want some one that can give most flexibility... so I want some thing that can also be compiled to achieve maximum functionality.

One that is in my mind is GameKit; but please tell what you guys would suggest that meets my requirements.

sentences:
Setting relative anchor point via matrix The page at https://webglfundamentals.org/webgl/lessons/webgl-2d-matrices.html provides an example for rotating around the center of the image:

// make a matrix that will move the origin of the 'F' to its center.
var moveOriginMatrix = m3.translation(-50, -75);

Similarly, the library I'm using (gl-matrix), provides an ability to rotate around an origin vector:

  fromRotationTranslationScaleOrigin [...] Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin

However, I'd like to generically set a rotation vector based on the relative local transform - e.g. something like giving [0.5,0.5, 0] as the origin parameter to fromRotationTranslationScaleOrigin() and have it always rotate around the center.

Would this require handling it somewhere else in the pipeline? (e.g. after composing with the perspective matrix) - or are there some best-practices ways of handling this?

I'd also like a matrix to allow centering within another's world matrix but that's a different question I guess :)

sentences:
Creating shattering effects without having to use actual physics? For certain effects like glass shattering and falling objects cracking to reveal their inner contents, are there any tricks or ways to implement these fracture physics without having to use actual physics simulation? Also, what are the trade-offs if I don't use real physics simulations?

Since the effects don't really require exact simulation, an actual physics simulation may be too expensive and wasteful.

sentences:
What is a library for event-driven mouse and keyboard input in Java? The title basically says it all.

The only thing to take into consideration is it needs to be cross platform.

sentences:
How do I render using VBOs? I'm trying to render a hemisphere in OpenGL, the problem that the hemisphere isn't rendered at all, only part of it. I initialize it, then at each frame I draw it using the following code. I'm trying to use a VBO for drawing it.

void Jellyfish::Init_HemiSphere(const float radius, const int segments )
{

    m_iSegements = segments;
    m_fVerts= new float[(segments+1)*2*3];
    m_fNormals= new float[(segments+1)*2*3];
    m_fTexCoords = new float[(segments+1)*2*2];

    for( int j = 0; j < segments / 2; j++ )
    {
        float theta1 = j * 2 * 3.14159f / segments - ( 3.14159f );
        float theta2 = (j + 1) * 2 * 3.14159f / segments - ( 3.14159f );

        for( int i = 0; i <= segments; i++ )
        {
            Vec3f e, p;
            float theta3 = i * 2 * 3.14159f / segments;

            e.x = math<float>::cos( theta1 ) * math<float>::cos( theta3 );
            e.y = math<float>::sin( theta1 );
            e.z = math<float>::cos( theta1 ) * math<float>::sin( theta3 );
            p = e * radius;
            m_fNormals[i*3*2+0] = e.x; m_fNormals[i*3*2+1] = e.y; m_fNormals[i*3*2+2] = e.z;
            m_fTexCoords[i*2*2+0] = 0.999f - i / (float)segments; m_fTexCoords[i*2*2+1] = 0.999f - 2 * j / (float)segments;
            m_fVerts[i*3*2+0] = p.x; m_fVerts[i*3*2+1] = p.y; m_fVerts[i*3*2+2] = p.z;

            e.x = math<float>::cos( theta2 ) * math<float>::cos( theta3 );
            e.y = math<float>::sin( theta2 );
            e.z = math<float>::cos( theta2 ) * math<float>::sin( theta3 );
            p = e * radius;
            m_fNormals[i*3*2+3] = e.x; m_fNormals[i*3*2+4] = e.y; m_fNormals[i*3*2+5] = e.z;
            m_fTexCoords[i*2*2+2] = 0.999f - i / (float)segments; m_fTexCoords[i*2*2+3] = 0.999f - 2 * ( j + 1 ) / (float)segments;
            m_fVerts[i*3*2+3] = p.x; m_fVerts[i*3*2+4] = p.y; m_fVerts[i*3*2+5] = p.z;
        }

    }

    glGenBuffers(3,&SVboId[0]);
    //Vertex
    glBindBuffer(GL_ARRAY_BUFFER,SVboId[0]);
    glBufferData(GL_ARRAY_BUFFER,sizeof(*m_fVerts)*(m_iSegements+1)*2*3,
        m_fVerts,GL_DYNAMIC_DRAW);
    // Normals
    glBindBuffer(GL_ARRAY_BUFFER,SVboId[1]);
    glBufferData(GL_ARRAY_BUFFER,sizeof(*m_fNormals)*(m_iSegements+1)*2*3,
        m_fNormals,GL_DYNAMIC_DRAW);

}

void Jellyfish::drawHemiSphere( )
{

    /*glEnableClientState( GL_VERTEX_ARRAY );
    glVertexPointer( 3, GL_FLOAT, sizeof(*m_fVerts)*(m_iSegements+1)*2*3, m_fVerts );*/

    glEnableClientState( GL_VERTEX_ARRAY );
    glBindBuffer(GL_ARRAY_BUFFER,SVboId[0]);
    glVertexPointer( 3, GL_FLOAT, 0, 0 );

    glEnableClientState( GL_NORMAL_ARRAY );
    glBindBuffer(GL_NORMAL_ARRAY,SVboId[1]);
    glNormalPointer( GL_FLOAT, 0,0 );

    /*glEnableClientState( GL_TEXTURE_COORD_ARRAY );
    glTexCoordPointer( 2, GL_FLOAT,  sizeof(*m_fTexCoords)*(m_iSegements+1)*2*3, m_fTexCoords );
    glEnableClientState( GL_NORMAL_ARRAY );
    glNormalPointer( GL_FLOAT, sizeof(*m_fNormals)*(m_iSegements+1)*2*2, m_fNormals );*/
    for( int j = 0; j < m_iSegements / 2; j++ ) {

        for( int i = 0; i <= m_iSegements; i++ )
        {

        }

        glDrawArrays( GL_TRIANGLES, 0,   (m_iSegements + 1)*2   );
    }

    glDisableClientState( GL_VERTEX_ARRAY );
    glDisableClientState( GL_TEXTURE_COORD_ARRAY );
    glDisableClientState( GL_NORMAL_ARRAY );

}

sentences:
How should I prepare for migration from D3D9 to D3D10 or D3D11? I'm considering a Direct3D9 texture streaming solution, but my company will eventually be going to D3D11 in the future.

I wanted to make my solution as forward compatible as possible, so I was hoping that someone could give me some feedback on exactly what D3D11's capabilities were and what I should be looking for when preparing such a migration?

For reference, here's what I'm considering on D3D9:

Load low res mip maps for all meshes at load time
Create bounding boxes around each of my objects and detect when I'm inside any given bounding box
For any bounding box that I'm inside of I will load the high res portion of the mip map
Any bounding box that I've left I'll unload the texture from
I've also got to cook up some scheme to manage fragmentation of the GPU memory, initially I'll probably just cycle the GPU memory whenever the camera and my objects are still

sentences:
Finding Pixels within UV Coordinates I am building lightmaps for 3D models. My lightmap algorithm needs to determine which pixels( lumels ) within the lightmap texture fall within the boundary of a mesh face( triangle )...this process takes place for each mesh face...

I was using barycentric coordinate techniques to accomplish this task. It works for the most part...here is code:

bool PixelIsWithinBounds( const D3DXVECTOR2 &t0,
                            const D3DXVECTOR2 &t1,
                            const D3DXVECTOR2 &t2,
                            const D3DXVECTOR2 &pUV )
{
    // compute vectors
    D3DXVECTOR2 v0 = t1 - t0,
        v1 = t2 - t0,
        v2 = pUV - t0;

    // do bounds test for each position
    float f00 = D3DXVec2Dot( &v0, &v0 );
    float f01 = D3DXVec2Dot( &v0, &v1 );
    float f11 = D3DXVec2Dot( &v1, &v1 );

    float f02 = D3DXVec2Dot( &v0, &v2 );
    float f12 = D3DXVec2Dot( &v1, &v2 );

    // Compute barycentric coordinates
    float invDenom = 1 / ( f00 * f11 - f01 * f01 );
    float fU = ( f11 * f02 - f01 * f12 ) * invDenom;
    float fV = ( f00 * f12 - f01 * f02 ) * invDenom;

    // Check if point is in triangle
    if( ( fU >= 0 ) && ( fV >= 0 ) && ( fU + fV <= 1 ) )
        return true;

    return false;
}

This function takes as input 3 UV coordinates( mesh face ) and a pixel UV coordinate. The problem with this method is that if the pixel is only partially covered by the face, the function returns false( because the pixel center does not ly within the triangle ). I could do overlap tests for each point on the triangle...I would like to know if there is a more efficient method...as this process takes place many times per generation of a lightmap...

...any ideas?

here is a screenshot showing the endpoint of a mesh face after lightmap generation...the corner of this face overlaps a pixel surface but doesn't overlap the pixel center...the algorithm left this pixel black( no light )...

EDIT: Shader code to dilate pixels

//--------------------------------------------------------------//
// Dilation Pass
//--------------------------------------------------------------//
PS_INPUT_Quad DilationPass_Vertex_Shader( VS_INPUT_Quad Input )
{
    PS_INPUT_Quad Output = ( PS_INPUT_Quad )0;

    Output.Position = mul( Input.Position, mOrtho );
    Output.UV = Input.UV;
    return Output;
}
float4 DilationPass_Pixel_Shader( PS_INPUT_Quad Input ) : COLOR0
{
    float4 vC = tex2D( g_SamplerLightMap, Input.UV );
    if( vC.w != 0 )
        return vC;

    int nValidPixels = 0;
    float4 vFinalColor = 0;
    for( int i = 0; i < 8; ++i )
    {
        float4 vNeighborColor = tex2D( g_SamplerLightMap, Input.UV + TexelKernel[ i ] );
        if( vNeighborColor.w == 0 )
            continue;

        //vFinalColor = ( length( vFinalColor ) > length( vNeighborColor ) ) ? vFinalColor : vNeighborColor;
        vFinalColor += vNeighborColor;
        nValidPixels++;
    }
    return vFinalColor / max( nValidPixels, 1 );
}

sentences:
How does one specify raster operations in XNA? I'm looking for a way to add a sprite using a particular logic operation (like XOR). I can't find anything on Google and I'm not sure where to look in the documentation.

I've looked into SpriteBatch.Begin(...) and its Draw method and several options in the GraphicsDevice class, but I'm not recognizing anything capable of this. I'm still pretty new to XNA so I may just not have recognized the terminology to do 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: Class design for instantly switching between free-roaming world to/from battle world? I plan to have an isometric world, which can be freely roam around. However, I desire the system to instantly apply the grid onto isometric world for battling system on any random encounter. Therefore, from what I expect, I should have a class of character that can generally switch between free-roaming and battle system. However, because I am still new to game programming, I do not know how should I approach this. If I make my character class such that I could abruptly derived it into either Free-roaming or Battle system, it may sound convenient, but I will have to implement this feature for all other class too (enemy, object, etc.). If I use Interface, then I won't have flexibility to add extra function to certain special class of object (maybe boss?). Or should I have a set of hierarchy of interface to tackle this problem? If so, it would be too complicated. Therefore, any suggestion?

sentences:
Dragging UI element lags behind the cursor Have been at this for 2 days straight trying different ways to solve this, and I can't.

I'm simply dragging around a UI panel using PointerDown and Drag events.  I set the transform.localPosition inside the Drag handler.  It works as expected, only problem is, the UI element seems to lag behind the cursor.

I created a GIF to show the issue in a build version to rule out the Editor.

Not sure how well you can see the issue, but the faster you move the cursor the worse it is.

Any ideas of what the issue is and how can I solve it?

Thanks

sentences:
How to compute acceleration by using Kinect device joint positions I have an application which uses the Microsoft Kinect camera device.

At each point I can obtain the position of my hand in the 3 Dimensional space ( X - Y - Z ) and I want to compute acceleration of my hand over each second on each axis.

Basically, I can obtain the coordinates at each frame(where 1 sec = 30 frames), and I want to compute the acceleration of my hand in 1 sec.

StartPoint - (x1, y1, z1)

EndPoint after 1 sec from StartPoint ( 30 frames ) - (x2, y2, z2)

Acceleration between StartPoint and EndPoint = ?

Also I can obtain all the other coordinates of my hand over time, but I want to compute the acceleration in the period of time between start point and end point.

Could you please explain or show me how?

sentences:
Dealing with field of view when zooming into a terrain from a height I'm creating a tech demo featuring a small planet. The problem I'm having is that the planet doesn't really feel like the right "scale" when the camera in down on the surface, I think it could be the curvature of the surface of the planet.

I was wondering if anyone had any suggestions for adjusting maybe the field of view, or any other camera tricks to give the impression that, once on the surface, the planet is larger than it appears at the moment.

sentences:
Getting wrong value for middle of screen My mouse is able to move the camera and rotate it around my model. If the mouse is in the middle of the screen, the camera should not move.

The red circle is where my mouse has to be at in order for the camera to stay still. If I put the cursor in the middle of the screen, it rotates the camera which shouldn't happen.

    Point screenCenter;
    float scrollRate = 1.0f;
    MouseState previousMouse;
    bool moveMode = false;

    #region MOUSE
        screenCenter.X = this.Window.ClientBounds.Width / 2;
        screenCenter.Y = this.Window.ClientBounds.Height / 2;

        this.IsMouseVisible = true;

        previousMouse = Mouse.GetState();
        Mouse.SetPosition(screenCenter.X, screenCenter.Y);
        #endregion MOUSE

    if (this.IsActive)
        {
            MouseState mouse = Mouse.GetState();

            if (moveMode)
            {
                Vector3 temp = player.playerWorld.Translation;
                player.playerWorld.Translation = Vector3.Zero;
                player.playerWorld *= Matrix.CreateRotationY(MathHelper.ToRadians(mouse.X - screenCenter.X) / 75);
                player.playerWorld.Translation = temp;

                cam.up -= MathHelper.ToRadians(mouse.Y - screenCenter.Y) / 25;
            }

            if (mouse.RightButton == ButtonState.Pressed)
            {
                if (graphics.GraphicsDevice.Viewport.Bounds.Contains(new Point(mouse.X, mouse.Y)))
                {
                    moveMode = true;
                }
            }
            else
            {
                if (moveMode)
                {
                    moveMode = false;
                }
            }

            if (mouse.ScrollWheelValue - previousMouse.ScrollWheelValue != 0)
            {
                float wheelChange = mouse.ScrollWheelValue - previousMouse.ScrollWheelValue;

                cam.up += 0.7f;
                cam.backward += 0.7f;
            }
            previousMouse = mouse;
        }

Why could this be happening? the screen is 650X1000. ScreenCenter x and y are the correct values.

Now that I play with it more, it seems each time the game starts, the mouse is set to a different position. The mouse should automatically be set to the middle of the screen each time the game starts, but it ends up anywhere but the middle.

Any idea of what could be happening here?

sentences:
Slick 2D first trial error I followed some advices to learn Slick2D and when I started doing the "SimpleGame" I got my first error. Does anyone have any idea of what is it and how to fix?

Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:Slick Build #274
Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:LWJGL Version: 2.0b1
Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:OriginalDisplayMode: 1024 x 768 x 16 @60Hz
Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:TargetDisplayMode: 800 x 600 x 0 @0Hz
Sun Dec 26 23:09:12 GMT-03:00 2010 ERROR:Could not find a valid pixel format
org.lwjgl.LWJGLException: Could not find a valid pixel format
 at org.lwjgl.opengl.WindowsPeerInfo.nChoosePixelFormat(Native Method)
 at org.lwjgl.opengl.WindowsPeerInfo.choosePixelFormat(WindowsPeerInfo.java:52)
 at org.lwjgl.opengl.WindowsDisplayPeerInfo.initDC(WindowsDisplayPeerInfo.java:54)
 at org.lwjgl.opengl.WindowsDisplay.createWindow(WindowsDisplay.java:158)
 at org.lwjgl.opengl.Display.createWindow(Display.java:299)
 at org.lwjgl.opengl.Display.create(Display.java:848)
 at org.lwjgl.opengl.Display.create(Display.java:800)
 at org.newdawn.slick.AppGameContainer.tryCreateDisplay(AppGameContainer.java:299)
 at org.newdawn.slick.AppGameContainer.access$000(AppGameContainer.java:34)
 at org.newdawn.slick.AppGameContainer$2.run(AppGameContainer.java:364)
 at java.security.AccessController.doPrivileged(Native Method)
 at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:345)
 at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
 at SimpleGame.main(SimpleGame.java:38)
Exception in thread "main" org.newdawn.slick.SlickException: Failed to initialise the LWJGL display
 at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:375)
 at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
 at SimpleGame.main(SimpleGame.java:38)

sentences:
How do I create geometry in SceneKit? I have been experimenting with Apple's new SceneKit for fun, but I cannot seem to figure out how to input vertex data without loading a .dae file.

Does anybody who has been testing SceneKit have any idea how to set or modify vertex data?

sentences:
Unity game crashes when opened on some computers but not all I'm facing a weird issue where every time I attempt to run a Unity application, it just crashes with no error message or log being generated. I tried running the game, it works on some computers (3) but fails on most (35). Upon attempting to run the application, I get a box that pops up for a second with a red exclamation point, which then crashes. See screenshot below:

I have found people having similar problems, but no real solution.
https://forum.unity.com/threads/solved-crash-when-running-any-unity-application.599953/
https://forum.unity.com/threads/crash-when-opening-any-unity-application.873133/
My game is made in Unity (v2018.1.9f2). Attaching the error logs for your reference. Unfortunately, I do not have the admin privileges to try the citrix solution in lab computers (since they are controlled by the University office).
Error logs:

https://pastebin.com/mcMaD9im
https://pastebin.com/M0e9a9GG
https://pastebin.com/DSRrU8bZ

sentences:
What is the point of a borderless fullscreen window? Quite a lot of game allow user to play in a "borderless fullscreen window" instead of a "fullscreen mode". I've been wondering. Why would one prefer a fullscreen window over the "built-in" fullscreen mode?

Simple test of my own showed me, that using fullscreen mode instead yields better performance. I also tried to search on Google and on SO, but most answers are gaming related or on how to actually create those windows in API X,Y or Z.

So what is the point of having a borderless fullscreen window? Are there any technical reasons?

sentences:
Please help me with my 2D isometric tile picking Possible Duplicate:
  How to convert mouse coordinates to isometric indexes?

Okay, I apologise in advance if I make no sense here.

Basically, I've got a simple application that takes in a file and populates a 2D array with tile objects that contain the type of tile, their X and Y values, location of the sprite in a tile map etc. The application then renders this back to front so the depth is sorted. The camera can be dragged about.

for (int i = 0; i < map.length; i++){
        for(int j = 0; j < map[i].length; j++){
            m_MapTest[i][j] = new Tile(((j * Tile.TILE_W / 2) + (i * Tile.TILE_W / 2)),
                      ((i * Tile.TILE_H / 2) - (j * Tile.TILE_H / 2)),
                      map[i][j], 0, map[i][j], 0);

The output:

The numbers are an example of where these tiles are located in the array. Ignore the temporary art.

How do I get the tile index of my mouse click? I've tried about 10 different picking algorithms including matrix translations but I haven't got anywhere. The closest I got was the application picking the right tile in one direction, yet the other axis would start at negative one, the next tile would be zero, the next would be zero then the next would be one and would be correct from there, although I seem to have deleted this in frustration. I feel bad that I don't really have any code for this.

My tile width is 64 and the height is 32, although the sprites are 64x64 and the actual tiles are located at the bottom of the image, if that makes sense... I have done it like this as I am planning on having varied tile heights.

If you need any more information to help me, please let me know. Math is not my strong point.

sentences:
Free vs. Paid: Picking a Financial Model I finally embarked upon my first "paid" game. What this means is that I will incorporate some sort of monetization strategy in my game. This may mean making the app pay-to-download, making it "freemium" with paid content, or something else.

Having never done something like this, I'm at a complete loss as to how to figure out what I should do. I know a couple of models (pay to download, freemium, etc.) and I can brainstorm some ideas. But how do I figure out what strategy to use?

Perhaps there's some body of research on this? (I recall reading that MMOs popular in Korea use a model where cosmetic changes only are pay-to-buy; everything else is free).

sentences:
Companion AI with NavMeshAgent causing jittery movement on the X-Axis I'm trying to do a companion AI that follows around my player but with a certain distance.
I first tried to self-program the movement behavior. but realized quickly that a NavMeshAgent offers more simple solutions to what I'm trying to achieve.
Now the problem is that my AI doesn't follow around smoothly. It's surely not because of the camera, since my player and my enemy AIs do not have these jittery movement.
My script is as simple as it can get:
private Transform target;
private NavMeshAgent agent;

public Animator partnerAnim;
public GameObject player;

private void Start()
{
    // set target to player transform
    target = GameManager.GM.playerMachine.transform;
    agent = GetComponent<NavMeshAgent>();
}

private void Update()
{
    // Determining wether to play the walk animation or not
    partnerAnim.SetFloat("normalizedSpeed", Mathf.Clamp01(agent.velocity.magnitude));

    agent.SetDestination(target.position);
}

My stopping distance is at 2 and my speed is at 3.5.
No matter how I change these values, the jittery movement won't change.
I also have a rigidbody attached to my NavMeshAgent, and I made sure to turn on isKinematic, and I also removed it to check if that solves the problem, but it didn't.
The weird thing is that it only seems to be a problem when moving along the X-Axis. When I move on the Z-Axis only, my partner is following my player smoothly (I'm guessing this is because I increase the speed of my player on the Z-Axis, but I don't really see the connection with my problem here. If it would be a speed problem, then lowering the speed on my AI would've fixed this, but it didn't.)
Here are the full NavMeshAgent settings:

sentences:
How can I access a method via a string in Unity? I myself am new to unity and I would like to know how it is possible to access a method via a string, something like this:
public string PlayerPrefsName;

public GameObject Button;

public string GadgetForSkin;

private void Start()
{
    GadgetChanged = PlayerPrefs.GetInt(PlayerPrefsName);
    if (GadgetChanged == 0)
    {
        Button.SetActive(false);
    }
    GadgetForSkin = "GadgetForSkin" + GadgetChanged;
}

public void GadgetChecker()
{
    GadgetForSkin();
}

public void GadgetForSkin1()
{

}

If it's not possible, how can I achieve something similar?

sentences:
I am struggling with a combo system for a game of mine I am currently trying to make a game with a friend but at the moment I am having a few problems with finding a combo system. Until we progressed I copied this code from a video where I use our first combo hit as a source of damage. My code for this is below:

public Animator anim;
private bool attack1 = false;
private float attackTimer = 0;
private float attackCd = 0.3f;
public Collider2D attackTrigger;
public KeyCode Stance1;
public KeyCode Attack1;

// Use this for initialization
void Awake ()
{
    anim = gameObject.GetComponent<Animator>();
    attackTrigger.enabled = false;
}

public void CreateHitbox (int createhitbox)
{
    attackTrigger.enabled = true;
}

public void DestroyHitbox (int destroyhitbox)
{
    attackTrigger.enabled = false;
}

// Update is called once per frame
public void Update ()
{
    if (Input.GetKeyDown(Stance1))
        anim.SetTrigger("Stance");

    if (Input.GetKeyUp(Stance1))
        anim.SetTrigger("Stance");

    if (Input.GetKey(Stance1))
    {
        //Melee attack
        if (Input.GetKeyDown(Attack1) && !attack1)
        {
            attack1 = true;
            attackTimer = attackCd;
        }

        if (attack1)
        {
            if (attackTimer > 0)
                attackTimer -= Time.deltaTime;
            else
                attack1 = false;
        }

        anim.SetBool("attack1", attack1);
    }
}

Our attack animations take a bit to initiate so we work with a hitbox as an attack trigger and activate the trigger through an animation event so that enemies are hit when they are supposed to. Furthermore in our game you have to go in a stance where you draw your sword to attack so I wrote it so that you can only attack when you are in the stance.

The problem is that I want to have a 3 hit combo in the end but I have a problem finding a solution that works. In addition I would like the different combo attacks to deal different damage so giving each attack different values would be great. My friend and I are beginners when it comes to C# as well so thinking of something ourselves was not possible.

sentences:
GameObject scope over RPC call Debugging my code I faced some unexpected behavior.

I called an RPC using uLink.NetworkView on the server passing some parameter including a GameObject tagged as Player.

Inside that RPC I make a call to GameObject.FindObjectsWithTag("Player")

What I refer to by saying "unexpected" is that that function returns all the gameobjects in hierarchy INCLUDING the gameobject passed as parameter to the RPC call.

I noticed that inside the editor it appears in hierarchy the gameobject passed to the RPC but without all the components BUT the transform.

My question is to know exactly how the scope is working, I seem to understand that the scope of the FindObjectsWithTags seems to include RPC parameters but without the most informations.

Any clue about this?

sentences:
Precise punch animation for unity I'm using blender to model, rig and animate my character for a Unity game, but there is something that I can't figure out by myself neither find on the internet, for example:

Lets say the main character is able to punch npcs and I want that punch aimed to the face but not all npcs have the same height.

How can the animation be adjusted to handle this?

Inverse kinematics seems to be the solution but to this date I couldn't find any good example or information about this subject better than "Check this box to fix the animation for stairs" and so on.

sentences:
How can I make an animation using arrays? I want to take an array of sprites, for example

sf::Sprite animation[3] = { stepLeft, inMiddle, stepRight };

and construct an animation by looping them. Is this possible? How do I go about it?

sentences:
How to render a curved horizon when rendering terrain far away For games with long view distance, it might look at bit weird when you fly high above the ground and the horizon is all flat.

So, how can I make a crumb/bend effect, when I fly high above the surface? Can this be done in the shaders?

If you're not sure what I mean, heres a picture:

A more clear example, though it might be captured with fish eye.

What would this best way to do this? I believe you could rotate and move (using transformationMatrix) all vertices a tiny little bit according to how far they are from the camera. But would this even create the desired effect, and would it be too resource extensive? Or maybe you know a whole another way to do it.

sentences:
Logical Dependencie Problem I am working with Unity and C#, but my Problem is a more general programming problem. I am trying to keep things easy, but still make them global access able and easy to modify.

So I have a Character_Model_Selection class, in which You can scroll from the right to the left with shifting for example to your desired model and then select it . An Id keeps track of which model is infront of the User on select. If He selects it, I compare that Id With an Integer and If it is equal to it, I pass it a string of the actual "hero" name . Before I used a singleton to create an default instance,  modify the Name and then access it in the Main screen, but since I have multiply Players with different spawns singletons doesn't really make sense anymore.

Question: What design Pattern or technique could I use to have a  Base class of a Player hero, which has some default properties, like health and pushforce. With I can create  multiply instances of but make it global access able and modify the default properties on select.

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:
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:
Unity Ajax and json data sending once again i need your help! with help from here i managed to make a function that sends a formated json text to a subscription service.the format is this
{
    "profiles":
    [
        {
            "email":"example@example.com"
        }
    ]
}

that works fine and great from my pc but once i upload the game it gets blocked by cors. Now i have cors enabled so i contacted klaviyo which handles the data and they told me their api does not accept data from the front end and i could use ajax to make it happer, an example of which is this:
var settings
=
{

"async"
: true,

"crossDomain"
: true,

"url"
:
"https://manage.kmail-lists.com/ajax/subscriptions/subscribe"
,

"method"
:
"POST"
,

"headers"
: {

"content-type"
:
"application/x-www-form-urlencoded"
,

"cache-control"
:
"no-cache"

},

"data"
: {

"g"
:
"LIST_ID"
,

"email"
: "email@address.com",

/
/
pass
in
additional fields (optional)

"$fields"
:
"$source, $first_name, $last_name"
,

"$source"
:
"Account Creation"
,

"$first_name"
: firstname,

"$last_name"
: lastname

}

};

$.ajax(settings).done(function(response) {

console.log(response);

})

now my code which is working from my pc is this :
public class testing : MonoBehaviour
{
    public InputField field;
    private string URL = "https://a.klaviyo.com/api/v2/list/YeXzKp/members?api_key=pk_ec448e1bdab7504c143466ca5eeabc5e95&profiles=[]";

    public void SaveData()
    {
        string data = JsonUtility.ToJson(
      new EmailApiData()
      {
          profiles = new EmailApiProfileData[]
          {
             new EmailApiProfileData() { email = field.text }
          }});
        StartCoroutine(SaveIntoJson(URL , data));
    }
    IEnumerator SaveIntoJson(string url, string data)
    {
        var request = new UnityWebRequest(url, UnityWebRequest.kHttpVerbPOST);
        request.SetRequestHeader("Content-Type", "application/json");
        request.SetRequestHeader("Access-Control-Allow-Origin","*");
        request.SetRequestHeader("Access-Control-Allow-Credentials", "true");
        var jsonBytes = Encoding.UTF8.GetBytes(data);
        request.uploadHandler = new UploadHandlerRaw(jsonBytes);
        request.downloadHandler = new DownloadHandlerBuffer();
        yield return request.SendWebRequest();
        if (request.isNetworkError || request.isHttpError)
        {
            Debug.Log(request.error);
            Debug.Log(request.downloadHandler.text);
        }
        else
        {
            Debug.Log("Form upload complete!");
        }
        Debug.Log(data);
    }
}
[Serializable]
public class EmailApiProfileData
{
    public string email;
}
[Serializable]
public class EmailApiData
{
    public EmailApiProfileData[] profiles;
}

how can i put those two together?? i know im way out of my waters here but i want to learn it!Thank you once more!

sentences:
How can I make sure that a component gets destroyed the last out of all components attached to an object in Unity? How can I make sure that a component gets destroyed the last out of all components attached to an object in Unity?
I have a component with some scripts on it: Script1 and Script2. Inside the Script2.OnDestroy method I have the following line of code: GetComponentInParent<Script1>().
I want that line of code to return Script1 whenever I click the Play button inside Unity editor to stop my game. While right now it returns null.

sentences:
How can I make an object move in a certain direction depending on its spawning point? I'm currently developing a 2D game and I couldn't find a way to figure this out. In the game, I have 4 different balls and 4 different spawning points. Every 2 seconds, a random ball spawns at a random spawning point.

What I want to achieve is, as I tried to describe above, lets say a ball spawns on right side, I want it to move towards left, if it spawns upside, I want it to go downwards etc.
Here is my spawner code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Game : MonoBehaviour {

    public Transform[] spawnPoints;
    public GameObject[] balls;

    public float timer = 2.0f;

    void Update()
    {
        timer -= Time.deltaTime;
        SpawnBalls ();
    }
    void SpawnBalls()
    {
        int spawnPoints_num = Random.Range (0, 4);
        int balls_num = Random.Range (0, 4);

        if (timer <= 0)
        {
        Instantiate (balls [balls_num], spawnPoints [spawnPoints_num].position, spawnPoints [spawnPoints_num].rotation);
        timer = 2.0f;
        }
    }
}

And here is my ball movement code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Balls : MonoBehaviour {

    public Game game;
    public float speed = 0.25f;

    void Start ()
    {
        game = FindObjectOfType<Game> ();
    }

    void Update ()
    {
    //Some if statement
    //transform.Translate (Vector3.left * Time.deltaTime * speed);
    //else if
    //transform.Translate (Vector3.up * Time.deltaTime * speed);
    //else if
    //transform.Translate (Vector3.right * Time.deltaTime * speed);
    //else if
    //transform.Translate (Vector3.down * Time.deltaTime * speed);
    }
}

I've tried giving spawnpoints tags and creating if statements with gameObject.tag and stuff but couldn't find a way to work it. How can I make it check which spawnpoint the ball spawned at so I can make it move accordingly?
Thanks for help.

sentences:
Alternative to Rotation degrees or clock facing to describe cards angle I'm working on some ideas for a system and hit a minor roadblock.

I would like to identify the angle of a card placed on a playing field. Besides a clock facing identification (3:00 would be a landscape position) or degrees (90 degrees would be a landscape position) are there any other terms that can be used to describe this angle?

I would like to find a different terminology for telling players (in the rules) to turn their cards to a landscape position, or portrait, etc. This may be unanswerable, but I could swear I have heard someone refer to an angle in an engineering environment that wasn't degrees or clock facings.

sentences:
How to fill in crevices on a height map I am a very experienced iOS Developer, but I am beginning my very first foray into 3D graphics (specifically with SceneKit).  I'm trying to model a planet, and I have it working with a height map giving mountains and valleys to a simple sphere.

What I'm wondering now is, how might I have a variable sea level?  As I understand it, a height map only affects how the image is rendered, but it doesn't actually change the geometry of the object, correct?  So my first idea, to have a smaller sphere and scale it up or down relative to the planet so that it shows through in the lower-elevation areas, wouldn't work?

If that's the case, how else might I approach this?  I'd love a code sample if it's simple or ready-made, but mostly I'm just looking for a conceptual answer that I can go off and implement.  How might I take a height-mapped planet surface, and have an adjustable sea level that fills in the lower-elevation areas first?  For simplicity, I'm treating sea level as purely altitude-based (i.e. I don't need to factor in dams or obstacles, and maintaining a consistent volume of water isn't important).

sentences:
How to create an animation clip that changes whatever color a RawImage has to a certain destination color? I created an animation clip that turns a certain RawImage's color from white to red.
I'd like to know how I could change that clip to turn any color that the RawImage might have into red - with other words, I don't want to have a specific starting color. Instead the current color shall be used and faded to red.

sentences:
GraphicRaycaster performance OnClick Let's say I have two Canvases: BackgroundCanvas and UICanvas.

Now, on BackgroundCanvas I have multiple moving, not clickable objects so I removed the GraphicRaycaster (+ 69 to performance).

On the UICanvas, all the objects are on the UI layer.
I also have some additional layers somewhere else.

Now, if I change the GraphicRaycaster's (on UICanvas) blocking mask to UI only, would it improve performance if there are other objects on the Default and other layers? Or would it still ray all these objects on other layers?

How does this really work? I'm asking cause I don't see any performance impact while switching these Blocking Masks, but after disabling the entire component - I do (but the input is not working ;S).

sentences:
XNA Seeing through heightmap problem I've recently started learning how to program in 3D with XNA and I've been trying to implement a Terrain3D class(a very simple height map). I've managed to draw a simple terrain, but I'm getting a weird bug where I can see through the terrain. This bug happens when I'm looking through a hill from the map. Here is a picture of what happens:

I was wondering if this is a common mistake for starters and if any of you ever experienced the same problem and could tell me what I'm doing wrong. If it's not such an obvious problem, here is my Draw method:

public override void Draw()
{
    Parent.Engine.SpriteBatch.Begin(SpriteBlendMode.None,
        SpriteSortMode.Immediate, SaveStateMode.SaveState);

    Camera3D cam = (Camera3D)Parent.Engine.Services.GetService(typeof(Camera3D));
    if (cam == null)
        throw new Exception("Camera3D couldn't be found. Drawing a 3D terrain requires a 3D camera.");

    float triangleCount = indices.Length / 3f;

    basicEffect.Begin();

    basicEffect.World = worldMatrix;
    basicEffect.View = cam.ViewMatrix;
    basicEffect.Projection = cam.ProjectionMatrix;
    basicEffect.VertexColorEnabled = true;

    Parent.Engine.GraphicsDevice.VertexDeclaration = new VertexDeclaration(
        Parent.Engine.GraphicsDevice,
        VertexPositionColor.VertexElements);

    foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
    {
        pass.Begin();
        Parent.Engine.GraphicsDevice.Vertices[0].SetSource(vertexBuffer, 0,
            VertexPositionColor.SizeInBytes);
        Parent.Engine.GraphicsDevice.Indices = indexBuffer;
        Parent.Engine.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList,
            0, 0, vertices.Length, 0, (int)triangleCount);
        pass.End();
    }

    basicEffect.End();

    Parent.Engine.SpriteBatch.End();
}

Parent is just a property holding the screen that the component belongs to. Engine is a property of that parent screen holding the engine that it belongs to.

If I should post more code(like the initialization code), then just leave a comment and I will.

sentences:
Deferred Rendering and skeletal animation I am working on a deferred rendering engine and just finished skeletal animation in the vertex shader, but soon realized that this was only updating the rendered geometry and not the shadows, as the animation was only done in the VS of the deferred rendering step, and not in the VS of each light.

I assume this means I should just calculate the animation on the cpu, as otherwise it will be done #oflights + 1 times in the gpu, which seems like a huge waste of cycles.

Is this how it is typically done?

Edit:  As a note, I am currently implementing this in OpenGL

sentences:
Using atan2 to calculate angle between two vectors I understand that:

atan2(vector.y, vector.x) = the angle between the vector and the X axis.

But I wanted to know how to get the angle between two vectors using atan2. So I came across this solution:

atan2(vector1.y - vector2.y, vector1.x - vector2.x)

My question is very simple:

Will the two following formulas produce the same number?

atan2(vector1.y - vector2.y, vector1.x - vector2.x)
atan2(vector2.y - vector1.y, vector2.x - vector1.x)

If not: How do I know what vector comes first in the subtractions?

Thanks

sentences:
Would creating a player scriptable game using Unreal Engine or Unity violate their license agreement? I want to create a game in Unity or UE4 which allows the user to write scripts in Python and run them mainly to control the AI. I will have to find a way to enable runtime script execution first. After searching the internet i was able to find some ways that may work.
What i cant find an answer for is how to limit the parts of engine and game code the user has access to so that the player doesnt feel like he's playing it in God mode.
And the main question is that even if i am able to restrict access to the API will it violate the terms of agreement for these commercial engines because the player will get access to the underlying engine and will be manipulating objects within it. I don't intend to make a moddable game just a game that requires you to write some code but that would be an extreme case to think about.

sentences:
is this approach correct to make my game framerate indipendent in javascript? this is what i did

my game loop is run every REFRESH milliseconds

loop = setInterval(tick,REFRESH);

in the loop i calculate how much time is passed since last tick and subdivide that for how much time i expected to be passed

var now = performance.now();
var elapsedTime = now - lastTick;
var delta = time / REFRESH;
lastTick = now;

and every time based action that should happen every tick is "scaled" with the delta factor,
for example my movement code

var distance=ball.dest.x-ball.x;
var movement=distance/speed;
ball.x+=movement;

will have movement multiplied with delta

sentences: Is the "Match-3" mechanic unpatented? Can I use a match-3 mechanic in my commercial game without being sued by some company holding the patent? I will add some extra features to the mechanic.

sentences:
Unity: scaling and animations In my Unity project I have a script that programmatically changes the scaling of an object during the game.

Recently I wanted to add a spawning animation clip to my object, which modifies the object's scaling (but only during a short delay). So I added an animation controller to the object, containing the spawning animation clip.

I can now successfully run the spawning animation but the in-game programmatic scaling changes don't work anymore, even when my animation is not running.

Any idea?

sentences:
How to fix this unexpected movement? I am facing a problem below is the detail.

There are two scripts(actually more than two but these have the problem) Cannon.cs and Launch.cs and three buttons(up, down, and launch) to move cannon and launch the bullet.
Cannon have bullets and each bullet has Launch.cs attached also a RigidBody2D.
When specific event occurs the Cannon.cs calls the Launch.cs's Launch(direction); method.
Parameter "direction" = Cannon.transform.right.
Bullets are being instantiated dynamically and are stored in the list Cannon.cs take one bullet and fires it(firing includes calling the Launch(direction));.
Launch(direction); will always be called once no matter what also to double sure myself I destroy the launch script on launch.

The problem is once the bullet is fired or launched in the direction specified by the direction of cannon(since direction = cannon.right) and I click on the up or down button the launched bullet changes its direction which should never happen because Launch() method is called only once in the lifetime of the bullet and also I detach the Launch.cs script on launch.

I am using rigidbody2D.velocity = direction * thrust; what I think is that rigidbody2D.velocity once called will possess the direction just like a method called by reference. I am totally lost I hope I made my question clear please do help me if you can.

sentences:
How to create pixel-perfect text in TextMeshPro with a shadow? Problem
Making the font asset of type Raster creates a pixel-perfect font, but it doesn't have the underlay option inside its material to give it a shadow.
Making it of type SDF (or one of the variants) does, but it's blurred in game view.
See the image for a visual example. The top text uses the SDF variant, whereas the bottom is of Raster type. This is Game View, zoomed in.

Attempted Solution
I considered using Unity's own Text component, which, strangely enough, doesn't blur in Game View (but does in Scene View). However, to give it a shadow, I need to create a 2nd, black Text object to place behind it with a small offset. This is fine, but then I need to match its value to the main Text's, and I can't seem to do that without checking every frame inside Update(), which is wasteful.

sentences:
How can I create a "cracked glass" material? I'm trying to figure out how the cracked and chipped glass effect in a Bioshock Infinite Burial at Sea Episode 2 works.

My current guess is that it is essentially a transparent shader with gloss. It would have a map defining the direction of reflections from the environment, with the cracks being significantly different from the mesh's normals. It would also include some kind of model of the angular dependence of the amount of refraction/transmission to reflection so that it can roughly approximate Fesnel's equations.

It doesn't appear to be a full refractive model, so I'm wondering how exactly this is implemented? Am I right with what I have said above?

sentences:
How do I fix a "missing mcp.cfg" error? I am trying to use mod coder pack (MCP) to create mods of my own. I have downloaded MCP 9.4 version from www.modcoderpack.com. The error that I have encountered is that when I try to run a file called decompile.sh in the mac terminal, the terminal responds with an error: ERROR:root:!! Missing mcp.cfg. I have checked my MCP folder and made sure that it contained the file mcp.cfg. The file is in my folder.

I am currently running on a Macbook Pro with MacOS Mojave Version 10.14.4.

sentences:
Directional light type I am currently trying to implement a specific directional light type.

This light type has been used in the game INSIDE and is called orthogonal spotlight (aka local directional light). I assume that this is a directional light which behaves like a spot light and have a squared or rectangular attenuation but I have some difficulties to integrate it in my deferred pipeline and get the general concept of this light type.

Implementing a simple directional light is simple dot(worldNormal, lightDir) but what kind of data should I use to constraint its application into a square or a rectangle ?

I hope that you'll be able to give me some clues. Thanks a lot !

sentences:
Soft body, where to start learning? I want to ask you about some resources to learn simulating soft bodies, do you know some good knowledge sources?

I asking because I want to make car crash simulator, I've made something but it didn't work well. :/

sentences:
Collision detection circle-segment-segment I've already implemented collision detection in my game loosely following this tutorial, which works great, but I realized there's one major flaw.
The player and the enemies are circles, while the obstacles can be either segments or polygons or circles.
Now, let's say I have segment A from point (100, 100) to point (300, 100) and segment B from point (100, 200) to point (300, 100), which means they form an acute angle, and player has it center in point (100, 125), with a radius of 25.
If player starts moving right, it will eventually collide against segment B. My method checkCollisions() will return a vector, but if I apply that vector on player, it will be moved up and left, and will overlap segment A.
If I call checkCollisions() a second time, player will be pushed down and collide again with segment B, so recursive invocations aren't a solution. Any ideas?

Here's a picture to explain:
 The g->n vector direction is along the bisector of the two little vectors, but how do I find the length?

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:
rotating a sprite around a non-fixed center I'm trying to get this character to spin in a circle to aim at the cursor. It all works pretty well, but I can't get the image to rotate around its center. Only around its corner. I've been trying to find a solution be using some crazy trig stuff, but I'm not getting anywhere.

public void draw(Graphics g, double inter)
{
BufferedImage im;
Graphics2D g2d = (Graphics2D)g;
GImage gImage;

gImage = GImages.getImage(p.sprite);
im = gImage.imageFile;
AffineTransform at = new AffineTransform();
at.translate((p.xcord+((float)p.width/2))+(p.xspd*inter), (p.ycord+((float)p.height/2))+(p.yspd*inter));
at.rotate(p.angle+(Math.PI/2));
at.scale((double)gImage.xsize/im.getWidth(), (double)gImage.ysize/im.getHeight());
//at.translate(-(float)p.width/2, -(float)p.height/2);
g2d.drawImage(im, at, null);
g2d.setColor(Color.BLUE);
g2d.drawRect((int)p.xcord,(int)p.ycord,1,1);
//g.setColor(Color.BLACK);
//g.drawString(p.suh, (int)(p.xcord+(p.xspd*inter)), (int)(p.ycord+(p.yspd*inter)));
}

p is my sprite object, the cords make up the point of the corner of the image.
The sprite moves around the screen, so I can't use a fixed point method as far as I know.
If anyone has any suggestions to make this work.

sentences:
libgdx ActorGestureListener.pan() parameters not moving actor in smooth line I override the pan method in ActorGestureListener to implement dragging actors in libgdx (scene2d).

When I move individual pieces on a board they move smoothly, but when moving the whole board, the x and y coordinates that is sent to pan is "jumping", and in an increasingly amount the longer it is dragged.

These are an example of the deltaY coordinates sent to pan when dragging smoothly downwards:

 1.1156368
-0.13125038
-1.0500145
 0.98439217
-1.0500202
 0.91877174
-0.984396
 0.9187679
-0.98439026
 0.9187641
-0.13125038

This is how I move the camera:

public void pan (InputEvent event, float x, float y, float deltaX, float deltaY) {
    cam.translate(-deltaX, -deltaY);

I have been using both the delta values sent to pan and the real position values, but similar results. And since it is the coordinates that are wrong, it doesn't matter whether I move the board itself or the camera.

What could the cause be for this and what is the solution?

When I move camera only half the delta-values, it moves smoothly but only at half the speed of the mouse pointer:

cam.translate(-deltaX / 2, -deltaY / 2);

It seems like the moving of camera or board affects the mouse input coordinates. How can I drag at "mouse speed" and still get smooth movements?

(This question was also posted on stackoverflow: https://stackoverflow.com/questions/20693020/libgdx-actorgesturelistener-pan-parameters-not-moving-actor-in-smooth-line)

sentences:
Quat.AngleAxis broken on one axis I have a scene in my game where you create your own designs by placing static meshes and manipulating their scales, positions, and rotations.

For the rotations I'm using Quaterion.AngleAxis as so:

        if (toolMode == PositioningTool.Rotate)
        {
            switch (grabbedCollider.transform.name)
            {
                case "X":
                    focus.localRotation *= Quaternion.AngleAxis(delta.x * 90 * Time.deltaTime, transform.right);
                    break;
                case "Y":
                    focus.localRotation *= Quaternion.AngleAxis(delta.x * 90 * Time.deltaTime, transform.up);
                    break;
                case "Z":
                    focus.localRotation *= Quaternion.AngleAxis(delta.x * 90 * Time.deltaTime, transform.forward);
                    break;
            }
        }

where delta is the mouse movement for that frame, focus is the object I am manipulating, and transform is the transform component of the ToolArm that the player interacts with. toolarm.position is set to focus.position every frame

my problem arises when I try to do a rotation on my x axis. my other axis will spin 360 and beyond, spinning in circles endlessly. when x axis is used, it only rotates from -90 to 90 (as seen in the unity editor). What am I doing wrong?

sentences:
How can I get a property of an entity without having to call getEntityByType every time? I'm trying to get an entity (a bullet, a grenade, and an explosive) from my player. Specifically, I want the shootingRate of my bullet (how frequently it can be fired).

How can I do this without having to call getEntityByType each time I fire this projectile? There has got to be a cleaner way from what I'm doing right now, which is:

// Shooting
var isShooting = ig.input.state('shoot');

if (isShooting && this.lastShootTimer.delta() > 0) {

switch (this.activeWeapon)
{
    case("EntityBullet"):
        ig.game.spawnEntity(this.activeWeapon, this.pos.x, this.pos.y - 10);
        var equipedWeap =  ig.game.getEntitiesByType(EntityBullet);
        this.lastShootTimer.set(equippedWeap.shootingRate);
        console.log(equipedWeap.shootingRate);
        break;
    case("EntityGrenade"):
        ig.game.spawnEntity(this.activeWeapon, this.pos.x, this.pos.y +5);
      var  equipedWeap =  ig.game.getEntitiesByType(EntityGrenade);
        this.lastShootTimer.set(equipedWeap.shootingRate);
        console.log(EquipedWeap.shootingRate);
        break;
    case("EntityExplosiveBomb"):
        ig.game.spawnEntity(this.activeWeapon, this.pos.x, this.pos.y +5 );
     var   equipedWeap =  ig.game.getEntitiesByType(EntityExplosiveBomb)[0];
        this.lastShootTimer.set(equipedWeap.shootingRate);
        console.log(equipedWeap.shootingRate);
        break;
   }
}

sentences:
Would a box2D sensor fit my needs? I have a object in my game that when the main character hits it, all I want to do is have the object explode and then notify the character object that a hit has occurred.

Would I use a b2Body and set it as a sensor for this or would I achieve this some other way?

I'm using cocos2d by the way.

sentences:
Unity: Is there any way for a button to call a function of all clones? I really don't know off hand. I've got a few ideas but I'm not at my PC to test it.

like ButtonisPressed > Clone script etc()

//on every gameobject clone
void etc() {
  i = 2;
}

That way all i's in the clones will be 2. I want it to work like pacman, if all the clones(or ghosts) have i = 2 then they enter their blue state and they change colors. Except I want to call etc() function with a button
Thanks in advance. If no one figures it out, I will report back later (~12hrs)

sentences:
How does ECS handle systems which need to know more about the environment of the entities it processes? I'm trying to wrap my head around the concept of ECS (Entity Component System). I think I grasp the concept of the different parts, Entities, Components, and Systems.

Entities: Basically just a container for components

Components: Data. E.g Transform component holding position, rotation and scale.

System: Runs on a subset of entities matching a combination of components. E.g. RenderSystem rendering all entities with a Mesh and a Transform.

What I'm having trouble wrapping my head around is how a system is supposed to assign data regarding the surrounding environment to the components without using global data. And it's probably because of a lack of understanding.

Example of what I'm getting stuck on:

Lets say I have a Player entity consisting of, among others, a Transform component. And lets say that there are multiple Zombie entities roaming the game world, which has a Transform and a AIPathfinding component. So I would naturally create a System that operates on Transforms and AIPathfinding to make the zombies chase the player.

My only problem is, how is the system supposed to know where the player is, or if there even is a player within range, without having to grab the player globally?
Sure I could pass the player into the creation of the system. But what if along with the player the zombie are also chasing a constantly changing amount of civilians. Do I pass them to the system at creation as well? Or should I have some global way to fetch entities matching a component query, similarly to how the system detemines which entities to operate on?

I understand that this might be entirely up to the implementation of the ECS. But I'm having a hard time finding resources that explains any further that the most basic systems (RenderSystem etc.).

sentences:
Math: determining a proper procedural vector for sine-movement My Problem
Suppose you have an object moving along the x-axis, wobbling up and down. Movement code might look like this:
x += 1;
y = Sin(x);
Move((x,y) * speed);

When I try to figure out a method to move my object along a sine wave, say diagonally, I run into trouble. I am not sure what kind of Vector math I use to calculate the appropriate Sine movement along a diagonal where both X and Y values must be altered.
The visual result would be the object bobbing up and down and sideways but still moving in its given direction.
How do I enable sine movement along a diagonal?

sentences:
LeanTween : How to check if gameObject is destroyed? I am trying to animate a gameObject using LeanTween which has got destroyed already.
The MissingReferenceException occurs in LeanTween.setOnUpdate();
The null check doesn't work either: (gameObject != null)
I have used LeanTween.cancel(gameObject,false); but it still throws an exception.

sentences:
What is the impact of many AI enemies on state replication networking? Imagine an online coop style FPS or TDS game where say 2-6 real players fought large amounts (20-60 concurrent) of AI enemies. Could this style of game be reasonably networked over the internet using a Quake or Tribes style partial state replication model? Almost every coop game I know of uses a lockstep style networking in these cases (even games like Halo which use state replication for normal multiplayer, but lockstep for coop/firefight). My concern is that the network download (for clients) and upload (for server) overhead of each AI would end up being about the same as if a real player was in the game. Is this a real concern? Or is the limiting factor on the number of players more about how much data the players upload?

TLDR; Can large numbers of AIs be reasonably networked to a few players with a partial state replication model or is lockstep the only real solution.

Any help here would be great!

sentences:
Limiting a player's movement to the screen's dimensions I have a player, that I can control using WASD. And I don't want him to leave the screen.

So I've tried the following:

if (player1.getX()+5 < 974 && player1.getX()-5 > 0) {
    if(Keyboard.isKeyDown(Input.KEY_D)) {
        player1.addForce(5, "d");
    }
    if(Keyboard.isKeyDown(Input.KEY_A)) {
        player1.addForce(5, "a");
    }
    if(Keyboard.isKeyDown(Input.KEY_W)) {
        player1.addForce(5, "w");
    }
    if(Keyboard.isKeyDown(Input.KEY_S)) {
        player1.addForce(5, "s");
    }
} else if(player1.getX() >= 974) {
    player1.addForce(5, "a");
} else if(player1.getX() <= 0) {
    player1.addForce(5, "d");
}

It actually works, but the player gets stuck at the edge of screen, and can't move anymore. Any ideas why? Or rather, how do I make a proper collision detection?

NB: 1024 is the width of screen. And my player is 50 pixels wide, thus the 974. I am only working with X at the momemnt, to try getting it to work.

sentences:
Object movement in Unreal using BPs and input touch and ARCore So I am trying to move an object in Unreal through input touch using ARCore. The problem is that I can't use the simple Screen to world position because it just returns a world position wherever the camera is at the time that you touch. I'm trying to convert the X and Y positions to actual space but, I am having a difficult time with it. Here's what I have so far:

This works okay, but the movement isn't equal if that makes sense. Obviously it's because I am just pulling the raw coordinates but, I honestly have no idea what I need to do to them in order to get it to move smoothly.

If you're still not following, basically, the closer I get to the left, top edge the slower the object moves and the closer I get to the right bottom edge the faster the movement. This happens because the X and Y coordinates get smaller/larger

What can I do to compensate for this disparity between coordinates?

Is there a way to get like a percentage from the edge of the screen?

sentences:
QuadTree: store only points, or regions? I am developing a quadtree to keep track of moving objects for collision detection. Each object has a bounding shape, let's say they are all circles. (It's a 2D top-down game)

I am unsure whether to store only the position of each object, or the whole bounding shape.

If working with points, insertion and subdivision is easy, because objects will never span multiple nodes. On the other hand, a proximity query for an object may miss collisions, because it won't take the objects' dimensions into account. How to calculate the query region when you only have points?

If working with regions, how to handle an object that spans multiple nodes? Should it be inserted in the nearest parent node that completely contains it, even if this exceeds the node's capacity?

Thanks.

sentences:
Refresh a single view The game I'm working on is based on different levels. I can use different activities or only one activity with different layouts ( or maybe only one layout, you have to apologize me but I'm studying alone and it's pretty hard to learn alone ).

My problem is: I'm not sure what is best way to implement levels in game. If I use only one activity as container for each level, where I design each level as different layout, how can I refresh my current activity with the new content ?
To make it clear, think about "Cut the rope", is every level a different activity or they load different xml's on the same ?

I'm sorry if this question is not properly written, but I can't find more specific terms to make it better.

sentences: Static Meshes vs 3D models What is the difference between static meshes and regular 3D models. I am very new to game development, and I am using UDK (Unreal Development Kit).

sentences:
MonoGame - Model not rendering properly I'm trying to render a model made in Blender. I export it to .fbx and import it in the content pipeline, load and draw it, but it displays like this:

And this is what it looks like in Blender:

Code that draws the model:

foreach (ModelMesh modelMesh in model.Meshes)
{
    foreach (BasicEffect basicEffect in modelMesh.Effects)
    {
        basicEffect.EnableDefaultLighting();
        basicEffect.PreferPerPixelLighting = true;
        basicEffect.World = Matrix.CreateTranslation(Position);
        basicEffect.View = camera.ViewMatrix;
        basicEffect.Projection = Matrix.CreatePerspectiveFieldOfView(width / height, MathHelper.PiOver2, 0.1f, 100f);
    }

    modelMesh.Draw();
}

Does anyone know what's wrong with the model?

sentences:
How should I account for the GC when building games with Unity? *As far as I know, Unity3D for iOS is based on the Mono runtime and Mono has only generational mark & sweep GC.

This GC system can't avoid GC time which stops game system. Instance pooling can reduce this but not completely, because we can't control instantiation happens in the CLR's base class library. Those hidden small and frequent instances will raise un-deterministic GC time eventually. Forcing complete GC periodically will degrade performance greatly (can Mono force complete GC, actually?)

So, how can I avoid this GC time when using Unity3D without huge performance degrade?

sentences:
How can I make sure the rotation has finished or the transform is facing the target? void FixedUpdate()
    {
        LiftProcess();
        MoveProcess();
        TiltProcess();

        if (hasRotate == true)
        {
            Vector3 targetDirection = helicopterPlatform.transform.position - transform.position;
            Vector3 newDirection = Vector3.RotateTowards(transform.forward, targetDirection, lookAtSpeed * Time.deltaTime, 0.0f);
            transform.rotation = Quaternion.LookRotation(newDirection);
        }
    }

I want ot make a check IF transform.rotation has finished and the transform is facing the newDirection then change the flag hasRotate to false. What check and how should I apply ?

sentences:
How to solve "server lag" problems that break the game How do real-time multiplayer games deal with latency problems (or “server lag”)?

Imagine an online fighting game where 2 players battle head-to-head in real time. When a player performs an action, there'll be a short delay until that player's action appears on the opponent's computer screen. This delay causes many game-breaking problems.

Let's say 2 hypothetical players, Player A and Player B, are fighting against each other right now in the game, and the latency is 1 second. Player A is moving toward Player B, but then Player B places a wall (or something of the like) that stops Player A from moving toward Player B. Player A doesn’t see the wall appear on his/her computer screen until 1 second later, but by then Player A has already moved past where the wall was placed.

In a more game-breaking situation, Player B is just about to kill Player A. Right before that happens, Player A uses a special attack that instantly kills Player B. But on Player B’s computer, Player B kills Player A, because it takes 1 second before Player A’s special attack happens on Player B’s computer. This makes it so both players die even though only Player B was supposed to die.

One solution to deal with the latency issue is to implement an artificial delay so that when there’s a discrepancy, one player’s game is momentarily paused to wait for the other player’s game state to “catch up.” This is not a good solution because it makes the game feel extremely laggy and unresponsive, and it also renders some reactive actions useless (like dodging) because of the artificial delay.

What can be done to fix these latency problems?

sentences:
How do I add custom data to a ListView widget in Unreal? I have a UserWidget object with a ListView in it.
How do I add objects add and custom data to them, such as names?

sentences:
Render with multiple lights (one pass per light) I have already a system that at the moment handle multiple lights just passing an array of light struct and loop through it. I had been told to switch to a multipass rendering approach. How should I do this in an efficient way? Can you link me to some resources about this?

I cannot switch to defferred rendering.

sentences:
Handling keyboard input in SDL2 I'm using SDL2 with .NET bindings. Keyboard handling is encapsulated in static class, and keyboard handling code part looks like this:

// class members
private static int _numkeys;
private static IntPtr _keysBuffer;
private static byte[] _keysCurr = new byte[(int)SDL_Scancode.SDL_NUM_SCANCODES];
private static byte[] _keysPrev = new byte[(int)SDL_Scancode.SDL_NUM_SCANCODES];

// called once, to get buffer pointer
_keysBuffer = SDL_GetKeyboardState(out _numkeys);

// update keyboard state each frame
var tmp = _keysPrev;
_keysPrev = _keysCurr;
_keysCurr = tmp;
// copy new state
Marshal.Copy(_keysBuffer, _keysCurr, 0, _numkeys);

all is workig as expected mostly, however once in while one of the following behavior occurs:

Physical key is pressed, but no key press is detected. Keypress is detected after key repeat interval.
Physical key is pressed, but no key press is detected. Lasts for infinite amount of time.

For example, I press Right (D), the movement to right starts, shortly after I press Fire (SPACE), movement is stopped, no firing occurs, then after key repeat interval firing starts, but movement to Right is stopped despite key is also still pressed.

Unfortunatelly I have both 1) not discovered 100% reproducible pattern for the bug yet (seems like it happens on burst sequental presses), 2) have no ideas what is the cause.

For now I just want, a fresh view on my code (is it solid?) and maybe some ideas on what to check. Thanks!

sentences:
How can I reference for a two cameras on prefab through script? I have this script for controlling the cameras :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CamerasViewSwitch : MonoBehaviour
{
    public List<Camera> cameras = new List<Camera>();
    public string currentViewMode;

    // Start is called before the first frame update
    void Start()
    {
        if (cameras[0].enabled)
        {
            currentViewMode = "Third Person";
        }
        else
        {
            currentViewMode = "First View";
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.V))
        {
            cameras[0].enabled = !cameras[0].enabled;
            cameras[1].enabled = !cameras[1].enabled;

            if (cameras[0].enabled)
            {
                currentViewMode = "Third Person";
            }
            else
            {
                currentViewMode = "First View";
            }
        }
    }
}

In the Assets, I have a prefab with two children's cameras that I want to use in this script.
In this screenshot to show what I mean, I dragged the prefab name Platform to the hierarchy to show where the cameras are. The script is on the object name Cameras Switch.
How do I get these two cameras from the prefab and using them in the script?

I'm using the Platform prefab with this script but the problem is when I'm starting the game the CamerasViewSwitch script is missing the two cameras I'm not to get/find them.

sentences: Unity is Creating Black Boxes when I look around Please help me with this issue. I believe it came about after I finished tweaking post processing behavior in a minor way. If anyone has any idea please share it. I tried to rebake lighting on both scene and lightmaps tabs and it didn't make any difference.

sentences:
LWJGL 3 how to convert screen coordinate to world coordinate? I'm trying to convert screen coordinate to world coordinate on mouse click event.
For LWJGL 3 there's not GLU utility class is available whereas LWJGL 2 has.

I'm using JOML math classes and wrote following code, but its returning wrong world coordinate, I'm doing something wrong and couldn't figure out.

On program init, I get viewProjMatrix and viewport:

viewProjMatrixUniform = glGetUniformLocation(this.program, "viewProjMatrix");
IntBuffer viewportBuffer = BufferUtils.createIntBuffer(4);
int[] viewport = new int[4];
glGetIntegerv(GL_VIEWPORT, viewportBuffer);
viewportBuffer.get(viewport);

On render loop, I calculate viewProjMatrix:

viewProjMatrix
    .setPerspective((float) Math.toRadians(30), (float) width / height, 0.01f, 500.0f) // define min and max planes
    .lookAt(eye_x, eye_y, eye_z,
            eye_x, eye_y, 0.0f,
            0.0f, 2.0f, 0.0f);
glUniformMatrix4fv(viewProjMatrixUniform, false, viewProjMatrix.get(matrixBuffer));

I convert screen coordinate to world coordinate with following code:

DoubleBuffer mouseXBuffer = BufferUtils.createDoubleBuffer(1);
DoubleBuffer mouseYBuffer = BufferUtils.createDoubleBuffer(1);
glfwGetCursorPos(window, mouseXBuffer, mouseYBuffer);
double x = mouseXBuffer.get(0);
double y = mouseYBuffer.get(0);
System.out.println("clicked at: " + x + " - " + y);

Vector3f v3f = new Vector3f();
viewProjMatrix.unproject((float)x, (float)y, 0f, viewport, v3f);
System.out.println("world coordinate: " + v3f.x + " - " + v3f.y);

Here's the full source code: https://gist.github.com/digz6666/48bb433c83801ea4b82fa194f05b4f02

sentences: Can I name a team with the name of their city to avoid trademark issues? I was wondering, if you want to make a NBA game on smartphones, without the license held by EA, the first solution seems to name your teams with a different name, such as "Chicragro Brulls" (this is just for the example), but would it be possible to just call your team with the name of the city, such as "Chicago vs. Dallas" ? I know the first solution was chosen by Pro Evolution Soccer, would you know any other game that don't use a license?

sentences:
How to handle levels in Unity3d I’m making a top-down 2d game in Unity3D for Android-based smartphones. Currently I have two scenes - a preloader and the game itself with all the stuff I need packed into one scene file. Also there is a very simple game-state-manager in my scene.

My question now is: Is it better to script all the levels within one scene-file or should I seperate them into unique scene-files? I’m just asking because basically the levels are very similar to each one - only the background and the sprites are different. Is there a problem with memory management if I use one scene only?

sentences:
XNA 4.0 - Car game dashboard lights I'm making a car game and doing the dashboard part. I'm trying to do the dashboard lights, i've did this changing the dashboard texture, overwriting the texture with the light image over it, example:

Texture2D dashboardTexture;
Texture2D parkingBrakeLightTexture;
Model carModel;

//when the light needs to turn on:

PutTextureOverDashboardTexture(parkingBrakeLightTexture);

//on Draw method I change the texture of dashboard mesh:

effect.Texture = dashboardTexture;
effect...

This is alright, but the lights will suffer influence from the external light if I EnableDefaultLighting() in the effect, then the dashboard lights will almost don't appear depending on what direction the car is, and of course that should not happen.
So how can I make the lights of dashboard appear? I need to use another alternative? Or can I still utilize this method?

sentences:
Console (CMD like) in a DirectX application I really need a console for the game i'm making. I am programming a first person camera right now and i want to see what is going on with the variables (to be more specific i need to know if i'm getting the mouse input as i want or no) and i don't know how to see it. I searched online A LOT and i found tons of scripts with no explanation so i don't know what to do.
What i need is the "noob" line of command you get when you don't use WINAPI. The one you have from just writing your code into the dev c++.
I know it sounds like i have no idea of what i'm saying but i don't know how to ekplain it better.

sentences:
How do I pause and unpause gameobjects on is own in the scene without pressing keys in unity3d I can't get my gameobject to pause or unpause in the scene in Unity3d.
I need the game to pause for a couple of seconds maybe longer than unpause
 by itself. Here is my script :

using UnityEngine;
using System.Collections;

public class hu : MonoBehaviour {
GameObject[] pauseObjects;
public bool isPaused;
 void Start () {

 pauseObjects = GameObject.FindGameObjectsWithTag("Player");

 }

 // Update is called once per frame
 void Pause () {

  {
   if(Time.timeScale == 1)
   {
    Time.timeScale = 7f;

   } else if (Time.timeScale == 8f){

    Time.timeScale = 1;

   }
 }
}
}

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:
Checking whether a specific key was pressed in enchantJS I am using enchantJS and would like to use the letters and numbers as well as numpad on a keyboard to do different things (eg: hotkeys).

From this page http://users.csc.calpoly.edu/~foaad/enchant/guide/playerInput.html

  By default, enchant.js provides input listeners for six buttons: UP, DOWN, LEFT, RIGHT, A, and B. By default, the directions are bound to the arrow keys. Any of the six buttons may also be bound to any key with an ASCII value. We’ll address that later.

So enchant provides the ability to bind keys to different input such as up, down, left, right...but how can I simply check whether the D or X key was pressed, and if so, perform certain actions based on that event?

sentences:
Why can't I change the size of my spheres in Unity? I started to learn Unity. Now I make something like a solar system. I have one problem. What are the min and max sizes of the sphere? E.g. I have a radius of the Sun - 1.5 but it shows like the Sun has radius 1, I can't make bigger. But also I have the Earth with 0.01 size and the Moon with 0.009. But I can't make the Mercury with 0.03 radius.
So why when I'm creating a new sphere now I have only radius 1 and can't change it in Scene window?

sentences:
Transparent textures being handled oddly In OpenGL why is it that when rendering transparent textures it changes the color values of all the pixels? Ex. when this transparent texture is rendered it comes out as this. Also if I change the texture to not have transparency it still has the same problem of changing pixel values. What causes OpenGL to completely change a transparent texture when it is rendered? (Note: the textures have been created in GIMP and the program is running on a mac (OSX 10.10.3))

EDIT:

Turns out this happens when you load a texture with transparency on the RGB color spectrum instead of the RGBA spectrum.

sentences:
Matrix transformation I have to find components of a matrix for 3D transformation. I have a first system in which transformations are made by multiplying:
M1 = Scale x Rotation x Translation.
I want to have the same transformations in an engine who compute like this:
M2 = Scale x Translation x Rotation
So when I enter the same values there's a problem du to the inversion of translation and rotation.

How can I compute the values in the last matrix M2 for having the same transformation?

Thanks

sentences:
How can I reduce the draw calls in a split screen game? I am working on a split screen game with one camera per player.  It appears that the number of draw calls is multiplied by the number of cameras I have, which makes perfect sense.  More cameras means more drawing means more draw calls.

So for every player, there is effectively a new instance of the game that must be rendered.

What do developers do when presented this problem?  Do they scale down their game?  Or are there practices I am unaware of to where this should not be an issue?

(I am using Unity, if it is relevant.)

How can I improve rendering performance in a split screen game?

Example:

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:
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: Issue with dark .PNG files in Unity I made sprite assets in Krita and I exported them as .PNG files. When I import the files into Unity assets, however, they become a lot darker than the original colors. So far, I haven't found the issue, and I was wondering what's going on?

sentences:
Fast method of detecting whether point is inside mesh I'm trying to construct a 3d object from a large number of particles. I think this is called BVH (Bounding volume hierarchy). I figured the best way is to draw the particles inside the mesh, then let them drop down. Repeat as often as produces suitable results.

For this, I need to check for each point whether they lie inside the 3d model. I might be using something in the order of 1 million particles, so the point-in-mesh code needs to be fast. I have some clues about creating a 2d stencil projection first, and checking against that. But I'm not really sure what's the smart way to go about this.

sentences:
Running both the server and the client within the same process Question

I have just started working with Lidgren and networking for the first time, and I've come to the realisation that it is possible to run both the server and the client within the same process.

Is this practice discouraged for any reason?

Context

The reason I'm asking is because I theorized that this concept might allow me to treat both singleplayer and multiplayer modes as one and the same, which would be very helpful.

Following my line of thought, this is the distribution I had in mind:

Singleplayer - 1 server + 1 client in the same process. How fast are the communications?
Multiplayer - Same as singleplayer for the host + 1 aditional client for each other player.

The execution flow I'm picturing is for clients to recieve user input and send a notification to the server. Then the server validates it, and broadcasts an action to be executed by all the clients. It shouldn't matter if there is only one client (i.e. singleplayer) or multiple clients (i.e. multiplayer).

sentences: Roofs not appearing in Unity My buildings are fine until I import them to Unity. None of the formats I've come across( FBX, DAE, 3DS Max, Blender Files, any of the Autocad formats, OBJ, PRJ, WRL etc.), have roofs when importing the buildings as one cohesive file into Unity. In Sketchup, Blender etc. they all appear fine. Does anyone have suggestions?

sentences:
Press multiple switches to unlock the door I made 2 scripts, one that is a switcher and one that checks if object is switched (Switch, SwitchCheck).

Switch script (it's on 2 objects that are switches and both objects have colliders with IsTrigger checked):

public var IsPressed : boolean = false;

function OnTriggerStay (){
    if (Input.GetKeyDown(KeyCode.JoystickButton1)){
        IsPressed = true;
        Debug.Log("Switch activated");
    }
}

SwitchCheck script (it's on door that should be opened)

public var Switch1 : Switch;
public var Switch2 : Switch;

function Update()
{
    if (Switch1.IsPressed && Switch2.IsPressed)
    {
        Destroy (gameObject);
    }
}

Now, he problem here is, that it "does" kind of work...after I press the button like 20 times.
My question is, did I write something wrong?

sentences:
Unity3d - c# - changing FPSInputController controls through script For a game I am making I would like the user to be able to change the controls (in game NOT through the clunky launch window (wich i disabled)) I have the system working but don't know how to change the controls for FPS controller. I am okay with writing my own version of the FPSInputController but I don't really know how to do that (the good way (using the CharcaterMotor)) I looked at the original FPSInputController script but that used axes (from the "conventianal" input settings in unity) and I don't really know how to do that with:

if (Input.GetKey(controls.forward))

sentences: How would I generate random falling objects I'm creating a game using libgdx on Eclipse that is similar to Ragdoll Avalanche.  I'm looking for a way to generate falling objects like the triangles of Ragdoll Avalanche.  All I know that i have to use an array but i dont know how to do it.

sentences:
OpenGL glTexImage3D not working? I'm trying to use arrax textures with opengl 3.3 since this the target version for my application. So I have to use the glTexImage3D() method instead of glTexStorage3D(). The problem is, if I use glTexImage3D() instead of glTexStorage3D() the screen is always black. The other way round, everything works. Here is how I create the array texture:

public ArrayTexture(int width, int height) {
    this.width = width;
    this.height = height;
    this.arrayTextureHandle = GL11.glGenTextures();
    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, arrayTextureHandle);

        //Works perfect
        GL42.glTexStorage3D(GL30.GL_TEXTURE_2D_ARRAY, 1, GL11.GL_RGBA8, width, height, 10);
        //Doesn't work with these parameters
        //GL12.glTexImage3D(GL30.GL_TEXTURE_2D_ARRAY, 0, GL11.GL_RGBA8, width, height, 10, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);

    GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, 0);
}

public void addTexture(ScrollingSprite... sprites) {
    if(zLayerCounter + sprites.length <= MAX_LAYERS) {
        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, arrayTextureHandle);

        Arrays.asList(sprites).forEach(sprite -> {
            sprite.getTexture().getTextureData().prepare();
            GL12.glTexSubImage3D(GL30.GL_TEXTURE_2D_ARRAY,
                0,                      //Mipmap number
                0, 0, zLayerCounter++, //xoffset, yoffset, zoffset
                width, height, 1,          //width, height, depth
                GL11.GL_RGBA,                 //format
                GL11.GL_UNSIGNED_BYTE,       //type
                sprite.getTexture().getTextureData().consumePixmap().getPixels()); //pointer to data

            GL11.glTexParameteri(GL30.GL_TEXTURE_2D_ARRAY, GL11.GL_TEXTURE_WRAP_S, sprite.getTextureWrapS());
            GL11.glTexParameteri(GL30.GL_TEXTURE_2D_ARRAY, GL11.GL_TEXTURE_WRAP_T, sprite.getTextureWrapT());
        });

        GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, 0);
    } else {
        throw new IllegalArgumentException("Maximum number of textures reached!");
    }
}

sentences:
How to design a multi-step game menu system? I am getting started with game programming. I am designing a game that starts by taking you through a series of menu screens. I am interested in learning how this is typically structured in professional game development.

Currently I handle the controller inputs from the main file and have individual classes for each menu screen. When the user makes a selection, I need to transition to the next menu screen. It seems like I either need some sort of "menu screen manager" for keeping track of the previous selection and transitioning between menu screens, and/or I need to pass the controller input handling down to the menu objects, since I want to use up/down on one menu and left/right on the other menu.

How would a professional game programmer architect/design this?

require "components/first_menu"
require "components/second_menu"

first_menu = FirstMenu.new
second_menu = SecondMenu.new
menu = first_menu
menu.render

on(controller: "up")   { menu.prev_option }
on(controller: "left") { menu.prev_option }

on(controller: "down")  { menu.next_option }
on(controller: "right") { menu.next_option }

on(controller: "buttonA") do
  if menu.is_a? FirstMenu
    menu.hide
    selected_option = menu.select_option
    menu = second_menu
    menu.show(selected_option)
  else
    selected_option = menu.select_option
    launch_game(selected_option)
  end
end

sentences:
How does lookAt matrix math work? Can someone provide me an explanation of how the lookAt matrix works?

+----+----+----+----+
| Xx | Xy | Xz |  0 |  <- x axis
+----+----+----+----+
| Yx | Yy | Yz |  0 |  <- y axis
+----+----+----+----+
| Zx | Zy | Zz |  0 |  <- z axis
+----+----+----+----+
| Tx | Ty | Tz |  1 |  <- camera position
+----+----+----+----+

From my current understanding using the diagram above from this tutorial, the zAxis is created by subtracting camera position from the target position. Then you create two more perpendicular vectors calculated by: xAxis = zAxis x up, yAxis = xAxis x zAxis.

However, I don't understand how these exact operations result in the camera facing towards something? Like why are these exact calculations needed? Why could it not have been zAxis = camPosition - targetPosition? Or yAxis = zAxis x down instead of zAxis x up? Or have xAxis = targetPosition - camPosition instead of the zAxis?

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:
Colliders slightly intersecting each other; any solution? Consider this simple scene:

In Unity, colliders slightly intersect each other. Typically, this isn't a problem. However, I want to make a custom character controller using a box collider and not a capsule collider. In the above scene, the floor is divided into 2 objects, each with their own collider. The playercontroller has their own box collider.

And the problem: if the box collider moves forward, it will clip with the seam on the floor, even though both floor objects have the same height. The box will stop moving as if it has run into a wall. If I keep adding force to the box, it will never move forward. It will stay stuck on the seam-- this only exists because the box is slightly inside the first floor collider, and it will hit the second collider of the floor like a wall.

This only occurs because of collisions clipping. With most playercontrollers, a capsule collider is used and thus this problem doesn't exist.

Is there a workaround? How can the box smoothly move across the floor without colliding with the seam?

Notes:

This does occur with capsule colliders but rare and is not very noticeable.
A possible solution would be to merge all the colliders of the scene into one, unified collider. It is extremely tedious and has its drawbacks.
This occurs if I am moving the collider with both MovePosition(), AddForce(), or modifying the velocity/position of the transform.

sentences:
Check which object triggered another Two animated car object both contain a rigid body, a box collider and a script with an OnTriggerEnter event.

I want to check which car started the collision event, by hitting the other car.

Consider two cars; regardless of whether carA hits carB or carB hits carA, both cars contain the same script with the same event. So both cars become the trigger.

How do I identify which car started the collision? I wish to do so without the use of raycasting, as it is too expensive for what I am wanting to do.

sentences:
How do OpenGL ES 2 engines typically handle automatic geometry sorting and batching? I'm trying to write a basic OpenGL ES 2 engine that can automatically sort and batch a fairly flexible set of input draw descriptions.

When I say 'draw description' I mean the actual uniforms, state, the shader, etc required to issue a single draw command for some geometry described by a vertex/index buffer.

When I say 'sort' I mean order a list of draw descriptions so that unnecessary state changes are minimized (ie. sort by surface, then shader, then texture, etc)

When I say 'batch' I'm specifically referring to merging draw calls by merging multiple vertex/index buffers that share the same draw description.

What I've tried

It seems like if you can sort a list of draw descriptions, you can batch as well because you can group draw descriptions that compare identical. So I thought I'd create something like:

std::map<DrawDesc,std::vector<Geometry>,DrawDescComparator>

std::map sorts the DrawDescs and I can stash geometry for identical draw descriptions in std::vector for batching.

However, I'm having trouble creating a draw description object that encapsulates all the required information, and specifically allows it to be compared.

Some things are easy to describe and compare, like a shader which can be assigned a unique id. Other things get complicated; to check if blend state is the same between two draw descriptions I'd have to look at (blend_enabled, equation_rgb, src_rgb, dst_rgb, equation_alpha, src_alpha, dst_alpha, and blend_color) in the worst case:

bool CompareBlendState(DrawDesc a, DrawDesc b)
{
    if (!a.blend)
        return true;

    if (!b.blend)
        return false;

    if (a.equation_rgb != b.equation_rgb)
        // just use the underlying gl_enums for a consistent comparison
        return a.equation_rgb < b.equation_rgb;

    if (a.src_rgb != b.src_rgb)
        return a.src_rgb < b.src_rgb;

    //...

    if(a.etc != b.etc)
        return a.etc < b.etc;

    return false;
}

This is probably probably pretty inefficient. One possible way of making this nicer is storing blend state information in a std::bitset and just comparing the corresponding integer(s)

In general though, I feel like I may be barking up the wrong tree. There's way more state to compare (depth, cull modes, etc) and I don't want to create a difficult-to-maintain mess of code.

I'd like to know how other engines or libraries (unity, ue4, etc) typically handle this problem and if there's a common approach I've missed.

sentences:
Why is my Canvas/RawImage not included in my Camera's RenderTexture output? In my Unity2D game, I'm using a second camera to "screenshot" the current view.  I then display this screenshot within the game.  This works the first time I take a screenshot.  When taking the second screenshot, I expect the first screenshot to show up in the second, creating a screenshot-within-a-screenshot effect.  However, this doesn't happen - the previous screenshot doesn't show up in the next.

Here's a more visual description:

Before taking any screenshots:

After taking the first screenshot and displaying it in the bottom-left corner:

After taking the second screenshot:

Notice that this screenshot looks identical to the previous one.  Here's what I expected:

It seems like my Canvas/RawImage that is displaying the screenshot isn't being captured by my second camera.  Why is this?

Some additional details: my canvas is set to Screen Space - Camera.  I'm using Unity 5.6.1f1.

sentences:
Unity2D: Rendering multiple sprites as a single one I'm creating NPCs in Unity 2D using C#, and I have 16x16 sprites for body, helmet, clothes and weapon. All these have a tile set which has been split in unity. I'd like to be able to render one of each part together, so I can drag the sprite to the field, and then it will be rendered on the NPC. IE, I drag a helmet sprite into the helmet field and that is the rendered helmet.

I intend on having multiple NPCs, so I'd prefer to minimise the child objects. Multiple sprites will need rendering, however there's only one sprite renderer. Is it possible for me to combine the sprites (in code), and then render the final sprite? Or is there perhaps a better way?

Thanks in advance!

sentences:
object reference not set to an instance of an object hello i have a error "object reference not set to an instance of an object"

when my ball collide with the spikes.its supose to remove one heart but it doesnt.

health code:

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

public class Health : MonoBehaviour {
  public int health;
  public int numOfHearts;

  public Image[] hearts;
  public Sprite fullHeart;

  // Use this for initialization
  void Start () {

  }

  // Update is called once per frame
  void Update () {
    if (health > numOfHearts)
    {
      health = numOfHearts;
    }

    for (int i = 0; i < hearts.Length; i++)
    {
      if (i < health)
      {
        hearts[i].sprite = fullHeart;
      }
      if (i < numOfHearts)
      {
        hearts[i].enabled = true;
      }
      else
      {
        hearts[i].enabled = false;
      }
    }

  }
  public void Damage(int dmg)
  {
    numOfHearts -= dmg;
  }
}

spikes code:

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

public class Spikes : MonoBehaviour {

  private Health Player;

  // Use this for initialization
  void Start () {
    Player = GameObject.FindGameObjectWithTag("Player").GetComponent<Health>();

  }

  // Update is called once per frame
  void Update () {

  }

  void OnTriggerEnter2D(Collider2D col)
  {
    if (col.CompareTag("Player"))
    {
      Player.Damage(1); // here i have the error.
    }
  }
}

sentences:
Check if an object is facing another based on angles I already have something that calculates the bearing angle to get one object to face another. You give it the positions and it returns the angle to get one to face the other.

Now I need to figure out how tell if on object is facing toward another object within a specified field and I can't find any information about how to do this.

The objects are obj1 and obj2. Their angles are at obj1.angle and obj2.angle. Their vectors are at obj1.pos and obj2.pos. It's in the format [x,y]. The angle to have one face directly at another is found with direction(obj1.pos,obj2.pos).

I want to set the function up like this: isfacing(obj1,obj2,area){...}
and return true/false depending if it's in the specified field area to the angle to directly see it.

I've got a base like this:

var isfacing = function (obj1,obj2,area){
   var toface = direction(obj1.pos,obj2.pos);
   if(toface+area >= obj1.angle && ob1.angle >= toface-area){
       return true;
   }
   return false;
}

But my problem is that the angles are in 360 degrees, never above 360 and never below 0. How can I account for that in this? If the first object's angle is say at 0 and say I subtract a field area of 20 or so. It'll check if it's less than -20! If I fix the -20 it becomes 340 but x < 340 isn't what I want, I'd have to x > 340 in that case.

Is there someone out there with more sleep than I that can help a new dev pulling an all-nighter just to get enemies to know if they're attacking in the right direction? I hope I'm making this harder than it seems.

I'd just make them always face the main char if the producer didn't want attacks from behind to work while blocking. In which case I'll need the function above anyways.

I've tried to give as much info as I can think would help. Also this is in 2d.

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:
Delta time not accurate enough In my game i have a delta timer based almost exactly on the page from here

http://wiki.lwjgl.org/index.php?title=LWJGL_Basics_4_%28Timing%29

But if the the main loop is fast enough,  my delta time variable is 0. This causes problems because it often happens several times in a row.
I don't want to force a frame cap either. How can I remedy this?

EDIT: Setting a frame cap works,  it only happens when the frame isn't capped. I've set delta to a minimum of 1, but that doesn't make it smooth.  I could add a delay of one if it's zero, but that only fixes it for the next frame.

sentences:
Parent-Child position mathematics What is the math theory when a child object moves with the parent transform?

I am doing an angle indicator which shows a field of view, which works fantastic when the angle is static. But I cannot get the
field of view indicators to play nice with the angle changing. Everytime I change the angle, the indicators are reset to
default positions and then the direction indicator and FoV indicators are out of sync.

There is of course a ghetto way of resetting the whole thing when changing the angle, but I'd prefer not to do it that way.

The red circles are the points which are used to draw the FoV lines and they are childed to the white sphere. If the angle is not modified after start they follow the white sphere nicely and show the FoV correctly.

Here is how it looks after trying the dynamic angle changing. The FoV lines should be pointing to the right and the white sphere should be in the middle.

Currently I am changing the red circles' position based on the angle given(transform is the green square in the middle.):

leftAngle.transform.position = transform.position + new Vector3(Mathf.Cos(firstLineRendererAngle * Mathf.Deg2Rad), 0, Mathf.Sin(firstLineRendererAngle * Mathf.Deg2Rad)) * 10;
rightAngle.transform.position = transform.position + new Vector3(Mathf.Cos(secondLineRendererAngle * Mathf.Deg2Rad), 0, Mathf.Sin(secondLineRendererAngle * Mathf.Deg2Rad)) * 10;

How do I add the position of the FoV direction sphere to emulate parent-child relationship with the objects?

sentences: How do you capture keyboard and mouse input for an HTML5 game? Is there an accepted method for capturing player input in HTML5 games? I have seen several methods, and the browsers seem to be in varying states of implementation; On MDN they tell you not to use both the newer and older implementations. I'm open to methods utilizing various libraries, but I would also like to see a pure JavaScript and DOM version as well.

sentences:
Documentation on 2D space partitioning I am looking for documentation that explains the different kinds of (well the major ones anyway) 2D space partitioning algorithms & data structures.

Any pointers besides 'Google it and sift through hundreds of papers'. A book perhaps?

sentences: Using Unity's uNet to create a turn-based RPG I've been checking some tutorials about uNet and it seems pretty powerful. The NetworkManager is a great tool when you want to make generic games, but what is troubling me about it is the need of spawning a "Player". I intend to create a turn-based RPG, and for that, during the battle there's not a "physical player entity", there's two players which have a set of monsters and the players can select a monster to attack the opponents', but the player itself doesn't exist, in the end it sums up to a trade of commands between the clients. How can I achieve such an architecture with uNet? Should I discard the use of the default NetworkManager? Should I simply create a bodyless Player and go along with it?

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:
What's the technology that allows programming inside a game? There are some games which allow the player to write/create scripts in-game, for example: Space engineers or Psi.

I want to use something similar to either one, but I've had a hard time finding information so my question is:

Is there a branch of programming that covers the ability of a software once compiled to run new code created by the user?

By branch of programming I mean something like PTG (Procedural Terrain Generation).

To avoid the too broad of a question or opinion based, let me clearly state that I'm not looking for guides or places to learn, I want the name or definition (if one exists) of the technology involved.

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:
Is it possible to use the Unreal Engine as a big C++ library, without using the editor? I want to write a game entirely in C++, but I would like to profit from the possibilities offered by the Unreal Engine, especially in terms of graphics and physics. Nevertheless, I strongly dislike its visual editor: I find it heavy, slow and unintuitive. Finally, it forces me to use Visual Studio instead of my favourite C++ IDE.

Is there a way to use the Unreal Engine as a big library that I could simply include in my C++ project, or am I forced to used the Unreal Editor?

Related question for Unity: How can I build a game in Unity with minimum/no use of the visual editor?

sentences:
Libgdx import bin/xml/json from physics editor I'm using Libgdx. I did a simple json file in Physics Body Editor and I don't have any idea how could I import it into my physic world in libgdx.

Any idea will be appreciated.

P.S: Sorry if there are question with the same subject, I didn't find any of them.

sentences:
hexagon tiles to square tiled map in a previous question asked here:how-to-create-a-hexagon-world-map @Tim Holt has provided code that does the job that i'm wanted to do, the only difference I would like is to have it as squares rather than hex. Is this easy to convert, or is there a better way?
thank you.

sentences:
Deleting an item in the game world: detecting if an item supports other items I'm writing a 3D construction module similar to the how you build houses in the Sims. Users are able to build walls and floors (which also act as ceilings) on multiple floors (layers). This question needs a little background info:

I'm not using an physics, there is no gravity. I use the term floor/ceiling tile here interchangeably. Essentially all are floor tiles, ceiling tiles are just floor tiles on a higher layer.

I store the build data in a multi dimensional array like:

grid[layer][row][column][position]

The layer represents the layer (ground floor, 1st floor etc..). The row and columns make up the grid. The position can hold any number of 3 positional values, namely:

0 : wall on west side of cell
1 : wall on south side of cell
2 : ceiling

So for example, a south wall on the row/column 2/4 on layer 3 would looks like:

grid[3][2][4][0=>null,1=>item,2=>null]

This works great, and it's easy to write functionality to check if a item can be placed at any position (by looking at neighbouring cells, layers below etc...)

Here is the actual problem and question:

I'm writing functionality to delete items within the game world. The rules by which I decide if something can be deleted are what you would expect in real life:

Any item that's not on the ground floor needs something else supporting it

So for the following examples:

Only 1 of the 2 blue tiles adjacent to the red tile could be deleted

The red tile cannot be deleted because the wall connected to it would no longer have a support.

Walls are simple enough, I just check nothing is in the same row/col above them (since it would only be another wall or ceiling). It's the floor/ceiling tiles that are difficult.

It's easy enough to check if an item has neighbouring items, or if is supported by a wall below, but I can't seem to find an efficient way to do the checks if, for example, a ceiling tile has many neighbouring tiles that it supports:

VS those same neighbouring tiles, but they are supported by another item:

I thought maybe I should be storing the information about which other items support the current item during placement, but that just feels like moving the same complexity to another part of the code.

Is there and algorithm or concept that I could use/adapt to do the checks?

sentences:
Breakout angle calculation I am making my first game in python and I am really stuck at with a physics problem. The game I am trying to make is a copy of the game Breakout. In Breakout, the player controls a "paddle" at the bottom of the screen, which the ball will bounce off of.

I have got the collision to work, but I want the angle between the ball's direction vector and the "paddle" to have an impact on the angle at which the ball leaves the paddle. How can I make this work? I have tried a lot of things, but I can't get it to work.

In these situations I want the angle to be sharper when the ball hit's closer to the edge of the paddle. How can I calculate and make these angles to work?

sentences:
Tile map optimization algorithm I've read this artical on tilemap optimization https://www.scirra.com/blog/ashley/3/tech-blog-tilemap-tidbits and wondering what algorithm is used to achieve something like this.

I'm wondering how they convert an array of tiles into simplified rectangles that use the same texture. To optimize rendering

sentences:
What GPU culling techniques are appropriate for voxel spheres other than octrees? I'm creating a dynamic smooth-voxel based world in the shape of a sphere. Right now my current approach is to spherize a cube, generate voxel terrain on each of the six patches, and then use octrees to cull the data further.

Octree's are best served with cubes. Is there a better system for storing/accessing data in a sphere? I've heard some talk of Octree's not being the best way to store voxel data, even for cube worlds. How can this be? What would be better? A Hash Table?  Surely multidimensional arrays wouldn't be faster? Perhaps it's just more of a design decision than performance? As in, maybe someone didn't like chunks popping in so they would rather load individual rows and columns?

If it matters, I'm probably going to keep relevant geometry in GPU memory and stream in the surrounding area over time as the player gets closer to it from main memory. I bring this up because I'm really not sure if GPU memory benefits from any particular structure. All I really know is that the parallel powers of the GPU are, well, unparalleled (I had to). How can I tap into that?

sentences:
How do I find the closest points(thereby forming a polygon) enclosing a particular point?(see image) I am working with a game engine, and my task is to add code for simulating fracture of rigid meshes.

Right now I'm only working on breaking a cube.

I am using Voronoi's algorithm to make a (realistic)fractured shard and I am using the half-plane method to generate a Voronoi cell.

Now the way I do this is for every seed point, I make planes that are perpendicular bisector planes(the straight black lines in the image) with rest of the seed points and I calculate the intersections of all these planes to give me distinct points(all the orange dots).

I've gotten this far.

Out of all these calculated intersection points, I only need the ones that are closest and enclosing the seed point(the points encircled in red) and I need to discard all the rest.

Information that I have :

1) Plane equations of all planes(defined by normalized normal vectors and their distance from origin)

2) Points of intersection(that I've calculated)

Can anybody help me find out how I can find the points encircled in red?

sentences:
how can i fix my code in order to get rid of the error that says that the object I want to instantiate is null? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class replicate : MonoBehaviour
{

    public void replicateCube(InputField T)
    {
        int H = int.Parse(T.text);

        for (int i = 0; i < H; i++)
        {

            GameObject prefab = Resources.Load("Cube") as GameObject;
            GameObject go = Instantiate(prefab) as GameObject;
            go.transform.position = new Vector3(0, i*5, 0);

        }
    }
}

sentences:
How to add a feel of depth? I have several mountain models drawing in the background.
See actual screenshot here:

At the very back, you see those grey mountains. Although they are so much in background, it still doesn't seem "in the background".

How can I add a feel of depth to those mountains? I would like see them as far far away.

This is how it looks now, thanks to DarenW

sentences:
Gravity well shader for Unity2D I'm trying to find or create a gravity well distortion shader for Unity. I've been looking around and all I can find are "lenses" which bend space around a black hole.

I'd rather have a distortion that "pulls" or "bends" the image behind into a small hole. Essentially, what this would look like if viewed from above (ignoring the sphere):

I can't seem to find any examples or a common terminology for it.

sentences:
Method for creating a next gen MMORPG out of thin air? Update August 2012: thank you all for your answers. I started small as suggested, creating first a Facebook Game about it, the next step will be to port it later on PC for a 3D version, and much later as a MMORPG as I would have build credibility and funding. The upcoming FB game will be done by Blup Blup Game Studio (my studio). Thanks.

Original Question:
Background:
I am documenting since a few months a game design document (GDD)(sci-fi & fantasy MMORPG) all by myself, without any real game design background (I am just a Chartered Accountant (CA and CISA)). For now, it looks more like a proposal document.

The question:
If you would have a series of amazing ideas that would revolutionized MMORPGaming how would you create that company out of thin air? Focus on creating the initial core team that would create the mockup that would be present to capital venture companies for major financing.

You may not be financial expert here but you did a massive amount of games in the past, of various types and platforms. With our different backgrounds we are complementary.

Cheers,

Raistx

P.-S. Edited for a leaner question. Removed elements linked to money as it's not the core question. I know how to get money and convince cap venture CIES, but I need a mockup / high pitch to do so.

sentences:
How to handle global Data within a state machine setup? (C#) I am currently building a turn-based framework (Unity,C#)

I was tired of my former tight-coupled systems and opted for a state machine this time, basically all components subscribe to the state-Enter and state-Exit event. I am aiming for scalability and structure.

But I ran into a problem. If the components cannot communicate directly, how to store and forward data in between states?

Example: The game starts with unit placement. The player has the option to select a unit in his pool via the ui and place it on the board.
The Unit-creation logic is and should(?) be handled inside the level script. How does it know where to create which unit?
Ive done a workaround with a static container class, with is basically my clipboard. The player assigns a grid cell for his selected unit and the game leaves the state.
While leaving the state the level scripts scans the clipboard and creates any assigned units.

But I feel like a cheated my attempt to really work strictly within a firm structure this time to guide the design process.

Is there a better way?

sentences:
Art style for a character that has frequent visual changes during gameplay I'm creating a game with a bodybuilding/fitness theme. The camera will almost always be focused on an inclined front view of a character who will be evolving very frequently during the game as the player 'levels up' the musculature of each part of the character such as arms, legs, chest, etc.

I've been doing some research trying to figure out the most economical yet effective way to incorporate this visual mechanic of letting individual parts of a character independently increase in size and detail and have come up somewhat short, most likely due to my complete lack of experience when it comes to art (my experience is mostly in programming).

I was thinking 2D would be best for this game, however maybe this one character should be in 3D? Would a low poly style fit these requirements, or should I look towards something akin to sprites or hand drawings? The games interactivity will be purely through menus so that doesn't need to be taken into account when dealing with the problem of this character. I would like this character to have some animations, of course, however I'm not sure if that fits the scope of this single question.

sentences:
How do I simplify a 2D game grid for level management while keeping its by-pixel features? (I cross-posted this from StackOverflow as this seems to be a more appropriate f̶o̶r̶u̶m̶ community. I've looked around a little here and I did not find an answer, so I hope this is not a recurring question.)

This is a question dealing with 2D world design.

I am playing around by creating a 2D bird's eye view shooter game, and I am looking to make the game sleek and advanced. I hope to be able to write physics so projectiles have momentum and knock-down properties.

I am immediately running into the problem of world design.

I need a way to have level files that store everything there is about a game. This is easiest by just having a grid of objects. But there are thin-walls and other objects that don't seem to fit into a traditional cell of a grid. I want to be able to fit all these together so I can streamline level design; so I don't have to put in the exact pixel-specific start and end of a wall.

There doesn't seem to be an obvious translation from level file to game without forcing myself into a pacman-life scenario, meaning a scenario where the game feels boxy and discrete. There is a contrast between the smoothly (relatively) moving characters and finite jumps in a grid.

I would appreciate an answer that would describe implementation options or point me to resources that do. I would also appreciate references to sites that teach game design.

The language I am using is Java (although I would love to use C or C++, but I can never find convenient resources in those languages).

Thank you for any answers. Please leave any questions in the space below; I will be able to answer them later tonight (28th Nov).

Answering Questions:

I will definitely consider using a game engine; I wanted to write a lot of it myself, but I am rethinking gradually.

Perhaps there is no answer to this question that I will "like", and the process is just inherently a bit tedious.

I meant to find a way to easily specify things like "wall goes here" without saying "add wall at 293, 195 with width 123 and height 5". This of course, is easy by dividing the game world into a grid. But dividing a gameworld into a grid is not ideal, because it has to deal with things like objects taking up more than one grid, objects being irregularly shaped and taking up only part of the grid, etc..

I've had more time to think about this, and I think that there is no way to "gridify" my world without losing some major functionality, and so I think I will have to create a world editor, where I can more easily create levels.

I still foresee problems though, specifically with AI. I need to have pathfinding capabilities, and so the algorithms naturally have some sort of search-space reduction, which is essentially making a grid. I will have to read more about this.

Until then I would still appreciate answers and suggestions on this design choice. I hope this clarifies my question - if it does not, please direct a question and I can try to answer it.

(Storing object locations is the only practical way to do any of this, I now realize).

sentences:
How and when should I update events occuring after a while? This question is not language specific but a more generic approach on how to deal with lazy updates for some game variables.

Let's say, for instance, that I want to implement a "character age system" for a game.

I guess that the "age" attribute does not need to be updated 60 times per second for each of my 10.000 or so RTS/MMO characters.

So, how to implement in the game loop the update of this "long term" variables that may have it value changed very sparsely?

At the moment, I would implement some global variables to accumulate the delta time between the frames until it reaches a certain value, then, it resets and updates that variables.

Is that correct? I mean, that's how things work? Or depending on the language/plataform you would set some timers, or events that trigger the update of these variables?

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:
2D HUD overlay drawing based on 3D coordinates and camera azimuth and elevation Assume you have the 3d coordinates of the player and another unit N as well as the azimuth and elevation of a camera always looking at the player. In the following illustration the sun would be the camera of course:

(source: permetix.com)
Let's say one wants to draw something on a different transparent window (not using the game window or any hooks) that is always displayed on top of the unit. An example would be TurboHUD for Diablo. In the linked video you can see that it displays affixes using textboxes right on top of the blue elite mobs.
In Diablo doing this is much simpler since the camera cannot be rotated and moved thus only simple projections depending on the distance are necessary, but what about situations with more degrees of freedom? How can one estimate 2d coordinates to draw at that match the position of the 3d units on the screen without access to more than described in the first paragraph? What is the mathematical background and what are the necessary computations?

sentences:
How would I create a shadowy "Fog of War" effect in Game Maker Studio 2? You know if you ever played "StarCraft," as you explore the map it's dark until you go to that area. I am trying to replicate this effect in Gamemaker studio 2.

I want to create a shadowed area effect on the map, so that when a "obj_player" moves to a darkened area it reveals that part of the map.

Here is a picture to help describe the effect i'm trying to achieve:

sentences: Asymetrcal Public Key (Host it on a server or distribute with launcher)? I am currently building a launcher for the front end of my game and I am wondering if I should host the public key on a server and have the launcher pull the data as and when needed, or should I distribute it packaged with the launcher. My thinking is that if I distribute it I will need to update the launcher should I need to change the keys but if I host it then I won't need to I just need to swap the keys on the server. I ask because I am unsure if this would dramatically increase load/traffic on the site should the game become popular.

sentences:
Map video texture to a half sphere in Unity I'm new to unity3D. and am trying to play a 360-degree video. But instead of mapping the whole 360-degree (equirectangular) video to the whole sphere, I need to map the half-video to a half-sphere object. How can I do that? So basically we'll have two half-sphere, tied together, each playing the half of 360-degree video, as if a single video is mapped to a whole sphere. An example or tutorial for a beginner would be great.

e.g. So the top half of this 360 video should be textured on such mesh

UPDATE: No worries...we not cropping the video on the go! It is already cropped as two separate videos)

sentences:
2D Parallax scrolling through GLSL shader I currently switched from LWJGL to LibGDX. In LWJGL I had a shader to do parallax scrolling by simply adding an offset to the texture coordinates and it worked fine, the texture repeated itself when the coordinates where greater than 1 or smaller than 0. But in LibGDX the same shader won't work. Once the texture coordinates are greater than 1 or smaller than 0, the texture just "smears" all over the screen, it doesn't repeat itself.

Vertex shader:

#version 330 core

layout (location = 0) in vec4 a_position;
layout (location = 1) in vec4 a_color;
layout (location = 2) in vec2 a_texCoord0;

out vec4 v_color;
out vec2 v_texCoords;

uniform float x_offset;
uniform mat4 u_projTrans;

void main() {
    v_color = a_color;
    v_texCoords = vec2(a_texCoord0.x + x_offset, a_texCoord0.y);
    gl_Position = u_projTrans * a_position;
}

Fragment shader:

#version 330 core

in vec4 v_color;
in vec2 v_texCoords;

out vec4 frag_color;

uniform sampler2D u_texture;

void main() {
    frag_color = v_color * texture2D(u_texture, v_texCoords);;
}

sentences:
convert mouse coords to zig-zag isometric I was wondering, how do I convert mouse coordinates to zig-zag isometric coordinates?

I already know how to convert to isometric using the Diamond approach, so I just need to know about the zig-zag approach. I also know how to get the mouse coordinates as well.

Here is the zig-zag approach (copied from the link below):

Here is the link I used for the definition of drawing both the Diamond and zig-zig isometric approaches.

https://stackoverflow.com/questions/892811/drawing-isometric-game-worlds

Help is greatly appreciated, thanks.

sentences:
FXC: Error X3501: 'main': entrypoint not found I am trying to compile a vertex shader using VS2013, but every time I try, FXC returns the following error:

Error error X3501: 'main': entrypoint not found

I've reduced the vertex shader to its simplest form and yet I'm still getting the same result:
DefaultVS.hlsl
#include "Include.hlsl"

cbuffer CameraTransform {
    float4x4 ViewProjMat;
};

VS_OUT main(VS_IN input) {
    VS_OUT result;

    result.Position = mul(input.Position, mul(input.WorldMat, ViewProjMat));

    return result;
}

Include.hlsl
struct VS_IN {
    float4 Position : POSITION;
    float4x4 WorldMat : INSTANCE_TRANSFORM;
};

struct VS_OUT {
    float4 Position : SV_POSITION;
};

And the properties of both files:

/Zi /E"main" /Od /Fo"Path\To\Output\DefaultVS.cso" /vs"_5_0" /nologo
/Zi /Od /Fo"Path\To\Output\Include.cso" /nologo

sentences:
Texture atlasing in Unity I'm researching new ways to optimize games for better performance. Currently I am working on texture atlasing, which is giving me a hard time. I made the atlas using Texture2D.PackTextures and saved the offset and height and width values to a text file.

Now when I insert the values to a material the texture is shown correctly, but since batching requires that the same material is used - how I can I use the same material with different offsets?

Picture: All the cubes use the same texture. Only the two on the right batch as they use the same material.

sentences:
How to set speed of circular motion Edit 2 - clarification

Just to clarify, the issue I have at the moment is how I specify a time (in seconds) for a complete revolution to occur.  My delta is fixed and is 1/ticks per second (1/60).  As you can see with my linear sprite movement, I have a 'time' variable which is where I specify (in seconds) how long the sprite should take to travel the length (or height) of the screen. I'm looking at how I do this for circular movement.

Edit 1 - Results from suggestions

See at end of question.

Background

When moving my sprites along a straight path, I'm using delta so I can get the same rate of relative motion on all devices like so:

spriteGridX = 240/480;  //I start out with a virtual 'Grid' so I can scale position to all resolutions etc so 240/480 would place the sprite at the center of the screen (X)

spriteScreenX = spriteGridX * width;  //Scale to physical screen where width is the width of the current devices screen (viewport)

spriteXTime = 8f; //8 being the amount of time in seconds that this sprite will take to traverse the entire width of the screen

spriteXVel = 1/spriteXTime; //Velocity that will be used to move the sprite along the virtual grid position

So, when I need to move the sprite, I simply do the following:

spriteXGrid+= (spriteXVel * Delta) //+= for right -=for left. I'm using a fixed delta time
spriteScreenX = spriteGridX * width; //And again, convert to usable screen position for current device
drawsprite(spriteScreenX, SpriteScreenY); //Draw the sprite (drawSprite is just a method I've written to draw openGL quads and it takes the screen X and Y as coordinates - spriteScreenY not shown here but essentially same as X with height instead of width.

Now, I need to have a sprite move along a circular path. So far, I have a test up and running which directly acts on the 'screen' coordinates of the sprite directly like so:

Java Code

int rad = 25;
float angle = 50;

spriteScreenX-=Math.round(rad*Math.cos(angle));
spriteScreenY+=Math.round(rad*Math.sin(angle));
angle+=.1;

The Problem

Now, the above does work, but the sprite completes it's circular path way too quickly (it's doing approximately 1 revolution per second).

So my question is:

Am I doing this correctly and if so..........
How do I slow this down?  I won't particularly need to keep changing the speed, I just want to be able to set it initially.

Would really appreciate some pointers.

Edit 1

When I put the following the code above I get the following result:

If I put the following:

spriteScreenX-=Math.round(rad*Math.cos(angle*Math.PI/180*delta));
spriteScreenY+=Math.round(rad*Math.sin(angle*Math.PI/180*delta));
angle+=.1;

Or:

spriteScreenX-=Math.round(rad*Math.cos(angle*delta));
spriteScreenY+=Math.round(rad*Math.sin(angle*delta));
angle+=.1;

Something like this happens:

sentences:
What kind of algorithms could I use to generate biome borders like in Minecraft? After I've found this post I'm curious what kind of algorithms they use to generate these shapes (second image).

I can't imagine that the basic shapes are basing on a perlin or simplex noise or a voronoi diagram. With voronoi I'm a bit uncertain to be honest.

Well, so what do you think. What algorithm could be used to generate biome borders like they do?

sentences:
unable to map one object position to another object over network objective: I have a player which instantiate by network manager class. I want to map/sync its position/rotation to another object which is also instantiate by my player object.

(what it i have tried)
Below code is attached to my network player which instantiating another object (mimic object)

         void Start() {
                if (isLocalPlayer)
                {
                    CmdInstantiate();
    }

         [Command]
            void CmdInstantiate()
            {
                // This [Command] code is run on the server!
                mimic = (GameObject)Instantiate(
                     mimicObject);
                // spawn the bullet on the clients
                NetworkServer.Spawn(mimic);
            }

void Update()
    {
        if (!isLocalPlayer) {

            return;
        }
        CmdMimicObjectPosSync();//updating position on server
    }

   [Command]
    void CmdMimicObjectPosSync()
    {//position sync method
        mimic.transform.position = this.transform.position;
        mimic.transform.GetChild(0).position = this.transform.GetChild(0).position;
        mimic.transform.GetChild(1).position = this.transform.GetChild(1).position;
        mimic.transform.GetChild(2).position = this.transform.GetChild(2).position;
    }

it is working fine on the player side but another player who has joined the network unable to see it although mimic object has instantiated but its value remains same (no change). Mimic object has attached network identity and network transform.

sentences:
Rotate a UI Image exactly 360 degrees over the course of 1 second? I have a UI Image that I want the user to click and have it rotate 360 degrees once on the z axis.  I can get it to rotate through a coroutine but I'm having trouble making it stop once it is started.

public void getInputClick()  // OnClick method for UI object
{
    foreach (Transform child in EventSystem.current.currentSelectedGameObject.GetComponentsInChildren<Transform>())
    {
        if (child.gameObject.name == "Lock")  //Making sure this is an object that should rotate becasue it has a child named "Lock"
        {
            if (rotating == false) //enable coRoutine if not already rotating
            {
                runRotationRoutine = true;
            }
            break;
        }
    }

}

void Update()
{
    if (runRotationRoutine == true)  //Listening for coRoutine execution directive during update.
    {
        StartCoroutine(rotationRoutine());
    }
}

IEnumerator rotationRoutine()
{
    runRotationRoutine = false;  // make sure update doesnt try to run the coroutine more than once!
    rotating = true;  // bool signifying that rotation is currently happening.

    while(rotating == true)
    {
        imageObject.transform.Rotate(rotationVector);
        yield return null;

        //  This works but rotates forever because the coroutine is never terminated.

        //  How do I make this stop after the object has rotated 360 degrees????

        //  Something like (when current rotation == starting rotation --->  set rotation = false
        // But how would I determine this?
    }

}

It needs to be a coroutine because there are a lot of other things executing simultaneously.  I feel like it should be pretty simple to just tell it to only rotate around once, what am I missing here?

sentences:
Unity, Replace or modify camera with own script I am making an RTS game which has a slowdown when many units are on screen at once. I have a plan to write my own camera script to speed this up.

Since I have an efficient way to find where units are without the raycast, I want to write scripts to replace the camera and check raycasts against only the few objects that my scripts will identify as in the correct area for that raycast?

Alternatively is is possible to have the camera ignore certain entities on one part of the screen, and then a different set on another part of the screen?

--Edit--
I am very grateful for people helping in anyway, but I wanted to know if this Could be done even if in my case it shouldn't be.

sentences:
My grid based collision detection is slow Something about my implementation of a basic 2x4 grid for collision detection is slow - so slow in fact, that it's actually faster to simply check every bullet from every enemy to see if the BoundingSphere intersects with that of my ship. It becomes noticeably slow when I have approximately 1000 bullets on the screen (36 enemies shooting 3 bullets every .5 seconds). By commenting it out bit by bit, I've determined that the code used to add them to the grid is what's slowest.

Here's how I add them to the grid:

for (int i = 0; i < enemy[x].gun.NumBullets; i++)
{
   if (enemy[x].gun.bulletList[i].isActive)
   {
      enemy[x].gun.bulletList[i].Update(timeDelta);

      int bulletPosition = 0;
      if (enemy[x].gun.bulletList[i].position.Y < 0)
      {
         bulletPosition = (int)Math.Floor((enemy[x].gun.bulletList[i].position.X + 900) / 450);
      }
      else
      {
         bulletPosition = (int)Math.Floor((enemy[x].gun.bulletList[i].position.X + 900) / 450) + 4;
      }

      GridItem bulletItem = new GridItem();
      bulletItem.index = i;
      bulletItem.type = 5;
      bulletItem.parentIndex = x;

      if (bulletPosition > -1 && bulletPosition < 8)
      {
         if (!grid[bulletPosition].Contains(bulletItem))
         {
            for (int j = 0; j < grid.Length; j++)
            {
               grid[j].Remove(bulletItem);
            }
            grid[bulletPosition].Add(bulletItem);
         }
      }

    }
}

And here's how I check if it collides with the ship:

if (ship.isActive && !ship.invincible)
{
   BoundingSphere shipSphere = new BoundingSphere(
    ship.Position, ship.Model.Meshes[0].BoundingSphere.Radius * 9.0f);
   for (int i = 0; i < grid.Length; i++)
   {
   if (grid[i].Contains(shipItem))
   {
      for (int j = 0; j < grid[i].Count; j++)
      {
         //Other collision types omitted
         else if (grid[i][j].type == 5)
         {
            if (enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].isActive)
            {
               BoundingSphere bulletSphere = new BoundingSphere(enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].position,
               enemy[grid[i][j].parentIndex].gun.bulletModel.Meshes[0].BoundingSphere.Radius);
               if (shipSphere.Intersects(bulletSphere))
               {
                   ship.health -= enemy[grid[i][j].parentIndex].gun.damage;
                   enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].isActive = false;
                   grid[i].RemoveAt(j);

                   break; //no need to check other bullets

                }
             }
             else
             {
                grid[i].RemoveAt(j);
             }
          }

What am I doing wrong here? I thought a grid implementation would be faster than checking each one.

sentences:
Reuse and Interact With Multi-Layer Tile Maps I'm new to game development and try to make a game where buildings are created in tile maps. My problem is that I need to interact with these buildings and I want to reuse the buildings I created.
Now I would like to export these two layers to a single sprite or prefab to create multiple buildings and to make them clickable.
Is there a way to achieve this or do I have the wrong approach?
EDIT:
My current setup looks like this:
Two tile maps: One tile map contains the wall of the building. Another tile map contains decoration like door or window.
My problem is, that I am not able to export these tile maps as one prefab to reproduce it or to attach scrips.
I am looking for a way to combine these two layers into one resource (=The building with all its decorations, doors, windows), so that I can place them anywhere I want and make them clickable as a game object.

sentences:
Detecting tile with height in isometric game I'm trying to create an isometric tile-based game (for iPhone) and I'm having trouble with height in tiles.

What I currently do (without heights) is apply some mathematic transformations to my 2D-matrix (which represent the tiles) so that I know where in the screen (x,y) should I place the isometric tile. Then, when the user clicks somewhere in the screen, I take that values and pass them through a function (kind of f^-1) to get which tile it belongs to.

This works perfectly. My problem is: imagine that I want some tiles to have a different height from others. In order to draw the tile itself its pretty simple, since the z-coordinate has no transformation in the isometric approach used in games (z'=z). BUT what if I want to calculate the tile coordinate (defined by X-tile and Y-tile) from the touch coordinates (x,y)? Any guess?

sentences:
Positioning entities in adjacent maps Say I have a 2D tile based game engine (I don't, but I will soon). I was wondering how I would manage drawing adjacent maps. That is, imagine we have a map that is 50 by 50 tiles wide. Then next to that, we have another map which of the same size - but they are loaded via separate files. So they are visibly next to each other.

Let's call the first map (the one we are on) A, and the second map B. How would I:

Draw the two maps next to each other at the combining point (provided that I have already saved data about what maps are next to each other, and at what point), so they join seamlessly, without the need for a loading screen / "teleport".
Manage entity positions. Positions, currently, are managed relatively. That is, each map has it's own (0, 0) tile. How would I manage this when drawing an entity? I was thinking about storing a pointer to the map the entity, and if it happens to change map, the pointer is updated, and we - somehow - find the tile the entity would move on to.

I should mention that only the player will ever need the use for this movement.

Any ideas? Sorry if I wasn't very clear.

sentences:
C++ OpenGL ShadowMap Issue/Artifacts I am currently implementing basic shadow mapping in my C++ Custom Engine using GLSL 4.10. It is currently working with basic PCF anti-aliasing and very minimal reduction for unwanted artifacts. Here is a screenshot for reference:

Recently, I have started modifying my shadow map pipeline to reduce shadow acne. After reading through various articles, many suggest either using a bias value, which is subtracted from the depth value being compared to the shadow map

// Shadows
float bias = 0.0005;
vec4 shadowCoordinate = u_worldToShadowMapSpaceTransform * vec4( worldPosition.xyz, 1.0 );
shadowCoordinate.z -= bias;
float shadowValue = textureProj( u_shadowMap, shadowCoordinate );

and or to cull front faces when rendering to the shadow map.

glCullFace( GL_FRONT )
// Render to ShadowMap FBO
glCullFace( GL_BACK )
// Render Scene

Culling front faces reduces most of the shadow acne but creates another problem that none of the articles have mentioned. The screenshot below shows the issue. If you look at the white box in front of horned creature, you will notice the creatures's shadow is cast upon the other side of the box. This is because the front faces of the box are culled which leads the back faces to compare their depth values against geometry to the north of the box.

Naturally, this also leads to these shadows also being cast below the floor as well as above. Here is a screenshot of the bottom of the floor. It is difficult to see but you can see the shadows being cast.

I believe many 3D engines utilize variations of these artifact reduction techniques. So, how do they avoid the shadow casting issue described above?

sentences:
How do I get consistent Xbox360 Controller input across Linux, Mac, and Windows? I'm developing a browser plugin to provide joystick access to all browsers on all platforms. The issue that I'm running into is that OS X doesn't seem to provide Xbox 360 joystick input without installing some extra drivers, and even when those drivers are installed they map the buttons and axes completely differently than Windows and Linux.

I'm using xboxdrv on Linux, which has a pretty decent mapping and is very similar to the standard Windows XBox driver mapping. On windows XP using the default XBox Controller driver the order of the x and y axes are swapped. Is there an alternative driver that can be installed?

On OS X using Colin Munro's OS X Driver, the mapping is totally different though. The d-pad is mapped to the first four buttons and the axes are all switched.

What I want to know is what drivers do I need to install on each OS to get XBox 360 Controllers to register exactly the same as the do under Linux with xboxdrv.

OS: DRIVER
Linux: xboxdrv
Windows: ?
OS X: ?

The reason why I prefer the xboxdrv style of controller mapping is that the mapping is pretty much the same for any other random USB controller. The two primary axes are the same and the first 5 buttons are the same. This way the XBox controller will behave like an "enhanced" generic USB controller and any game logic won't need to know anything about the specific controller type. I want to be able to assume the basic axes and buttons will be mapped correctly (or at least consistently) and then use the extra buttons and axes for extra functionality.

The newer versions of the standard Linux X11 input also match exactly the xboxdrv mappings which is another reason that I prefer it.

sentences:
My character can jump even when its not grounded Here is the code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovementscript : MonoBehaviour
{
    //vars
    public CharacterController controller;

    public float speed = 12f;

    Vector3 velocity;

    public float gravity = -9.81f;

    public Transform groundCheck;
    public float groundDistanace = 0.4f;
    public LayerMask groundMask;
    public float jumpHeight = 3f;
    bool isGrounded;
    //-----------------------------------

    // Update is called once per frame
    void Update()
    {
        isGrounded = Physics.CheckSphere(groundCheck.position, groundDistanace, groundMask);

        if(isGrounded && velocity.y < 0)
        {
            velocity.y = -2f;
        }

        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.GetButtonDown("Jump") && isGrounded)
        {
            velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
        }

        velocity.y += gravity * Time.deltaTime;

        controller.Move(velocity * Time.deltaTime);
    }
}

character controller and etc

sentences:
How can I reduce writes-per-second when saving player data to a database? Consider a game where the player has some profile or save data stored in a database. What I want to understand is, for things that effect the users score or level, there could be so many factors that this has to be persisted to the database and if it is, this could be many writes per second per player potentially, which could be expensive or slow.

How can I reduce the load on the database while still maintaining critical player information?

sentences:
OpenGL — Better to switch out material or shader for changing object colors? I'm fairly new to shaders and OpenGL so bare with me please, I just want to make sure I'm doing it correctly! Now I'm using LibGDX in order to create a simple 3d diagram for my company. I have a few models that I need to display as grey until they are active, where they will fade to a brighter blue, probably gain some emission value so that they're brighter.

Now, when I export my models from Blender to .fbx, and then run Fbx-Conv to generate .g3dj files, I get some output like the following:

"materials": [
    {
        "id": "glowy_blue_material",
        "ambient": [ 0.000000,  0.000000,  0.000000],
        "diffuse": [ 0.000000,  0.753256,  1.000000],
        "emissive": [ 0.000000,  0.753256,  1.000000],
        "opacity":  0.592209,
        "specular": [ 0.000000,  0.759441,  1.000000],
        "shininess":  9.607843,
        "textures": [
            {
                "id": "Texture",
                "filename": "heat_exchange_uv_edge_highlight.png",
                "type": "DIFFUSE"
            }
        ]
    }
]

Which is all good and displays what I want, but I've been reading about shaders the past few days and see that in a lot of cases LibGDX suggests extending the default shader and making tweaks that way.

From a computational point of view, what is the best way to go about switching colors of models? Extending the default shader with some logic about if x is inactive, change shader to render as greyscale, else render as normal blue material? Or should I create a greyscale version of the material and switch them out? ( I'm not quite sure how to do this, also, because I apply the material in the g3dj file — could I do this in Java instead of the g3dj file? Does it cause a performance hit? If anyone could point me in the direction of some documentation somewhere.. )

Any help would be appreciated. Thanks!

sentences: How do you allow joints in a character to fall freely based on gravity? I am building a game in Unity in which a character falls down on death. Is it possible to make the joints fall and bend based on gravity? That is to leave the joints fully dependent on gravity and colliders and not any skeletal animation.

sentences: Moving a tiled map in a jframe I rendered a tiled map, with the help of slick2d, in my JFrame in Java. I can move my main character, but it is just that the character itself moves. I would like to do it that, if the player moves, the map moves and the player himself stays in middle of the frame. Do you have any suggestions on how to do that ?

sentences:
Multiplayer architecture in games like Diablo 2 So I've been wondering, what kind of architecture would games like world of warcraft, diablo 2 (which is most probably a different beast than WoW) use?

As far as I know, RTS games state-syncs every client and server, and the input from the clients get relayed to the server, and all states from all clients will get the same input, because everything is synced.

And because everything is synced, state changes can be done safely, thus allowing large numbers of entities in the game (e.g zerglings), because the clients only need to know the players' inputs.

This is all fine and well, but AFAIK diablo 2 allows players to join servers mid-game, which leads me to believe they use a different architecture. I'm stumped on how they do this though, and if elegant solutions exist for such a thing. Does anyone have a better idea?

sentences:
What is an acceptable GC frequency for a SlimDX/Windows/.NET game? I understand that the Windows GC is much better than the Xbox/WP7 GC, being that it's generational and multithreaded -- so I don't need to worry quite as much about avoiding memory allocation.

SlimDX even has some unavoidable functions that generate some amount of garbage (specifically, MapSubresource creates DataBoxes), yet people don't seem to be too upset about it.

I'd like to use some functional paradigms to write my code too, which also means creating objects like closures and monads.

I know premature optimization isn't a good thing, but are there rules of thumb or metrics that I can follow to know whether I need to cut down on allocations? Is, say, one gen 0 GC per frame too much?

One thing that has me stumped is object promotions. Gen 0 GCs will supposedly finish within a millisecond or two, but if I'm understanding correctly, it's the gen 1 and 2 promotions that start to hurt. I'm not too sure how I can predict/prevent these.

sentences:
Walk to nearest attackable range node My game has 3D environment which is partitioned in 2d cells(nodes). I have implemented A* for path finding.

Now I am just breaking my head to how to implement the algorithm to move the hero to the nearest attackable range node/point when the enemy is out of attack able range.

Which means, it should satisfy two conditions

Target whithin attackable range
No obstacles in between the target
and attacker

See below picture (pardon for my bad drawings)

Brown boxes are obstacles
Attacker/hero is in the cell highlighted with Turquoise color dot, the circle is  the radius/size of the model.
Target is the red dotted color cell, surrounded with red color circle to indicate the size of the model
Green circle is the radius where hero has to move to some where inside that location to attack (its the radius of hero's attack range)
Blue dots are the A* path to reach from hero position to target position

When the player issues attack command, hero should move to the nearest attack able node and start attacking.

Finally I thought of below algorithm

Calculate radius to scan - This is the sum of attacker radius + attacker weapon radius + target radius
Get nodes fall within the radius (from step 1) from targets position
Find path from attacker to target using A*
Keep walking in the path (from step 3)
check if current node is in the scanned nodes (from step 1)
If true,
Check that no obstacle are in between
If true, attack, if false keep walking (repeat step 4)

If we put together the algorithm and the figure1

The A* gets the path of 9 node to reach the target
After moving 5 steps, it enters the attackable range, since there is obstacle between the target, it take two more steps where it finds no obstacles and stats attacking.

I am not sure if this is the optimized method to achieve this but I am not getting alternative solution.

Very particular to the steps 2-5 which looks little weird and process intensive to me.

I am using actionscript 3 and Flare3D (Stage3D API)

sentences:
Creating a static background when using camera transforms in Allegro 5 How can I draw a static bitmap for the background of an Allegro 5 graphics window, if I'm using camera transformations to apply perspective to bitmaps in front of the background so it appears that they're otherwise in a 3D space?

If I try simply drawing a bitmap to the backbuffer without any transforms applied, and then call al_use_transform on a perspective transform when drawing the other objects, the "background" moves along with the transform.

sentences:
Maintaining velocity of free fall body using Box2D in libGDX I want to maintain the speed of a free-falling Box2D body using LibGDX. I'd like the vertical velocity increase with the level. I've applied a linear impulse and velocity actually increases like this:

fruitBody.applyLinearImpulse(0, -800, fruitBody.getLocalCenter().x, fruitBody.getLocalCenter().y, true);

I think this is a bad approach, because the speed has increased only a little and I applied as much as -800 units of impulse.

Below is my render function of game play screen class:

    public void render(float delta) {

        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

//      camera.update();
//      batch.setProjectionMatrix(camera.combined);
        batch.begin();

        backgroundSprite.draw(batch);
        grassSprite.draw(batch);

//      bucketSprite.draw(batch);

        Iterator<Body> bodies = world.getBodies();

        while(bodies.hasNext()){

            Body body = bodies.next();

            if(body.getUserData() != null){

                String spriteName = (String) body.getUserData();

                Sprite sprite = (Sprite) userDataMap.get(spriteName);

                if(spriteName.equals("bucket"))
                    sprite.setPosition(body.getPosition().x + 345, body.getPosition().y + 230);
                else
                    sprite.setPosition(body.getPosition().x + 375, body.getPosition().y + 225);

                sprite.draw(batch);

            }
        }

        batch.end();

        fruitBody.applyLinearImpulse(0, -800, fruitBody.getLocalCenter().x, fruitBody.getLocalCenter().y, true);
//      debugRenderer.render(world, camera.combined);
        world.step(1/60f, 8, 3);
//      world.clearForces();
    }

My world is:

world = new World(new Vector2(0, -10), true);

Orthographic camera:

camera = new OrthographicCamera(800, 480);

My fruitBody fixture def is:

bodyDef.type = BodyType.DynamicBody;
        bodyDef.position.set(0, 100);

        // shape
        CircleShape ballShape = new CircleShape();
        ballShape.setRadius(15f);

        //fixture
        fixtureDef.friction = .1f;
        fixtureDef.restitution = .7f;
        fixtureDef.shape = ballShape;
        fixtureDef.density = .2f;

        fruitBody = world.createBody(bodyDef);
//      fruitBody.setUserData(fruitSprite);
        fruitBody.setUserData("fruit");
        fruitBody.createFixture(fixtureDef);

I just want to increase the fruit's speed (free falling body) at each level by a given value.

sentences:
Doom-style 8 directions sprite math HELP C++ I'm trying to get Doom-style 8 direction sprite rotation that changes its sprite depending on the camera and the forward vector of the entity just like this video here: https://www.youtube.com/watch?v=DBRR_ZVWtMk&t=13s.

I've searched around the internet for a solution and I have found some people that have been having the same issue but no one that really got it working like it should. I managed to figure out how to get the entity to change it's sprite depending on the camera view angle but I can't figure out how to account for the entity's own forward vector. I would assume you'll use the CrossProduct but I'm not sure...

Here is my code:

// Get the angles
angles = entity->parms.axis.ToAngles();

// Compute the forward and normalize
forward = angles.ToForward();

// Compute the direction and normalize
direction = rg.renderView.origin - entity->parms.origin;
direction.Normalize();

odVec3 point = forward.Cross(direction); (NOT USED)

// Compute the yaw angle
yaw = RAD2DEG(odMath::ATan(direction.y, direction.x));
yaw = odMath::AngleNormalize360(yaw);

        if (yaw >= 22.5f && yaw < 67.5f)
            entity->parms.skin = R_FindSkin("skins/sdk/rotation/angle_1");
        else if (yaw >= 67.5f && yaw < 112.5f)
            entity->parms.skin = R_FindSkin("skins/sdk/rotation/angle_2");
        else if (yaw >= 112.5f && yaw < 157.5f)
            entity->parms.skin = R_FindSkin("skins/sdk/rotation/angle_3");
        else if (yaw >= 157.0f && yaw < 202.5f)
            entity->parms.skin = R_FindSkin("skins/sdk/rotation/angle_4");
        else if (yaw >= 202.5f && yaw < 247.5f)
            entity->parms.skin = R_FindSkin("skins/sdk/rotation/angle_5");
        else if (yaw >= 247.5f && yaw < 292.5f)
            entity->parms.skin = R_FindSkin("skins/sdk/rotation/angle_6");
        else if (yaw >= 292.5f && yaw < 337.5f)
            entity->parms.skin = R_FindSkin("skins/sdk/rotation/angle_7");
        else
            entity->parms.skin = R_FindSkin("skins/sdk/rotation/angle_0");

sentences:
DXGI - Frame rate drops from ~8000 FPS to ~1500 FPS when switching to full screen mode I've created a simple app with a DirectX11 device and swap chain (IDXGISwapChain). All it does is clear the screen with a color and call Present(0, 0) on the swap chain. The app handles full screen/windowed mode transition by itself (I passed DXGI_MWA_NO_WINDOW_CHANGES) to the IDXGIFactory object. After switching from windowed mode to full screen, the VS graphics profiler shows a drop in the frame rate, from ~8000 FPS (window mode) to ~1500 FPS (full screen mode). I think I'm resizing my buffers properly (in response to WM_SIZE), I'm not getting any warnings about presentation inefficiencies in the debug window. The mode used to create the swap chain is obtained by enumerating the supported modes of the output device and selecting the proper resolution info. Isn't full screen mode supposed to be more efficient (as I understand, it can simply do a flip instead of a bit blit).
The code is here in case you want to take a look.

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:
Lag Compensation in a Real-Time Game I have been trying to implement some lag compensation techniques for a real-time game, I've found some good resources online, but I don't think I fully understand the server-side part of the problem.

The game is a simple 2D game, where the player moves an entity around the map. There will be other entities with their own behavior that are controlled by the server, but I made it so that their movement can be easily interpolated. The player input is quite simple: an analog stick and some commands (pick target, loot objective, etc.). The game runs at a fixed 10 TPS (it's on mobile and it's not that action packed, 10 TPS will suffice). The client will send the input state every tick (even if no input is present, like the analog stick is in the default position).

It is worth mentioning that only one player is connected at the same time, so in a way this is not multiplayer, but I need to run this on the server as well to prevent cheating.

I understand client-side prediction and that's quite straightforward to implement. I am struggling with the server-side part. As far as I can see I have 3 options:

The server waits for the input from the client then computes the new game state and sends it to the client. This is a viable option only because there is only one player.
The server runs the game loop waiting up to 100ms (10 TPS -> 100ms / tick) for an input. If it gets one, it will be taken into consideration when computing the next state, otherwise it will be discarded. If an input arrives after the tick was done, it will be discarded. If an input arrives during this timespan, but the tick numbers don't match (client send input for tick 5, but server is at tick 7) it will be also discarded.
The server runs the game loop waiting up to 100ms (10 TPS -> 100ms / tick) for an input. If it gets one, it will be taken into consideration when computing the next state, otherwise it will be discarded. In this case it will not care if the input is not for the current tick, it will apply it anyways.

Option 1 is the easiest to implement and will be more consistent. The biggest issue with this is that I believe it's easy to cheat. Since the server is waiting for input, the player might be able to "pause" the game, analyze the situation then dispatch the action, basically allowing a cheating player to play in slow-motion. The client-side reconciliation in this case seems easy, when the player moves, it will move instantly on the screen and when it received the updated state from the server it will do it's reconciliation.

Option 2 is a tad harder to implemented (not by much though), but it will be unplayable (literally, the player won't be able to move) if their ping is higher than 100ms.

Option 3 has the same complexity as Option 2. It will work with pings higher than 100ms but it will most probably lead to some frustration on the player's side since their inputs will not arrive in time.

Is there a better way to do this? What are your thoughts?

sentences:
Replacing a custom 3D model format with something more standard This is long, so the short question is: What's the best/right/standard set of technologies for creating 3D models and incorporating them into a game such that the complexity for the artist is kept to a minimum while also keeping things relatively sane for the game authors?

The long story:

I am a developer for an open source space game called Pioneer. We currently have a custom 3D model format based around a Lua script that defines how the various objects in the model hang together.

The existing format has a lot of flexibility. It can load Wavefront objects or build its own from polygon primitives. It has a dynamic function that can emit tailored geometry each frame based on game state. It can also define various attributes and properties such as special collision surfaces, simple waypoints (use for automated docking with a space station), and so forth.

The feature set is more than enough for what we need right now, but its implementation leaves a lot to be desired. The actual script reader is almost 3000 lines of spaghetti. Model scripts are messy and require too much knowledge of the game engine. Matters are made worse by that fact that the original author is not readily available at the moment, so its left to others with little understanding of this system to fix things. We're also hearing some of our users say they can drive a modelling program just fine, but find the required Lua script to be completely incomprehensible. We don't want to turn these contributors away, so we need to find a way to help them.

(Some examples of model scripts, for the interested, can be found in our models repository).

As a result, I'm looking for a replacement. Ideally, I'd like to be able to point interested parties at something like Blender, tell them to draw a ship, define a few special properties and then export it, and that'd be that. On the code side, I'd very much like to be able to integrate a good third-party library that I can hand one of these files and just poke an object to get the necessary data back out. Anything that we can shift on to other, more competent projects is a win.

My question then, is what to use? I've done some searching and the best approach at this point appears to be to require artists to export their model in COLLADA format and then write a utilty based on FCollada to convert the export to some internal format. That's a little heavier than I think I want, but keeps things as easy as possible for the artist, which is the major requirement.

I'm very new to world of 3D modelling however, so I wouldn't be at all surprised to learn that there is a better way. Recommendations of standard/best practice for this sort of thing would be greatly appreciated.

sentences:
GLSL - Efficient Point inside Box Check I'm attempting to improve the performance of a shader that changes the colour of a region of the world that is inside a "zone".

I am using a deferred lighting system, so the colour and world-space position of each pixel on the screen are stored in two separate textures, gColor and gPosition.

The zonePos uniform stores the two corners of each zone.
The zoneColor uniform stores the colour of each zone.
The totalZones uniform stores the amount of zones in the current game.

Here is the fragment shader:

out vec4 FragColor;

in vec2 texCoords;

layout (binding = 0) uniform sampler2D gColor;
layout (binding = 1) uniform sampler2D gPosition;

uniform vec3 zonePos[10];
uniform vec3 zoneColor[5];
uniform int totalZones;

void main()
{
    vec3 FragPos = texture(gPosition, texCoords).rgb;
    vec3 Albedo = texture(gColor, texCoords).rgb;

    vec3 j;
    vec3 k;

    for (int i = totalZones; i > 0; i--)
    {
        j = zonePos[i * 2];
        k = zonePos[i * 2 + 1];

        if (FragPos.x >= j.x && FragPos.x <= k.x &&
            FragPos.y >= j.y && FragPos.y <= k.y &&
            FragPos.z >= j.z && FragPos.z <= k.z)
                Albedo += zoneColor[i];
    }

    FragColor = vec4(Albedo, 1.0);
}

The changes I have made so far are:

Using j and k, rather than accessing zonePos 6 times in the if statement
Looping down from totalZones to 0, as a comparison against 0 is faster

Any suggestions are greatly appreciated.

sentences:
UE4 - storing complex actors in Game Instance I want to make a game where I can hold tools in my hand and inventory. Obviously I want to pass them between levels and maybe even game sessions. Question is, how would I do that?

With simple variables like amount of money or HP, all I do is store a variable in the Game Instance. But what about, for example, a tool that has more data, like the class type, durability, maybe value? Even worse, whole array of them?

The way I use that in game is, there's an actor representing the tool. But even if I store array of those in the game instance, the actors get destroyed while changing level and the array just points empty memory. I could just spawn new ones by using the class type - but that is not enough for me.

My idea is to create something... maybe a struct, that would hold the information and then recreate the inventory item actors according to the data in the struct.

My questions:
What are other ways to do it?
and
Is there something fundamentally wrong with the way I'm storing the items in my inventory now?

sentences:
How do I calculate the forces exerted by a taut wire wrapping 2D objects? Assume I have a physics primitive I am going to call a "wire", wrapped around a 2D environment (as described in this question).

Here's an illustration of what that might look like:

In the example illustration: The box is being pulled upwards (held up) by the wire, and the box is pulling the wire downwards. The object on the spring is being pushed downward by the wire, but is also pushing the wire upwards.

While I haven't figured out how to implement it yet, assume the wire will slide freely across the points that it is wrapped around.

In a 2D physics simulation (ie: frame based) how do you calculate the forces (or impulses) to apply to the objects that are attached to or wrapped by a wire like this?

As I alluded to in my first question, I imagine that if the only non-static object "on" the wire was the mass at the end, then the force would be identical to a fixed-length joint between the mass and the point before that on the wire.

sentences:
Dynamic Sort order For walking in front and behind stuff I'm using tile maps, and I'm having a difficult time with the concept of walking both in front of things, and behind things and having the layers sort order show properly. Take the image below, I need it to behave like #1 AND #2, so that if you walk behind it, you get that nice layering. However, I also need it to act like #2 when infront of it without looking like #3. Is there some sort of way to make the top of the barrels sort order change depending on if the player is in front of it, or behind it?
I was looking at rule tiles, but that's something else, unless there is some feature about it I do not know of.

sentences:
OnPointerClick not being called I implemented the IPointerClickHandler in a script that runs on multiple GameObjects in my scene. I'm definitely missing something since the implementation is not being called at all. The objects are not UI elements. Here is the implementation of the interface :

 public void OnPointerClick(PointerEventData eventData)
 {
      Debug.Log("clicked on " + eventData.selectedObject.name);
 }

Can I even use the EventSystem with normal GameObjects? If I can how do I do it.

What i tried: Adding a BoxCollider2D to the object, using the event trigger component on the object calling a public method.

Edit: I was missing a raycaster on the main camera.

sentences:
In Unity how do I make a button call everything suscribed to the "onEndEdit" event of an InputField? How do I make a method (that is going to be called every time that a button is pressed) to call everything subscribed to the "onEndEdit" event of an InputField?

I expected something like this:

public class DoneButtonInputField : MonoBehaviour
{
    [SerializeField] private InputField inputField;

    public void ClickDoneButton()
    {
        inputField.onEndEdit();
    }
}

But it does not work and I do not know how to search for the answer (probably by vocabulary lack).

sentences:
Unity / Animation / Change the "Transition Speed" between 2 animations during runtime I need to change the Transition Duration per Runtime.
I just didnt find a way to do access it.
I found questions with similar problems though (links below)- those didnt work for me because they accessed it to change it via editor - script. But I need it in runtime.
Is that even possible?

https://stackoverflow.com/questions/29315507/unity-5-access-modify-animatorcontroller-from-c-sharp-script-in-editor

sentences:
Why does AudioSource not initializes itself? Why does AudioSource not initializes itself?

Here is my code:

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

public class CameraConfig : MonoBehaviour
{
    public GameObject objToFollow;

    public bool followRabbit;

    // Use this for initialization
    void Start()
    {
        followRabbit = true;
        LevelController.current.cameraWhichLooksForRabbit = this;

        setMusicSource();
        setSoundSources();
    }

    public AudioClip music, rabbitWalksSound, rabbitDiesSound, rabbitFallsSound, enemyAttacksSound;
    private AudioSource musicSrc, rabbitWalksSrc, rabbitDiesSrc, rabbitFallsSrc, enemyAttacksSrc;

    private void setMusicSource()
    {setClipForSrc(musicSrc, music, true);}

    private void setSoundSources()
    {
        setClipForSrc(rabbitWalksSrc, rabbitWalksSound, false);
        setClipForSrc(rabbitDiesSrc, rabbitDiesSound, false);
        setClipForSrc(rabbitFallsSrc, rabbitFallsSound, false);
        setClipForSrc(enemyAttacksSrc, enemyAttacksSound, false);
    }

    private void setClipForSrc(AudioSource src, AudioClip clip, bool loop)
    {
        src = gameObject.AddComponent<AudioSource>();
        src.clip = clip;
        src.loop = loop;
    }

    void Update()
    {
        checkMusicAndStopOrStartIfNecessary();

        if (!followRabbit)
        { return; }

        Transform rabit_transform = objToFollow.transform;
        Transform camera_transform = this.transform;

        Vector3 rabit_position = rabit_transform.position;
        Vector3 camera_position = camera_transform.position;

        camera_position.x = rabit_position.x;
        camera_position.y = rabit_position.y;

        camera_transform.position = camera_position;
    }

    public void playSoundRabbitWalks()
    {
        if (!rabbitWalksSrc.isPlaying)
        { rabbitWalksSrc.Play(); }
    }

    public void playSoundRabbitDies()
    { rabbitDiesSrc.Play(); }

    public void playSoundRabbitFalls()
    { rabbitFallsSrc.Play(); }

    public void playSoundEnemyAttacks()
    { enemyAttacksSrc.Play(); }

    public void stopSoundRabbitWalks()
    {
        if (rabbitWalksSrc.isPlaying)
        { rabbitWalksSrc.Stop(); }
    }

    public void stopSoundRabbitDies()
    { rabbitDiesSrc.Stop(); }

    public void stopSoundRabbitFalls()
    {rabbitFallsSrc.Stop();}

    public void stopSoundEnemyAttacks()
    {
        enemyAttacksSrc.Stop();
    }

    private void checkMusicAndStopOrStartIfNecessary()
    {
        if (SoundManager.Instance.isMusicOn() && !musicSrc.isPlaying)
        { musicSrc.Play(); }
        else if(!SoundManager.Instance.isMusicOn() && musicSrc.isPlaying)
        { musicSrc.Stop(); }
    }
}

Here are screenshot of the exceptions in console and inspector view:

sentences:
Where is the Shader Designer in Visual Studio? I have Visual Studio 2012 Ultimate and I've been trying to access the Shader Designer. I searched through MSDN's text and Channel9's videos, but they keep failing to mention how to access it.

Can someone let me know where it is?

sentences:
Physics for Android Game I'm making a 2D game for the Android phone, one that involves falling balls. I want to use a physics engine to properly simulate the balls falling and hitting other objects. I'm currently using Phys2D, but when the game runs in the emulator it doesn't look natural; slow and rough. Course, I don't know if this is because of the emulator or Phys2D seeing as how I don't own an Android phone (A real drawback not being able to test on the actual phone, I know, but I can't afford a smartphone).

Anyways, do you think the game would run faster and smoother on an actual android phone, or is it the engine I'm using, or how I'm using it. If it's the engine, any recommendations on Java physics engines?

UPDATE: If you want to test the game yourself, you can find the rough prototype here: http://bpcp.angelfire.com/BallDrop.apk

sentences:
best way to compute vertex normals from a Triangle's list hi
i'm a complete newbie in computergraphics so sorry if it's a stupid answer.
i'm trying to make a simple 3d engine from scratch, more for educational purpose than for real use.

for now i compute only face normals. in this way:

i have a Surface object with inside a Triangle's list. i compute normals inside Triangle class, in this way:

triangle.computeFaceNormals() {
    Vec3D u = v1.sub(v3)
    Vec3D v = v1.sub(v2)
    Vec3D normal = Vec3D.cross(u,v)
    normal.normalized()
    this.n1 = this.n2 = this.n3 = normal
}

and when building surface:

t = new Triangle(v1,v2,v3)
t.computeFaceNormals()
surface.addTriangle(t)

and i think this is the best way to do that.. isn't it?

now.. this works, ok. but light it's not smoothed. i'm trying to compute also vertex normals. (i'm testing my engine with tubolar surfaces so i have almost all vertex shared with more then one triangles)

i've found this simple algorithm: flipcode vertex normal
but.. hei this algorithm has.. exponential complexity? (if my memory doesn't fail my computer science background..) (bytheway.. it has 3 nested loops.. i don't think it's the best way to do it..)

any suggestion?

sentences:
Quad tree vs Grid based collision detection I'm making a 4 player co-op r-type game, and I'm about to implement the collision detection code. I've read a lot of articles and stuff about how to handle collision detection, but I'm having a hard time figuring out what to go with.
It seems the quad tree is the most common way to go, but in some resources they mention the grid based solution. For having used a grid for detections in a previous game, I'm comfortable with that, but is it actually better than a quad tree ?
I'm not sure which offers best performance, and I've also ran a little benchmark, there is not much difference between both solutions.

Is one better than the other ? or more elegant ? I'm really not sure which one I should use.

Any advice is welcome.
Thanks.

sentences:
Is unzipping SDL2 necessary to set it up on a Visual Studio project? Some tutorials, such as the one on WikiHow.com, suggest to download SDL and use it without unzipping it. The instructions there read as such:

  Download the version for Visual C++. It is SDL2-devel-2.0.9-VC.zip (Visual C++ 32/64-bit).

  In downloading window you have the zip folder SDL2-devel-2.0.9-VC.zip, and inside the folder SDL2-2.0.9. Click it > right click > select Copy.
  Navigate to C:\SDL. Inside SDL, right click > select Paste. Click on name SDL2-2.0.9 and rename to SDL2. Now in folder SDL you have folder SDL2.

I'm wondering if it would be better to unzip the library instead, something that would be instructed like this instead:

  Download the version for Visual C++. It is SDL2-devel-2.0.9-VC.zip (Visual C++ 32/64-bit).

  In downloading window you have the zip folder SDL2-devel-2.0.9-VC.zip, right-click on the zip file and select Extract everything...
  In the window that opened up, type C:\SDL, then click Extract.

sentences:
model view projection multiplication order I'm debugging a lighting problem where the camera position is effecting the diffused lighting component on my 3d model. In researching my problem I went back and am reading over all the how to documents. I found that one of my old sources (where I learned open gl 2.0) said this (summarized):

  When creating the modelViewProjection matrix you can't change the order or you'll get unexpected results.  First take the View Matrix and post-multiply it by the projection matrix to create a viewProjection matrix. Then post-multiply the model matrix to get the modelViewProjection matrix.

Looking at my code, all this time I haven't been doing this:

matrixMultiply(mView, thisItem->objModel, mModelView);
matrixMultiply(mProjection, mModelView, mModelViewProjection);

As a test I tried changing it to this:

matrixMultiply(mView, thisItem->objModel, mModelView);
matrixMultiply(mProjection, mView, mViewProjection);
matrixMultiply(mViewProjection, thisItem->objModel, mModelViewProjection);

...but the result appears the same.

EDIT: To answer a question about what the matrices contain. A snapshot of the matrix values:

EDIT2: As a test I did the math both ways to compare the results and even with moving the camera and model around and rotating the model I'm getting the same results for the final ModelViewProjection.

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:
How can I manipulate a static 2D sprite so that it looks alive? I've got a stick figure in the corner of my UI, but I don't like the way he's just standing there, without moving. I'm stuck without additional frames of animation, so my only recourse is the manually move the sprite up and down, left to right, rotation, or whatever else you can think of. Basically I can do everything besides drawing another sprite of animation.

I've tried things like have it subtly bounce or rotate a bit to give it a little bit of dynamism, but I don't believe its the best approach.

I've got a static sprite of a stick figure, how do I give it a bit of life?

sentences:
How can cooperation be encouraged in and after a game jam? The trouble is that with game jams sometimes loads of people participate, but at the end they say "Right! Bye!" and you never hear from them again. If a cooperative element was introduced, the reward from the jam would not only be a game, but a new friend to create games with.

How do you go around implementing such a design without causing lots of people to drop out?

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:
Problem with GLFW input I am using GLFW for the input in my game. I just started learning it and I have encountered a problem. The problem is the input, I have a callback function, where I check for keypresses. I want the program to toggle wireframe mode when the user press 1, therefore I have this code:

if(key == '1' && action == GLFW_PRESS)
{
    wireframe = !wireframe;
}

The problem is that I am Czech and we obviously have different keyboard layout - I use english keyboard layout for programming and when I press 1 it works, however, when I press the same key on czech layout it doesn't work, probably because we have to press Shift along with the '1' key to actually get the 1 on the screen. It may seem obvious that it does not work, but when I used SFML it worked.

I also tried replacing the '1' with 49 or 0x0031, but the result is the same.

Is there a solution or do I have to set the layout manually by the system API?

Thanks in advance.

sentences:
Changing default folder structure of New Project in Unreal Engine? I wonder is there a config option to change the default folder structure of a new project.

So for example when I create a new project there is already a folder for 'Blueprints', 'Maps', 'Audio' and 'FBX' sitting in my Content folder.

The reason I ask is it's usually the first thing i do after i create a new project.

sentences:
How does one get adjacency information in a geometry shader? If you use triangle_adjacency as the input type of a geometry shader, do you need to do something on the client side besides make the primitive mode triangle_adjacency?

Basically what I'm asking do you need to do anything in your application to make the adjacency information available to the geometry shader besides setting the primitive mode in your draw commands?

sentences:
How can I obtain information about the GPU in Cocos2d-x? I'm trying to obtain information about the GPU that is running the game in order to use the correct texture compression for that GPU:

std::string GPUInfo::getTC()
{
    std::string TC;
    cocos2d::Configuration::getInstance()->gatherGPUInfo();
    if(cocos2d::Configuration::getInstance()->supportsPVRTC())
        TC = ".pvr.ccz";
    else if(cocos2d::Configuration::getInstance()->supportsATITC())
        TC = ".dds";
    else
        TC = ".png";
    CCLOG("Texture compression format -> %s", TC.c_str());
    return TC;
}

But this keeps causing this error:

call to OpenGL ES API with no current context (logged once per thread)

Is there another way to obtain details about supporting GPU features on the current device?

sentences:
Should I link GLFW and GLEW into my engine directly? I want to write my own (simple) game engine with OpenGL.
I use GLEW and GLFW and so far linked it successfully.

Should the engine or the respective game (which depends on the engine) include GLFW and GLEW?

Ultimately I would like to create a library out off my engine and include it into my game, but I'm not quite sure if that is possible, if its the case, that the engine should depend on GLFW and GLEW. Would I have to link all the libraries that are neccessary for GLEW and GLFW into the game plus the engine-lib itself?

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:
Add Rigidbody and MeshCollider at runtime : is it a bad practice? Good day.

To simulate an explosion of a vheicle, I decided to do this:

When I need to explode veichle , at runtime, i add rigidibody for every single part of veichle (5-10 part: door, wheel, hood etc), and collider (mesh).
I detach them from parent
I apply an AddExplosionForce to every single part

This cause a big lag in my game, so I'm supposing this is not the efficent way.

The other way could be to add Rigidbody and Collider in my prefab, with Rigidbody.gravity = false, and isKinematic=true, then enabling after explosion, but also this is not good for performance.

Do you have some suggestions to achive my scope, considering that I could have a lot (5-10) enemy veichles at time on my scene ?

Thanks

sentences:
How should I texture objects in Blender to use in Unity? I need to model some things to use in Unity. How should I texture objects (road, tree, etc.) in Blender?
I almost lost all textures when I exported and loaded them into Unity.

sentences:
How to access bottom canvas layer in HTML? I have such html:

<div id="main_window">
 <canvas id="canvas_hex_logic" width="200" height="100"></canvas>
 <canvas id="canvas_ground" width="200" height="100"></canvas>
</div>

and css:

#canvas_hex_logic{
 position: absolute;
 top:31px;
 left:201px;
 z-index: 0;
}
 #canvas_ground{
 position: absolute;
 top:31px;
 left:201px;
 z-index: 1;
}

in #canvas_hex_logic I'm rendering mask for my hexagons:

over it I'm placing ground layer:

part of JS code, for picking color under mouse:

  ..... mouse event handler above .....
  var c_hex = document.getElementById("canvas_hex_logic");
  var ctx_hex = c_hex.getContext("2d");
  ..... ..... ..... ..... ..... .....
  var color = ctx_hex.getImageData(mouseX, mouseY, 1, 1).data;

This code working, if #canvas_hex_logic is on tom of other layers.

So, question is - how to pick color under mouse from #canvas_hex_logic layer when it is overlayed with another layer?

Thanks!

sentences:
Should I call SDL_ConvertSurface right before SDL_CreateTextureFromSurface? Is there a significant benefit (or any benefit at all), when I convert SDL surface and create a texture from optimized surface?

Here is example of what I mean:

loadedSurface = IMG_Load(path);
optimSurface = SDL_ConvertSurface(loadedSurface, SURFACE_FORMAT, 0);
loadedTexture = SDL_CreateTextureFromSurface(renderer, optimSurface);
//return loadedTexture and destroy the rest

/*  VS  */

loadedSurface = IMG_Load(path);
loadedTexture = SDL_CreateTextureFromSurface(renderer, loadedSurface);
//return loadedTexture and destroy the rest

According to SDL2 documentation

  This function is used to optimize images for faster repeat blitting. This is accomplished by converting the original and storing the result as a new surface. The new, optimized surface can then be used as the source for future blits, making them faster.

Its tied with surface blitting, but I can't say its effect "within" texture.

Thank you

sentences:
Scaling physics engines beyond single computational server Currently working on a small home project of developing our own game. The game basics are just a straightforward space game, currently without any collision detection/resolution, just movement with position, velocity, and acceleration.
The game is an MMO(RPG), so currently designing & implementing the backend / server / platform side of things.
So the only items we need to store right now for each object is linear and angular 3D vectors. we're doing this for the position, velocity, and acceleration.
So far, so good.
The question now comes to scaling wise: let's say, a single container of the physics engine has the computational power to calculate 10 rooms of 1000 objects each. It continuously calculates the new velocity and positions of all the objects and that's about it.
So what if we want to scale? I want to go to 20 rooms of 1000 objects, theoretically this seems straightforward: spin up another container and room 1-10 on container1, room 11-20 on container2.
However, what if one of those rooms in container1 suddenly goes to 5000 objects, this would mean container1 can no longer feasibly calculate this, so it should be moved (instantly) to container3.
The objects would all be stored on a redis in-memory database for purposes of speedily operations. The goal is to not have any limits to a single room or the amount of rooms, and just scaling the amount of containers based on the amount of total objects that are moving around in the whole game.
Similarly, the scaling down should be handled as well, if 5 containers are each operating at 10% capacity, it should be moved to 1 container.
We were discussing things such as event bus where we insert a repeating event to "tick" on roomX, a container would take this event, look at the total amount of objects in the room, and then determine how much it can handle.
The problem which we have here is that there's no guarantee the container will be done with tick_0 when another container could be working on the same room for tick_1.
Are there any other techniques we should consider doing to try and get this to figure out a scaling solution?
Other relevant things to mention:

the rooms are unrelated to each other
current programming language is Golang
platform can be cloud agnostic (kubernetes with whichever pods are needed)
client side will use an existing physics engine, as the client only has to draw the current room it's in
physics engine is aimed to "tick" in between anywhere from 2-10/second, depending on the results and the computational cost of each item in the room

Looking for any help or pointers to get us underway with this issue! Places to discuss this would also be greatly appreciated.
Best regards

sentences:
How do I perform an xBR or hqx filter in XNA? I'd like to render my game scaled up with one of the hqx filters (hq2x, hq3x or hq4x) or an xBR filter in a shader.

How can I do this in XNA 4.0 and SM3?

Side note: this question has been heavily edited to become what it is now.

sentences:
Unity3D - override main camera rendering for compositing effect I'm fairly new to Unity and am having a bit of trouble understanding the rendering pipeline.

I need to render the scene to four "windows," so that the viewport shows a 2x2 grid of the scene, each with a slightly different projection matrix.

My first thought was to have a component that would create four RenderTextures, and, in OnPreRender(), iterate through them, setting the main camera's targetTexture property to each texture in turn and rendering the camera's view to that texture:

(Pseudocode)

public class CompositiongEffect : MonoBehaviour
{
    private Material m_material;
    private List<RenderTexture> m_textures;

    void OnEnable()
    {
        if (null == m_textures)
        {
            m_textures = new List<RenderTexture>();

            for (var i = 0; i < 4; ++i)
            {
                m_textures.Add(new RenderTexture(512, 512, 24));
            }
        }

        if (null == m_material)
        {
            m_material = new Material(Shader.Find("Custom/CompositingEffectShader"));
        }

    }

    void OnPreRender()
    {
        var cam = Camera.current;

        foreach (var texture in m_textures)
        {
            /// adjust cam projection matrix here...

            cam.targetTexture = texture;
            cam.Render();
        }
    }

    void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        Debug.Assert(
            null != m_material
            && null != m_textures
            && m_textures.Count == 4, "Texture list not initialized"
            );

        for(var i = 0; i < m_textures.Count; ++i)
        {
            var x = i % 2;
            var y = i / 2;

            var uniformName = string.Format("Texture{0}{1}", x, y);

            m_material.SetTexture(name, m_textures[i]);
        }

        Graphics.Blit(source, destination, m_material);
    }

}

The Image Effect m_material would then draw the 2x2 grid to the frame buffer in a single pass.

Is this a good approach? I suspect (perhaps incorrectly) that using an image effect for the last step would actually cause an additional scene render that never gets used.

The reason for this is the signature for OnRenderImage()

void OnRenderImage(RenderTexture source, RenderTexture destination)

implies that source is already a valid image when this is called. That image has to come from somewhere, and it seems that it would contain the full-resolution rendered scene already. Since I am already rendering the scene in the previous step, I'd like to avoid this additional render.

Am I interpreting the pipeline correctly? If so, how can I address this?

Thanks!

Edit

Can I disable the main camera, then do everything manually in my component as mentioned above? If the camera is disabled, to what should I attach my component? Perhaps the camera's parent gameObject?

sentences:
Making more complicated systems(entity-component-system model question) I'm using a model where entities are collections of components and components are just data. All the logic goes into systems which operate on components. Making basic systems(for Rendering and handling collision) was easy. But how do I do more compilcated systems? For example, in a CollisionSystem I can check if entity A collides with entity B. I have this code in CollisionSystem for checking if B damages A:

if(collides(a, b)) {
HealthComponent* hc = a->get<HealthComponent();
hc.reduceHealth(b->get<DamageComponent>()->getDamage());

But I feel that this code shouldn't belong to Collision system. Where should code like this be and which additional systems should I create to make this code generic?

sentences:
Adding new components and systems in my ECS requires lots of boilerplate code I'm writing an entity component system for a project I've been working on. It's currently in a working condition, and overall i'm pretty happy with it, but I've noticed that adding new components and systems to it requires quite a lot of boilerplate code.

I've been researching ECS a bit, and I'm not entirely sure if that's normal or not. None of the things I've read mention how much boilerplate is typically necessary to add new components or systems.

Here is how I designed my ECS. The Entity class carries an id and a map of smart pointers to it's components. Entities are defined in YAML, and a factory class parses the YAML and creates all the components an entity needs. Entities are stored in the main engine class.

Systems hold a vector of nodes, each node containing only the components needed by the particular system. Each update, the system loops through the nodes, removing ones with invalid pointers and updating ones with valid pointers.

As of right now, boilerplate for component creation is not too bad. Each new component must also come with a function that returns an instance of itself, and the factory needs to have it's map of function pointers updated to include said function.

Boilerplate for making new systems is worse. The pointers in each node are hard coded. If a node needs to hold a lot of pointers to different components, things get messy quickly. The Node constructor lists every component pointer. The function for registering entities has to check if the entity contains any of the components. The update function has to check to validity of each pointer in the node.

Obviously all of these things need to be done, but making changes to the components a node holds requires updating the system in 4 different places, and creating a new component requires updating things in the factory class.

If lots of boilerplate code is the reality of working with entity component systems, then I'm alright with it because there are a lot of benefits. However, I'm not satisfied with not knowing if there is a better way to handle these things.

sentences:
How to balance audio levels to be loud enough yet safe There are a few sound effects in my game that sound a bit piercing over earbuds but OK when played through the iPhone speaker. Also sound levels seem lower on older hardware. Is there some objective way to be sure my sounds are loud enough yet safe?

Notes: I made my music with GarageBand for iPad. The output was very hot but not clipped. To preview the sounds on my computer I played them in the iPad simulator and matched the volume coming out of my iPhone. To resolve my volume issues, I reduced the high end in Amadeus Pro using the EQ tool. A couple passes for each of the worst sound clips let me reduce the shrillness without muting the volume too badly. Thanks everyone for your help.

sentences:
"Breakout" script fails to trigger win after destroying the last brick The behavior I want is that when all the bricks are destroyed, the last brick's OnCollisionEnter2D handler calls SimulateWin(), triggering the next level.

For some reason SimulateWin() is never called.

using UnityEngine;
using System.Collections;

public class Brick : MonoBehaviour {

    public static int brickCount = 0;
    public int maxHits;
    public int timesHit;
    private LevelManager levelmanager;

    void Start ()
    {
        timesHit = 0;
        levelmanager = GameObject.FindObjectOfType<LevelManager>();
    }

    void OnCollisionEnter2D(Collision2D col)
    {
        timesHit++;
        Debug.Log("Collision happened with " + col.gameObject.name);

        if(timesHit >= maxHits)
            Destroy(gameObject);

        if(GameObject.FindObjectOfType<Brick>() == null)//Not entering this if
            SimulateWin();//this is never called
    }

    void SimulateWin()//This is the function that is supposed to be called when all the bricks are destroyed.
    {
        levelmanager.LoadNextLevel();
    }

}

sentences:
Unity3d: Get a direction vector parallel to plane I need to send a raycast from my camera which is parallel to the plane (Ground) and in the same direction of its forward vector (Represented by the black color vector)

I cant use world space direction because the global forward vector of the camera points at the same direction no matter how much I rotate it (Since its a VR camera)

I tried to use Vector3.ProjectOnPlane, but not sure how it works.

Can someone help me?

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:
OpenGL calculate circle rotation around a given point I'm trying to rotate an object around a certain point. If this point is the center of my world space I use the following algorithm:

glm::vec3 center is the center of the current object. Each frame it will get updated.

glm::mat4 transformationMatrix is the 4x4 matrix I am "uploading" to my shader later on. It will get multiplied by the vertex position.

t_point is the point I'd like to rotate around

t_deflection is the impact for each axis (in order to draw ellipses instead of circles)

t_speed is in my case the current time since the game started (e.g. glfwGetTime())

void rotateByPointY( const glm::vec3& t_point, const glm::vec3& t_deflection, const float& t_speed )
{
    float radius = glm::length( t_point - center );

    glm::vec3 newPosition( glm::sin( t_speed ) * radius * t_deflection.x, center.y, glm::cos( t_speed ) * radius * t_deflection.z );

    translationMatrix = glm::translate( glm::mat4( 1.0f ), newPosition );
    center = newPosition;
}

How can I take into account a point other than the center of my world in the calculation?

EDIT:

So my rotateByPointY calculates the translation around the world center. Therefore I am adding the new center vector to my new position:

translationMatrix = glm::translate( glm::mat4( 1.0f ), newPosition + t_point );
center = newPosition + t_point;

That is working now!

sentences:
Where to hire someone to make a trailer? Developers are found on coding forums, artists are found on art forums, etc... but where to find someone who is good at making trailers? Is there some community of "trailer makers"? Should I look for someone in a game enthusiasts forum? Any hints where to look at?
...let me also mention that we have very low budget, and a volunteer would be even greater.

sentences:
Add Atten property in Unity Shaderlab In Unity Shaderlab shader, Is there any way to apply _Atten value?
Using surface shader, and vertex/fragment shader I can do it easily.
But, I didn't find any reference to do that in Shaderlab syntax.

Shader "Diffuse" {
    Properties {
        _Atten ("Light Attenuation Power", Float) = 1.0 // <= how to apply?
        _Color ("Main Color", Color)            = (1,1,1,1)
        _MainTex ("Base (RGB) Transparency (A)", 2D) = "" {}
    }
    SubShader {
        Pass {
            SetTexture[_MainTex]
            {
                  constantColor [_Color]
                combine texture * constant, texture * constant
            }
        }
    }
}

this makes syntax error.

constantColor [_Atten * _Color]

sentences:
How to render water reflections on multiple heights I'm making a voxel game on OpenGL, and are trying to find a way to render semi-realistic water (At least partially good looking, it doesn't need to be strictly scientific accurate).

All sources written about that topic I find seem to assume that all the water in the scene has the same height, which is not the case on a voxel game, where you can have (And see at the same time) multiple bodies of water, with different height each.

The tricky detail lies in the multi-height part of the problem, which makes really difficult to render the scene in real time using typical water reflection algorithms aimed at single level water surface.

As an example, consider the following image:

The dirt pillar at the left should be reflected on the water at its front, as so should be the mountains near the horizon. The water collindant to the pillar is ~20m higher than the general sea water, so traditional reflection methods (Considering a fixed water level) would simply not work in this case. Considering that a lot of different water levels can be seen in a single scene, performing a traditional water reflection method for each water body height is not an option if we want to achieve a acceptable frame rate execution.

How can I overcome this problem? There is any way to render it in real time?
If it isn't actually possible to do, what approximation should I take to get a good looking result, even if reflections aren't 100% realistic?

sentences:
How do I hide UI canvas in c# Unity3d? I want to display the final results at last in the game when gameobjects finish the winning(finish) line. For that I am using canvas and in that a panel onto which an image is attached.
I have to hide that canvas at start of the game and then show when gameobjects cross the last finish line.
How can I do this..? Please if anyone has an idea about this can help me.
Thanks in advance :)

sentences:
Algorithm for a dense crowd of people who avoid the player? I want to make a game like this. When player moves other humans will move too. And other humans will push people around. Are there any algorithm for this ? How can i solve this very efficient way ?

I dont want to check all objects at scene with loop. And i dont want people overlap.

Video:

https://youtu.be/V5ZMicq05LQ

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:
How would I make a bullet shoot from my player to my mouse. So far I've created an object called obj_mouse. And my plan is whenever the player left clicks, it spawns a bullet from him toward where ever the mouse is pointing. I've got the concept down, but I'm struggling getting it to work.

Extra bits of code I'm messing around with to try and get it to work:

    bullet=instance_create(x,y,obj_bullet)
with (bullet) {
move_towards_point(mouse_x,mouse_y,5)
image_angle=direction
}

point_direction(obj_mouse,obj_mouse,obj_mouse,obj_mouse)
image_angle=direction

(In the above code, I havent attempted to specify to the program that I want the bullet to go in the direction of obj_mouse, or rather, just the mouse. The above code works, and bullets do shoot, however the player must have the mouse on the players sprite for it to work.)

Thank you in advance for any advice given.

sentences:
Best approach for destructible car in Unity I'm developing a simple racing car game.
I'm wondering what is the best approach to manage visually car destruction.
For instance: i think one option (expensive) is to build car 3d model with 'separate' mesh, each for any component (bump, door, glass) and relative cooliders..
Other options ?
Thanks

sentences:
Can I set the unity camera to have the same position in a real world? I have a problem about setting the camera in the unity to have the same extrinsic parameters as my real world camera to the origin. So let's me describe my problem step by step.

I have a camera in a real world and Its extrinsic to an aruco plane was calculated. So I use the Aruco plane(You can think as a plane reference) as an world origin(0, 0, 0).
The in my unity, I want to set my camera to have the same extrinsic as my real world camera. So I take an translation to set the Position in unity transform toolbox. And set the rotation by convert my rotation matrix from extrinsic to the euler's angle and set it to x, y, z rotation.
So I test this by use the unity properties named "camera.cameraToWorldMatrix". You can treat this as an extrinsic of the unity camera transform to the world coordinates(0, 0, 0). So this value should equal to my extrinsic since it's use the same rotation euler's angle. But unfortunately it's not.

So how can i solve this problem or there's a simpler way to set the cameraToWorldMatrix equal to my extrinsic parameters.

For more information : All of my coordinates system is respect to opengl (In Opencv coordinates system are negated in y and z axis from opengl)

1.Here's my extrinsic that i got from the solvePnp() function. This is an extrinsic from camera to my aruco plane. Then I use this [R|T] to get the euler's angle rotation and translation. And in my image also show my euler and translation. So this extinsic is also my expected extrinsic.

I use these euler's angle rotation and translation to set my camera in unity.

Here's my code to map from the camera coordinates to the aruco plane coordinates

def mapBallToArucoPlane(camera_coordinates, rvec, tvec):
  # Mapping ball in left camera_coordiantes to the camera_coordinates(Aruco plane coordiantes)
  # By using the inverse of [rvec|tvec]; Since [rvec|tvec] is the transformation matrix from Aruco->camera, but we need camera->Aruco
  R = cv2.Rodrigues(rvec)[0]
  # print(R.shape, cv2.Rodrigues(rvec))
  T = np.array(tvec)
  # print(R.shape, T.shape, np.hstack((R, T)).shape,
  # np.linalg.pinv(np.hstack((R, T))).shape)
  arucoPlaneToCameraMatrix = np.vstack((np.hstack((R, T)), np.array([0, 0, 0, 1])))
  cameraToArucoPlaneMatrix = np.linalg.inv(np.vstack((np.hstack((R, T)), np.array([0, 0, 0, 1]))))
  plane_coordinates = cameraToArucoPlaneMatrix @ camera_coordinates
  plane_coordinates = plane_coordinates/plane_coordinates[-1]

  return plane_coordinates, arucoPlaneToCameraMatrix

My output extrinsic. (Should be the same as above)

Thank you very much.

sentences:
HTML5 multi-player game data/event validation best practices I'll start by saying that I am fully aware that this question might seem subjective at first, but I'll try and provide a specific test case scenario for it to be a clear question about validating the data received from 2 multiplayer game clients.

Scenario

Imagine we have a multi-player Tower Defense (TD) game. And let's assume that the game is built using HTML5 Canvas, Javascript and a multi-threaded web server, for example, Tornado running in the back-end. And in this scenario both of the players have an option to place a turret anywhere they want.

After a turret is placed, a bunch of enemies are released from both sides and move in a straight line towards the other side.

As soon as an enemy reaches turret range, we can assume that it is destroyed in 1-5 shots. If it takes more than that, the enemy safely passes to the other side.
Now, my problem lies in the fact that usually I would do all the validation server-side, but it becomes increasingly difficult to do, because I would need to simulate every step of the game.

Instead, I would like to depend on the event data (enemy destroyed/enemy gets safe passage) received from both clients.

Question

The main question then is this:

What is the best and hopefully easiest way to implement these sorts of checks and would there be anything prohibiting me from continuing with the development using HTML5, Canvas and Javascript?

sentences:
most efficient Bounding Sphere vs Ray collision algorithms Is there a known 'most efficient' algorithm for Sphere 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 algorithms 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. Although 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?

sentences:
How do I make an object not appear grey regardless of distance? My moon texture is on a plane 500m away and I would like to know if there is a way to keep displaying the texture:

As opposed to it turning grey as pictured here:
regardless of the distance it is from the camera. Any help is greatly appreciated,
Thanks.

sentences:
In Unity, on an Android device, CaptureScreenshot writing to Phone, but persistentdatapath linking to the external card I'm using CaptureScreentshot() to get an image. But when I try to access it on an Android device it's giving me:
Could not find file "/storage/emulated/0/Android/data/appname/screenshot.png"

When I go the external storage, it's not there, but rather on the phone storage. So why is persistentdatapath accessing something different?

My code is the following:
byte[] Bytes_File = System.IO.File.ReadAllBytes(currentScreenshotPathname); with thepathname obtained using:
currentScreenshotPathname = System.IO.Path.Combine(Application.persistentDataPath, currentScreenshotName);

Is there anyway to make the persistenDataPath go to the phone storage rather than emulated to read the file? I've tried changing the WriteAccess perimission to Externalas well as Internal in the player settings, but it's still the same.

Edit: Here's what's happening:
PersistentDataPath is /storage/emulated/0/Android/data/myapp/files/, but the screenshot is being saved to /mnt/sdcard/Android/data/myapp/files, despite the documentation saying that it should save to the PersistentDataPath.

sentences:
Rendering large and high poly meshes Consider an huge terrain that has a lot polygons, to render this terrain I thought of following techniques:

Using height-map instead of raw meshes: Yes, but I want to create a lot of caves and stuff that simply wont work with height-maps.
Using voxels: Yes, but I think that this would be to much since I don't even want to support changing terrain..
Split into multiple chunks and do some sort of LOD with the mesh: Yes, but how would I do that? Tessellation usually creates more detail not less.
Precompute the same mesh in lower poly version (like Mudbox does) and depending on the distance it renders one of these meshes: Graphic memory is limited and uploading only the chunks won't solve that problem since the traffic would be too high.

IMO the last one sounds really good, but imagine the following process:

Upload and render the chunks depending on the current player position. [No problem]
Player will walk straight forward
Now we maybe have to change on of the low poly chunk with the high poly one
So, Remove the low poly chunk and load the high poly chunk [Already to much traffic here, I think]

I am not very experienced in graphic programming and maybe the upper process is totally okay but somehow I think it is too much.

And how about the disk space it would require.. I think 3 kind of levels would be fine but isn't that also too much?

(I am using OpenGL but I don't think that this is important)

sentences:
How can I create a cross-fade between two quads? I have two quads, and I would like to have each one of them on the screen for 5 seconds, then fade to the next one. How could this be done?

My code:

package net.makerimages.Unacrawl.stateSys;

import net.makerimages.Unacrawl.graphics.TextureManager;

import static org.lwjgl.opengl.GL11.*;
/**
 * Created by Makerimages on 12.01.14.
 */
public class LogoState extends GameState
{
@Override
public void render() {
    TextureManager.bigLogo.bind();

    glBegin(GL_QUADS);
    glTexCoord2f(0, 0);
    glVertex2f(0, 0);
    glTexCoord2f(1, 0);
    glVertex2f(0 + TextureManager.bigLogo.getTextureWidth(), 0);
    glTexCoord2f(1, 1);
    glVertex2f(0 + TextureManager.bigLogo.getTextureWidth(), 0 + TextureManager.bigLogo.getTextureHeight());
    glTexCoord2f(0, 1);
    glVertex2f(0, 0 + TextureManager.bigLogo.getTextureHeight());
    glEnd();

    TextureManager.makerLogo.bind();

    glBegin(GL_QUADS);
    glTexCoord2f(0, 0);
    glVertex2f(0, 0);
    glTexCoord2f(1, 0);
    glVertex2f(0 + TextureManager.makerLogo.getTextureWidth(), 0);
    glTexCoord2f(1, 1);
    glVertex2f(0 + TextureManager.makerLogo.getTextureWidth(), 0 + TextureManager.makerLogo.getTextureHeight());
    glTexCoord2f(0, 1);
    glVertex2f(0, 0 + TextureManager.makerLogo.getTextureHeight());
    glEnd();
}
}

sentences:
The normal vector to a plane ax+by+cz+d=0? I am calculating the normal vector to a plane ax+by+cz+d=0

According to the book:

The normal vector N is often normalized to unit length because in that case
the equation

d = N ⋅Q + D

gives the signed distance from the plane to an arbitrary point Q. If d = 0, then the
point Q lies in the plane. If d > 0, we say that the point Q lies on the positive side
of the plane since Q would be on the side in which the normal vector points.

How to get the N (Normal vector)? Thank you

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: Determining a point that reached another point I have two points, one is moving and one is stationary. I would like to know if the moving point has reached that point or not. I tried to calculate the distance between two vectors and the distance never reaches 0.

sentences:
What is wrong with this character slope math? I'm making a sidescrolling platformer and have implemented some code that should convert the characters speed to an X speed and Y speed based on the angle of the surface they are on. This actual math for this was taken from a web page and I don't know if it's right or not.

// xSpeed and ySpeed are derived from speed, based on the angle
    xSpeed = speed * Mathf.Cos(angle);
    ySpeed = (speed * -Mathf.Sin (angle)) - gravity;

The angle is found with this code:

RaycastHit ground;
    Physics.Raycast (transform.position, Vector3.down, out ground, 1.5f);
    Debug.DrawRay (transform.position, Vector3.down.normalized, Color.green, 2, false);
    if (ground.collider != null)
    {
        angle = Vector3.Angle (ground.normal, Vector3.up);
    }
    else
    {
        angle = 0;
    }

This works fine when walking on a flat surface, but freaks out when walking on a slope. I believe the problem lies with the angle itself.

sentences:
LibGDX GestureDetector touchUp I am using to GestureDetector to detect drag gesture and determine vector based on position my finger first touched the screen and position when my finger left the screen. I already know that I can get coordinates where my finger touched the screen using touchDown(), but as far as I know there is no touchUp() in GestureDetector.

I tried to acieve this using fling(), but the problem with fling is that it has to be quick, otherwise it is not counted as fling.

pan() would be good, but it doesn't tell you if your finger left the screen.

So is there a way to detect touchUp? Or is there maybe another/better way to achieve what I want?

sentences:
LibGDX RPG walking animation I've been trying to nail down a walking animation with libGDX.  I'm making an RPG with the character that can move up, down, left, and right.  I have this movement in a spritesheet.  I've been following a youtube tutorial called Java Tiled Map Game which can be found here: http://www.youtube.com/watch?v=qik60F5I6J4

He does a better job then some of explaining what the code does but he glosses over the part where he gets his character to do a walking animation (by which I mean he doesn't show it at all).

I then moved to the tutorial found here: http://obviam.net/index.php/getting-started-in-android-game-development-with-libgdx-tutorial-part-2-animation/

But this tutorial tells exactly what needs to be done in regular words and then just gives a block of code.  I already know what I need to do in regular words but I'm not trying to learn english but programming which is a completely different language.  I'm sure I could copy and paste that code and edit it to do what I need but I wouldn't understand HOW it works only THAT it works.  I want to know the how of it all.  I'm new to libGDX and this is my first RPG game.  I really want learn how to do it myself instead of relying on others.

My question is simply this:  Do you know of a tutorial which shows and (more importantly) explains how to do a simple walking animation?  I'm hoping you can supply one for me.

sentences:
SpriteSheets with XML and without XML I'm very new to game development, and I'm working with Godot engine.
I'm making a platform game and I downloaded a package from the web with assets, it contained some sheets.
I have used a 2D atlas importer in Godot before bt it requires a .json file which contains the coordinates.
The sprite sheet i downloaded does not have a xml or json.
How can i get sperate images from that sheet? Or any work around to make a tiled map in Godot?

sentences:
How to rotate an object so it stands correctly (back always facing the camera) I have the following scene:

And I have two 3D vectors, the camera position, and the focus position. The focus vector is always behind the monster. I know how to rotate the camera around the focus with the help of my mouse, but the monster is always facing the same direction, and I'd like to change that!

I'd like it to work almost as in World of Warcraft; while I'm standing still I can move the camera around freely, but as soon as I move, the monster should change the direction according to the camera.position >>> focus vector. Also, I need to make it move in that direction, I guess I could have a 2D vector called speed, which I should change accordingly (it would look like a rotating radius of a circle I guess).

How do I do this?

For reference, I'm working in Three.js, and this is the code with which I rotate the camera:

onDocumentMouseDown = function(event)
{
    event.preventDefault();

    game.isMouseDown = true;

    game.onMouseDownTheta = game.theta;
    game.onMouseDownPhi = game.phi;
    game.onMouseDownPosition.x = event.clientX;
    game.onMouseDownPosition.y = event.clientY;
}

onDocumentMouseMove = function(event)
{
    event.preventDefault();

    if (game.isMouseDown)
    {
        game.theta = -((event.clientX - game.onMouseDownPosition.x) * 0.5) + game.onMouseDownTheta;
        game.phi = ((event.clientY - game.onMouseDownPosition.y) * 0.5) + game.onMouseDownPhi;
        game.phi = Math.min(160, Math.max(20, game.phi));

        game.cameraBuff.x = game.radious * Math.sin(game.theta * Math.PI / 360 ) * Math.cos( game.phi * Math.PI / 360 );
        game.cameraBuff.y = game.radious * Math.sin(game.phi * Math.PI / 360 );
        game.cameraBuff.z = game.radious * Math.cos(game.theta * Math.PI / 360 ) * Math.cos( game.phi * Math.PI / 360 );
    }
}

And at render time I do this:

self.camera.position.x += self.cameraBuff.x;
self.camera.position.y += self.cameraBuff.y;
self.camera.position.z += self.cameraBuff.z;

self.camera.lookAt(self.focus);
self.renderer.render(self.scene, self.camera);

self.camera.position.x -= self.cameraBuff.x;
self.camera.position.y -= self.cameraBuff.y;
self.camera.position.z -= self.cameraBuff.z;

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:
Transform luminosity (Watt) to be usable in shader I'm studying the color and the Luminosity of Stars.
I'm trying to figure how to transform information of Luminosity i perceive at a given distance to something usable into a shader.
For instance , Given the Radius and temperature of a star, with inversed square law on Distance(meters) i obtain the perceived luminosity of a star in Watt (brut force, without any scattering).
For sample, the luminosity I obtain for the Sun ON Earth is about 1361W and a RGB color about

w=1361
r=255 g=245 b=242

Astronomical and physics are quite OK, but how to transform this values into usable shader formulas or values? best practices ? samples ?

I guess i will simply take the aboves value as Light reference an normalize the intensity(1361) to be 1 on each rgb componemt value. I' ll keep you posted.

sentences:
How to implement a Behavior Tree (preferably in Unity 3D) I have a state machine I want to implement as a behavior tree. I now have an understanding of how they work but I can't seem to find a full implementation of one. I have implemented a simple one using a plug-in called Behavior Machine but the problem I have with it is I feel like it limits me just as it did when I used it for making my FSM until I implemented my own FSM that is when I had the privilege of using my own functions to trigger my own state transitions and optimize it so that it doesn't use a lot of resources.

The other problem I have is it is difficult to implement my own nodes and control which part executes (optimization). Any idea where I can find a good tutorial on how I can do this, preferably with Unity and in C# or Java. Or where I can find a good library with proper documentation because the one I found on Git-hub or other sites are buggy or just some classes with no documentation. Your help will be greatly appreciated.

So basically, what I want to do is implement my own Behavior Tree. This way I think I can have better control on how it executes so that it can run on mobile devices smoothly.

sentences:
Pitch camera around model Currently, my camera rotates with my model's Y-Axis (yaw) perfectly. What I'm having trouble with is rotating the X-Axis (pitch) along with it. I've tried the same method for cameraYaw() in the form of cameraPitch(), while adjusting the axis to Vector.Right, but the camera wouldn't pitch at all in accordance to the Y-Axes of the controller.

Is there a way similar to this to get the same effect for pitching the camera around the model?

// Rotates model on its own Y-axis
    public void modelRotMovement(GamePadState pController)
    {
        Yaw = pController.ThumbSticks.Right.X * MathHelper.ToRadians(speedAngleMAX);

        AddRotation = Quaternion.CreateFromYawPitchRoll(Yaw, 0, 0);
        ModelLoad.MRotation *= AddRotation;
        MOrientation = Matrix.CreateFromQuaternion(ModelLoad.MRotation);
    }

    // Orbit (yaw) Camera around model (camTarget is the model's position)
    public void cameraYaw(Vector3 axis, float yaw)
    {

        ModelLoad.CameraPos = Vector3.Transform(ModelLoad.CameraPos - ModelLoad.camTarget,
            Matrix.CreateFromAxisAngle(axis, yaw)) + ModelLoad.camTarget;
    }

    public void updateCamera()
    {
        cameraYaw(Vector3.Up, Yaw);
    }

sentences:
Servers do not remove spawned prefab after disconnection I built a multiplayer game with the Unity UNET. For doing this I bought a VPS server. Everything works fine.
But sometimes when players want to quit the game, the servers do not destroy him from the scene!!!
& the other players still can see him in the scene till the servers being restarted and ran again!!
For quitting the game I wrote this code :
NetworkManagers.singleton.client.Disconnect();
Destroy(NetworkManagers.singleton.gameObject);

For more explanation, this is my ConnectionConfig for server & client:
MinUpdateTimeout:15
ConnectTimeout:1200
DisconnectTimeout:2000
PingTimeout:500
NetworkDropThreshold:50
OverflowDropThreshold:50
AckDelay:32
AcksType:1
MaxSentMessageQueueSize:150

Why this happening?! Did I miss something?! & how can I avoid that?!

sentences:
Math behind drawing one game object relative to another? Let's say I have a square (a) and I want to draw another square (b) that stays on one corner of the square (a).

Square (a) can rotate and move around the game world, what math would be used to keep square (b) on the same relative point on square (a) ?

My current thought process would be:

You give Square b an offset from square a, which would be a distance and an angle.

Then using trigonometry you could update the location of square b to stay in the correct location.

sentences:
C++ Help with Separating Axis Theorem I am trying to detect collision between two triangles using Separating Axis Theorem however I am unaware what is wrong with my code. The CollisionHelper::isTriangleIntersectingTriangle is called every frame and passes in the vertices of both triangles. It never returns true, however. I've been stuck on this for days now. Any help is appreciated.
glm::vec3 CalcSurfaceNormal(glm::vec3 tri1, glm::vec3 tri2, glm::vec3 tri3)
{
    //Subtracts each coordinate respectively
    glm::vec3 u = tri2 - tri1;
    glm::vec3 v = tri3 - tri1;

    glm::vec3 nrmcross = glm::cross(u, v);
    nrmcross = glm::normalize(nrmcross);
    return nrmcross;
}

bool SATTriangleCheck(glm::vec3 axis, glm::vec3 tri1vert1, glm::vec3 tri1vert2, glm::vec3 tri1vert3, glm::vec3 tri2vert1, glm::vec3 tri2vert2, glm::vec3 tri2vert3)
{
    int t1v1 = glm::dot(axis, tri1vert1);
    int t1v2 = glm::dot(axis, tri1vert2);
    int t1v3 = glm::dot(axis, tri1vert3);
    int t2v1 = glm::dot(axis, tri2vert1);
    int t2v2 = glm::dot(axis, tri2vert2);
    int t2v3 = glm::dot(axis, tri2vert3);

    int t1min = glm::min(t1v1, glm::min(t1v2, t1v3));
    int t1max = glm::max(t1v1, glm::max(t1v2, t1v3));
    int t2min = glm::min(t2v1, glm::min(t2v2, t2v3));
    int t2max = glm::max(t2v1, glm::max(t2v2, t2v3));

    if ((t1min < t2max && t1min > t2min) || (t1max < t2max && t1max > t2min))
            return true;
    if ((t2min < t1max && t2min > t1min) || (t2max < t1max && t2max > t1min))
            return true;

    return false;
}

bool CollisionHelper::isTriangleIntersectingTriangle(glm::vec3 tri1, glm::vec3 tri2, glm::vec3 tri3, glm::vec3 otherTri1, glm::vec3 otherTri2, glm::vec3 otherTri3)
{
    //Triangle surface normals, 2 axes to test
    glm::vec3 tri1FaceNrml = CalcSurfaceNormal(tri1, tri2, tri3);
    glm::vec3 tri2FaceNrml = CalcSurfaceNormal(otherTri1, otherTri2, otherTri3);

    glm::vec3 tri1Edge1 = tri2 - tri1;
    glm::vec3 tri1Edge2 = tri3 - tri1;
    glm::vec3 tri1Edge3 = tri3 - tri2;
    glm::vec3 tri2Edge1 = otherTri2 - otherTri1;
    glm::vec3 tri2Edge2 = otherTri3 - otherTri1;
    glm::vec3 tri2Edge3 = otherTri3 - otherTri2;

    //axes
    //TODO: may need to (un)normalize the cross products
    glm::vec3 axis1 = tri1FaceNrml;
    glm::vec3 axis2 = tri2FaceNrml;
    glm::vec3 axis3 = glm::normalize(glm::cross(tri1Edge1, tri2Edge1));
    glm::vec3 axis4 = glm::normalize(glm::cross(tri1Edge1, tri2Edge2));
    glm::vec3 axis5 = glm::normalize(glm::cross(tri1Edge1, tri2Edge3));
    glm::vec3 axis6 = glm::normalize(glm::cross(tri1Edge2, tri2Edge1));
    glm::vec3 axis7 = glm::normalize(glm::cross(tri1Edge2, tri2Edge2));
    glm::vec3 axis8 = glm::normalize(glm::cross(tri1Edge2, tri2Edge3));
    glm::vec3 axis9 = glm::normalize(glm::cross(tri1Edge3, tri2Edge1));
    glm::vec3 axis10 = glm::normalize(glm::cross(tri1Edge3, tri2Edge2));
    glm::vec3 axis11 = glm::normalize(glm::cross(tri1Edge3, tri2Edge3));

    //Perform SAT
    if (SATTriangleCheck(axis1, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis2, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis3, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis4, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis5, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis6, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis7, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis8, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis9, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis10, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis11, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;

    return false;
}

sentences:
Console spam when opening editor: Assertion failed on expression: 'txn.Exists(guid)' I have just opened up a new project in Unity 2019.3.04b - and in the console I got an error message repeating a lot of times:

In addition, when unfocus and focus Unity, it spits out one more pair of errors (the same errors like in this image).
Anyone knows what it is and how to fix it?

sentences:
Scrolling backgrounds without tiles I'm writing a paper on game backgrounds and need to look at how they are implemented in different games, but I'm a bit stuck on scrolling backgrounds.

While it's easy to recognize a scrolling background, everywhere I look I also see tiles.

Are there any popular published games that use scrolling backgrounds, but that don't use tiles?

All of the classics, like Commander Keen, Mario, etc. use both scrolling and tiles.

Any suggestions? Google is not helping me on this one.

sentences:
Efficient Dynamic Memory Management My world is procedurally generated. As the player moves, chunks behind them are unloaded and chunks in front of them are loaded. Each chunk has a mesh of triangles.

At the moment, I create two VBOs for each chunk (vertices and colours), when the chunk is loaded. Once a mesh is created, it is only edited every few seconds. These buffers are deleted when the chunk is no longer visible.

Am I leaking memory here by constantly creating and destroying buffers?

I've heard somewhere that OpenGL (or WebGL in this case) doesn't do garbage collection until the program quits, due to it being slow. Is this right?

Could I improve this system somehow?

sentences:
Change item rotation axis in inventory item visualization I'm learning unity and i'm trying now make an inventory, i made a simple interface, and now i'm trying to make a item visualization. I look for some codes from web and i found this one:

using UnityEngine;

public class TurnObject : MonoBehaviour
{
    protected Vector3 posLastFame;
    public Camera UICam;

    // Update is called once per frame
    void Update()
    {
        if(Input.GetMouseButtonDown(0)) {
            posLastFame = Input.mousePosition;
        }

        if (Input.GetMouseButton(0)) {
            var delta = Input.mousePosition - posLastFame;
            posLastFame = Input.mousePosition;

            var axis = Quaternion.AngleAxis(-90f, Vector3.forward) * delta;
            transform.rotation = Quaternion.AngleAxis(delta.magnitude * 0.1f, axis) * transform.rotation;
        }
    }
}

I know some code, but I'm not good with geometrics. In this code when I move my mouse horizontal way, my object turn in the Y axis. And that's good. But when I move my mouse vertical the object move in the X axis instead of Z axis.

Is there a way in this code for change this? I really have difficulty to understanding geometrics in Unity.

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: AABB of a sphere's screen space projection What is a nice, neat way to get the AABB of a sphere's projection onto the screen? This is to determine simplified geometry for lights in deferred shading.

sentences:
What are the advantages of a sprite sheet over an image sequence/flash timeline? I've noticed sprite sheets are used more and more in Flash games and I don't fully understand what are the advantages over an image sequence/flash timeline - MovieClip.

I've read this related question:
2D graphics - why use spritesheets?
and that makes sense for hardware accelerated games, but that's not the case for
flash yet.

Any Flash Player specific insights ?

sentences:
Unity Grid Shader line Color First of all I'm sorry if my question is a odd thing to ask, but i'm new to Shader things and don't know how to handle this stuffs.
I have a shader that draws grid on a ground plane and it works just fine.
But i wanna do one thing more.
Currently the color of the grid lines are all in same color. I want to set the main grid line's color differently.
for example, like this one :

and this is what i have now :

for example, every 4x4 or 2x2 the line color should be something like red / blue etc.
I'm adding my shader's code below. plz somebody help me figure this out.
Shader "Unlit/Grid"
{
    Properties
    {
         _GridColour("Grid Colour", color) = (1, 1, 1, 1)
        _BaseColour("Base Colour", color) = (1, 1, 1, 0)
        _GridSpacing("Grid Spacing", float) = 0.1
        _LineThickness("Line Thickness", float) = 1
    }
    SubShader
    {
       Tags { "RenderType" = "Transparent" "Queue" = "Transparent"}
        LOD 100

        Blend SrcAlpha OneMinusSrcAlpha
        ZWrite Off

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            fixed4 _GridColour;
            fixed4 _BaseColour;
            float _GridSpacing;
            float _LineThickness;

            v2f vert(appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = mul(unity_ObjectToWorld, v.vertex).xz / _GridSpacing;

                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                float2 wrapped = frac(i.uv) - 0.5f;
                float2 range = abs(wrapped);

                float2 speeds;
                /* // Euclidean norm gives slightly more even thickness on diagonals
                float4 deltas = float4(ddx(i.uv), ddy(i.uv));
                speeds = sqrt(float2(
                            dot(deltas.xz, deltas.xz),
                            dot(deltas.yw, deltas.yw)
                         ));
                */  // Cheaper Manhattan norm in fwidth slightly exaggerates thickness of diagonals
                speeds = fwidth(i.uv);

                float2 pixelRange = range / speeds;
                float lineWeight = saturate(min(pixelRange.x, pixelRange.y) - _LineThickness);

                return lerp(_GridColour, _BaseColour, lineWeight);
            }
            ENDCG
        }
    }
}

sentences:
How can I locate empty space next to polygon regions? Let's say I have the following area in a top-down map:

The circle is the player, the black square is an obstacle, and the grey polygons with red borders are walk-able areas that will be used as a navigation mesh for enemies.  Obstacles and grey polygons are always convex.

The grey regions were defined using an algorithm when the world was generated at runtime.

Notice the little white column.  I need to figure out where any empty space like this is, if at all, after the algorithm builds the grey regions, so that I can fill the space with another region.

Basically what I'm hoping for is an algorithm that can detect empty space next to a polygon.

sentences:
Touch input not working well for mobile game made with Unity 2D I made a simple game in unity where the user taps their phone screen and the player jumps up. When I test it on my phone (not sure if this matters but it's a Samsung s9+), I tap the screen and usually the tap causes the player to jump up and fall back to the platform properly, but sometimes when I tap the screen nothing happens at all it just stays in place. The game on my phones is also very slightly laggy (although, on my computer it runs smoothly) and I'm not sure how to fix that either or if they're related.

This is the code attached to the player:

 void FixedUpdate()
 {
     Jump();
     Dead();
 }

 void Jump()
 {
     if (Input.touchCount > 0 && isGrounded)
     {
         gameObject.GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, jumpForce * Time.fixedDeltaTime), ForceMode2D.Impulse);
     }
 }

Also, I know that it's the touch input that's the problem, because when I make it so that pressing the up arrow key on the keyboard makes the player jump, it works perfectly fine. If there's some other information about the game you'd need to know to answer my question, let me know. Thanks for your help.

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 correctly solve a procedurally generated puzzle? I'm creating a puzzle game where the player must remove all colored blocks from a grid. When the player selects a block, all adjacent blocks of the same color are removed. Any blocks that have empty cells below them will then fall into those cells. Here's a simple illustration of the mechanic:
https://imgur.com/TBNrAUW
The game will procedurally generate puzzles with varying degrees of difficulty. When the player completes a puzzle the game will then score the player based on how quickly and, more importantly, how efficiently they solved the puzzle.
The problem I am having is implementing a method of determining the most efficient way of solving a puzzle (i.e. identifying the fewest number of moves possible). Here's an example of a puzzle that was generated:
https://imgur.com/RQcAgkH
As a human, I could identify that the fewest number of moves that could be made to solve this puzzle was 11. Here is a gif of the solve:
https://imgflip.com/gif/463qck
However, when I whipped up an application that just clicked blocks at random in order to solve this puzzle, the lowest number of moves that it was able to solve this in was 14. And this was over billions of iterations which took many minutes. Obviously that is not acceptable. I need to find the correct solution and it should be done within seconds.
I also tried to reverse-engineer the generation process but that doesn't work. For example, it could place a blue block in column 1, a bunch of other blocks, a red block in column 1, a bunch of other blocks, then another blue block in column 1. Column 1 could be resolved in 2 moves (by clicking the red block and then one of the blue blocks), which reverse-engineering the generation would not detect.
So, my question:
What kind of techniques or tricks can I implement that will allow the application to resolve this type of generated puzzle quickly and correctly? I'm sadly out of ideas.

sentences:
Set Non-Looping Animation Time to Seconds I have an animation that does not loop.  It plays for the default duration (n seconds), then stops on the last frame.  This is exactly what I want to have happen, but I want it to play for m seconds, not n seconds.  I do not know how long n seconds is.

I have to get it exactly to m seconds, because it is a changing variable.  So estimating will not work.  I need it to match up exactly with another animation.  How can I stretch an animation to last an exact number of seconds?

sentences:
Javascript and PHP for real-time multiplayer? I'm wondering if combining Javascript clientside with PHP/mysql serverside is a good idea for HTML5 real-time multiplayer (small scale) browser games?

My technical knowledge is very limited, and even though I plan on learn node.js in the future, the learning curve is rather huge right now.

Since I'm already familiar with PHP I feel I would get it functioning much faster.

The scale I'm thinking is 2-8 players at the time. And trying to keep the client to server message count as low as possible.

The values I intend to store/handle are:

Player name and ID.
X and Y position.
Health.
Equipped items (maximum 8 slots, probably less).
Actions (walk, attack, use etc but only 1 action/player at a time).
Bullet X,Y coordinates and trajectory.
Guild/Clan name.
And some basic chat/mailing function.

My guess is even though it's not the best solution, but aslong as I keep the logic small, that this is completely doable.
Am I right?

sentences:
Constructing a game stock market Short Question: How do I calculate market values for different resources in the game?

Long Question:

I am building a game around the concept of resource gathering and manufacturing to gain different resources. Those resources can be traded with other players or with a "game market", meaning auto generated trades that get created on a certain time interval (undecided on the interval yet). Because it would be too complex to create different exchange rates for each pair of resources (there are currently just under 100 types of resources and plans for a few hundred in total), I have come to the conclusion that there needs to be a "game currency" (lets just call it GC for now). Each resource would have its exchange rate to GC and this exchange rate would, on a certain interval, be impacted based on what is going on in the game. How would I calculate this exchange rate or market value of a certain resource every interval? I assume different things would effect it like popularity of trading within previous interval, previous exchange rate, abundance of resource currently, etc etc. But I am not sure how to apply this methodically.

Update: Some of my concerns are around the value of a resource:

Some resources can be mined directly from the environment. Other can only be obtained from manufacturing the mined resources. Other resources may be manufactured for other manufactured resources. How do I create a stable starting point to account for these factors? Obviously manufactured resources would be worth more because they are more time consuming to create.
Should players be forced to observe the market value or place their trade requests at what ever value they desire? If the value is forced, what happens to trades after a market value changes? If the is opened ended, what stops players from gaming the market to boost or fall prices? Should I only calculate the value based on successful trades and consider that open request haven't been filled for a reason?
How do I calculate what will happen in a large multiplayer situation when the game is only in development and I only have myself and a few AI players trading? The market values could be effected differently in different situations and I don't want to be caught in a situation where I have to change game mechanics after a game in live which could potentially upset players who have figured out the predictability of the market and over night, the rules change.

sentences:
XNA 2D: How to load/unload specific content by level I'm writing a 2D room-based* platformer using XNA, and I'm trying to figure out the best way to load resources based on what the current map requires. Basically, I need to (want to) dispose of the loaded tileset/textures and load just the ones the next map requests at every transition (ideally, I'll check if they're actually different first), without killing off the more universal textures (player sprites, etc.).

I've seen a few forum posts saying the best way to do this is to create a second instance of ContentManager, but they never go into detail on how to do this correctly.

Currently, my XML map files each contain strings with the filenames of all necessary assets. I was planning on having my XmlReader method load the textures as their names were read, but then I realized I knew neither how to instantiate the second ContentManager, nor where to instantiate it--i.e., should it be in the MapFactory class that's loading the map, or in the static LevelManager that's calling the MapFactory (passing the new ContentManager as a parameter to the MapFactory, along with the name of the desired map)?

Alternatively, is there a simpler/cleaner way to do this? I'm more concerned with the code being easily comprehensible than efficient right now, as this is my first attempt at this kind of game.

*Ex. Castlevania, Metroid, but simpler (for now). I'd like to implement constant streaming eventually (chunks loaded as they are approached), but I want to get this part down first.

UPDATE: Instantiated the second ContentManager using this.Services inside the Game class (it was the only way I could find to get access to Game.Services, which is what everywhere online says to use in the ContentManager constructor). Should have thought of that sooner. For anyone confused by this in the future, the full line of code is:

ContentManager myContent = new ContentManager(this.Services, "myContent")

sentences: differences between opengl 3 and opengl 4 I'm just getting started with game programming and I want to start learning opengl. I found a very great tutorial from scratch to get started with opengl 3 and I'm wondering if there is a big difference between openGL 3 and openGl 4. Or I should ask, does openGL 4 make openGL 3 obsolete, or I can start with openGL 3 and then I can move to openGL 4?

sentences:
How do I detect and remove completed rows of blocks in Tetris? I am making Tetris for a learning experience in XNA, and I'm having trouble deleted completed rows.

I am having an issue with deleting rows, for some reason when I go to delete a row, I end up creating more blocks or not deleting all of the blocks in the row. The method I am using to detect and remove blocks is as follows:

    // 'rowCount' is an int[20] holding the number of blocks in each row
    // (my playing field is 20 rows tall and 10 blocks wide).
    for (int i = 0; i < rowCount.Length; i++)
    {
        if (rowCount[i] >= 10)
        {
            // The row is full, remove the blocks.
            // 'blocks' is a list of all blocks that have settled.
            for (int j = 0; j < blocks.Count; j++)
            {
                if (blocks[j].Row == i)
                {
                    // If the settled block is in this row, remove it.
                    blocks.RemoveAt(j);
                    rowCount[i]--;
                }
            }

            // Move any blocks above the now-empty row down one row.
            foreach (Block b in blocks)
            {
                if (b.Row < i)
                {
                    b.Row++;
                    rowCount[b.Row]++;
                }
            }
        }
    }

This is done in my main Update method after I've determined if the current block has settled or not.

As implemented, this algorithm will usually end up recording more than ten blocks in some rows and will not correctly clear completed rows and move the rows above down one unit. Why is this, and what can I do to fix the algorithm?

sentences:
How to handle two players playing on one keyboard with Box2D (LibGDX)? I'm making a racing game with LibGDX and Box2D. I've been using this tutorial to implement the basic physics, and it works properly.

My main problem is to implement two different sets of keys (UP-DOWN-LEFT-RIGHT and ASDW) to control two different instances of a Car class on a same screen.

The code I have yet for handling one set of input (for KeyDown):

@Override
public boolean keyDown(int keycode) {
    if (keycode == Input.Keys.UP) {
        if (!pressedKeys.contains(Key.Up)) {
            pressedKeys.add(Key.Up);
        }
    } else if (keycode == Input.Keys.DOWN) {
        if (!pressedKeys.contains(Key.Down)) {
            pressedKeys.add(Key.Down);
        }
    } else if (keycode == Input.Keys.LEFT) {
        if (!pressedKeys.contains(Key.Left)) {
            pressedKeys.add(Key.Left);
        }
    } else if (keycode == Input.Keys.RIGHT) {
        if (!pressedKeys.contains(Key.Right)) {
            pressedKeys.add(Key.Right);
        }
    }
    return false;
}

(KeyUp):

    @Override
public boolean keyUp(int keycode) {
    if (keycode == Input.Keys.UP) {
        if (pressedKeys.contains(Key.Up)) {
            pressedKeys.remove(Key.Up);
        }
    } else if (keycode == Input.Keys.DOWN) {
        if (pressedKeys.contains(Key.Down)) {
            pressedKeys.remove(Key.Down);
        }
    } else if (keycode == Input.Keys.LEFT) {
        if (pressedKeys.contains(Key.Left)) {
            pressedKeys.remove(Key.Left);
        }
    } else if (keycode == Input.Keys.RIGHT) {
        if (pressedKeys.contains(Key.Right)) {
            pressedKeys.remove(Key.Right);
        }
    }

    return false;
}

How should I do to be able to handle UP-DOWN-LEFT-RIGHT and ASDW keys simultaneously?

Note: A Car is instantiated in the main class.

I can always add more code if needed.

sentences:
Touch to continue (coroutine) in unity When the object gets destroyed in my game, I want a touch to continue function after a delay. This is what I tried.

this is the SceneManager class which is attached to the Main Camera

 public bool ttc;
 public void NextLevel()
{
    StartCoroutine(Delay());
}
IEnumerator Delay()
{

    yield return new WaitForSeconds(2);
    print("touch to continue");
    ttc = true;}

My Object class:

   void OnDestroy()
  {
   Camera.main.GetComponent<SceneManager>().NextLevel();
    if (Camera.main.GetComponent<SceneManager>().ttc == true)
    {
        if (Input.GetKeyDown(KeyCode.V))
        {
            Application.LoadLevel("TheGame2");
        }
    }
}

I also tried this:

IEnumerator Delay()
{
    yield return new WaitForSeconds(2);
    print("touch to continue");
    if (Input.GetKeyDown(KeyCode.V))
        {
            Application.LoadLevel("TheGame2");
        }
    }

side note: I will change the 'KeyCode.V' to a mouse button later

sentences:
GLSL Multiple Uniform Structs I'm developing a lighting system for my voxel game, and I have to send multiple (alot, say up to 200) lights to my shader program. Those lights contain the following data:

Position (vec3)
Color (vec3)
Radius (float)
Strength (float)

What is the most efficient way to send alof of those light structs to my shaders? I would like it to work with lower versions of OpenGL, like 2.1.

sentences:
How do I draw a line from a set of points in unity to use as terrain in a 2D game? I'm trying to make a 2D game in unity. My terrain is randomly generated and what I'm trying to do is make a bunch of points with different x coordinates and then draw a line through them to use as my ground/terrain.

Originally I wanted to make a polygon out of the points by specifying two additional vertices which would basically be the camera bounds and fill the whole thing in, but I'm not sure that's feasible, so I'll settle for just having a line as a platform.

How would I go about doing this?

sentences:
Is semantic games a good idea? I wish to address the low re-usability of game technology (at least provide a theoretical solution).

I'm considering an approach using a semantic game format, effectively decoupling the story and logic of games from its presentation and art. I can see a few immediate advantages:

Completely platform independent games (think SCUMM games)
Optionally: presentation independent games (cheaper and more flexible)
Game editors can provide different specialized game construction UI's, but producing the same game format. (think bytecode)
Game engine technology (voice synthesis, facial synthesis, skeleton animation etc. etc.) can be reused across games as a part of (or extensions to) the semantic game format/language.
Game art and game technology can be licensed extensions, paid by game distributors, independent of client platforms.

Apart from the huge resources needed to establish such a game format/language, are there any theoretical limitations that should stop this concept?

sentences:
Why does the player grab the object outside the trigger zone? I want the player to be able to grab an object (in this case the knife) when he is in the object's trigger zone. He can get the knife but there is a problem: if I press grab button outside of the trigger zone, then he can get the knife immediately after entering the zone. I want Unity to get the input only when the player is in the trigger, otherwise it should not be working.
Here's the grab script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Grab : MonoBehaviour
{
    public GameObject player;
    private bool grabbed;
    public GameObject knifePosition;
    private bool isInTrigger;

    void Update()
    {
        if (Input.GetButtonDown("Grab"))
        {
            grabbed = true;

        } else
        {
            grabbed = false;
        }

       if (grabbed && isInTrigger)
        {
            gameObject.transform.position = knifePosition.transform.position;
       }
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject == player && grabbed)
        {
            gameObject.transform.SetParent(player.transform);
            isInTrigger = true;
            Debug.Log("Picked up");
        }
    }
}

sentences:
How do I enable higher FPS in XNA 4.0? I created a FpsCounter DrawableGameComponent (linked to code, it's longish). It works great: It displays 60.0 fps normally. If I artificially slow down the game loop, it drops.

My 'game' at the moment is a single keyboard-controlled sprite, so it should be possible to render more frequently than 60 frames a second.

I figured turning off vertical synchronization would increase the FPS cap:

public Game1()
{
    _graphics = new GraphicsDeviceManager(this)
                    {
                        PreferredBackBufferWidth = WindowWidth,
                        PreferredBackBufferHeight = WindowHeight,
                        SynchronizeWithVerticalRetrace = false,
                    };
    _graphics.ApplyChanges();
    Content.RootDirectory = "Content";
}

However, even though the above code seems like it should turn off vsync, it doesn't seem to be. Is there something wrong with my constructor, or perhaps my FPS calculations? Or is there something else that may be limiting the frame count?

sentences:
Find x and y position with angles in 3D world I'm actually creating a Tracking Camera (or 3rd person camera), and to do so, I used two angles (X and Y) for the rotation of the camera and an other floating value for the distance between the target and the camera.

The camera system works fine, but I am searching a way to calculate the position of the correct position of the camera (for debug purpose only)

Do you have an idea of how I can do to figure it out?

This is the camera update function:

public void Update(GameTime gameTime)
{
  this.View =
    Matrix.CreateTranslation( 0, 0, 0 ) *
    Matrix.CreateRotationY( MathHelper.ToRadians( this.RotationAngle ) ) *
    Matrix.CreateRotationX( MathHelper.ToRadians( this.ArcAngle ) ) *
    Matrix.CreateLookAt(
      new Vector3( 0, 0, -this.Distance ),
      this.TrackingPosition,
      Vector3.Up );

  Viewport _viewport = this.graphicsDevice.Viewport;
  Single _aspectRatio = (Single)_viewport.Width / (Single)_viewport.Height;

  this.Projection = Matrix.CreatePerspectiveFieldOfView(
    MathHelper.PiOver4,
    _aspectRatio,
    NEAR_PLAN, FAR_PLAN );

  // Find x and y
  this.Position = new Vector3( 0, 0, -this.Distance );
}

sentences:
How do I use a script located not in the Assets folder? I'm developing several games at once, and they all use the same helper C# class which I have named "Helpers.cs".

This script contains common helper functions.

I'm still making changes to this Helper.cs files quite often, and I have to take care to update this file for all of my projects: If I work at 3 projects as once, I have to make sure I didn't forget to update

Project 1\Assets\Scripts\Helpers.cs
Project 2\Assets\Scripts\Helpers.cs
Project 3\Assets\Scripts\Helpers.cs

This is error prone.

I would like to know if there is a way to have only 1 "Helper.cs", for example in

d:\dev\games\common\Helpers.cs

... and all projects would use this. Then I would only have to update the file once if edit it.

I'm using Windows.

Is this possible?

sentences:
Problem with action mapping Summarizing my problem well, I need a single button (right mouse button) to do two things.

In my project (TopDown) I defined that instead of the left mouse button, the character moves with the right mouse button.

I happen to like that when I click the right mouse button on a particular actor, a simple event is called (print hello).

I tried doing this with the Event On Clicked, but it only works with the left mouse button:

With the help of these links:

https://www.unrealengine.com/en-US/blog/input-action-and-axis-mappings-in-ue4

https://answers.unrealengine.com/questions/134349/right-click-on-an-actor.html

https://answers.unrealengine.com/questions/17729/how-to-create-a-right-mouse-click-event-with-bluep.html

I figured out how to do an action/event call with the right mouse button, but even then I did not succeed.

Soon I discovered that the reason was that there was already an action that was executed with the right mouse button (walk/set destination):

I would like my character to continue to move with the right click of the mouse, but how do I also call an event when I click the right mouse button?

EDIT 1

If the mapping is done with two different keys, it works perfectly:

In this case the character jumps and walks (instead of jumping it could be anything else):

I want this to happen by right-clicking (walking and jumping):

This action I want to perform is when clicking on the mesh of any actor, but I can only do this with the left button.

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:
No animation clips in assets folder I'm trying to import an FBX file made in Blender into Unity so I can use the actions created in Blender in a Unity animation state machine. A lot of sites seem to suggest that simply dropping the FBX file into the assets will automatically import animation clips, but that doesn't seem to be happening. Unity does however recognize the discrete actions created.

Tutorial image:

My screen image:

I used the Blender export settings "Include Animation" and "All actions", but not "Include Default Take" as people recommend.

For reference, I'm trying to follow the animator controller tutorial at unity3d.com

How can I retrieve my animation clips from the fbx file, or is there another way to insert them into the Animator?
Thanks!

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: What's the difference between UClass and UObject? I know that UCLASS() macro creates a seperate UClass for every UObject class ,but what is the need for this seperate class , how both of these classes relate to each other and what is the basic difference between both of them??

sentences:
How to get Pixel Coordinates of certain colors in a Texture? I have a relatively big Texture, and I try to find a certain color pixels pattern:
eg. White, Black, White, Green .
They are lying next to each other,

If I use Texture2d.Getpixels() on every pixel every frame its possible, but way too slow.

Is there a "real good" way to do this? For example a shader way?

The "big idea" is to make a game which is "remote-playable".
For example through Twitch or of a streamed youtube video.
The user should not be connected to the server in any way, Instead he is sending messages or not.

For this I have to find a health bar. This health bar has the left-upper corner in black-> white -> black -> green pixels lying next to each other.

In the shader I CAN find these colors, but I dont really know the coordinates.
Also I think there "should" be a solution with a  ... compute shader?
I dont really want to render new stuff. Just check pixel colors.
I just want to know where these pixel colors are.

I imagined something like this:

If PixelColorIsWhite(x,y)
{
If PixelColorIsBlack(x+1,y)
{
If PixelColorIsWhite(x+2,y)
{
If PixelColorIsGreen(x+3,y)
{
return x+20,y+100 //because the player is 20 pixels right and 100 pixels below
}}}}

In a shader i guess i can access the current coordinate, but I cant access the other pixels. Its paralell processing... right?
So its impossible to access the "entire thing" in one go , right?

I think it must work somehow with... getting the big "chunk" of texture data, a very long array of pixels, giving it to a compute shader, and letting the CS find it.

I hope I could clarify the problem now :)

_-----------------------------------

Update:

I found out it (at least) should work with a compute shader.

I feel like im so close to the solution, yet im getting errors. :-(

So...

This is my C# Code:

public ComputeShader shader;
public Material thisMat;

public RenderTexture ScreenTex;

public int x;
public int y;

public const string INPUTTEX = "InputTexture";

private void Update()
{
    RunShader();
}

public void RunShader()
{
    RenderTexture tex = new RenderTexture(1024, 786, 24);
    tex.enableRandomWrite = true;
    tex.Create();

    shader.SetTexture(0, INPUTTEX, ScreenTex);
    shader.SetFloat("_ScreenWidth", Camera.main.pixelWidth);
    shader.SetFloat("_ScreenHeight", Camera.main.pixelHeight);

    int[] data = new int[2];
    ComputeBuffer buffer = new ComputeBuffer(data.Length, sizeof(int)*2);
    buffer.SetData(data);
    shader.SetBuffer(0, "readWriteIntBuffer", buffer);

    thisMat.mainTexture = tex;
    int kernelHandle = shader.FindKernel("CSMain");

    shader.SetTexture(kernelHandle, "Result", tex);
    shader.Dispatch(kernelHandle, 1024 / 8, 786 / 8, 1);

    buffer.GetData(data);

    x = data[0];
    y = data[1];
    buffer.Release();}

And this is my ComputeShader Code:

    -------------------
    #pragma kernel CSMain

RWTexture2D<float4> Result;

RWStructuredBuffer<int> readWriteIntBuffer;
Texture2D<float4> InputTexture;
float _ScreenWidth;
float _ScreenHeight;

[numthreads(8, 8, 1)]
void CSMain(uint3 id : SV_DispatchThreadID)
{
    if (id.x >= (uint)(_ScreenWidth*_ScreenHeight))
    {
        return;
    }

    int y = id.x / int(_ScreenWidth);
    int x = id.x % int(_ScreenWidth);
    readWriteIntBuffer[0] = 999; //some debug-testnumbers that show me that there were no colors found
    readWriteIntBuffer[1] = 998;

    if (InputTexture[float2(x,y)].r == 1.0f && InputTexture[float2(x, y)].g == 0.0f && InputTexture[float2(x, y)].b == 0.0f)
{
    float2 coordinates = float2((float)id.x / (float)_ScreenWidth, (float)id.y / (float)_ScreenHeight);

    readWriteIntBuffer[0] = coordinates.x;
    readWriteIntBuffer[1] = coordinates.y;

}
}

This Computeshader checks if a single pixel in a texture is red and writs it in a buffer. The buffer gets read by C# with getdata.
-- it seems we're almost getting there!
But "something" seems to be wrong, since I dont seem to get the colors i want.
But the compute shader seems to work, since i also get the triange-pattern in my material.

sentences:
Unity Material Override Video is too dark I have made a TV in Blender, UV Wrapped a material and applied a  video on it in Unity.
But the picture is too dark, and I would like to make it brighter.

How could I solve this problem?

The left one

sentences:
How to apply toastr notifications when user get leveled up? This question is about when user get leveled up the toastr will pop up.

What I want to do is i want to put the toastr.js inside my script but I don't have idea how to implement.

** Link and Script **

<link rel="stylesheet" href="{{ asset("css/toastr.min.css") }}">
<script src="{{ asset('js/toastr.min.js')}}"></script>

** Profile.blade **

 <script>
   @if(Session::has('success'))
    toastr.success("{{ Session::get('success') }}")
   @endif
 </script>

** Controller **

         use Session;

          while($user->curr_exp >= $user->exp_needed){
             if($user->level == 10 || $user->level == 15 || $user->level == 20)
               {
                  $user->reward_token += 1;
               }
                  $user->curr_exp -= $user->exp_needed;
                  $user->prev_exp = $user->exp_needed;
               if($user->level <= 19){
                   $user->exp_needed = $user->prev_exp * 1.4;
               }
               elseif($user->level >= 20 && $user->level <= 39){
                   $user->exp_needed = $user->prev_exp * 1.1;
               }
               elseif($user->level >= 40 && $user->level <= 59){
                   $user->exp_needed = $user->prev_exp * 1.05;
               }
               elseif($user->level >= 60 && $user->level <= 79){
                   $user->exp_needed = $user->prev_exp * 1.04;
               }
               elseif($user->level >= 80 && $user->level <= 99){
                   $user->exp_needed = $user->prev_exp * 1.03;
               }
               elseif($user->level == 100){
                   $user->exp_needed = $user->exp_needed * 0;
               }
                   $user->level += 1;
                   Session::flash('success','You leveled up!');
                   $user->save();
               }

I'm using laravel framework 5.4.36 version. I'm confused how to display a live notifications on the user's profile every time they leveled up.

Any ideas? Thank you

sentences:
Good 3D Math Theory Books I've been developing a modification for the Source engine for well over a year, but am now facing some troubles with the weapons, gamemovement (player physics) and player feedback from explosives.

This is all because of my weakness in mathematics!!!

What books, tutorials or any  other various texts could you recommend (that have helped you).

sentences:
Can world depth be achieved in a side scroller? I tend to build games with strong stories, which usually involves quite an indepth world environment. Typically I develope typical 2.5 over head view JRPG style (think Zelda, Final Fantasy 3, etc) because I have it stuck in my head that you can only achieve world depth using this style.

This question is limited to the 2D environment. Can this be achieved in a 2D side scroller? Can a user experience the world when only seeing it from the side? Can he/she explore villages in this manner? Any examples would be great.

The closest thing that comes to my mind at the moment is Castle Crashers.

sentences:
Copying render target texture loses all depth I have a render target RenderTargetScene that holds my scene texture with the scene's depth buffer

            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
            );

If I attempt to copy the render target contents to another render target using the following code

        game.GraphicsDevice.SetRenderTargets(sceneCopy);

        game.GraphicsDevice.Clear(ClearOptions.Target, Color.Transparent, 0f, 0);
        //game.GraphicsDevice.Clear(Color.Transparent);

        game.SpriteBatch.Begin(
            SpriteSortMode.Immediate,
            BlendState.Opaque,
            SamplerState.PointClamp,
            DepthStencilState.Default,
            RasterizerState.CullCounterClockwise
            );

        game.SpriteBatch.Draw(game.RenderTargetScene,
             new Rectangle(0, 0, sceneCopy.Width, sceneCopy.Height), Color.White);

        game.SpriteBatch.End();

Then the texture is copied across but the depth buffer appears to be lost.

This is apparent when using DepthStencilState.DepthRead as there is no depth for the objects drawn with that render state to read.

How can I make sure the depth buffer is copied across too?

EDIT:

I have a depth texture created via my deferred rendering system so I thought I would use that.

I'm now drawing a full screen quadrangle using a depth writing shader

    public void RestoreDepthBuffer(Texture2D depthTexture)
    {
        // Set the render states
        game.GraphicsDevice.BlendState = BlendState.Opaque;
        game.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
        game.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
        game.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;

        Effect effect = restoreDepthBuffer;

        effect.CurrentTechnique = effect.Techniques["Default"];

        effect.Parameters["DepthTexture"].SetValue(depthTexture);

        effect.CurrentTechnique.Passes[0].Apply();

        game.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionTexture>(
            PrimitiveType.TriangleStrip,
            NearPlaneVerticesVPT,
            0,
            4,
            Indices,
            0,
            2
            );
    }

The important parts of the shader look like

struct PixelShaderOutput
{
   float4 Colour                        : COLOR0;
   float Depth                          : DEPTH;
};

PixelShaderOutput PixelShaderFunction(VertexShaderOutput input)
{
    PixelShaderOutput output;

    output.Colour = float4(0, 0, 0, 0);
    output.Depth = 1.0f - tex2D(DepthSampler, input.TextureCoordinates).r;

    return output;
}

This is still not working though.

EDIT2:  I've got it to work but I have to set the depth and draw all the objects when the RenderTarget is first set and not unset it again.

Should I post an answer based on my working method?

sentences:
Unity - protect MonoBehaviour-derived classes from instantiating via new in C# When the class hierarchy grows and you deal with a lot of custom types in your project, it sometimes becomes hard to remember which types are allowed to be created via new and which types are derived from MonoBehaviour and therefore can't be created via new but must instead be attached to the GameObject as a Component.

Is it possible to have some safety-mechanism for this? The goal would be to have two base classes to control the ability to use new on a certain type. Ideally resulting in a compile-time error instead of an easy to miss warning in the console ("You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. Blah blah.").

My attempt to make the constructor protected, like this

public class UnCreatableBase : MonoBehaviour {
    protected UnCreatableBase() {
        // using new should be not allowed
    }

    public static T Create<T>() {
        // instead this method allows object creation
        return GameObject.Instantiate (Resources.Load ("Prefabs/" + typeof(T).Name) as GameObject).GetComponent<T>();
    }
}

public class CreatableBase {
    public CreatableBase() {
        // new is ok here
    }
}

still allows me to write:

var whyDoesThisWork = new UnCreatableBase();

I can access the protected constructor even from an outside scope.

Now, the obvious solution would be to make constructors of MonoBehaviour-derived classes private. Manually. All of them. Manually. I was wondering if there's a way of achieving the same in a more generic way.

sentences:
Technique suggestion to render corroded pipes in 3D We currently have a lot of data relating to cracks/corrosion/deformations in metal pipes which at present, can be viewed in a crude flat/2D application which makes the metal anomalies hard to spot.

What I would like to create is a virtual 3D pipe viewer that displays the pipe and then models all of the dents in it.

I have limited knowledge of graphics programming from University however, what I was thinking of doing is creating a height-map from the data given and then use tessellation to push/pull the vertices of the pipes mesh, similar to terrain generation techniques.

My Question(s):

Can a tessellated square/plane be wrapped around to form a pipe (and would this approach loose accuracy)? (I've only ever manipulated vertices in the y-direction on a flat plane).
Some of the dents are extremely small (1-5mm across/deep), would my approach be accurate enough to model these anomalies?
Is this tessellated/terrain generation style the correct way to proceed or is there a simpler solution.

Any advise is welcome

sentences:
How to make a 'Picture-book Cutscene' in Unity 2D with simple 2D images? I'm trying to implement a simple cutscene system in my Unity game, preferably one that allows cutscenes to play at the start and end of each of the levels.

What I was imagining was pretty similar to A Hat in Time's 'storybooks' from it's time rifts, but full-screen and advanced with a single key. The images are simple and comic-like, and I was wondering how to implement such a feature since it feels like it's a bit different to Unity's pre-existing Timeline system, as there isn't many moving parts.

How do I go about approaching this problem? At least, I don't know how to get the project to a state where a person can press a key to turn to the next page (whether or not there's a visual transition to the next is optional) and once it's done, to start the actual level/scene. Do I still use the Timeline for this? I know I could potentially use an empty game management prefab in order to set up when to play the cutscenes, however.

sentences:
Releasing a demo in an unfinished state? I'm a fairly unexperienced game developer, (despite having some coding abilities) as i never really had the opportunity to launch more than 1 "finished" game.
So in terms of getting the word out, marketing or even getting usefull feedback of players, i have very little experience.

Now, i'm working for almost 3 years on a game which i'm developing in my spare-time. Despite its pretty long development cycle it is a fairly "simple" game.

The question i'm asking myself multiple times (and more frequently as time goes on) is:
- When should i release a demo? (Should i release a demo at all?)

I don't want the players to play it now and loose interest afterwards after the game finishes. (as it will take maybe another full year until it is even remotely finished.)
But at the same time i know that i have to do something in terms of marketing (it is going to be a free game, but i would like to reach as much people as i can) as despite the 3 year long development cycle, not many people know about this project. (Which isn't really optimal, as i have a potential target audience which i know would like a game of this type.)

My strategy up to this point was to simply develope it in my spare time, not having a demo at all and only showcasing (meaningfull) progress of the game in youtube videos (This videos are released every 2 or 4 months, depending on how much time i have to develope the game...) and only release the game after it is more or less finished.

Its a very strage scenario for me to be in. I would love to let people know about the project (like every other dev), but at the same time i fear that people will be put down by its quality (alpha-state) and that they aren't going to be interested in it afterwards after they played it. (The only thing you can currently do is to "free-roam" > no objectives whatsoever.)

So my question is:
Am i to worried about this stuff? Should i release a demo? (Now or later after it's more polished?)
What are your experiences in releasing games or using demos?

sentences:
Save a mouse coorinates after a specific number of seconds I have a specific method that saves my mouse x and y coordinates. I want that mouse coordinates be saved by specific time (for example after 1000ms). How I need to do that in Java?
Please add a simple usage example.

 public void mouseMoved(MouseEvent e) {
        currentX = e.getX();
        currentY = e.getY();

        if(enemy.onWall() == true){
            timer.schedule(new TimerTask(){
                public void run() {
                    saveX = e.getX();
                    saveY = e.getY();
                    enemy.setCont(true);
                    move();
                }
            },100);
            enemy.setOnWall(false);
        }
    }

But this code saves mouse coorinates immediately and then waits for 1000ms and I have old coordinates.

sentences:
Make a sprite jump to a certain direction in libGDX I was wondering how you can make a sprite jump to a certain direction in libGDX just like the brick does in the famous mobile game "Amazing Brick'

I want to make my sprite jump up a bit to the right when I tap the right part of the phone and make it jump up but to the left direction when I tap on the left part of my phone.

I am using libGDX on android studio and I am on a beginner level, trying to develop a unique game for android. Plz help. Thanks in advance. ^o^

sentences:
C++ low-level optimization tips Assuming you already have the best-choice algorithm, what low-level solutions can you offer for squeezing the last few drops of sweet sweet frame rate out of C++ code?

It goes without saying that these tips only apply to that critical code section that you've already highlighted in your profiler, but they should be low-level non-structural improvements.  I've seeded an example.

sentences:
How to make a fade effect on the Unity's scrollView? I have a basic ScrollView, with some additional scripts so it snaps to the nearest element (focusing on it).

When I perform the scroll, it looks like this:

What I need to achieve is to fade the part which is currently going off the screen.

Like when I'm scrolling left, the right panel is coming in, and the left one - fading out:

Is there any built-in option for this? I'm opened for any ideas!

sentences:
How to make players be creative in a game, if the game cannot evaluate it? I am working on a prototype game with several funny/visual effects that the player can trigger. The player can be quite creative in the way to use or combine these effects but it seems impossible to make detect/evaluate this creativity by the computer.

So, from a game design perspective, I wonder what could be the features to drive the players to be creative (experiment various combinations).

For the moment i think about "Draw something" where the result is evaluated by other players. I think about levels designed by "Little Big Planet" players but this aspect is out of the core game. I think also about "Minecraft" but I do not understand really how this game encourages the people to be creative (except of the open world).

Please tell me if you have any ideas, articles or references that could help me coping with this problem.

sentences:
Unreal Engine - How can I add blur effect at my Camera in iOS I have requirement to add blur effect at my camera in specific point , it work just fine in pc but when I deploy in my phone it remove the effect

According to documentation

  To turn off Depth of Field, set "Scale" to zero, this is suggested as
  default to improve performance.

  Mobile Depth of Field is currently not compatible with PC. There is no
  way to currently visualize on the desktop version what the mobile
  settings will look like except using an unsupported "-FeatureLevelES2"
  launch flag when starting the editor, or using the "Mobile Preview"
  option from the "Play" button drop down menu.

But when I run in my mobile this effect disappear

any one know the reason

here is my Camera setting

sentences:
How can I create 2D, sprite-based reflections in HTML5 Canvas? I'm trying to create simple reflections in a 2D, sprite-based game using HTML5. I'm looking to recreate an effect like the one you'd often see in GBA games, such as Pokemon Emerald and Mother 3:

These days we don't really get to see many 2D games that pull off this kind of effects.  How could I achieve this with HTML5 Canvas?

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:
Placing units on isometric map (2D) I'm making a map editor for further RTS game (2D), something like the first StarCraft Editor. Terrain tiles will be a rhombuses. So I'll probably just make an 2D array with intigers, that corresponds proper tiles. Then, after creating the terrain, you'd probably like to add some units and structures to map (especially if you're making a scenario). I'm not sure how do I check if the unit can be placed somewhere. I decided to make units almost independent from terrain tiles like in StarCraft (1), so the units are not placed in any grid.
I'll give a simple image:

As you can see, those green tiles represent a passable area (grass, let's say), and a blue one impassable (for example water). That stickman in a box is our unit. You can place it only in green area. That means the box can't go outside the green rhombuses.

I have some ideas how to achieve this, but I'm not sure which one would be the most optimal.

1) Since I work in Unity, I could add a collider to every tile. That will be very simple to do and will probably have terrible optimalisation in maps 256x256.

2) Math. I can calculate if any of those boxes crosses tile's borders. If so, I'll have to check if all those tiles are passable. It won't be that easy to programme (well, for me at least) and... yeah, here comes my dillema. Am I right that it would have much better optimalisation? Is it worth the effort?

What about saving this map? I can easily save the array with tiles, but how can I do it with units? Just save their positions or is there a better way to do it?

EDIT: I've tested the first idea (I've written script to create 256x256 map - that will be probably the biggest, and to move a camera). The map generates quite long (comparing to tiles without collider), but after that there isn't much difference in performance (it doesn't mean it won't cause problems when I add more features than moving a camera ;)). I can also attach colliders only to impassable tiles, not all. This should improve the performance even more. Still not sure if that's a good idea.

EDIT 2: I've just realised how bad my idea was. Let me visualise this:

So if you consider not the whole rectangle, but only a circle, it's not only easier to implement, but also more reasonable. You can now convert rhombus' vertices' position from isometric to cartesian like Bálint said:

CartX = ( 2 * IsoY + IsoX) / 2
CartY = ( 2 * IsoY - IsoX) / 2

You can also do it with circle's center point. Radius is equal to half of square (rhombus) side length OR sqrt(2) * square side length (when square is inscribed in circle).

So now I have a square grid and a circle. How can I check if all squares that this circle lays on are passable? What's the most optimal way to do it?

sentences:
Algorithms for positioning rectangles evenly spaced with unknown connecting lines I'm new to game development, but I'm trying to figure out a good algorithm for positioning rectangles (of any width and height) in a given surface area, and connecting them with any variation of lines.  Two rectangles will never have more than one line connecting them.

Where would I begin working on a problem like this?  This is only a 2 dimensional surface.  I read about graph theory, and it seems like this is a close representation of that.  The rectangles would be considered a node, and the lines connecting them would be considered an edge in graph theory.

sentences:
Are random events beyond players' control necessary for "strategy" games? By "random event" I mean critical hits, misses, random variation in some kind of result etc. Examples of these include the accuracy mechanic in XCom; critical hits and accuracy chance in Darkest Dungeon; misses and fire/breech chance in FTL.

Something in common about these examples is that they are all games in which players have an indefinite amount of time to decide on actions. So, could it be that by adding random, RNG-based events, the game relieves the players' burden of feeling compelled to predict every possible outcome in the future? Could a game similar to the example do away with the randomness? If so, how could that change the experience?

sentences:
Using a Wii remote as main controller? I would like to use a Wii remote to control my player in my 3D game.

So far I have the arrow keys and mouse to move and look but I want the Wii d-pad to move and accelerometer data to look around.

I have downloaded Unity-Wiimote-1.1 and the demo works fine. In my game I have imported the Unity package for the Wii remote but I'm not sure what script goes where, attached to what, how to call particular functions. They are mostly C# scripts.

There is no documentation with the Unity-Wiimote-1.1 and as I'm a newbie, I'm clueless on what to do.

Or is there a simpler method to getting the Wii remote to be the main controller?

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:
Extending control remapping script to work with mouse buttons I have created a default key map for my game, however I have also included an option in the settings where the player can change the key bindings.

My issue is if the player clicks on the button for shooting, which is defaults to mouse0, or aim on mouse1, then click on another key, they can never go back to mouse0 or mouse1.

I am unsure of how to include all the mouse buttons/scroll wheel into the viable buttons the player can choose from.

Here is the part of my code that deals with the changing of the keys:

private void OnGUI()
{
    if(curKey != null)
    {
        Event e = Event.current;
        if (e.isKey)
        {
            keyBinds[curKey.name] = e.keyCode;
            curKey.transform.GetChild(0).GetComponent<Text>().text = e.keyCode.ToString();
            curKey.GetComponent<Image>().color = normal;
            curKey = null;
        }
    }
}

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:
Procedural terrain in the Style of "Zelda: A Link to the Past" I am working to create a system that randomly generates pseudo-3d terrain on a tile grid using the methods used in the legend of zelda games between link to the past and minish cap.

I have created a tileset for it, and after manually making some maps and getting a feel for what the tile placement algorithm needs to do, I've implemented one of four possible layer-transitions. There are still some special edge-cases which will likely need special tiles, but the image shows a fully procedural map using it. My implementation keeps track of the altitude of each vertex (not center) of a tile. By comparing the altitudes at each corner, and in some cases those around the focused tile, I can determine which sprite to use.

This system needs to be "infinite" in that I can generate chunks adjacent to existing ones using the same noise function. I have plans to make a worldmap system similar to a LOD system too, which wouldn't be too hard with perlin noise, but alternative suggestions should keep this in mind.

I have several questions about this system. The first is this: How I can make my noise more like the example, preferring to line up edges which are nearby (but only to a degree)? How can I make it prefer less complex shapes, more similar to octagons than realistic messy hills?

The second is about how I can connect the layers: for altitude changes greater than 1 level, I want to require the player to use ramps. Unfortunately I don't have a solid example of this in my current tileset, but essentially, two disconnected altitudes should have a "slope" (really just the neutral tile) between them... I could use A* or similar, but how do I detect where it needs to be used? Or is there a better way to ensure connectivity?

Excuse the programmer ""art"" please

What I have:

What I want:

sentences:
Getting crash on glDrawElements Here is the code where I initialize the VAO, vertex attributes(also the main VBO) and EBO(im using my own wrapper class for these "databuffers" to hide some of the API features and make life easier so i dont think the problem will be in the generic class as it was working without problems)

void initVAOManager(const bool& ebo) {

    if (_vaoID == 0)
        glGenVertexArrays(1, &_vaoID);

    glBindVertexArray(_vaoID);

    /**
    Here is the main data buffer (positions,colors,UVs)
    If it doesn´t exist a new one is created
    **/
    if (!_mainBuffer)
        _mainBuffer = new DataBuffer<T>(GL_ARRAY_BUFFER);

    _mainBuffer->bindBuffer();

    if (!_eboBuffer && ebo) {

        _eboBuffer = new DataBuffer<eboData>(GL_ELEMENT_ARRAY_BUFFER);

        _eboBuffer->bindBuffer();
    }

    //This is the position
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, position));

    //Color attrib pointer
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, color));

    //UV
    glEnableVertexAttribArray(2);
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, uv));

    _mainBuffer->unbindBuffer();

    if (ebo)
        _eboBuffer->unbindBuffer();

    glBindVertexArray(0);
}

Then the render function (dont mind the for loop, as i want to render multiple objects from the batch in one function):

void renderBatchNormal()
{
    uploadData();

    glBindVertexArray(_VAOManager->getVAO());

    std::vector<eboData>

    for (std::size_t i = 0; i < _DATA.size(); i++) {
            glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
    }

    glBindVertexArray(0);

    clearData();
}

The upload data function send a data from the vectors to their buffers, I can send it too but as Im using my generic wrapper and it worked before with normal drawings I assume there is no problem.
And finally a class eboData(if anyone wondered) (basically just a blank class with an array of 6 indices)

class eboData {
public:
    GLuint indices[6];
};

However, this is causing crashes on the line where I try to execute the glDrawElements command, I read that it can be caused with no binded VAO while binding the ELEMENT BUFFER but as you can see from the code I´m doing it right(at least I think that). However, if I change the following line with:

std::vector<eboData> _eboVector;

glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, _eboVector.data());

The code is working (problem is also that I don´t know how to render second item in the buffer as it is showing only the first one). Do you have any ideas what can cause this crash?

PS:
glGetError() returns 0.

sentences:
How are one-to-many relationships usually expressed in ECS architecture? I'm trying to implement a simple ECS to help understand the concepts, and I am having a bit of trouble wrapping my head around how it would be used in cases where there is not a 1-to-1 mapping between entities and components.

For instance, an example of ECS, as I understand it, is that you might have a "drawable" component defined, which contains a mesh ID and a material ID required for drawing.  This is easy to understand  in the case you want a game like Super Mario, where each character is represented by exactly one sprite at any time, but what if you need more than one mesh to draw some characters?

Is it common to allow more than one component of the same type on an entity?  Or else would you typically have an entity for each drawable component, and implement some kind of "join table" to map sub-components to a parent?

sentences:
how to do picking in 2d lwjgl I searched the whole internet, but I couldn't find something useful.
How to do picking (like ray picking) in lwjgl in orthographic mode (2d)?
I think this is less confusing than picking in 3d, but I really can't figure out how to do it.
Picking for rectangles is easy because you can use the mouse coordinates and the quad coordinates and test if the mouse coords are inside the area of the quad.
But my biggest problem is how to do this with rectangles, and circles? Or quads that looks like a circle because I use a texture of a circle (with transparent corners).
Please can someone explain it to me?

sentences:
Multiple Object Collision SDL I figured this is would be the correct place to ask the following ...

1) How would I go about making multiple object collision detection (Bullets For Example)?

2) How would I make it efficient enough so that I can have many objects be able to detect collision of other objects.

The only idea I currently have is for each bullet to iterate through the other game objects and check collision individually. But that could/would have a terrible impact on time, considering that there can be many objects in the scene. I have also considered multi threading, but I really don't know how to apply it in game programming. Any Suggestions?

sentences: Which is faster: raycasting or shadowcasting? I'm looking to create an FoV implementation and I was wondering which algorithm is faster - raycasting or shadowcasting?

sentences:
In Unity, is there a difference between Vector3.down and -Vector3.up? I've noticed numerous tutorials and examples using something like "transform.up * -1" or "-Vector3.up" instead of simply saying "transform.down" and "Vector3.down".

Is there a good reason for this, or is it simply a style difference?

I'm specifically thinking about downward raycasts, if that matters at all.

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:
Game state and input handling in component-based entity systems My question is:

How can I handle game states in my entity system, without resorting to keeping a stack of game state objects around?

So the design of my entity system means that when an entity needs to register for input events for instance, the input component calls the input system and says "register this entity for this input". This is all fine and well, however if you add into this the concept of game states (say a pause screen), it becomes a problem to work out if an entity is in the current state and should receive the input.

I could augment the input component/system so that it says, "register this entity for this input while in these game states", but this requires that every entity know which states it's going to be used in, and that may not be obvious. Also, keeping a list of game states around per registered input (and other systems that use callbacks) doesn't sound too efficient.

Another idea I had is since there will be an entity that represents the game state, mark that as being disabled, then when generating the input event check that the entity is not a descendant of a disabled game state entity. Seems expensive to work out the parent for every callback.

Another idea is to have all the systems store their data keyed against the current state, that way when generating the input, the target entity won't even be a candidate. However this really hurts the ability to allow communication between entities in different states (not so much a problem for pause screens, but think lock picking in Oblivion/Skyrim).

The only other idea I've had is to have all components handle a state change events and communicate with their relevant system to disable anything they have registered, and re-enable it when switching back to this state.

The second (mark an object as disabled) and forth (have each component deal with state changes) seem like the best of my ideas, but none of them jump out at me as being particularly great.

Does anyone else have any other ideas on how to do this?

edit While I talk about input specifically in this question, it can mean any system capable of sending messages/events to entities, such as collisions, timer events, etc...

sentences:
How can I trigger an event each time the rotation of my rigidbody2D is at a given value? I would like to trigger an event each time my rigidbody2D is at a particular value.

The event should only be triggered once for each given value per complete object revolution.

Initial attempts at achieving this have resulted in the following method which checks against an array of values, logging an event and incrementing an index when the value has been passed.

static readonly float[] angles = new float[] { 90f, 180f };
int angleIndex = 0;

void CheckForTrigger()
{
    if (rigidbody2D.IsSleeping())
        return;

    var rotation = Mathf.Abs(rigidbody2D.rotation);

    if (rotation % 360f >= angles[angleIndex])
    {
        Debug.Log("Fire");

        angleIndex++;

        if (angleIndex== angles.Length)
            angleIndex= 0;
    }
}

This suffers from a couple of issues:

Floating point inaccuracy means that values close to 360f will often be missed (e.g. 359f)
Fire will be logged each frame between the last and first value (i.e. between 180f and 90f)

Does anyone have any advice for approaching this problem and improving the above method?

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:
Scanning a 2D tile map and detecting regions? I have access to all points/tiles on the map with top-right most point being (0,0). Simplest way to traverse the map would be using for loops, one nested within the other to traverse the x axis, and then y (going through rows). But to solve this problem, I would probably need to scan the map in a more intelligent fashion. The important thing to note is that I'm only able to check one tile at a time and see what type it is. So t.getCoordinates() would return something like (32,54) and t.senseTile() would return: WALL, ROAD, OFF_MAP, etc.

I wanted to scan the entire map and divide it up into regions. The regions would be of two kinds: "open" and "paths". For open regions, I just want to fill the entire region until it starts hitting boundaries, walls/obstacles, etc and stop the fill when appropriate. A rule for an open space is that a player should be able to get from one edge to another edge taking any path, angle, etc without bumping into some wall/obstacle.

For paths, there's certain number of tiles a region is limited to, then a new region starts (see lightBlue and gray).

Also, the paths should have entrances/exists also stored and to which regions they connect to. For example, scanning through a map like this (see pic), these regions should be generated. Not sure which data structure to use to connect them, but maybe a tree/graph would look like this:

  Gray
    |
 LightBlue
    |
   Pink
    |
  Yellow
    |   \
   Red  Black

Edit: I think Dijkstra's search algorithm could be a good starting point although I've never implemented it before. That only solves a small part of the problem. It still doesn't solve how it's going to detect regions. Also, I'm afraid Dijkstra's would be too costly in terms of time/performance (both are extremely important).

sentences:
Get the tile that my mouse pointer is currently over? I want to get the tile that my cursor is over in my game.

I did some googling though most of the examples we're in other languages/libraries and if they weren't, they didn't work for me because I use a sf::view.

So, what I currently have is a tile generator which works like this :

GameScreen.h :

std::vector<sf::Sprite*> tiles;
std::map<std::string, sf::Texture*> textures;

GameScreen.cpp :

void GameScreen::Init()
{
    std::cout << "Loading map" << std::endl;
    textures.insert(std::make_pair("Grass", new sf::Texture()));
    if (!textures["Grass"]->loadFromFile("Res/Textures/Grass.png"))
        std::cout << "Could not load texture : Grass.png" << std::endl;

    for (int y = 0; y < MapSize; y++)
    {
        for (int x = 0; x < MapSize; x++)
        {
            sf::Sprite* tile = new sf::Sprite();
            tile->setTexture(*textures["Grass"]);
            tile->setPosition(x * 32, y * 32);
            tiles.push_back(tile);
            std::cout << "Loading : " << tiles.size() << " / " << MapSize * MapSize << std::endl;
        }
    }

    std::cout << "Map loaded!" << std::endl;

    initialized = true;
}

How would I get the tile my cursor is currently over, even if my sf::view is moving?

This is how the newest code is looking :

Calling the get tiles function :

gameScreen.GetSpriteByPosition(window.mapPixelToCoords(sf::Mouse::getPosition(window), view));

Inside the get tile function :

sf::Sprite* GameScreen::GetSpriteByPosition(sf::Vector2f mousePos)
{
    sf::FloatRect mouseBound(mousePos, sf::Vector2f(1, 1));

    for (int i = 0; i < tiles.size(); i++)
    {
        if (tiles[i]->getGlobalBounds().intersects(mouseBound))
        {
            std::cout << "Found tile, index : " << i << std::endl;
            return tiles[i];
        }
        std::cout << "not found" << std::endl;
    }

    return nullptr;
}

sentences:
SQLite Query from unknown table based on known column value single query I'm working on a database to back up my online TCG. It's currently SQLite, but I'm going to transition it to a MySQL database later.

Currently, I have three distinct types of cards with their own unique fields. For example. However, all cards have a single uniqueid that I use to refer to them.

TABLE cards {
    CARD_ID as INT
    CARD_TYPE as INT
    TYPE_ID as INT
}

TABLE creature_cards {
    CARD_ID as INT
    TYPE_ID as INT
    NAME as TEXT
    FLAVOR as TEXT
    ATTACK as INT
    DEFENSE as INT
    ELEMENT as INT
    FLAGS as INT
    MANA_COST as TEXT
}

TABLE spell_cards {
    CARD_ID as INT
    TYPE_ID as INT
    NAME as TEXT
    FLAVOR as TEXT
    SPELL_TYPE as INT
    ELEMENT as INT
    MANA_COST as TEXT
}

TABLE mana_cards {
    CARD_ID as INT
    TYPE_ID as INT
    NAME as TEXT
    FLAVOR as TEXT
    ELEMENT as INT
}

I'm trying to figure out how to build a query that will allow me to get all fields from a specific table without knowing the table I need to pull from ahead of time.

Basically, I want to be able to supply CARD_ID, query the cards table, and use the CARD_TYPE and TYPE_ID to return the row from creature_cards where CARD_TYPE is 1, spell_cards where CARD_TYPE is 2, and mana_cards where CARD_TYPE is 3.

I'm currently doing this through two separate queries and doing the logic on the backend, but I'm wondering if there's a way to get the data all in one query, because my queries can be quite time consuming.

Would it just be better to jam all card fields into one table, rather than keeping them in three separate tables?

sentences:
XNA Skinning Sample - exporting from Blender recognize only first animation clip (and sorry for my English)
I'm using animation components from XNA Skinning Sample. It works great but when I export a model from Blender, it does not recognize any other animation clips than the first one. So I have three animation clips, but XNA recognize only one. Also, when I looked up on Xml file of the model in Debug\Content\obj directory, there is only one animation clip, but when I check code directly from .fbx file, it seems to be alright.

Link to my model files:
https://skydrive.live.com/redir?resid=8480AF53198F0CF3!139

BIG Thanks in forward!

sentences:
Move ball based on direction of force? I'm trying to make a ball that will move in the direction I push it from, and later pull it to me based on where the player is standing.

using UnityEngine;
using System.Collections;

public class BallForce : MonoBehaviour {

    public float thrust;
    public Rigidbody rb;

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

    // Update is called once per frame
    void Update () {

        if (Input.GetMouseButton (0))
            rb.AddForce (transform.forward * thrust);
    }
}

This seems to work, but I'm not sure how I get it to move based on the position of the player. How would I do this?

sentences: Unity, shader, vertexID I'm writing a shader and I just wanna ask if it's possible to get the ID of the vertex that is currently being manipulated. I read something about gl_vertexID, but I couldn't find out if that is something I can use.

sentences:
Achieving smooth movement curves & correct collision detection with a google app realtime multiplayer game server I'm an hobbist game developer. I'm trying to make a clone of a game like this: http://superhex.io/ to experiment with multiplayer online.

First of all I'm not sure if there is a better way to implement server-client comunication. So far I have implemented a server which updates the game state every 0.5 seconds and sends the information to all the clients.  You can try my current prototype here: https://hexpose.appspot.com

With respect to local development where the 0.5 seconds rounds are very regular, playing on the public server you see that the pace is not regular... I think this is due to a variable latency in server-client comunication.

Suppose I have many players moving on an arena like in this game. The superhex original gameplay is very fluid, you see enemies move on smooth curves. How this can be achieved? The position of enemies is known later (because of client-server-client latency) than the position of my player. But collision are anyway correctly detected. Is it just a matter of very slow latency and good server infrastructure or it depends on game logic implementation?

sentences:
Quaternion rotation problems I want to rotate my model and I have X and Y rotations. Here is my code:

D3DXQUATERNION q, qrotation;

D3DXQuaternionRotationAxis(&q, &D3DXVECTOR3(1.0f, 0.0f, 0.0f), m_matrixRotX*0.0174532925f);
qrotation = q;

D3DXQuaternionRotationAxis(&q, &D3DXVECTOR3(0.0f, 1.0f, 0.0f), m_matrixRotY*0.0174532925f);
qrotation *= q;

D3DXMatrixRotationQuaternion(&worldMatrix, &qrotation);

But I get the same gimbal lock. What is the problem?

EDIT 1: OK, but how can I rotate my object if I have X Y and Z rotations?

EDIT 2: Here is all my code:

m_matrixRotY += (float)m_mouseStateX;
m_matrixRotX += (float)m_mouseStateY;
if (m_matrixRotY >= 360.0f)m_matrixRotY = 0.0f;
if (m_matrixRotX >= 360.0f)m_matrixRotX = 0.0f;

D3DXQuaternionRotationYawPitchRoll(&qrotation, m_matrixRotY*0.0174532925f, m_matrixRotX*0.0174532925f, 0.0f);

D3DXMatrixRotationQuaternion(&worldMatrix, &qrotation);

I want to rotate my object in world static XYZ axis (world orientation not
 local orientation).
Each frame I get mouse x y states and add them to total rotation. Is it wrong that I am counting total rotation and then creating the quaternion from it?

NOTE: m_mouseStateX = current_mouse_state - previous_mouse_state

sentences:
Concerns about how to efficiently implement sprite atlas I currently transform (translate, rotate, scale) a bunch of vertices in my own Java code, then populate an mPositions array and an mTextureCoordinates array, which draws a bunch of different textured sprites to the screen in one GL draw command. Works great.

However, I now wish to move the transformation process away from native Java code and over to the vertex shader, and so I will need to pass into the shader transformation matrices which encode the translation, rotation, and scaling operations for each sprite.

Given my current approach the naive and obvious choice is to introduce another array mTransformations, passed into the shader via a GLES20.glVertexAttribPointer command, which contains a matrix for each and every vertex.

But this way seems a little wasteful for two reasons:

I will have to add the same transformation matrix 6 times per sprite to the mTransformations array since each square sprite is made of 2 triangles (3+3 vertices)
Since I'm now going to use the shader to perform the transformations, the 6 canonical coordinates of each square sprite (two triangles) will be the same for every sprite. In effect I'd have to populate mPositions with the same coordinates over and over for each sprite.

Is there a more efficient way to do achieve what I want?

sentences:
Project organization for a multiplayer client-server game I'm programming a game 100% in Java but I'm having some issues concerning the final games architecture.

I plan on having two separate projects: one that will hold the client side of communication and another, the server side. As for all the rest, the Player Class, the Main Game class, etc. I'm not sure whether they should be in the server project or the client project... any suggestions?

sentences:
Multi-Threaded Pipelined Game Engine Data Synchronization Questions Let's say I'm setting up a worker pool based game engine with pipelining. Let's say I have 4 stages in my pipeline as such:

Stage 1: Physics
Stage 2: AI/Input
Stage 3: Game Logic
Stage 4: Rendering

Now let's say that the physics detects a collision between a bullet and a character in stage 1. Two frames later the game logic may choose to remove that bullet from the simulation, however none of the other copies of the data for the other pipeline stages will get this information. How is this sort of thing and other things like it get handled? Do you generally make changes like this to every pipeline stage's data at the end of a frame?

sentences:
How can I move my player on exact x and y coordinates, like on a grid? I'd like to implement movement exactly like it is done in this game. (You can see it in action on YouTube.)

I need my Player to always stay in the center of X and Y similar to grid movement, but with free movement/line like. Only move on x and y lines. And I need smooth changes at intersections.

 var x = Input.getAxis("Horizontal");
 var y = -Input.getAxis("Vertical");
 var deltaPos = Vector2.zero;

 if (Mathf.Abs(inputY) > Mathf.Abs(inputX)) {
     deltaPos.Y = speed * inputY * Time.deltaTime;
 }
 else {
     deltaPos.X = speed * inputX * Time.deltaTime;
 }

 transform.position += deltaPos;

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:
Why is FindObjectOfType(MyType) not finding anything? Why would I get the following log?

Start OpponentMotionReceiver
motion receiver not found
true

    public class ScoreAnimation : MonoBehaviour
    {
        private OpponentMotionReceiver cachedObject;

        private void Start()
        {
            cachedObject = FindObjectOfType<OpponentMotionReceiver>();
        }

        private void OnDestroy()
        {
                var motionReceiver = FindObjectOfType<OpponentMotionReceiver>();

                if (motionReceiver == null)
                {
                    Debug.Log("motion receiver not found");
                }

                if(cachedObject != null)
                {
                    //prints true, another proof that the gameObject is active
                    Debug.Log(cachedObject.gameObject.activeInHierarchy);
                }
        }
    }

public class OpponentMotionReceiver : MonoBehaviour
    {
        private void Start()
        {
            Debug.Log("Start OpponentMotionReceiver");
        }

        private void OnDisable()
        {
            //never enters
            Debug.Log("OnDisable OpponentMotionReceiver");
        }

        private void OnDestroy()
        {
            //never enters
            Debug.Log("OnDestroy OpponentMotionReceiver");
        }
    }

P.S. This is extremely simplified version of the code so that the rest brings no confusion. If you need more details, I'd be pleased to answer you!

sentences:
The practical cost of swapping effects I use XNA for my projects and on those forums I sometimes see references to the fact that swapping an effect for a mesh has a relatively high cost, which surprises me as I thought to swap an effect was simply a case of copying the replacement shader program to the GPU along with appropriate parameters.

I wondered if someone could explain exactly what is costly about this process? And put, if possible, 'relatively' into context?

For example say I wanted to use a short shader to help with picking, I would:

Change the effect on every object, calculting a unique color to identify it and providing it to the shader.
Draw all the objects to a render target in memory.
Get the color from the target and use it to look up the selected object.

What portion of the total time taken to complete that process would be spent swapping the shaders?
My instincts would say that rendering the scene again, no matter how simple the shader, would be an order of magnitude slower than any other part of the process so why all the concern over effects?

sentences: How can I detect touch intensity or pressure via libGDX? How can I detect the intensity of touch pressure in libGDX? For example, low pressure, medium, medium-high, high and so on. There are some questions about it but there aren't answers for libGDX.

sentences: Rotating Object using Unity's Bolt system I want to rotate a object and stop when it reaches a certain angle using Unity's Bolt, visual scripting.

sentences:
lwjgl and slick util text over textured quad So, I load a TrueTypeFont like this:

   private TrueTypeFont trueTypeFont;
   try {
        InputStream inputStream = ResourceLoader.getResourceAsStream("assets/fonts/main.ttf");

        Font awtFont2 = Font.createFont(Font.TRUETYPE_FONT, inputStream);
        awtFont2 = awtFont2.deriveFont(24f); // set font size
        trueTypeFont = new TrueTypeFont(awtFont2, true);

    } catch (Exception e) {
        e.printStackTrace();
    }

After that, I draw a textured quad, as one usualyy would and then, draw trueTypeFont.drawString(this.x, this.y, this.text, Color.white);
.
What this gives, however is far from text, this is what it does, the black is supposed to be text...

How to fix?

sentences:
Sampler referencing in HLSL - Sampler parameter must come from a literal expression The following method works fine when referencing a sampler in HLSL

    float3 P = lightScreenPos;
sampler ShadowSampler = DPFrontShadowSampler;
float depth;

if (alpha >= 0.5f)
{
    // Reference the correct sampler
    ShadowSampler = DPFrontShadowSampler;

    // Front hemisphere 'P0'
    P.z = P.z + 1.0;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;

    // Rescale viewport to be [0, 1] (texture coordinate space)
    P.x = 0.5f * P.x + 0.5f;
    P.y = -0.5f * P.y + 0.5f;

    depth = tex2D(ShadowSampler, P.xy).x;
    depth = 1.0 - depth;
}
else
{
    // Reference the correct sampler
    ShadowSampler = DPBackShadowSampler;

    // Back hemisphere 'P1'
    P.z = 1.0 - P.z;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;

    // Rescale viewport to be [0, 1] (texture coordinate space)
    P.x = 0.5f * P.x + 0.5f;
    P.y = -0.5f * P.y + 0.5f;

    depth = tex2D(ShadowSampler, P.xy).x;
    depth = 1.0 - depth;
}

// [Standard Depth Calculation]
float mydepth = P.z;
shadow = depth + Bias.x < mydepth ? 0.0f : 1.0f;

If I try and do anything with the sampler reference outside the if statement then I get the following error:

Sampler parameter must come from a literal expression

This code demonstrates that

    float3 P = lightScreenPos;
sampler ShadowSampler = DPFrontShadowSampler;

if (alpha >= 0.5f)
{
    // Reference the correct sampler
    ShadowSampler = DPFrontShadowSampler;

    // Front hemisphere 'P0'
    P.z = P.z + 1.0;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;
}
else
{
    // Reference the correct sampler
    ShadowSampler = DPBackShadowSampler;

    // Back hemisphere 'P1'
    P.z = 1.0 - P.z;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;
}

// Rescale viewport to be [0, 1] (texture coordinate space)
P.x = 0.5f * P.x + 0.5f;
P.y = -0.5f * P.y + 0.5f;

// [Standard Depth Calculation]
float depth = tex2D(ShadowSampler, P.xy).x;
depth = 1.0 - depth;
float mydepth = P.z;
shadow = depth + Bias.x < mydepth ? 0.0f : 1.0f;

How can I reference the sampler in this manner without triggering the error?

sentences:
Selection of a mesh with arbitrary region Considering example:

I have a mesh(es) on the OpenGL screen and would like to select a part of it (say for delete purpose). There is a clear way to do the selction via Ray Tracing, or via Selection provided by OpenGL itself.

But, for my users, considering that meshes can get wired surfaces, I need to implement a selection via a Arbitrary closed region, so all triangles that appears present inside that region has to be selected.

To be more clear, here is screen shot:

I want all triangles inside black polygon to be selected, identified, whatever in some way.

How can I achieve that ?

sentences:
Unity3d Cross platform Input GUI Depth I'm creating my GUI controls in Unity 5.3 I have a joystick in which overlays a swipe pad.  Originally all of the controls were working fine.  However, now the touch pad is overlaying the Joystick.

In previous verisons you could focus the window

GUI.FocusWindow(0);

I've tried reassign the order by making one a child of the other and vise versa yet nothing works.

Does anyone know how to control the Z index of the controls, or make one overlay the other.  I've looked at the GUI depth documentation, but I don't see how I could apply that here.

Does anyone know how to control the depth of cross platform controls in unity?

sentences:
How to get rid of an image upon collision detection in SDL? I am fairly new to SDL in C, but I have written a simple game whereby a character has to reach the end of a level and avoid bad stars on the way. If he hits a star, he dies. There are also good stars he can collect and get points.

I have set up my point system so now when he hits a good star, he should get a point. However, when he hits a star, he actually gets lots of points, as long as he is touching the star, which I don't want. I think that what's happening is because the stars are moving and he rubs up against the stars; each pixel he moves counts as a new collision so he gets a point per collision. Ideally, he should only get one point per star.

So I have two problems: 1) I need to figure out how to make it so that he can only get one point when he hits a star. 2) Since he is supposed to be 'collecting' the stars, I want to make the star disappear when he collects it.

So it's similar to most of these types of games, whereby, the player collects something, it disappears and they get a point.

EDIT:

This is struct I've made:

typedef struct {
    int x, y, w, h, baseX, baseY, mode;
    float phase;
} Goodstar;

I've then referenced it in another struct like so:

Goodstar goodStars[GOOD_STARS];
SDL_Texture *goodStar;

[GOOD_STARS] is equal to 100.

And then here's my collision detection code:

// Check for collision with good stars
for (int i = 0; i < GOOD_STARS; i++) {
    if (collide2d(game->man.x, game->man.y, game->goodStars[i].x, game->goodStars[i].y, 48, 48, 32, 32)) {
        if (!game->man.isDead) {
            game->man.points++;
        }
        break;
    }
}

So right now it only checks for a collision and then adds a point.

EDIT 2:

This is the code you suggested and it works:

for (int i = 0; i < GOOD_STARS; i++) {
    if (!game->goodStars[i].awarded) {
        if (collide2d(game->man.x, game->man.y, game->goodStars[i].x, game->goodStars[i].y, 48, 48, 32, 32)) {
            if (!game->man.isDead) {
                game->man.points++;
                game->goodStars[i].awarded = 1;
            }
            break;
        }
    }
}

And this is my initialisation code:

  // Initialise stars
  for (int i = 0; i < GOOD_STARS; i++) {
    game->goodStars[i].baseX = 320 + random() % 38400;
    game->goodStars[i].baseY = random() % 480;
    game->goodStars[i].mode = random() % 2;
    game->goodStars[i].phase = 2 * 3.14 * (random() % 360) / 360.0f;
        game->goodStars[i].awarded = 0;
  }

sentences:
What does glBlendFunc do when given an incorrect enumeration value? In cocos2d-x, I am using particle system from plist with blend values: dst = 1, and src = 100 which is wrong enum for gl_blend.

Although app logged "OpenGL error 0x0500" but it still run and showed a good blend effect. And i can not find the right pairs of dst and src to recreate that effect.

So i hope someone can tell me how BlendFunc / gl_blend will work when it having bad src value. Base on that i hope i can recreate that effect without using wrong src value. Thanks

sentences:
How to force keep the aspect ratio and specific resolution without stretching the output screen view? I'm using Screen.SetResolution()

But when I run in Android device, it shows the output image is stretched to fill up the full screen which I don't want. I want it to keep the aspect ratio properly.

Example 01 : This is coincidentally match and ok because my device screen aspect is 16:9.

But here is the incorrect one (stretched)

Example 02:
This is 640 x 480 in resolution but it should remain in aspect ratio of 4:3.

How could I keep it's aspect ratio and [make it black at the extra space outside] or [customize it using my own image to cover the extra space]? in Android.

Note: I'm not talking about the canvas but entire output view.

sentences:
Keeping per-client data, when using singleton-based states In my game, I deal with a lot of units. Every unit implements a state machine, and changes states quite often. As a result, I'd like to keep my states as singletons, since I want to avoid the creation of one and the same state over and over again.

This works quite OK for most case, except when I need to introduce some time intervals, e.g. in 5 seconds the unit has do something. Of course, everyone knows that singletons cannot keep per-client data, which is exactly what I want to achieve. The state should be aware of the time elapsed since it was initiated for a specific unit.

One way to do this would be to keep timers within the units themselves, but that doesn't make a good abstraction.

Another one, which I am currently working on, is to keep the per-client state, i.e. timers on a Dictionary/Hash within the state. When a client initiates the state, the timer gets activated, and a dictionary record gets set. Every time when the specific timer is needed, the dictionary is queried with the id of the specific client. Then on state exit, the record is deleted.

Which is in general the proper way to deal with these problems?

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:
Why isn't my method an option for onClick? Update: The problem went away when I restarted Unity and tried again.

The problem

I am using Unity 2019.1.8f1 Personal with Visual Studio for Mac 7.8.4. I have a button named Refresh; I would like its onClick handler to be the public instance method Refresh() in the class Libretto. My GameView has the Libretto script as a component:

The script Libretto.cs includes:

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

public class Libretto : MonoBehaviour, IInputHandler
{

    // Other members omitted

    public void Refresh()
    {
        // Code omitted
    }
}

My scene Scene_Libretto has a Canvas that contains a Button named Refresh:

In the onClick() section of the Refresh component, I selected GameView, which is a GameObject:

When I try setting the function, the method Libretto.Refresh() is not an option:

Attempted solutions

Searching online, I have found these solutions, none of which work for me:

The method must be public. (It is.)
The method must be void with 0 or 1 parameters. (It is void with 0 parameters.)
The script should contain using UnityEngine.UI; (It does.)
Try creating a new object with just the script and use that. (This makes no difference.)
Your code must compile with no errors. (It does.)

Full project

I have tried to make my question complete, but, if anyone wants to look at my code, it is available on GitHub in espertus/UnityWordGames (a fork of Roger Engelbert's code from his book Word Games With Unity).

A sibling scene, Scene_Crossing, in the same project has a similar Refresh button and Refresh() method that work properly.

Update

It worked after I restarted Unity.

sentences: SDL2 window as child of Win32 GUI I'm building an editor. Is it possible to create a child window of SDL2 within a Win32 gui? (The most obvious page from SDLTutorials works for earlier versions of SDL)

sentences:
Why is my game object generated by a custom Unity editor script missing its sprite? I have a number of sprites that I generate outside of Unity.  I'd like to automate the process of importing these sprites into Unity as fully-configured game objects.  I'm trying to do this through a Unity editor script, but I'm having some difficulty.  When I run my script, my game object is saved as a .prefab as expected.  However, the Sprite I'm assigning to my game object's SpriteRenderer component is missing:

In my script, I'm assigning my SpriteRenderer's sprite property to a Sprite object that I dynamically create in the script.  Here's the relevant excerpt from my editor script:

GameObject gameObject = new GameObject(fileName);

SpriteRenderer spriteRenderer = gameObject.AddComponent<SpriteRenderer>();

// texture size will be replaced during the LoadImage() call
Texture2D texture = new Texture2D(1, 1);
texture.LoadImage(File.ReadAllBytes(Path.Combine(generatedOutputPath, fileName + ".png")));

spriteRenderer.sprite = Sprite.Create(
    texture,
    new Rect(0.0f, 0.0f, texture.width, texture.height),
    new Vector2(0.0f, 0.0f)
);

PrefabUtility.CreatePrefab("Assets/Prefabs/" + fileName + ".prefab", gameObject);
DestroyImmediate(gameObject);

I can verify through logging that the image path to my .png is correct and that the Texture2D and Sprite objects seem to be instantiated correctly.  For example, I can do this:

// logs "580" as expected
Debug.Log(texture.width);

What am I doing wrong?  How can I save this game object as a .prefab without losing its sprite information?

sentences:
How to I make MOUSEY look up I have MOUSEX worked out perfectly, it  moves on the X axis, but when I add the Y axis, I can't use the MOUSEX axis.
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;
    float camRot = 0f;
    public Transform altCamera;

    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;
            }

            if (Input.GetKey(KeyCode.LeftShift))
            {
                moveDirection = transform.forward * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
                moveDirection *= runSpeed;
                moveDirection = transform.right * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
                moveDirection *= runSpeed;

            }
        }

        // 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);

    }
}

Here's my code.
but when i add:
camRot -= MOUSEY;
transform.localRotation = Quaternion.Euler(camRot, 0f, 0f);
camRot = Mathf.Clamp(camRot, -90f, 90f);

The MOUSEX axis doesn't work, and the MOUSEY moves up and down, with the MOUSE axis, but doesn't clamp and the MOUSEX doesn't rotate.
Help please?
Thanks

sentences:
Logical math behind jumping in a 3D world I'm unsure if I should ask the mathematic part of StackOverflow or the gamedev part. I'm trying to figure out how the gravity changes the position of an element in a 3D world. I've been trying to rescript the gravity in a game so I could attach it to every element I want.

As far as I know; The movement of the player has something to do with the current position ( obviously ), the velocity, the gravity and Delta Time. As far as I'm concerned too, I know that when an element makes some kind of jump, he should go up since the velocity is still positive. Each frame should update the player's position, depending on the current position and velocity, the new position will be created. I've been able to create it in a platformer ( 2D ) but I haven't succeeded to do this in a 3D game. As far as I came, the object just flew into the air at a massive speed and ended up landing in another galaxy..

I'm currently working with Lua, if you were trying to explain something in a language. If you're working with another language and want to give me an example in that.. feel free to do so. I'm known with a lot of languages ( programmer here. ). It's just about the logic behind it, the actual math.

Thanks in advance

sentences:
Efficient 2d Java Line of Sight for a lot of entities? My problem today is this:

I have many civilians going around, they are classes stored by an arraylist.

The idea is when they see another civilian panic, they'll start to panic and it will spread.

First I call each classes Step() function by looping through an iterator. Then in the Step() function it goes through another civillian iterator
     As it goes through, it tries to detect whether it can see the other civillian in the iterator, this is where performance time goes from 0 to 50 Milliseconds for having 100 Civillians.

This is the problem I need to fix, I tried to make an easy way to detect whether any objects are in the way of point a to point b.

Here's the code for the line of sight:

public static Object LOS(int x, int y, int x2, int y2, String Scan, Object Me, Object You) {
   DirectionX = (x-x2)/Quality;
   DirectionY = (y-y2)/Quality;
   CurrentX = x;
   CurrentY = y;
   String[] ScanArray = Scan.split(":");
   for(int I=0;I<=Quality;I++) {
      for(String Type: ScanArray) {
         if(Type.equals("Boxs")) {
            Iterator it=Level.Boxs.iterator();
            while(it.hasNext()) {
               Box Box = (Box)it.next();
               if(Me!=Box&&You!=Box) {
                  //Collision = Tools.Collision((int)(CurrentX-(Width/2)), (int)(CurrentY-(Width/2)), Width, Width, Box.GetX(), Box.GetY(), Box.GetWidth(), Box.GetHeight(), 1);
                  boolean Col = Tools.BasicCollision((int)(CurrentX-(Width/2)), (int)(CurrentY-(Width/2)), Width, Width, Box.GetX(), Box.GetY(), Box.GetWidth(), Box.GetHeight());
               }
            }
         }
      }

      CurrentX-=DirectionX;
      CurrentY-=DirectionY;
   }
   return null;
}

If you have a headache the fundamentals are:

It figures out 10 points in between and detects whether it is inside, using BasicCollision:

public static boolean BasicCollision(int x, int y, int width, int height, int x2, int y2, int width2, int height2) {
   if(x<x2+width&&x+width>x2&&y<y2+height&&y+height>y2) {
      return true;
   } else {
      return false;
   }
}

My question is: Is there an easier way to detect this Line of Sight that doesn't severely impact my performance in large numbers? Any feedback?

sentences:
Need help understanding VkCommandBuffer and VkCommandPool I'm creating my first Vulkan project and I'm at the point where I need to send commands to the GPU. Now I need help understanding how and when commands are being executed and what sort of commands can be sent. I have a working example of where I clear the screen using the following.

Creating the Buffer

VkCommandBufferAllocateInfo commandBufferAllocateInfo{};
commandBufferAllocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
commandBufferAllocateInfo.commandPool = engine.pipeline.command_pool;
commandBufferAllocateInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
commandBufferAllocateInfo.commandBufferCount = 1;

VkCommandBuffer commandBuffer = VK_NULL_HANDLE;

vkAllocateCommandBuffers(
    engine.device.instance,
    &commandBufferAllocateInfo,
    &commandBuffer
);

Clearing the screen

VkCommandBufferBeginInfo commandBufferBeginInfo{};
commandBufferBeginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
commandBufferBeginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;

engine.ErrorCheck(vkBeginCommandBuffer(
    commandBuffer,
    &commandBufferBeginInfo
));

VkRect2D renderArea{};
renderArea.offset.x = 0;
renderArea.offset.y = 0;
renderArea.extent = window->GetVulkanSurfaceSize();

std::array<VkClearValue, 2> clearValues{};
// Depth stencil
clearValues[0].depthStencil.depth = 0.0f;
clearValues[0].depthStencil.stencil = 0;
// Color
clearValues[1].color.float32[0] = 0.0f;
clearValues[1].color.float32[1] = 0.0f;
clearValues[1].color.float32[2] = 1.0f;
clearValues[1].color.float32[3] = 0.0f;

VkRenderPassBeginInfo renderPassBeingInfo{};
renderPassBeingInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
renderPassBeingInfo.renderPass = engine.window.renderPass;
renderPassBeingInfo.framebuffer = engine.window.framebuffers[engine.window.activeSwapchainImageId]; // Get current frame buffer
renderPassBeingInfo.renderArea = renderArea;
renderPassBeingInfo.clearValueCount = clearValues.size();
renderPassBeingInfo.pClearValues = clearValues.data();

vkCmdBeginRenderPass(
    commandBuffer,
    &renderPassBeingInfo,
    VK_SUBPASS_CONTENTS_INLINE
);

I'm finding it difficult to understand. I see that when you define a CommandBuffer you point to the pool that it will be submitted to, then when you execute the command it gets added to the queue to be processed asynchronously with the logic that is happening CPU side? I'm not sure if that is right.

Also, can the command buffer be used for other commands? and if so, what commands and how would I find example usage of them.

And what is a command pool in the scheme of things that is happening?

sentences:
Unlit Node Shadow Shader Graph How to make unlit node cast shadows?
Is is possible with the current state of Shader Graph in LWRP?

In this great article Toon Shader OP grabs pass from VertexLit shader. Is something similar achievable with Shader Graph?

sentences:
Why this if logic isnot short circuiting? I've this script in UNITY to check if the hit RayCastHid2D variable has some gameobject with hole tag or a parent gameobject with hole tag when I Raycast...

if (hit.collider != null && (hit.collider.gameObject.tag == "hole" || (hit.collider.gameObject.transform.parent.gameObject != null && hit.collider.gameObject.transform.parent.tag == "hole")))

Everything is fine until if (hit.collider != null && (hit.collider.gameObject.tag == "hole" ||

but when I enter (hit.collider.gameObject.transform.parent.gameObject != null && hit.collider.gameObject.transform.parent.tag == "hole") it throws a NullReferenceException....

But why?

It supposed to short circuit here hit.collider.gameObject.transform.parent.gameObject != null && if there's no parent gameobject!

sentences:
Instantiated Object returns Null outside Start method I'm attempting to access an instantiated 'goalTemp' GameObject from a different function inside the same script. I'm getting the information in the Start method, assigning the GameObject find/get component script code to a variable. When I'm printing the results outside the Start method, it returns null, even though the 'goal' variable is public.

void Start()
 {
     GameObject goalTemp = (GameObject)Instantiate(goal,respawnGoalLocation[CreateLevel.currentLevel-1],Quaternion.identity);
     goal = goalTemp.gameObject;
 }

public void Explode()
 {
     Debug.Log(goal);
     Instantiate(rockParticle, goal.transform.position, goal.transform.rotation);
     Instantiate(explosionParticle, goal.transform.position, goal.transform.rotation);
 }

What am I doing wrong here? Thanks for your time!

sentences:
Examples of faking 3D Does anyone know of any good examples of 3D being faked in 2D (not necessarily code, but games I could look up)? The player has the perspective that they are going 'into' the screen and things are coming out at them. At the moment, I'm simply scaling the 2D enemies to give the illusion that they're coming closer, but it still feels quite flat. Are there any tips on how to give it more of a 3D illusion without actually using a 3D engine?

Edit: Just came across the term 'Mode7' and this video which shows pretty much what I'm trying to figure out. (especially the games at 0:13 and 1:03). What's a good way of implementing something like this?

sentences: C# different resolutions compatible application Can you give me a quick tour for an application which has to work in different resolutions. It's a game, with lot's of graphics and images and effects. We are using C#. The game is simple 2D, looking like OGame but working like a desktop application. Our problem is how to make it compatible with different resolutions. What I expect you to give me is an advice - which technologies or combination of technologies and/or some basic tricks I should use to make my application work the same in different resolutions. Thank you!

sentences: What is dead reckoning and how do you deal with it? I've come across this problem before and it would be good to know the different ways of solving this problem.

sentences:
It is worth planning before jumping in the code? I always thought that planning is important for a game. But i don't know at which point. Some are telling me to code instead of planning but i feel like its still important because when you will be in the code you will know what to do next more easily. I am currently working on a game that will have lots of content so i decided to start a design document introducing thoses content and at a side-level i am doing proofs of concept to check if it can be done. Parts of each proofs of concept then could be used later in the real game.

EDIT: I am working alone on this project.

So my question is : It is worth planning before jumping in the code ? Im still interested to know what others have to say about this. Cause i still get some poeple saying i should code instead of thinking.. so what your opinion on this ?

sentences:
Rotate a rigid body not around its centre of mass I have a rigid body (a boat) whose centre of mass is towards the front of the object. However, this makes the rotation look strange as the rudder that is turning the object is at the back of the boat so the rotation would be around that point.

How can I rotate the object from the a separate point (using forces) without changing the centre of mass?

Applying a force at a location still causes the object to rotate around the centre. In real life, you need to pin down the point that you want to rotate around, forcing the object to rotate around that point.

This would suggest using constraints but I can't figure out how that would work. You sort of need the rotation point to act as a hinge, but when I apply a suitable constraint, but that would just block the rotation rather than convert it into a rotation around the new point.

I want to resolve this using physics driven operations in Unreal Engine 4.

I don't want to move the Centre of Mass, admittedly for not a particularly good reason, but this still feels like a valid question even if that was an option - what if you want to rotate around two different points.

sentences:
Get 3D quad rotation matrix from points I have 4 3D points which represent a even quad in space. (So 3 points are sufficient)
I need to get all the individual transformations (translation, rotation, dimensions) so that I can build that quad in my CSS 3D engine. So the default normal vector for a quad is [0, 0, 1].

What I have so far:

// 4 points
p0, p1, p2, p3

// normal
normal = cross(p1 - p0, p2 - p0)

// axis and angle
axis = cross([0, 0, 1], normal)
angle = arccos(dot([0, 0, 1], normal))

// rotation matrix
rotationMatrix = matrix4.fromAxisAngle(axis, angle)

// width and height
width = sqrt((p2.x - p1.x)^2, (p2.y - p1.y)^2, (p2.z - p1.z)^2)
height = sqrt((p1.x - p0.x)^2, (p1.y - p0.y)^2, (p1.z - p0.z)^2)

// translation
x = (p0.x + p1.x + p2.x + p3.x) / 4
y = (p0.y + p1.y + p2.y + p3.y) / 4
z = (p0.z + p1.z + p2.z + p3.z) / 4

It almost works, but some rotations are wrong or more specifically one rotation axis is missing. This is logical because the rotation is only build from the normal. So how can I get the full rotation?

Here you see that the top and bottom quads are just rotated around the x axis but the y axis rotation is missing:

sentences:
How might I eliminate asymmetrical gameplay caused by turn order? I'm designing a turn based game in which players profit from buying, transporting, and selling resources. Each turn, the map has to produce a certain number of resources and different locations, and resource prices have to be updated. Because of this, each round, after every player has taken their turn, the game state has to be updated; resources are consumed/produced, prices in each cell of the map need to be updated, etc. Originally, I was going to have a simple turn order, where each player took their turn, then the map is updated, then the cycle repeats in the same order. However, after a little bit of testing, it became clear that this gave a significant advantage to players who have their turn right after the map is updated. They're able to collect the newly produced resources before any one else has a chance to.

The easiest way I could think of to balance out the gameplay for all players is to randomize the turn order after each round. While this would give everyone a fair chance, I'm worried that this might be too big of a shift away from strategy and towards luck.

How might I eliminate asymmetrical gameplay caused by turn order?

sentences:
Are games designed to be addictive? When I was younger I used to play games a lot for hours. I would say I got addicted to them. Now I'm a software developer and was wondering if games are explicitly designed to be addicting?

Game developers are interested in keeping their users playing as long as possible. I've read about Operant Conditioning and Virtual Skinner Boxes. According to psychologists, most games use a fixed reward system to get the player hooked at first. For example, you can level up pretty fast in beginning. Then reward frequency gradually drops, but player keeps playing because they are hooked. In the end, you switch to variable reward frequency, which means rewards occur randomly and rarely. By this stage, the player might not even enjoy the game, but still play in order to get his reward fix and the resulting good feeling from it. This is very similar to how rats are conditioned in Skinner boxes.

Rewards can be in the form of social status recognition in the game world, working hard for a virtual item therefore giving it great value when acquiring it, feeling in control and power that are not met in the real world, escaping to somewhere else, being able measure progress to some goal and getting instant feedback. If the player abstains from the game, a punishment is applied, i.e losing social status or items. After a while, the rewards will be associated with the game itself and therefore even the sight of the game can evoke craving, much like in case of Pavlov's dog

In addition, there is another research which states that the immersive nature of video games, the rich visual stimulus from realistic graphics, the complex thinking required for playing, great autonomy and fast feedback loop can result in increased dopamine levels in the brain, and create a sense of flow. Combined with an effective rewarding system, games can stimulate the feel good centres of the brain. This means that after several sessions, the player needs to play longer in order to achieve the same dopamine levels as before. Some even experience euphoric feeling and relief from withdrawal when they play. They replace real world with game world and focus on in-game motivations only. Players may stop showering for long time, have reduced hygiene, become socially isolated, drop out of school, become overweight, withdraw from their family, have dreams about the game, think and plan about the game while doing other activities, stop doing non game related activities, have trouble concentrating.

References:

http://www.cracked.com/article_18461_5-creepy-ways-video-games-are-trying-to-get-you-addicted.html

http://www.betabunny.com/behaviorism/Conditioning.htm

http://www.world-science.net/exclusives/081111_gaming.htm

Can a game be simply too fun to resist?

sentences: Do industry professionals building games using UE4 use Blueprints at all, or do they use C++ exclusively? As a teacher on a game development module I have usually insisted that users use C++, because it is a more sought-after skill in industry, but online support and information on C++ in Unreal Engine 4 seems to be relatively weak. Are professionals now using Blueprints as well, or not?

sentences:
How are voxel terrain engines made? A few days ago I found something called voxel terrains and I think that they're pretty cool.  But I don't know anything generating them. Do you model it in your modeling software or use something like a heightmap? I read on wikipedia that voxels are like 3d pixels or volumetric pixels.

After I make the voxel terrain, how can I take these voxels and make them  destroyable/diggable?

I will pick the best answer based on:

code and algorithms. preferably based in C#
explanations. I am a beginner with algorithms but I'm very familiar with object oriented programming
step by step demonstrations. Not only concept but direction.
diagrams/illustrations. No, not screenshots of other engines.

I know that this is a complicating subject. But, thanks for any help!

No, I'm not trying to make a minecraft clone.

Edit

Thanks to everyone for your great help (especially Nick Wiggill)! This is what I managed to make (Work in progress).

sentences:
relationship between the model and the renderer I tried to build a simple graphics engine, and faced with this problems:

i have a list of models that i need to draw, and object (renderer) that implements IRenderer interface with method DrawObject(Object* obj). Implementation of renderer depends on using graphics library (opengl/directx).

1st question: model should not know nothing about renderer implementation, but in this case where can i hold (cache) information that depends on renderer implementation? For example, if model have this definition:

class Model
{
public:
    Model();

    Vertex* GetVertices() const;

private:
    Vertex* m_vertices;
};

what is the best way to cache, for example, vertex buffer of this model for dx11? Hold it in renderer object?

2nd question: what is the best way for model to say renderer HOW it must be rendered (for example with texture, bump mapping, or may be just in one color). I thought it can be done with flags, like this:

model->SetRenderOptions(RENDER_TEXTURE | RENDER_BUMPMAPPING | RENDER_LIGHTING);

and in Renderer::DrawModel method check for each flag.

But looks like it will become uncomfortable with the options count growth...

sentences:
How to get a list of parameters from a material in UE4? TLDR: how to access the parameters of a given material/material instance in BP and/or C++.
I would like to expose material parameters to the UI so the player can edit material instances at runtime(i.e. color, roughness of objects, etc).
I have a base class, that is the parent of everything in game; that has a variable of type Material Instance Dynamic called WMaterialInstance. It also has an Interface function to return that var.
Please see the construction script.
I'd like read parameters of this instance and expose it to the UI somehow.
But I can't get those parameters...
I am using a Get Scalar Values node to get my params...
I tried feeding it a Material Instance Dynamic reference, but my Print String nodes return zero, although there are parameters on the material, 100%.
Please see the BP nodes here.
I found a post describing a similar issue.
One of the answers says:

That node is a bit silly, it doesn't work with dynamic material instances, only constant. What you can do is get the parent of the material instance you're creating, cast it as a MaterialInstance (not dynamic), then get the scalar parameters of that one. If you need the values too you can use a for loop with the scalar parameter array as the input, break the array element and hook the Name into a GetScalarParameterValue (from your dynamic material instance) in the loop.

So I got the parent of my Material Instance Dynamic and tried casting it to just a normal MaterialInstance, but the cast seems to fail, if I feed the parent to it...
Here is how I did it.
Note: the Get Material node is my interface call to the Dynamic Instance from construction script, not the built in one.
Further down in the post there is an answer saying:

Well you need to have an actual constant material instance first,
create that by right clicking your material and creating a material
instance in the content browser. Then create your dynamic version from
that.

I created a material instance from my original material and assigned it to one of the child classes of the baseclass, so I use that one in the base construction script.
Still, doesn't want to work...  I get the same zeros and cast failures...
I noticed, that if I Print String the Display name of the Parent I get from the accessed base material it prints WorldGridMaterial, which means, it did not find what it supposed to...
Did anyone experience something similar?
Is there a better way to access these parameters?

sentences:
How can I create borders in an open-world game that don't feel artificial? When creating open-world maps, a big issue to take into consideration is how "borders" of sorts are implemented. Obviously, in an open-world game, there shouldn't be invisible-wall borders, as it ruins immersion, and makes the game feel more "artificial".

I've done a little bit of research online and I've found the following methods:

Have the map be an island, surrounded by water that will kill you if you venture out too far.
Have the map be surrounded by mountains that are much too steep to climb over.
A combination of the above; mountains plus a body of water. The Elder Scrolls V: Skyrim does something like this but does have places where paths lead out of the world. (Thanks @Pharap)

These seem like the best methods but I'm wondering if there are any other methods that can be used to create borders in an open world without ruining immersion.

sentences:
How to store information into the tile? I have made a map via TilePallete tool.

Now I want to store information in certain tile.
How I can do this?

ForEx:

I'm hittin a certain tile and I need it to have info about health remaining.
For first hit I change a tile.
For second I set it to null.

sentences:
GLES2-AnchorCenter branch has no org.andengine.util.color.Color I am porting my game from GLES2 to GLES2-AnchorCenter branch. I am using

import org.andengine.util.HorizontalAlign;
import org.andengine.util.color.Color;
import org.andengine.entity.particle.modifier.ExpireParticleInitializer;

... but these aren't available in GLES2-AnchorCenter branch, it seems.
Could anybody guide me on this?

sentences:
In modern AAA games with open environment and lot of static content (eg : crysis), how is occlusion culling performed? Two ideas i have in mind :

1) Scene is rendered to a invisible buffer, using low resolution and low polygon count models (or even using only bounding volumes like cubes or spheres). The buffer is then checked to know what is visible or not. Before rendering the low resolution scene, some frustum culling could be applied, to already remove as much objects as possible.

2) A tool is run on the static map and will perform complex (and thus slow) ray tracing to know for some 3d positions on the map what is visible and what is not. All that information is then stored in a efficient way that can be user later at runtime (eg: an octree)
This solution would only work for static meshes (eg : building) not moving objects.

sentences:
Stopping sprites from toppling off platform I am new to Unity and am trying to create a simple 2d platformer. I have applied a box collider to my player sprite and the floor/platform its standing on. Now when I go over the platform, it toppes off of it as expected, but I want it to simple fall off it instead of toppling. How can I do this?

Also I saw a video of Unity Live Training in which he was using a separate circular collider for the player's feet. When I did this, the sprite started rolling.

Can anybody help me with this?

sentences:
AI Pathfinding Algorithms I am looking to create a special kind of pathfinding system. At this point, the geometry is still flexible, but this pathfinding is integral to the project.

The goals I have are this:

I will have a number of entities seeking paths.
Each entity will have a memory of certain paths.
The memory will be based on landmarks. Landmarks will be objects or
entities on the map that can be or have been seen by the entity.
When an entity generates a path, it's only doing it based on what it
can see, and what it has memory of.  Anything else has to be
guessed, it can't use unknown information.
The system has to be able to handle a updating paths for a lot of
entities at once, but it never has to find the best path, especially
not on the first try.
It doesn't need to find a path to it's destination in a single
frame, just be able to make progress, and reach the target eventually if possible.
Entities might be able to share partial or full path information.

I'm thinking this is best served by some modified D* algorithm, but I was wondering if anyone had any other suggestions for something to do this, or challenges that I'd expect to face.

One thing I'm cognizant of for instance is that if I'm using landmarks to confirm the path, that I'll be able to quickly look up nearby landmarks.  If I have thousands of landmarks in a list and need to iterate through them and calculate distance to the player this is going to cause trouble.  If I'm going to define regions, like a convex hull, I might be able to share that calculation across entities when they need it since I might be able to say anyone inside this poly should be able to see everything within this poly.

sentences:
Prevent Unity from crashing your computer? Recently, I made a very dumb mistake that caused Unity to crash my computer. I could move the mouse sometimes, but everything else became completely unresponsive, leading to me having to shut off my PC.

What happened: I had an object, let's say an arrow, that could collide with another object, let's call it spawner. When the arrow collides with the spawner, it's supposed to destroy the arrow that activated the spawner. The spawner would then, as the name might imply, spawn more arrows. The problem was that I forgot to temporarily disable to collision on the newly spawned arrows, meaning that as soon as they would spawn inside the spawner's collision box, they'd spawn more arrows, and those arrows would spawn more arrows, and those arrows would... you get the idea. It was a very stupid mistake I realized the moment I hit play, but it was too late.

Now, I know that was entirely my fault, but I was wondering if you could prevent Unity from sending your PC into a coma like that? (Besides not making a dumb mistake like that, of course...) I'll be honest, I kind of expected Unity would have some sort of fail safe for this kind of error. Is there a way to limit the object count for example?

sentences:
Libgdx FPS drop drawing alot of text i'm drawing text above monster head and it's fine. But when there is to many monsters and their name gets render every second cause fps go down. When i disable the font drawing, then the fps is fine. Any idéa how to tackle this perfomence issue?

Thanks.

sentences:
Java Game not rendering properly Hello I have a game that you can play(duh). When you start the game a loading screen pops up and on the loading screen I display an image of an eye I drew. In paint.net they eye looks perfect but in game it dose not.

Here is the image in paint.net:

Here is the image in game:

I don't understand why the image is all messed up as much. Please help me! Thx.

sentences: Unity: Bypass Ctrl+S in a custom Editor Window Is there a way to bypass Ctrl + S for Windows or ⌘ + S for Apple default behaviour (save scene) in a custom editor window?

sentences:
Unity not opening in Ubuntu I installed the latest version version of Unity for Linux from the official website, but when I try to launch Unity, it displays a blank dialog box. I waited for a long time, but nothing happens.

These are my system specifications. I was running Unity on the same computer, several months ago, using Windows.

Model: Thinkpad R500
Processor: Intel® Core™2 Duo CPU P8600 @ 2.40GHz × 2
RAM: 2Gb DDR3 RAM
Storage: 155Gb HDD
Graphics Card: ATI Mobility Radeon HD 3400 Series 128mb dedicated GFX

Why is it doing this? Is there a problem with the latest build? What should I do to fix it?

sentences:
Should I go with SpriteBatch or just 3D with Z component always zero? I'm designing a platformer and beginning to code the viewing engine of the game. Now, I have to make a key decision: Should I just use SpriteBatch to draw all the 2D stuff, as there is no 3D, or should I just go with making camera-facing polygons with Z set to zero? What are the good sides and drawbacks of both? Performance? Extensibility?

Performance is a key factor as I'll be having lots of texttures/objects/effects/animations etc, and I'll be targetting high resolutions like 1920x1200 (if available on client's computer), so I need things to go smooth. On the other hand, I also need some extensibility, as I want to have great control over the drawing methods. Seems like I'd be going with 3D/polygon method, but I was wondering if it has any side-effects?

sentences:
Quick way to approximate a truncated gaussian distribution? I'm doing some procgen stuff and I need a truncated gaussian distribution. Basically, I need a way to get the same thing as this:

import random
def truncated_gaussian(mean, deviation, min, max):
    while True:
        val = random.gauss(mean, deviation)
        if min < val < max: return val

except without so much wasted effort. It looks like this is a pretty complicated thing to do properly, but I don't need statistics-grade perfect randomness, just a video-game-grade approximation.

Anyone know a trick to make this work?

sentences:
Unity detecting edge of mesh or end of mesh I'm trying to create procedurally generated tiles and I've reached a point where I need to figure out the boundaries of the mesh or the outer vertices of the mesh.

    RaycastHit hit;
    if (Physics.Raycast(bound[ i ].v2, Vector3.forward, out hit)) {
    if (hit.distance > 2) {

I've tried raycasting all the vertices, but still can't get the vertices of the edge. The mesh does have a collider. any help on how i would go about this is appreciated, Thanks.

sentences:
Weird windowed resolution - can't seem to change without changing the name My game is windowed, and when I set the resolution in the build settings (960x540 - 16:9 - Windows standalone), and build it, it works as intended, but from then on, I can no longer change the resolution (can change it in the editor, and it also saves, but when I build it, it is still the original res (960x540))unless I change the Product Name as well. When I change the product name, I can change the resolution, build it, and it will change, but then it is stuck as well. When I change back to the first name, the resolution automatically change it the resolution for the first name (960x540) (it doesn't show up in the editor, only when you build it.)

So basically:

Name1
960x540

Name2
1280x720

Name3
1024x576

etc

So you can change the resolution every time you change the name and build it, and that name is stuck with that resolution (no matter what you change it to in the editor later). I am fairly new with unity, so am I missing something very basic here?

Thanks for any help!

sentences:
Platformer command queue - not sure how to proceed While trying to figure out how to implement platform agnostic input handling for a platformer, I've discovered the command pattern and I liked the idea so I wanted to take it a step further.

I got the idea of having a Command Queue System (I'm using ECS in my gameplay screen/state) which would expose a simple api for enqueueing commands which other systems could invoke and then the command system would execute those commands within a logic loop derived from Fix your timestep blog post.

While processing and implementing this idea, however, I've encountered a couple of issues where I'm not sure on how to proceed:

Input processing is currently done with an abstraction over LibGDX's InputProcessor so input processing is event-driven and thus commands are queued as fast as events are emitted. This in turn causes the queue to fill up the command queue with more and more commands(40-50+) waiting for execution which, along with filling up memory, causes longer and longer delays. I've tried to mitigate this by removing oldest commands from the queue while the queue size is > 10 but that made gameplay really choppy since command removal was on the same thread and is blocking everything else until it's done(at least that's what I'm assuming is going on).
Is a complement to issue 1. wherein if I use a single queue for all commands including all AI NPC's, enemies and the player, I only see massive delays while the systems processes all inbound commands. I could spin up new threads for every entity but then I'm not sure how could I get them to execute within the fixed timestep logic loop, and I'm not particularly fond of having dozens of threads for every single entity.

I really like the idea of having movement and interaction of characters represented as commands but I can't figure out how to implement this without greatly losing precision and performance. Can anyone steer me in the right direction?

sentences:
Why are Visual Studio and VSCode not giving me a dropdown list of methods and options etc? I am using VSCode but I have also tried Visual Studio 2019 to write code for Unity, but when I'm writing the lines I don't get dropdown menus with for example the methods this class holds. Or objects. Or it's properties. etc.: basically, IntelliSense is not working.

Is there a setting that I need to enable in order to get those? Since I've seen everyone who use VSCode and visual studio get these dropdown menus.

sentences:
Walkin on terrain - Opengl i wanna walk to terrain...
first i created the terrain

void desenha_terreno(float px, float pz){

for (int z = 0; z < iwidth-1; z++)
{
    glBegin(GL_TRIANGLE_STRIP);

    for (int x = 0; x < iheight-1; x++)
    {
        // for each vertex, we calculate the grayscale shade color,
        // we set the texture coordinate, and we draw the vertex.
        /*
           the vertices are drawn in this order:

           0  ---> 1
                  /
                /
             |/
           2  ---> 3
        */

        // draw vertex 0
        glColor3f(terreno[x][z][1]/255.0f, terreno[x][z][1]/255.0f, terreno[x][z][1]/255.0f);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(terreno[x][z][0], terreno[x][z][1], terreno[x][z][2]);

        // draw vertex 1
        glTexCoord2f(1.0f, 0.0f);
        glColor3f(terreno[x+1][z][1]/255.0f, terreno[x+1][z][1]/255.0f, terreno[x+1][z][1]/255.0f);
        glVertex3f(terreno[x+1][z][0], terreno[x+1][z][1], terreno[x+1][z][2]);

        // draw vertex 2
        glTexCoord2f(0.0f, 1.0f);
        glColor3f(terreno[x][z+1][1]/255.0f, terreno[x][z+1][1]/255.0f, terreno[x][z+1][1]/255.0f);
        glVertex3f(terreno[x][z+1][0], terreno[x][z+1][1], terreno[x][z+1][2]);

        // draw vertex 3
        glColor3f(terreno[x+1][z+1][1]/255.0f, terreno[x+1][z+1][1]/255.0f, terreno[x+1][z+1][1]/255.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(terreno[x+1][z+1][0], terreno[x+1][z+1][1], terreno[x+1][z+1][2]);

    }
    glEnd();
}
}

I can move the camera with the functions:

void keyboard (unsigned char key, int x, int y) {
if (key=='w')
{
    float xrotrad, yrotrad;
    yrotrad = (yrot / 180 * 3.141592654f);
    xrotrad = (xrot / 180 * 3.141592654f);
    xpos += float(sin(yrotrad))*5;
    zpos -= float(cos(yrotrad))*5;
    ypos -= float(sin(xrotrad))*5;

}

if (key=='s')
{
    float xrotrad, yrotrad;
    yrotrad = (yrot / 180 * 3.141592654f);
    xrotrad = (xrot / 180 * 3.141592654f);
    xpos -= float(sin(yrotrad))*5;
    zpos += float(cos(yrotrad))*5;
    ypos += float(sin(xrotrad))*5;
}

if (key=='d')
{
    float yrotrad;
    yrotrad = (yrot / 180 * 3.141592654f);
    xpos += float(cos(yrotrad))*5;
    zpos += float(sin(yrotrad))*5;
}

if (key=='a')
{
    float yrotrad;
    yrotrad = (yrot / 180 * 3.141592654f);
    xpos -= float(cos(yrotrad))*5;
    zpos -= float(sin(yrotrad))*5;
}

if (key=='q')
{
    yrot += (float) -0.5*5;    //set the xrot to yrot with the addition of the difference in the x position
}

if (key=='e')
{
    yrot += (float) 0.5*5;    //set the xrot to yrot with the addition of the difference in the x position
}

if (key=='r')
{
    xrot += (float) -0.5*5;    //set the xrot to yrot with the addition of the difference in the x position
}

if (key=='f')
{
    xrot += (float) 0.5*5;    //set the xrot to yrot with the addition of the difference in the x position
}

if (key==27)
{
    exit(0);
}

glutPostRedisplay();
`

and, i change the position with the values of x,y,z positions

    // clear screen and depth buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();

//glTranslatef(0.0f, 0.0f, -cRadius);
glRotatef(xrot,1.0,0.0,0.0);
glRotatef(yrot,0.0,1.0,0.0);  //rotate our camera on the    y-axis (up and down)

glTranslated(-xpos,-ypos,-zpos); //translate the screen to the position of our camera

// set the camera position
//gluLookAt(cameraX, cameraY, cameraZ, lookX, lookY, lookZ, 0.0, 1.0, 0.0);

// set the current texture to the land texture
//glBindTexture(GL_TEXTURE_2D, land);

    desenha_terreno(xpos,ypos);
    glEnable(GL_BLEND);

// enable read-only depth buffer
glDepthMask(GL_FALSE);

// set the blend function to what we use for transparency
glBlendFunc(GL_SRC_ALPHA, GL_ONE);

// set back to normal depth buffer mode (writable)
glDepthMask(GL_TRUE);

// disable blending
glDisable(GL_BLEND);

    glFlush();

    glutSwapBuffers();

    angle++; //increase the angle
   }

well... i need to walk to the terrain, above the terrain, help me please!

sentences:
CS 1.6 server's request cartography Is there a way to request a CS 1.6, CS:Sourse or CS:GO servers to get the location coordinates of the recent deaths of players on the game map?

PS I'm using C# for my project

sentences:
How can I implement voxel-based lighting with occlusion in a Minecraft-style game? I am using C# and XNA. My current algorithm for lighting is a recursive method. However, it is expensive, to the point where one 8x128x8 chunk calculated every 5 seconds.

Are there other lighting methods that will make variable-darkness shadows?
Or is the recursive method good, and maybe I am just doing it wrong?

It just seems like recursive stuff is fundamentally expensive (forced to go through around 25k blocks per chunk). I was thinking about using a method similar to ray tracing, but I have no idea how this would work. Another thing I tried was storing light sources in a List, and for each block getting the distance to each light source, and using that to light it to the correct level, but then lighting would go through walls.

My current recursion code is below. This is called from any place in the chunk that does not have a light level of zero, after clearing and re-adding sunlight and torchlight.

world.get___at is a function that can get blocks outside of this chunk (this is inside the chunk class). Location is my own structure that is like a Vector3, but uses integers instead of floating point values. light[,,] is the lightmap for the chunk.

    private void recursiveLight(int x, int y, int z, byte lightLevel)
    {
        Location loc = new Location(x + chunkx * 8, y, z + chunky * 8);
        if (world.getBlockAt(loc).BlockData.isSolid)
            return;
        lightLevel--;
        if (world.getLightAt(loc) >= lightLevel || lightLevel <= 0)
            return;
        if (y < 0 || y > 127 || x < -8 || x > 16 || z < -8 || z > 16)
            return;
        if (x >= 0 && x < 8 && z >= 0 && z < 8)
            light[x, y, z] = lightLevel;

        recursiveLight(x + 1, y, z, lightLevel);
        recursiveLight(x - 1, y, z, lightLevel);
        recursiveLight(x, y + 1, z, lightLevel);
        recursiveLight(x, y - 1, z, lightLevel);
        recursiveLight(x, y, z + 1, lightLevel);
        recursiveLight(x, y, z - 1, lightLevel);
    }

sentences:
How can I reduce memory use when implementing an animation in UE4? We've already made a tank's track spline animation but it's using a lot of memory because it's implemented inside a tick function. So, it needs to check every second but as you may know it requires a lot of resources if there will be more than 10 tanks..

Is there an optimal solution for this problem? Have others faced these kind of problems?

It would be great if the solution was in blueprints.

sentences:
How can I get the vector3's names to gameobject name? void DrawBox()
    {
        SpawnLineGenerator(v3FrontTopLeft, v3FrontTopRight, color);
        SpawnLineGenerator(v3FrontTopRight, v3FrontBottomRight, color);
        SpawnLineGenerator(v3FrontBottomRight, v3FrontBottomLeft, color);
        SpawnLineGenerator(v3FrontBottomLeft, v3FrontTopLeft, color);

        SpawnLineGenerator(v3BackTopLeft, v3BackTopRight, color);
        SpawnLineGenerator(v3BackTopRight, v3BackBottomRight, color);
        SpawnLineGenerator(v3BackBottomRight, v3BackBottomLeft, color);
        SpawnLineGenerator(v3BackBottomLeft, v3BackTopLeft, color);

        SpawnLineGenerator(v3FrontTopLeft, v3BackTopLeft, color);
        SpawnLineGenerator(v3FrontTopRight, v3BackTopRight, color);
        SpawnLineGenerator(v3FrontBottomRight, v3BackBottomRight, color);
        SpawnLineGenerator(v3FrontBottomLeft, v3BackBottomLeft, color);
    }

And the gameobjects name:

    void SpawnLineGenerator(Vector3 start, Vector3 end, Color color)
    {
        GameObject myLine = new GameObject();
        myLine.name = start.ToString();

        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.03f;
        lr.endWidth = 0.03f;
        lr.SetPosition(0, start);
        lr.SetPosition(1, end);
    }

The method SpawnLineGenerator get two vector3 and a color:

SpawnLineGenerator(v3FrontTopLeft, v3FrontTopRight, color);

In the SpawnLineGenerator i'm setting a name for each gameobject:

 myLine.name = start.ToString();

This give me the name for example: (-2.1, 3.4, 4.9)
Nut I want it be the name like this format:

v3FrontTopLeft (-2.1, 3.4, 4.9)
v3FrontTopRight (-1.1, 3.4, 4.9)

The problem is if there is a easy way to get the names v3FrontTopLeft and v3FrontTopRight and the rest from the method DrawBox instead typing each one.

I want to know that (-2.1, 3.4, 4.9) are the coordinates for v3FrontTopLeft

sentences:
How to turn the hotspot on automatically in Unity? I have made a simple LAN multi-player game in Unity (just for learning purposes).

This is the main code (for connection):

using UnityEngine;
using System.Collections;

public class StartServer : MonoBehaviour
{
    public Transform Makan;
    public Transform CubeOBJ;
    public string SSS;

    void OnGUI ()
    {
        GUILayout.Box (Network.player.ipAddress);

        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            SSS = GUILayout.TextField (SSS);

            if (GUILayout.Button ("StartServer"))
            {
                Network.InitializeServer(10, 25000);
            }

            if (GUILayout.Button ("Connect"))
            {
                Network.Connect (SSS, 25000);
            }
        }
        else
        {
            if (GUILayout.Button ("creatCube"))
            {
                Network.Instantiate (CubeOBJ, Makan.transform.position, Makan.transform.rotation, 0);
            }
        }
    }
}

It works good. The problem is that in mobile devices I should turn on hotspot by myself for one of the devices.

How can I do this automatically from code?

sentences:
Unable to open project from a scene.unity file The tutorial I'm following has provided its project files, and I'm trying to open them in Unity. Here is the project download link. You can also go to the tutorial webpage and scroll down to download.

I can't figure out how to do it. Here is what I've done.

a) Extract zip to my Unity Scenes/ folder.

b) Open Unity, create a new project called tutorial

c) File -> Open Scene -> navigate to Unity Scenes/voxeltut3/scene.unity

d) Click Open

It opens.. but then I don't see any of the tutorial's files in my project. There's none of the c# scripts, no art, no prefabs... It's just the original empty project that I created.

I also tried importing it as a new package:

e) Assets -> Import New Asset... -> select Unity Scenes/voxeltut3/scene.unity

f) Click Import

And nothing happens. The Import New Asset dialogbox is still open with the scene.unity selected. It's like it's telling me that I've selected an invalid file. So I guess this is wrong?

How do I open this tutorial project? I'm using unity 5.3.2

This is the folder structure the new Unity project that it created for me:

C:\Users\me\Documents\Unity Scenes

tutorial/
    Assets/
    Library/
    ProjectSettings/

I unzipped the tutorial files in

C:\Users\me\Documents\Unity Scenes

voxeltut3/
    Materials/
        tiles.mat
        tiles.mat.meta
    Block.cs
    BlockAir.cs
    BlockGrass.cs
    scene.unity
    ... (other files)

sentences:
SpriteBatch does not draw on graphicDevice I'm using a control which is using XNA inside.
But when I try to draw something, it doesn't appear.
I already did a lot of tests but can't figure out what's wrong.
Here is the test I set up:

RenderTarget2D rTarget = new RenderTarget2D(GraphicsDevice, 1000, 1000);

GraphicsDevice.SetRenderTarget(rTarget);
GraphicsDevice.Clear(Color.White);
_spriteBatch.Draw(ts.Texture, layer.Location, source, Color.White, layer.Angle * (float)Math.PI /180, origin, SpriteEffects.None, 1f);
int spriteBatchGraphics = _spriteBatch.GraphicsDevice.GetHashCode();
int normalGraphics = GraphicsDevice.GetHashCode();
GraphicsDevice.SetRenderTarget(null);

using (FileStream stream = new FileStream("pic.png", FileMode.Create))
     rTarget.SaveAsPng(stream, 1000, 1000);

using (FileStream stream = new FileStream("pic2.png", FileMode.Create))
     ts.Texture.SaveAsPng(stream, ts.Texture.Width, ts.Texture.Height);

SpriteBatch.Begin, End  and GraphicDevice.Present is called too.

Because I didn't see anything, I tried to draw the stuff onto a renderTarget and save it to the HDD. I also saved the texture itself to be sure it's not just white.

However, spriteBatch should draw a 48x48 block here and I checked the parameters of spriteBatch, they are okay. But on the rendertarget, nothing appears. I reacts on GraphicDevice.Clear, the color I pick there really gets drawn.
The hashCodes of both graphicDevices are the same, so they really seem to draw to the same device.

What could cause this?

EDIT:------------------------------------------------------------------------------

I searched for some more and I found the following: I'm getting a AccessViolationException when closing the program. First I thought it's unrelated but it seems it's caused by what happened before. I found in the internet that a very bad graphic card can cause this. And the graphic card I tried this on was very bad indeed. So I tried it on an other machine now - I'm getting different results, but it's still not working and I'm still getting the exception.

Here is what it draws now:

In place of the black spot, the tile should be drawn. But it's not happening. The AccessViolationException only happens when the draw glitch happens - in this case as soon it just draws a black block instead the real texture. The lines are planed and part of it (the horizontal are still missing for some reason, but trying to fix that later).

So what is happening? Gets the graphic device too much stressed? I'm also running a game class which runs with the default loop (which manages the winforms and game).

I absolutely need the XNA technology here, because it should "preview" something from the game and using System.Drawing could change the outcome. The program also could get used by clients so a normal powered graphic card should be able to deal with it.

sentences:
In a scrolling 2D game, should the objects move or should the camera move? I'm new to game design and don't really know how things are done. I'm thinking of building an iOS game where a ship has to fly as high up as possible (at variable speeds), collecting power ups, et cetera, on the way.

What is the way to go here? Should the background and items scroll down from the top or should the ship really fly up moving the view with it?

sentences:
Multisampled Nearest Filtering in PS 2.0 is it possible? My game involves blocky, pixelated 3D textures. When using nearest neighbor filtering with a texture sampler, I get the desired result of nicely pixelated textures -- with the caveat that hard lines between pixels are aliased. Here's a screenshot of what I mean:

See the jaggies?

I'd like to know if I can use some kind of screen-space multisampling to fix these jagged edges. I'm using HLSL and pixel shader 2.0. Is it possible to accomplish this in the shader? (Note that MSAA does not work in this case because the aliasing is in the texture sampler, not in rasterizing geometry).

sentences:
Positioning ropes equidistantly on a landscape display I would like to render 4 similar ropes in my game that are equidistant on a landscape mode display.

How can I proceed? My screen is 1920*1080, at 420 dpi.

Is there any way that I could link the ropes coordinates with pixels or is there another way?

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:
How to calculate the Screen Position of a bounding sphere/box? Synopsis:  What I have is an object rendered on the screen.  I need to calculate the top-left / bottom-right of it's location on the screen in Screen Coordinates.

Explanation:  The object is basically a box that I'm trying to draw sprite textures into at specific locations, but due to the screen resolution being a variable (dependent on player settings), I can't hard-code in these translations.  So what I need to do is find out what the bounding box of the object is in Screen-Coordinates.  Once I know the bounding box, I can calculate the offsets to the positions within it.

I can calculate the center position of the box already with a function I scavenged:

public Vector2 GetScreenPoint(Matrix objMatrix)
{
    Matrix mat = objMatrix * mCamera.mViewMatrix * mCamera.mProjMatrix;
    Vector4 v4 = Vector4.Transform(new Vector3(0, 0, 0), mat);
    return new Vector2((int)((v4.X / v4.W + 1) *
        (pGame.GraphicsDevice.PresentationParameters.BackBufferWidth / 2)),
        (int)((1 - v4.Y / v4.W) *
        (pGame.GraphicsDevice.PresentationParameters.BackBufferHeight / 2)));
}

But now I need to go from that to the actual extents of the bounding box.  I've tried converting the BoundingSphere of the model into a BoundingBox and then translating the object matrix by the BoundingBox.Min values, but I'm nowhere near the left side of the object.

Am I going about this backwards, or what am I not seeing?  This would seem a simple enough thing to do, but I just can't figure it out.  Or is there a complete different way I should be approaching this?

sentences:
How to properly handle errors in a D3D11 framework? I'm writing a D3D11 framework and I'm trying to clean it up a little, and I'm unsure how to handle errors and return codes in my classes/code.

What is the "best" and cleanest way to implement error handling ?

Should I just use the HRESULT and other D3D types as return values for errors and such, or should I create my own types, or should I go with native c/c++ types ?

sentences:
Oriented Bounding Box - How to? I've been trying to write my own collision code, less because I want to, more because I want to understand its working.

To do this, i've been working off of the popular collision book i'm sure you've all heard of: Morgan Kaufmann Real Time Collision.

I'm on the subject of Oriented Bounding Boxes. These are boxes that can have an orientaiton applied to them.
If it matters, i'm doing my code in 2D. It seems easy enough to just cut out an axis from the books calculations.

Here is the OBB they define:

// Region R = { x | x = c+r*u[0]+s*u[1]+t*u[2] }, |r|<=e[0], |s|<=e[1], |t|<=e[2]
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
};

The confusing one is the Vector array, u.

Point c is the center 3 axis position of the box.
Vector e is the width, height, and length of the box.
Vector u[3] baffles me. My best guess is that it is the center-point of each of the 3 sides (with the reflected 3 finishing the box)

How does rotation work into this? Is the Vector u[3] taking the roation in somehow? How?

sentences:
Calculate evenly distributed points along a curve I'm using this equation to calculate a series of points along a quadratic curve:

// Returns a point on a quadratic bezier curve with Robert Penner's optimization of the standard equation
result.x = sx + t * (2 * (1 - t) * (cx - sx) + t * (ex - sx));
result.y = sy + t * (2 * (1 - t) * (cy - sy) + t * (ey - sy));

Sadly the points are unevenly distributed, as you can see in the dashed-line rendering below. The points are denser in the middle of the curve, and are further spaced apart near the edges. How can I calculate a evenly distributed set of points along a quadratic bezier curve?

Please note that I'm using this for rendering a dashed line, so a slow solution in MATLAB or something will not do. I need a fast solution that will fit inside a renderer. This is not for research or a one-off calculation!

Edit: I'm not asking how to accomplish the above. The above is MY RENDERING! I already know how to estimate the length of a bezier, calculate the number of points, etc, etc. What I need is a better bezier point interpolation algorithm since the one I have calculates points unevenly distributed along the curve!

Edit: Code in any language will do! My game runs in JS but I can port anything.

sentences:
Use a different target framework version in a unity c# project, other than 4.6 I'm using a dll in my project which is built against a higher target framework (4.6.1 actually)

I can't build or attach to Unity because of this. Visual Studio shows this error:

The primary reference "MQTTnet" could not be resolved because it was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.6".

The only option in player settings in Unity for API compatibility level is .NET 4.6

how can I change that to 4.6.1 in order to be able to build or attach to 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: SDL deleting an image from the screen? Well, I'm sort of a beginner to SDL, and I was wondering how one would go about deleting an image from the screen and replacing it with another? I attempted to do this, but it didn't seem to change it, how would someone with more experience than me go about doing it?

sentences:
unbelievable strange problem in unity android build - texture and frame Suddenly the texture quality of Unity Android Build and the frame of the game was greatly degraded.

See the picture A and B. In image A the center lines on the road are sharper, but B is blurred. I want my game to look like A, not B.

What is surprising is that you can roll back the project to the point where it worked and then run the apk build again.

In the above picture, A is a screenshot of a normal time. I have installed apk backed up at that point.

B is a screenshot of when I built A after I rolled back the Unity project at the build time.

Both are the same project, but the build output is different. (Of course not good ...)

Of course I did not touch Unity, Java, Android SDK etc at the same time.

Of course, there is no configuration change on the testing phone as well.

It's just like this all of a sudden.

I even reinstalled the PC this morning.

I still have this problem.

Even if you build on a separate PC, you're having the same problem.

I build a project at another pc, mac book pro, but problem is still there.

Of cause, I factory-reset my test phone, but problem still there.

Test phone is Samsung Galaxy S4.

build environment is Windows 10, Unity 2017.

sentences:
Strange problem with rotation missile | unity3d - c# I have a vertical missile with launcher that should find closest target and fire it's rocket to hitting target!

I use complete code of this 12min tutorial for launching my rocket, and the different between mine and its about the direction of rocket, mine is vertical and its horizontal!

homingMissile.velocity = transform.forward * missileVelocity;
Quaternion targetRotation = Quaternion.LookRotation(target.position - transform.position);
homingMissile.MoveRotation(Quaternion.RotateTowards(transform.rotation, targetRotation, turn));

After running the code, the rotation of my rocket change from (0,0,0) to (-8
.3,-4.7,0)!!!! and just change a little while hit target and explosion do.

In fact my rocket move to target in right path, but in wrong rotation!, in STRANGE!

Standby Rocket

Moving to Target

Anyone can help me for this problem?

sentences:
problem on enable and disable GameObject I'm trying to enable and disable GameObject (canvas) using this code:

public int canvaslevel = 1;
public GameObject one;
public GameObject two;
public GameObject three;

void Update(){
    if(canvaslevel=1){
        one.SetActive(true);
        two.SetActive(false);
        three.SetActive(false);
    }
    if(canvaslevel=2){
        one.SetActive(false);
        two.SetActive(true);
        three.SetActive(false);
    }
    if(canvaslevel=3){
        one.SetActive(false);
        two.SetActive(false);
        three.SetActive(true);
    }
}

but it doesn't work!!!

error:

  Cannot implicitly convert type int' tobool'

sentences:
Rotating a GameObject around its center I'm trying to rotate a GameObject that consists of several cubes around its center of gravity on an axis.

When using transform.Rotate(), it rotates around its pivot point (as shown in picture 1) and not its center of gravity as I want (picture 2). How can I achieve this rotation?

Picture 1:

Picture 2:

sentences: Play streaming sound in OpenTK? What's the simplest way to make a sound stream from disk and play in OpenTK?

sentences:
BoxCollider2D fails verification, where CircleCollider2D does not I have a 2D game object with no parent and a 2D box collider set with trigger enables. The dimensions are quite large.

When I place the game object in the scene, manually, it works just fine. However, when I instantiate the prefab, it doesn't work; in the inspector view, under the collider component a notification appears:

  The collider did not create any collision shapes as they all failed verification. This could be because they were deemed too small or the vertices were too close. Vertices can also become close under rotations or very small scaling.

When I switch to scene view, while the game is in play mode, I can not see the collider boundaries. Surprisingly, everything works fine, if I use the circle collider.  Does anyone know what the problem could be?

sentences:
Determine the z coordinate of a deformed plane based on uv (xy) coordinates I am using a formula to turn the following texture

into what looks like two 3 dimensional planes

The formula I am using for the texture deformation is

float2 texUV = float2(uv.x / abs(uv.y), (1.0 / abs(uv.y)));

Based on the deformation equation above, how can I work out a value for z on the surface of the plane at any given uv (xy) coordinate?

sentences:
How can I get into the educational market? I believe that my current game project is very well-suited for educational gaming; so well-suited, in fact, that I know of several different schools (one community college and at least one or two high schools) that have used versions of it at some time or another. And that's without any such marketing on my part.

I'd like to expand on this part of the potential user base. But I have absolutely no experience in dealing with school administrations. How can I break into this market enough to be noticed?

And on a side note, could marketing the game as educational kill the gamers market?

sentences: How likely will I be able to get a job in game design with a masters in computer programming? I'm currently attending college and am almost finish with my Bachelors in Computers science.I plan on getting my masters in computer programming in hopes that it will help me get into game design. If not I at least will have a fallback plan in any other IT related field. I'm just curious as to how likely it is to happen for me.

sentences:
Help with transform.lookat and camera? Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
transform.LookAt(mousePos);

This will actually make the camera follow the mouse, but it goes crazy, the camera seems to spin in circles rapidly : here is actually a gif of what is happening. https://gyazo.com/952da6c28e644b7b0e6500a597b6804e/preview Could anyone help me figure how how to fix it?

sentences:
How can i load a level in my gameengine wich is larger than 2GB? C# i were asking myself how could i load a large Level? My gameengine is written in C# and is rendering with Direct3D11. I just have my class called "Scenery" and the class is able to store all objects in a level (sceneryObject) with their components and features. My engine loads the serialized scenery, but i know that the maximal size of a .net object is 2gb. So how could my Scenery class load bigger levels? The .Scenery class contains a List with all the objects, and the Assets are included within the sceneryClass.
Do you thinkthe Scenery class should not include the Assets, and they should be stored extern?

Maybe somebody have a suggestion :)

Best Regards and thanks in advance!

sentences:
Having trouble running OpenGL on MSVC I'm using the  OpenGL Programming Guide, 8th Edition with MSVC 2013 but I can't get the triangles.cpp file to run.

These are the errors popping up:
http://puu.sh/jAokn/c07420cf46.png

sentences:
XNA Per-Polygon Collision Check I'm working on a project in XNA for WP7 with a low-poly environment, my problem is I need to setup a working per-polygon collision check between 2 or more 3d meshes.

I've checked tons of tutorials but all of them use bounding-boxes, bounding-spheres,rays etc., but what I really need is a VERY precise way of checking if the polygons of two distinct models have intersected or not.

If you could redirect me to an example or at least give me some pointers I would be grateful.

sentences:
UE4 - Event Tick and getting Forward Vector I'm trying to make a game where my character rotates towards cursor (that works). He can choose between a few weapons (also works). One of the weapons works like a machine gun. My idea was to make a simple solution with:
Event tick -> gate (opened by pulling LBM and closed by releasing it) -> gate (closed after firing and opened after some delay) -> spawning projectile which leads to a sequence that closes / opens the second gate.

It doesn't work perfectly. The projectile spawns with the right scale and location, but the rotation is always pointing straight forward.
If the exactly same blueprint is attached to anything else (straight up to the LMB pull or a timer), it works perfectly. However, doing the LMB pull defeats the whole purpose, as it's not a machine gun any more, and timer... is less then perfect I believe. I liked my solution using gates but it just doesn't want to work.
For example, this bit works with no problem (even though the spawning and rotation code is literally copy pasted):

Does anyone have an idea on how to fix this?

sentences:
Cocos2d rotating sprite while moving with CCBezierBy I've done my moving actions which consists of sequences of CCBezierBy. However I would like the sprite to rotate by following the direction of the movement (like an airplane). How sould I do this with cocos2d?

I've done the following to test this out.

    CCSprite *green = [CCSprite spriteWithFile:@"enemy_green.png"];
    [green setPosition:ccp(50, 160)];
    [self addChild:green];

    ccBezierConfig bezier;
    bezier.controlPoint_1 = ccp(100, 200);
    bezier.controlPoint_2 = ccp(400, 200);
    bezier.endPosition = ccp(300,160);

    [green runAction:[CCAutoBezier actionWithDuration:4.0 bezier:bezier]];

In my subclass:

@interface CCAutoBezier : CCBezierBy

@end

@implementation CCAutoBezier

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }

    return self;
}

-(void) update:(ccTime) t
{
    CGPoint oldpos=[self.target position];
    [super update:t];
    CGPoint newpos=[self.target position];

    float angle = atan2(newpos.y - oldpos.y, newpos.x - oldpos.x);
    [self.target setRotation: angle];
}

@end

However it rotating, but not following the path...

sentences:
Sorting a vector using array version of quick sort I'm coding  a simple rendering engine using OpengGL and I wrote a class that manages a particle system. The class creates the particles and pushes them into a vector to be used by a renderer to draw them on screen. I need to order the particles from the farthest to the nearest to the camera (in order to solve problems with alpha blending and depth, having disabled depth testing for transparency), so I tried with the following code:

void ParticleRenderer::render()
{
    // prepare renderer
    .....
    // update particle state (position,ecc..) and remove it if necessary
    // update returns a bool indicating if particle is still alive
    while (it != mParticles.end())
    {
        if (!(*it)->update())
        {
            delete *it;
            it = mParticles.erase(it);
            if (it == mParticles.end())
                break;
            else
                continue;
        }
        it++;
    }
    if (mParticles.size() > 0)
        sortParticles(&mParticles[0], 0, mParticles.size() - 1);
    for (Particle *particle : mParticles)
    {
        .....
        // render particle
        .....
        std::cout << getCameraDistance(particle) << std::endl;
    }
    std::cout << "*************************************" << std::endl;
    mShader.unuse();
    glDisable(GL_BLEND);
}

void ParticleRenderer::sortParticles(Particle **particles, int low, int high)
{
    if (low >= high)
        return;
    Particle *temp = particles[low];
    while (true)
    {
        while (compareParticles(temp, particles[high]) >= 0 && low < high)
            high--;
        if (low == high)
            break;
        else
            particles[low++] = particles[high];
        while (compareParticles(temp, particles[low]) < 0 && low < high)
            low++;
        if (low == high)
            break;
        else
            particles[high--] = particles[low];
    }
    particles[high] = temp;
    int middle = high;
    sortParticles(particles, low, middle - 1);
    sortParticles(particles, middle + 1, high);
}

double ParticleRenderer::compareParticles(Particle *particle1, Particle *particle2)
{
    return  getCameraDistance(particle1) - getCameraDistance(particle2);
}

double ParticleRenderer::getCameraDistance(Particle *particle)
{
    glm::vec3 distance = mCamera.getPosition() - particle->getPosition();
    return glm::length(distance);
}

but what I get on the console are all unsorted particles (the cout statement) and of course I have problems when the particles are rendered on screen.
Am I missing something?

I know I could use std::sort and the STL algorithms, but since I'm learning I would like to know what I am doing wrong.

sentences:
Assigning sprite to a sorting layer through scripting I have few prefabs with sprites which I want to assign to different sorting layers. How can I do it?
 I am also wondering if sorting layers matter if I use a perspective camera. Do they?

sentences:
Problem creating levels using inherited classes/polymorphism I'm trying to write my level classes by having a base class that each level class inherits from...The base class uses pure virtual functions.

My base class is only going to be used as a vector that'll have the inherited level classes pushed onto it...This is what my code looks like at the moment, I've tried various things and get the same result (segmentation fault).

//level.h
class Level
{
  protected:
    Mix_Music *music;
    SDL_Surface *background;
    SDL_Surface *background2;

    vector<Enemy> enemy;

    bool loaded;
    int time;
  public:
    Level();
    virtual ~Level();

    int bgX, bgY;
    int bg2X, bg2Y;
    int width, height;

    virtual void load();
    virtual void unload();

    virtual void update();
    virtual void draw();
};
//level.cpp
Level::Level()
{
  bgX = 0;
  bgY = 0;
  bg2X = 0;
  bg2Y = 0;
  width = 2048;
  height = 480;

  loaded = false;
  time = 0;
}
Level::~Level()
{
}
//virtual functions are empty...

I'm not sure exactly what I'm supposed to include in the inherited class structure, but this is what I have at the moment...

//level1.h
class Level1: public Level
{
  public:
    Level1();
   ~Level1();

    void load();
    void unload();

    void update();
    void draw();
};
//level1.cpp
Level1::Level1()
{
}
Level1::~Level1()
{
  enemy.clear();

  Mix_FreeMusic(music);
  SDL_FreeSurface(background);
  SDL_FreeSurface(background2);

  music = NULL;
  background = NULL;
  background2 = NULL;

  Mix_CloseAudio();
}

void Level1::load()
{
  music = Mix_LoadMUS("music/song1.xm");
  background = loadImage("image/background.png");
  background2 = loadImage("image/background2.png");

  Mix_OpenAudio(48000, MIX_DEFAULT_FORMAT, 2, 4096);
  Mix_PlayMusic(music, -1);
}
void Level1::unload()
{
}
//functions have level-specific code in them...

Right now for testing purposes, I just have the main loop call Level1 level1; and use the functions, but when I run the game I get a segmentation fault.  This is the first time I've tried writing inherited classes, so I know I'm doing something wrong, but I can't seem to figure out what exactly.

sentences:
Repelling a rigidbody in the direction an object is rotating Working in Unity, I have a game object which I rotate each frame, like so:

void Update()
{
    transform.Rotate(new Vector3(0, 1, 0) * speed * Time.deltaTime);
}

However, I'm running into problems when it comes to applying a force to rigidbodies that collide with this game objects sphere collider. The effect I'm hoping to achieve is that objects which touch the collider are thrown in roughly the same direction as the object is rotating. To do this, I've tried the following:

Vector3 force = ((transform.localRotation * Vector3.forward) * 2000) * Time.deltaTime;
collision.gameObject.rigidbody.AddForce(force, ForceMode.Impulse);

Unfortunately this doesn't always match the rotation of the object. To debug the issue, I wrote a simple OnDrawGizmos script, which (strangely) appears to draw the line correctly oriented to the rotation.

void OnDrawGizmos()
{
    Vector3 pos = transform.position + ((transform.localRotation * Vector3.forward) * 2);
    Debug.DrawLine(transform.position, pos, Color.red);
}

You can see the result of the OnDrawGizmos function below:

What am I doing wrong?

sentences:
Unity transform.rotation not giving real value i confused , when the object is at 0 rotation ( not rotated yet )  , it giving real value ( 0 ) , but when the object is rotated 180 degree , transform.rotation is giving false value ( 1 ) , this is the screenshot :

If the picture is not clear enough , go here https://i.stack.imgur.com/miWIE.png .

Then this is my script that debugged the code and rotate the object :

void RotateFlip() {
    GameObject databasegameobject = GameObject.Find ("database");
    database databasechange = databasegameobject.GetComponent<database>();
    Debug.Log ("current object rotation is " + theiconarrow.transform.rotation.z + " degree ");
    if (databasechange.pengertianmenustate == 2) {
        if (theiconarrow.transform.rotation.z == 0 ) {
            theiconarrow.transform.Rotate (new Vector3 (theiconarrow.transform.rotation.x, theiconarrow.transform.rotation.y, 180), Space.World);
        }

    }

    if (databasechange.pengertianmenustate == 1) {
        if (theiconarrow.transform.rotation.z == 180) {
            theiconarrow.transform.Rotate (new Vector3 (theiconarrow.transform.rotation.x, theiconarrow.transform.rotation.y, 180), Space.World);
        }
    }
}

I don't understand why this thing happened , is this a kind of bug or what ?

I am sorry if this already asked somewhere , but i just don't know how to find it at search engine ( neither here ) .

Extra question ( optional ) : is there any application to build app with easy coding and not an game engine ?

sentences:
Update and Render logic with interpolation I am working with C and SDL2 and just wanted some insight as to how to properly apply interpolation to the rendering.

EDIT - some clarification, update() input() and render() are just hypothetical stubs, the real code is messy and long as I learn SDL2.

while (!quit) {
    current = SDL_GetTicks();
    elapsed = current - previous;
    previous = current;
    lag += elapsed;

    input();

    while (lag >= ms_per_update)
    {
        update();
        lag -= ms_per_update;
    }

    interpolation = (float)lag / (float)ms_per_update;

    printf("Interploation: %f\r\n", interpolation);

    render(interpolation);
}

This is something that has always kind of baffled me -

lets say that in update() if SPACE pressed we start a jump animation and movement. So sprite.y += 2 to move it.

Where does that movement of one pixel happen? Does it happen in update()?

If the movement happens in update() then how do i properly apply the interpolation in render() since my item has already been moved (during the update)?

Lets say i have a bullet at (x=10, y=10)
It's velocity is 10 pixels per update.
use clicks button to shoot
first update bullet is moved to (x=20, y=10)
render(interpolation) // lets say it is 0.5) // lots of on screen lag from awesome effects
second update bullet is moved to (x=30, y=10)
third update bullet is moved to (x=40, y=10)
render(interpolation) // lets say it is .09 from lots of lag

How is the interpolation value applied to the bullet so that it appears to pass smoothly across the screen.
What information is known during render to apply the interpolation? Would a struct containing the origin point, current velocity (or amount moved since last render), and current location suffice?

sentences:
Is it better to make a cpp and hpp file for every new object or is it better to make one parent class and define types in there? Let's say we make a game. The game has items, enemies, allies, etc and there are multiple of them, like zombies and robots as enemies. Do you think it would be better to make one parent class called "Enemy" (and the corresponding cpp/hpp files) and making a class for each enemy (zombie or robot in this example) and making 2 files per enemy or would it be better to make an enumcalled "type" in the Enemy class and having all child objects in that one class?

Thank you for your help!

sentences: How to Load PDF file in runtime using PDF Renderer Asset in unity? Hello Guys : I am working in Unity PDF Renderer. I will purchased that Asset but i need to Know, How to load PDF file one by one in run time in File path mode but old PDF File will remove and Load new PDF file in run time. can any one help

sentences:
Do I need a company name to publish on Google Play? I'm going to upload my Android mobile game on Google Play. But it seems like all games are developed by companies(such as Zynga, and King) and I don't see individual's names as developers. Do I need to register a company name officially? I think it costs a few hundred dollars... If I have to, how and where do I register? or instead of registering a company for a few hundred dollars, if I make a domain website that is named as my company name, would it provide me some protections?
Also, do I need to trademark my game's title as well?
Thanks!

sentences:
Partial mesh culling by checking against the AABB-tree of objects vertices instead of only the AABB of the whole objects First thing: this is more of a conceptual question than an implementation oriented one, but still tips about implementation will be very much welcome if you happen to have any (athough I have some experience programming different parts of games, graphics are certainly my weak spot - as you will see).

So, I have an application in which all high-poly objects have their vertices grouped in an object-specific AABB-tree to speed up the narrow-phase of collision detection. Now, it occurred to me the following. Since that structure is already in place, would it be possible to use it for culling parts of objects instead of the usual all-or-nothing approach of the frustum and occlusion culling techniques?

The idea for that is simple in concept. Instead of testing for visibility only using the whole objects' AABB, I would do that first but in the positive cases I would proceed to visibility checks of the sub-AABBs containing that object's vertices. Once identified the sub-AABBs that are visible, only the triangles that are contained in these sub-AABBs would be sent to the GPU for rendering.

Therefore, in a more systematized way, my three related questions are:

1) is such an approach even possible in what regards the way GPU gets and processes the mesh geometry information pulled from CPU?

2) given that in such scenario the CPU would have to break the meshes somehow and pass to the GPU only the vertices that were identified as being in the visible parts of the visible objects, wouldn't that pose additional load on the processing time such that the cost would overcome the gains?

3) most importantly, passing to the GPU only some triangles of a mesh could cause graphically distorted results when shader and texture are rendered for that partially-only rendered object?

I searched quite a bit for academic references on this subject but came almost empty. I would gladly welcome reading suggestions of any sort.

sentences: How is a 3d perlin noise function used to generate terrain? I can wrap my head around using a 2d perlin noise function to generate the height value but I don't understand why a 3d perlin noise function would be used. In Notch's blog, http://notch.tumblr.com/post/3746989361/terrain-generation-part-1, he mentioned using a 3d perlin noise function for the terrain generation on Minecraft. Does anyone know how that would be done and why it would be useful? If you are passing x,y, and z values doesn't that imply you already have the height?

sentences:
What are the benefits of using a 2D game engine on Android? I have thought about just coding a 2D game on Android using just pure Java and the Android SDK, no engines like libdgx, cocoa-2dx attached. I don't know if I really need to use a game engine or not. Doesn't Java already come with basic libraries and APIs for most things already?

I'm not interested in the cross-platform aspect of game engines. The game is 2D, so there's no complex issues with 3D, importers, or what not. I also don't like to have to code around level editors or pre-built constructs like a character or tile class.

Given this, are there any other benefits for me using a game engine to code my Android 2D game? For example, I'm clueless with OpenGL so if I'm doing it w/o an engine I would be using pure Java, would that be significantly slower than using an engine like libgdx?

sentences:
Frame Skips in MonoGame I'm developing a 2D game using MonoGame. I've got a square on the screen I can move around. The problem is that about once a second, the square jumps a bit. Using a frame counter I found here I've concluded that my FPS drops from 59.9988 to either 59.3988 or 59.6988. It's skipping frames.

I've tried googling and searching forums for hours but can't find a solution. I've commented out everything in the Draw method of the Game class except for the frame counter and it still happens. I even tried creating an entirely new MonoGame project with nothing in it except the frame counter and still I would get the frame skips.

Setting IsFixedTimeStep = true does not fix the issue. I do get higher frame rate, but also not as high as I would expect (not higher than ~100). I've looked at the diagnostic tools and there is no garbage collection going on (no yellow triangles).

I am completely at a loss. If anyone has any insights to offer, it would be much appreciated.

sentences:
LibGDX Textfield has no pointer cursor or blinking on hover / focus stage = new Stage(new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    Gdx.input.setInputProcessor(stage);
    TextField.TextFieldStyle style = new TextField.TextFieldStyle();
    style.font = font;
    style.fontColor = Color.BLACK;
    style.cursor =
    style.selection = new Image(new Texture("core/assets/skin/textfield-big.png")).getDrawable();
    style.background = new Image(new Texture("core/assets/skin/textfield-big.png")).getDrawable();
    text = new TextField("Name", style);
    text.setWidth(500);
    text.setHeight(37);
    text.setPosition(50, 50);
    stage.addActor(text);

When I draw my stage, I can see my textfield, but when I hover it, my cursor doesn't change, and when I focus I can't see that blinking " | " at all, like normal textfields have.

What did I do wrong? Is it because style.cursor is null? If yes, how can I set it to the default cursor that libgdx uses?

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:
Scaling a game world both for realism and for mechanics I am currently working on a turn-based 4X game, and one of the things I quickly ran into was a question of scaling. On one hand, I want things like realistic sizes (having some idea of what each tile represents in terms of area), but on the other hand, doing so would limit me in terms of certain mechanics I want to implement (the size of a realistic city would not even occupy a tile, let alone multiple tiles, a mechanic I want to use).

How would I go about scaling the world so that I can have both realistic scaling AND the mechanics I want?

Some things I have considered:

Changing the size of the world. Nothing says that I have to have this take place on an Earth clone (especially with randomly generated terrain). Smaller worlds might allow the detailing I'd need for the cities without having unrealistic tile sizes.

Foregoing the realism: Something that came up while I was researching was that ancient cities were tiny by today's standards. Ancient Rome (the part encompassed by the Aurelian Walls) was only 5.3 square miles (for comparison, Manhattan is 22.96 square miles- enough to fit four Romes). I could forgo the realistic sizes of cities and make them the size I want for my mechanics.

Not including the entire world: Depending on the time-period I end up basing this off of, it may be pointless to include areas that effectively did not exist.

What is the best way to balance realism and mechanics for the scaling of a game world?

sentences:
What would be a good game making engine supporting Vector images? I want to create a simple platforming game, in which you are a square in a wonderful world. I would like this game to be able to be played in browsers. Basically I am searching for something similar to "Flixel", but with the following features:

Support Vector Graphics
Allow zooming/rotating objects without producing huge amounts of lag as soon as you are using more objects. (Because I want to rotate the map around the player) So in other words, preferably zoom the viewport/camera instead of the objects themselves.

Does an engine like that exist?

sentences:
Why doesn't this ContentLoader project (VS2010 e) recognize Microsoft.Build.dll? I am working with an XNA content loader sample. In the references for the project (VS 2010 Express) there are:

Microsoft.Build
Microsoft.Build.Framework

//as well as the standard XNA framework and graphics references

To emulate this project, I am trying to first add a reference to Microsoft.Build.dll. But Visual Studio warns me that it cannot load the .dll. I looked at MSDN and the document referenced Microsoft.Build.Evaluation. This is suppose to be available in the Microsoft.Build.dll and then I'll have access to the Project class.

Has anyone had any experience with this?

sentences:
Any way to embed Pygame in webpages? I have a Pygame game, and I was wondering if there was any way to embed it into a webpage to make it easily playable, or if there is a games website that accepts Pygame games.

EDIT: I am now using Unity and am not after the answer anymore, but please answer if you want as it could help others.

sentences:
Pseudo-magnet implementation with chipmunk How should I go about implementing "natural" magnet on a certain body in chipmunk space? Context is of simple bodies lying in the space (think chessboard). When one of the figures is activated as a magnet - others should start moving towards it.

Currently I'm applying force (cpBodyApplyForce)to the other figures with vector calculated towards the activated figure. However this doesn't really feel "natural". Are there any known algorithms for imitating magnets?

sentences:
Need physics algorithm for modeling ceiling collapse in voxel-based game I'm looking for algorithms on how to model the physics of cave-ins/collapses for a game idea I am working on. The game allows the player to extensively mine 3D voxel-based asteroids, and I want areas that are insufficiently supported to collapse under their own weight. Making the problem even more challenging, gravity will be non-uniform (the direction it pulls will depend on where a given voxel is in relation to the asteroid's center of mass), and the number of voxels in the asteroid will be too large to model them all individually (I am using a sparse voxel octree to model the asteroid).

Hopefully, someone will be able to provide links to articles discussing suitable algorithms, or can provide ideas on how to solve the problem. If you need more details, please ask.

Edit 1: It does not need to be very accurate, I'm looking for something that would be a reasonable approximation for a Minecraft or Dwarf Fortress style game. I am mostly interested in how to determine where sections should break off when blocks are added or removed, moving the bodies after they break isn't part of this issue.

Edit 2: My initial idea was to calculate the force on each block then iteratively distribute the forces amongst neighbors. However, this would require an entry for each block, while only blocks on the surface have entries in the data structure. Modeling all blocks on the scale I want would likely be prohibitive - I would like to have bodies of at least 10,000,000 voxels, of which 200,000 will be on the surface and need to be stored.

sentences:
How to avoid game starting before start button is clicked? I've made a game with a Title Screen (Canvas), and a Start Button attached to the Title Screen. Points, GameOver, Restart, and even the Start Button sort of works, but it's possible to play the game before the user presses start.

Is there a way to make the GameObjects only appear after the button is clicked? I've tried to move and change the "public void StartGame()", but I can't get it right.

This is my first game ever, so hope the code provided is relevant.

Enemy.cs

 void Start()
{
        enemyRb = GetComponent<Rigidbody>();
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        player = GameObject.Find("Player");
}

GameManager.cs

 public void StartGame()
{
    powerup.transform.rotation);
    score = 0;
    UpdateScore(0);
    isGameActive = true;
    titleScreen.gameObject.SetActive(false);
}

void Update()
{
    enemyCount = FindObjectsOfType<Enemy>().Length;

    if (enemyCount == 0)
    {
        roundNumber++;
        SpawnEnemyIntruders(roundNumber);
        Instantiate(powerup, GenerateSpawnPosition(), powerup.transform.rotation);
    }
}

void SpawnEnemyIntruders(int enemiesToSpawn)

{
  for (int i = 0; i < enemiesToSpawn; i++)
  {
      int enemyIndex = Random.Range(0, enemies.Length);
      Instantiate(enemies[enemyIndex], GenerateSpawnPosition(), enemies[enemyIndex].gameObject.transform.rotation);
  }
}
public void GameOver()
{
    restartButton.gameObject.SetActive(true);
    gameOverText.gameObject.SetActive(true);
    isGameActive = false;
}

PlayerController.cs

    void Start()
{
    playerRb = GetComponent<Rigidbody>();
    playerAudio = GetComponent<AudioSource>();
}

StartButton.cs

    void Start()
{
    button = GetComponent<Button>();
    gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
    button.onClick.AddListener(StartThis);
}

sentences:
Implementing Client-Server Delta Compression (with Protobufs) I am writing a 2D real-time RPG in C# and I am trying to implement client-server communication using protocol buffers. I am trying to figure out how to implement delta compression to reduce message sizes.

I have read the protobuf "optional" fields take up no extra space on the wire when they are not set (obviously they still do in local memory though), so if I can just programmatically determine my deltas efficiently I would be in better shape.

Here's the problem. I can think of a few ways, but none seem to be ideal. I was wondering if someone could point me in the right direction.

Try to keep a dirty bit array for EACH message-able class that gets cleared when a message is sent and marked when a variable changes. Then to send a message you just send the members that match the Boolean fields. This has LOW maintainability, but probably decent performance.
Every message-able class keeps a "pastMessage" member that gets updated saved when a message is sent. Then just serialize your current state and diff the two messages. This would probably have LOW performance and almost DOUBLE memory overhead for the game types..
Create a new message every time a message was sent and "fill-in-as-you-go." This would provide a better performance than the above, but still would essentially double my memory overhead on my server.

Any other ideas?

sentences:
Unity2D: Proper way to implement ladder climbing with a raycast controller? I originally posted this on Stack Overflow, but was told I might have more luck here:

I've been slowing grinding out programming features for my character controller, and one of the last things to implement is ladder climbing. The code I've come up with over the past 2 days mostly works, but presents some issues:

Sometimes the character bounces after climbing while holding the up arrow, at the point with which a 1-way platform meets the end of the ladder.
Once the character is all the way up, resting on the 1-way platform, it cannot go back down. This can be remedied with a longer ladder collider, but that makes issue #1 worse.
If the character is on the ground near a ladder and jumps, but presses the up arrow at the very last second, it gets flung considerably far in a certain direction.
If the character is on a rope and jumps off the rope, but holds the up arrow before doing so, it goes slightly higher, but is noticeable. Not holding the up arrow, but rather just pressing the left or right arrow and jumping, yields a regular jump. Perhaps this has something to do with the x or y input axes?

The way my classes work is that I have a Controller2D class which handles most of the raycasting stuff and movement methods, a Player class for input that calls the movement methods, and a parameters class that sets default world parameters, like gravity and jump height, but can be overridden if the character is in a certain volume, such as water or a ladder collider (this allows me to set gravity to 0 while climbing so the character can move properly). Almost all of my ladder code is contained in the OnTriggerEnter/Stay/Exit functions, and I'm just not sure if this is the best way to do it.

I tried making a ClimbUp/ClimbDown method, and shooting a raycast from the center of the player, which would allow him or her to climb up, but this was not overly successful (there were too many issues compared to using OnTriggerStay).

I'm wondering if someone who has successfully implemented ladder climbing in a raycast controller, or anybody who might have advice, would be willing to point me in the right direction for this task.

Here's some of the script:

public void ClimbLadder(float y)
{
    ClimbingOnLadder = true;
    SetVerticalForce(y);
}

public void JumpWhileClimbing(float x)
{
    if (ClimbingOnLadder)
    {
        ClimbingOnLadder = false;
        overrideParameters = null;
        AddForce(new Vector3(x, Parameters.jumpVelocity * .70f, 0));
        JumpAfterClimbing = true;
        print(Parameters.jumpVelocity);
    }
}

private void OnTriggerEnter2D(Collider2D other)
{
    if (other.tag == "Ladder")
    {
        CanClimb = true;
    }
}

private void OnTriggerStay2D(Collider2D other)
{
    if (other.tag == "Ladder")
    {
        if (ClimbingOnLadder)
        {
            var newParameters = other.gameObject.GetComponent<ControllerPhysicsVolume2D>();

            if (newParameters == null)
            {
                return;
            }

            overrideParameters = newParameters.NewParameters;
            Debug.Log("overriding");

            if (ClimbingOnLadder && State.IsCollidingBelow)
            {
                ClimbingOnLadder = false;
                overrideParameters = null;
            }
        }
    }
}

private void OnTriggerExit2D(Collider2D other)
{
    if (other.tag == "Ladder")
    {
        CanClimb = false;
        ClimbingOnLadder = false;
        JumpAfterClimbing = false;
    }

    var newParameters = other.gameObject.GetComponent<ControllerPhysicsVolume2D>();

    if (newParameters == null)
    {
        return;
    }

    overrideParameters = null;
}

sentences:
Is it possible to change the position of a Farseer joint tie point? When I create a revolute joint in Farseer, then there is always a tie point in the center of each of the two bodies. Is it possible to change the position of a tie point?

For example:

I created a revolute joint but I want to change the tie point of the Windmillsail1 body. Is it possible to change the position of the point to the lower edge of the Windmillsail1 body? I marked the position of the lower edge with a red arrow.

My code:

Body Windmillsail1, Windmillball;
RevoluteJoint RevJointA,
List<Vertices> list = new List<Vertices>();
Vector2 _origin;
float _scale;

uint[] data = new uint[WindmillsailSprite.Width * WindmillsailSprite.Height];
WindmillsailSprite.GetData(data);
Vertices textureVertices = PolygonTools.CreatePolygon(data, WindmillsailSprite.Width, false);
Vector2 centroid = -textureVertices.GetCentroid();
textureVertices.Translate(ref centroid);
_origin = -centroid;
textureVertices = SimplifyTools.ReduceByDistance(textureVertices, 4f);
list = Triangulate.ConvexPartition(textureVertices, TriangulationAlgorithm.Bayazit);
_scale = 1f;
Vector2 vertScale = new Vector2(ConvertUnits.ToSimUnits(1)) * _scale;
foreach (Vertices vertices in list)
{
  vertices.Scale(ref vertScale);
}

Windmillsail1 = BodyFactory.CreateCompoundPolygon(world, list, 1.0f, BodyType.Dynamic);
Windmillsail1.BodyType = BodyType.Dynamic;
Windmillsail1.Mass = 10;
Windmillsail1.IsSensor = true;
Windmillsail1.Position = new Vector2(1.45f, 4.05f);
Windmillsail1.Rotation = MathHelper.ToRadians(0);
Windmillsail1.CollisionCategories = Category.Cat10;

Windmillball = BodyFactory.CreateCircle(world, 0.25f, 1.0f);
Windmillball.BodyType = BodyType.Static;
Windmillball.Position = new Vector2(1.63f, 4.64f);

RevJointA = JointFactory.CreateRevoluteJoint(world, Windmillsail1, Windmillball, new Vector2(0f, 0f));
RevJointA.MotorSpeed = MathHelper.PiOver4;
RevJointA.MotorImpulse = 100;
RevJointA.MotorEnabled = true;
RevJointA.MaxMotorTorque = 100;

spriteBatch.Draw(WindmillsailSprite, ConvertUnits.ToDisplayUnits(this.Windmillsail1.Position), null, Color.White, this.Windmillsail1.Rotation, _origin, 1.0f, SpriteEffects.None, 0f);

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: Can a game world be made using a 3D editor? I'm just wondering it it's possible to create and render a game world in a 3D modelling program, such as Blender, with landscapes and trees and such, and then import it into a game engine? Is that how open world games make their worlds, or do they use another method?

sentences:
timebased scoring algorithm for game i am developing a game where user has to find target number using 5 given numbers and 4 operators. the score depends on the type of operators and number of operators used and time.

score = typeOperators + noOfOperators + timeScore

where typeOperators is the sum of score for each type of operator, 1 pt for +,* 2 pt for -, and 3 pt for /.

if all the three operators are used once, typeOperators will be 13.
currently, i am thinking of

timeScore = max(0, x - timespent)

But, the game should avoid the situation where the user finding target number with worst solution but with minimum time gets higher scores.
so the more weightage should be on the typeOperators rather than timeScore.

can there be any better approach?

sentences:
Rotate mesh to normal I have some instanced geometry (basic tube meshes) laid out in a grid, and I have a noise texture (normal map) that I want to use to rotate my instances with.
So head pixel in my texture is a normal and I want to rotate each instance with the corresponding normal in a shader. How can I achieve that in a shader only?
Unless I am mistaking, there should only be a rotation around the X and Z axes.

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:
Where should I save game object's attributes (hp, score) in Swift? Scenario: I have a game with several game objects on screen. Each can have different score and hitpoints. When I use collision detection for cannonball vs. ship (example) I need to know which ship is hit and how much hitpoints it has.

Problem: I had several approaches from extending SKSpriteNode or SKPhysicsBody but all failed. SKSpriteNode doesn't work, because Swifts collision detection only returns physicsBody and since you can't extend physicsBody, it didn't work to save there ships attributes as well.

Question: What would be a good approach to save such data to my game objects? I do not need code - because I think I can write it myself - but I would be happy to read a good suggestion. But if you have already some code written and a good solution for this problem, I would not be angry to read it ;)

sentences:
Tracking Object Position - Firing on a Trajectory How can I calculate the position of an object after "firing" it from a fixed point?

I am to create a small game - most likely with canvas (pure HTML, JS based) or Adobe Flash - in which the player fires objects at other obstacles in order to clear them.

sentences:
Creating a frustum for culling in world-space glm matrices I need to do frustum culling where the bounding boxes are in world-space to determine which entities get to be updated/drawn. I was trying to use the classic projection/view matrix plane extraction method but it doesn't seem to work with perspective matrices created by GLM. Is this method appropriate for world-space culling? It seems like it would be (takes the eye position into account and the projection matrix shapes the frustum).

I've only looked at the near/far planes extract so far and they're wrong for a frustum sitting at the origin (Both have a c component that's negative which means near and far are facing the same direction). Also, since the d components can't match the near/far clipping values with this method is it wrong for world-space culling?

sentences:
Tiling perlin noise seamlessly, but without repeating to generate an infinite 3D world I have been working on a 3D game in java using LWJGL for a while now. I am trying to make procedurally generated infinite 3D terrain that is generated around the player.

So far I have:

3D terrain chunks that are loaded and unloaded when the player moves. These chunks are made up of triangles not quads, and are 128x128 vertices.
A Perlin noise class that can successfully generate Perlin noise. (I think it is actually something called value noise, but it works)
A world class that handles loading and unloading of chunks, and applying the height maps to the chunks.

All of this works as it is coded to do, but not how I want it to. I don't know how to tile the noise seamlessly.

How would I make the noise tile, and furthermore, how would I generate large structures such as mountains that occupy probably up to hundreds of chunks.

Here is what is currently happening with the chunks and noise not tiling:

Here is my Perlin noise code:

private float[][] perlinNoise(int width, int height, int octave, float[][] whiteNoise)
{
    float[][] result = new float[width][height];

    int samplePeriod = 1 << octave;
    float sampleFrequency = 1.0f / samplePeriod;

    for (int i = 0; i < width; i++)
    {
        int x1 = (i / samplePeriod) * samplePeriod;
        int x2 = (x1 + samplePeriod) % width;
        float xBlend = (i - x1) * sampleFrequency;

        for (int j = 0; j < height; j++)
        {
            int y1 = (j / samplePeriod) * samplePeriod;
            int y2 = (y1 + samplePeriod) % height;
            float yBlend = (j - y1) * sampleFrequency;

            float top = (float) MathHelper.interpolateLinear(whiteNoise[x1][y1], whiteNoise[x2][y1], xBlend);

            float bottom = (float) MathHelper.interpolateLinear(whiteNoise[x1][y2], whiteNoise[x2][y2], xBlend);

            result[i][j] = (float) MathHelper.interpolateLinear(top, bottom, yBlend);
        }
    }
    return result;
}

public float[][] generatePerlinNoise(int width, int height, Random random, int octaveCount)
{
    float[][] whiteNoise = new float[width][height];
    float[][][] totalNoise = new float[octaveCount][][];
    float[][] perlinNoise = new float[width][height];
    float amplitude = 1.0f;
    float totalAmplitude = 0.0f;
    float persistance = 0.5f;

    for (int i = 0; i < width; i++)
    {
        for (int j = 0; j < height; j++)
        {
            whiteNoise[i][j] = random.nextFloat() % 1;
        }
    }
    for (int i = 0; i < octaveCount; i++)
    {
        totalNoise[i] = perlinNoise(width, height, i, whiteNoise);
    }
    for (int o = octaveCount - 1; o >= 0; o--)
    {
        amplitude *= persistance;
        totalAmplitude += amplitude;

        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                perlinNoise[i][j] += totalNoise[o][i][j] * amplitude;
            }
        }
    }
    for (int i = 0; i < width; i++)
    {
        for (int j = 0; j < height; j++)
        {
            perlinNoise[i][j] /= totalAmplitude;
        }
    }
    return perlinNoise;
}

I think it would also be worth mentioning that I have asked about this on StackOverflow as well.

sentences:
Tilemap Collision w/ different height levels and directions I've been programming a final fantasy 6 clone in C# using Monogame and Monogame Extended, and have met on a few interesting challenges regarding tilemap collision.

The game seems to have different height levels on tilemaps, such as in the picture below where the bridge is on one height level and the ground on another. I'm using Tiled for my maps and have the bridge on it's own layer, and the ground on another. However, when it comes to collision, you shouldn't be able to for example walk up on the bridge and end up on the ground, which leads to the problem of collision detection. Collision for the ground level should be different than on another height level like the bridge, but I'm not sure what a good solution to handle that could be.

Since I'm using TiledMap from Monogame Extended, I can't really modify the Tile class to hold collision data. My initial idea was to have an extra object or tile layer for each height level to specify collision/solids for each height level, but I found that it wasn't very intuitive and that it was a little messy. Optimally I would only need one tile layer per height level, but I'm at a loss for any ideas on how to handle collision in a scalable and intuitive way, so I was wondering if anyone here had any ideas?

Another interesting problem is regarding tile collisions and directions. For example, when standing in front of the fence in the picture below, you should not be able to walk up and behind the fence. But, if you are standing one tile above the fence, you should be able to walk down and behind it, but once you are behind it you should not be able to walk down again and end up in front of it.

I think the solution to that problem is to define collisions on each edge of the tile, so that the bottom edge of the tile is marked as solid, while the other edges aren't. The main issue with that is that I have no idea how to implement something like that with Tiled. It also presents the problem of rendering, since the tile would need to be rendered below the player if the player stands in front of it, and above the player if the player stands behind it. I think using a Z-index would solve it, but again, I haven't found a way to implement that using Tiled. Soo, I was wondering if anyone has any ideas or pointers on how to use Tiled w/ Monogame + Monogame Extended to implement those things?

sentences:
Memory Management when changing Game States I am just wondering what are some of the issues of loading and freeing the memory every time player changes the game state?

Or is it better to load all the resources at once?

sentences:
Libgdx draw a sprite in top of an isometric tile I have this isometric map and im using IsometricTiledMapRenderer to render the map I have a OrthographicCamera. I know where each tile is in the isometric map, but the isometric map is kinda rotated?

So I was wondering how to convert Map Coordinates to Isometric and viceversa?

Here I tried to draw a color cube in each tile coordinates....

Thanks in advance, I have been struggling with this for 2 days, and my lack english vocabulary isnt helping with the research, please some one point me to something

sentences:
Is it legal to use elements of the outfit of a character in another game as an optional cosmetic in my own game? In my game, I plan on implementing various optional unlockable costumes, earned by collecting in-game items.  One hypothetical example of such a costume would be Banjo's (from Banjo-Kazooie) shorts, backpack, and shark-tooth necklace.  In trying to find the answer to this, I've found plenty of information about directly using Banjo himself (clearly illegal without a license), but I haven't found any form of direct answer when it comes to his outfit placed onto the main character.

The closest thing I've found to an answer are similar cosmetics being used in other games -- In TF2, for example, there's a hat that references Mario's hat, but replaces the M with an E, while in Terraria, there's a direct recreation of Mario's entire outfit.  Obviously, though, just because another company was able to do such a thing doesn't mean I necessarily will be able to as well.

Lastly, I'm not sure if it makes much of a difference, but it's also worth mentioning that the art assets used for these costumes would be entirely created by me in the image/likeness of the other characters' outfits -- obviously, ripping said assets from the games themselves would NOT be legal.  Also, I do plan on selling the game and making a profit on it.

Would creating these homage outfits be legal, or would it violate the copyright and/or trademark (not sure which applies) of the character?

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:
When does a Reference become Copyright Infringement? I've seen quite a few posts on here similar to my question, but I am still having doubts about my implementation of an Easter Egg.

In the background of my game, There is a bookshelf, purely for cosmetic purposes. Because it's got books in it, I wanted to have names on all the books, as references to either real-world books, or fictional books in media.

Some Examples:

Real World Books:(These ones all have the authors names included on the cover)

 I-Robot

 D&D Monster Manual

 Rendevous with Rama

Fictional Books:(No Authors, Because they're fictional)

 The Necronomicon (From many H.P Lovercraft Stories)

 The Enchiridion (From Adventure Time)

 Gray's Sports Almanac 1950-2000 (Back to the Future)

Books Imagined by Me:

 Graboid Hunting for Beginers (Graboids are monsters in Tremors, but this book does not exist in the movies)

 Aperature Science Employee Handbook (Aperature Science is the corporation from Portal, but this book does not exist in the games)

So, My question is, is it "acceptable" to simply mention names of real-world or fictional works in a background asset such as this? Or is even that going to far?
My confusion comes from the fact that i'm not using any of the writing or artwork from the works, simply stating the name of the title.

If someone could please give my some guidance on this, I would greatly appreciate it.

Thanks!

sentences: What is the "TangentsW" attribute inside the FBX file format for? sometimes it is -1, sometimes is +1. Do I need it for the rendering of the normal maps?

sentences:
How to make unitypackage from allseen alliance's android sdk? Im making an offline multiplayer for Android device by Unity and I found only one way to do this is the allseenalliance sdk. After download its from here I found that to use it I need to create an .unitypackage file but I cant understand the tutorial they give
> Open a CMD window.
>     Add the path to Unity.exe (the Unity IDE) to your PATH, if it is not there already.
>         For example, set PATH=%PATH%;C:\Program Files\Unity\Editor
>     CD to each "unity" folder in the SDK, and run the following command in each location:
>         Unity.exe -batchmode -nographics -quit -projectPath %CD% -exportPackage Assets AllJoyn.unitypackage
>     This command creates the AllJoyn.unitypackage file.

Please give me a noob tutorial for this or the package file, thanks.
p/s:Is there another way to connect mobile device without internet in unity3d?

sentences:
does cocos2d cache texture automatically I know if we want the textures cached we can use the sharedtexture manager to cache them, but since this is on mobile platform , why don't cocos2d-x just do this for all texture loads ?

when creating sprites with images, are these textures cached as well ?

sentences:
Tiles and a walkable path My game a sidescrolling platformer. I've created my own Tile app which in the end export an xml file detailing what each 32x32 space (in the entire image) contains (environment, platform, etc.). I get how to use it for static things/collision detection and quad trees and so forth but still have no clue how to use this map xml file for keeping my character on a path in my background image which in my case is a hill with lots of odd curves.

Also, yes, there are tutorials on tile movement, but they are mostly movement from a top-down view which is slightly more trivial to implement. 80% of the image in my game is just a pure background and the very bottom are bricks covered with grass with some weirder angles. The thing is, I can have mixed tiles of empty space and grass which contains a part of a curve so I don't know how I would want the player leg to interact with this.
Can anyone give me an idea or an example?

sentences:
How to properly create a handle for setting moving platform's target position in Unity? As the title suggests, I am trying to set up a handle for setting target position of a moving platform.

I have an empty GameObject(targetPos) and this is what I want to use for setting target position of the moving platform.

Here is the code I have for it so far but it does not seem to work correctly and I am not sure what is wrong.

The problem is, the empty gameobject's transform is not using correct position for moving platform to go to. Not that I put the empty gameobject as the child of the moving platform.

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

public class MovePlatform : MonoBehaviour
{
public Transform targetPos;
private Vector3 initialPosition, targetPosition, targetPosDebug;
public float speed = 3;
public bool loop;

void Start()
{
    initialPosition = transform.position;
    SetTargetPosition(targetPos.position);
}

void Update()
{
    transform.position = Vector3.MoveTowards(transform.position, targetPosition, speed * Time.deltaTime);

    if (transform.position == targetPosition)
    {
        if (loop)
        {
            SwitchDirection();
        }
    }
}

public void SwitchDirection()
{
    if (transform.position == initialPosition)
    {
        SetTargetPosition(targetPos.position);
    }
    else
    {
        targetPosition = initialPosition;
    }
}

private void SetTargetPosition(Vector3 localPosition)
{
    targetPosition = initialPosition + localPosition;
    targetPosDebug = targetPosition;
}

void OnDrawGizmos()
{
    if (Application.isPlaying)
    {
        Debug.DrawLine(initialPosition, targetPosDebug, Color.red);
    }
    else
    {
        Debug.DrawRay(transform.position, targetPos.position, Color.red);
        Gizmos.DrawSphere(targetPos.position, 1.0f);
    }

}
}

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:
Authorization in scaling multiplayer game I have an architectural problem associated with authorization.

I'm making an MMORPG multiplayer mobile game without separation onto different servers. What I mean by that is that a player from USA could have a mission with someone from China.

Currently I have an authentication microservice that issues JWT tokens. Another types of microservices are game microservices that handles all game logic. By design they would scale to meet the demand.

Every account can have multiple characters created, but only one can be online at the time.

My question is: How can I ensure that only 1 character can be online? Do I attach selected character to JWT? But the player can request another JWT with another character and the previous one would be valid as well until it expires. In this case I would need to look up database with every request, but that defies the purpose of JWT. Should I be using JWT or is there another way authorize players?

sentences:
How to apply impulse to a body to make it fly away? I'm playing around with jbox2d and can't really make a body "fly away" as if from an explosion.

From what I have found on the net, making the body fly away from the world center (0,0), should have been something like that:

b.applyLinearImpulse( new Vec2(0,0) , b.getPosition() );

But really it just doesn't do anything, any idea why? Also how do I change the strength of the impulse, like if it want to make it fly skyhigh or just move a bit?

sentences:
Should I be using spritesheets, because of or despite of my vast number of images? I am developing a 2D game, and I have a lot of sprites. I used 3D animations and models to render into 2D, to give them that "Fallout" or "Diablo" look to them. It is also easier than drawing by hand, lol.

I have already had to cut the framerate down to 15fps, which was the lowest I could lower without making them have a choppy look to them. However, it was sad due to how incredibly smooth 24 frames looked.

There are two reasons I did this:

1) Cut down on HDD space. The fewer the images, the smaller my total game will be.

2) Cut down on RAM consumption. The fewer images to load, the more likely I am to avoid issues bloating my RAM limitation.

However, if there was a way to compress the images in both HDD space and RAM, I would do so. I have tested it before, and most do not receive any change in quality when giving from RGBA8888 to RGBA5555 and only a little hit when converting to RGBA4444 in my TexturePacker program. I do not do this currently, because SFML seems to use the same amount of memory regardless of which type of .PNG image it is. I looked into researching how to load it differently, but failed to find anything on the subject.

I have read a lot about how to handle 2D video games. The consensus is overwhelming: Pack your Sprites into a Bigger Texture for great performance! So I pack my tiny sprites into a much larger spritesheet using TexturePacker.

However, I plan to have 10-15 animations per character, 5 directions to move, and 15-40 frames per animation (probably an average of 24). With 15 animations, 5 directions, and an average of 24 frames per animation; That is 1800 individual frames per character.
If packed in a sprite sheet, that is only 75 images instead. (One sprite sheet per Animation, per Direction. 15 * 5)

For the one huge boss character in the game, I cannot use a spritesheet and have to program a way to simply load in one image at a time. I do not know if I can do this for performance yet.

For the characters, I already pack them in a spritesheet. For a single character walking about, this seems to work most of the time, although sometimes it stalls. However, I attribute that to my ill conceived code that swaps out textures instead of preloading all textures for that character.

If I were to preload the textures, it makes sense for sprite sheets. I would only imagine it's a bad idea to preload 1800 tiny images for each character.

However, I imagine streaming them into and out of memory one at a time would be extremely fast, so I would only need to have a single image in memory at one time. Wouldn't this mean that at any given moment I would only have each character consume a few KB instead of 45+MB?

I imagine this would kill my performance, as streaming would need to be incredibly fast (15 images going into and out of memory and rendering, per second) and although the images would be very small- it might be a better idea to load character spritesheets into memory instead. But I will have to code a single-image stream-like render system for my larger boss character anyway.

I have been experimenting, but it is not a simple process. Especially given the fact I am working on other parts of the game engine that do not deal with graphics right now.

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:
How can I draw multiple lines connected via "nodes" with SlimDX? I currently read out XML data with the following scheme: Position x,y,z

I try to add one new Vertex for each position node and add it to a Vertex array.

Then I try to render this list of vertices so I get all those lines connected to represent a "path" through space.
(Space is 3D)

What I tried so far:

    [STAThread]
    static void Main()
    {
        var form = new RenderForm("SlimDX - MiniTri Direct3D9 Sample");
        var device = new Device(new Direct3D(), 0, DeviceType.Hardware, form.Handle, CreateFlags.HardwareVertexProcessing, new PresentParameters()
        {
            BackBufferWidth = form.ClientSize.Width,
            BackBufferHeight = form.ClientSize.Height

        });
        form.Height = 900;
        form.Width = 900;

        LineVertex[] waypoints = new LineVertex[1024];

        XmlDocument paths = new XmlDocument();
        paths.Load("data.xml");
        XmlNode rootNode = paths.DocumentElement;

        int index = 0;
        foreach (XmlNode waypoint in rootNode)
        {
            foreach (XmlNode position in waypoint)
            {
                Console.WriteLine(position.ChildNodes[0].InnerText);
                float b = 1000.0f;
                float x, y, z;

                x = (float.Parse(position.ChildNodes[0].InnerText) / (b * b));
                y = (float.Parse(position.ChildNodes[1].InnerText) / (b * b);
                z = (float.Parse(position.ChildNodes[2].InnerText) / (b * b));

                Console.WriteLine(x.ToString() + " / " + y.ToString() + " / " + z.ToString());

                if (index % 2 > 0)
                    waypoints[index].Color = Color.Yellow.ToArgb();
                else
                    waypoints[index].Color = Color.Red.ToArgb();
                waypoints[index].Position = new Vector3(x, y, 0.0f);
            }
        }

        MessagePump.Run(form, () =>
        {
            device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.CornflowerBlue.ToArgb(), 0f, 1);
            // Since we don't have any lights in our scene, our lines won't receive
            // any light and will therefore be black...
            // ...but we want them golden as an asinus aureus, so let's disable lighting.
            device.SetRenderState(RenderState.Lighting, true);
            device.BeginScene();

            // Our struct was meant to describe a position and a color,
            // let's tell the device about it.
            device.VertexFormat = VertexFormat.Position | VertexFormat.Diffuse;

            // In this particular case SlimDX does not need the
            // vertex stride, it will be automatically calculated.
            device.DrawUserPrimitives(PrimitiveType.LineList, 0, waypoints.Length / 2, waypoints);

            device.EndScene();
            device.Present();

        });

        foreach (var item in ObjectTable.Objects)
            item.Dispose();
    }
}

But this does not work, and I am sure it is the complete wrong approach!

EDIT: So far one solution worked out, but not very well.
And I also need the Vertices to be changeable at runtime, so I locked at the documentation and samples, they always use VertexBuffer() to make it possible to dynamically change the Vertices by using a DataStream as Input for the VertexBuffer.

A question still open to me is, since I am used to "Update(Time time)" formats the procedural still of DX/OpenGL oftens confuses me.
So I assume that MessagePump.Run() represents the drawing call that's repeated each frame.
So if some values before the drawing call change like a Vertex, that's put into the datastream, I can instantly see the updated result on the screen.
Is that assumption right?

sentences:
Is C++ necessary to learn if I ever want to get a job in the game industry? Is C++ necessary to learn if I ever want to get a job in the game industry? I am extremely familiar with C# and have a basic mastery of making 2D games in XNA 4.0. Right now I am only 13 years old and love making games, and hope to someday get a game programming job. I have heard a lot of people say that C++ is the 'industry standard' and that it will hurt your career not knowing it. I am also trying to target more platforms than just windows and  i am aware of Monogame but for some reason i am having lots of trouble with the visual studio templates, and i find many bugs with monogame. Since i technically can't get a job yet, and probably couldnt get a programming job until i am like 22 or something (unless im self employed). And in that 9+ year time-span the game industry will most likely change a lot. So here is some questions

Will not learning C++ hurt my chances at getting a programming job?
By the time i can get a job will C++ still be the 'industry standard' programming language
If i am an indie developer does it really matter whether i learn C++ or not, and stick with what i know?
Should i even start learning it now seeing as i have many years before i can even get a job?

I am also having a worry that even though i am familiar with object oriented programming, i may spend lots of time on C++, and get very frustated and confused then just quit learning it, and by this time i've forgotten lots of XNA and i have to learn everything all over. So in short: Should i learn C++ if i ever want a programming job?

UPDATE

Thank You All For Your Answers And Suggestions. Recently I Picked Up SFML and C++ and it is going pretty good. I am getting the hang of C++, and starting to open my eyes to not worrying about learning new things because i was able to transfer all my C# knowledge into making C++ easier to learn. Thank You All Once Again.

sentences:
Crash when setting a new screen In my almost finished game I want to set a new screen on game over. I got my game over method:

    private void gameOver(Label score) {
    for (Body body : worldBodies) {
        world.destroyBody(body);
        dispose();
        ((Game) Gdx.app.getApplicationListener()).setScreen(new GameOver());
    }
}

Whenever the method gets called the screen freezes for a second and the game crashes with this statement:

09-02 22:04:34.036      391-425/com.joelbrun.jetskirider.android A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0x8 in tid 425 (GLThread 29501)

sentences:
GLES2.0 3D Android game performance and multi threading the update? I have profiled my mixed Java\C++ Android game and I got the following result:

As you can see, the pink think is a C++ functions that updates the game. It does things like updating the logic but it mostly it generates a "request list" for rendering.
The thing is, I generate DrawLists on C++ and then send them to Java to process and draw using GLES2.0.

Since then I was able to improve update from 9ms down to about 7ms, but I would like to ask if I would benefit from multi threading the update?

As I understand from that diagram is that the function that takes the most time is the one you see it's color on the timeline. So the pink area is taken mostly by update. The other area has MainOpenGL.Handle as it's main contributor(whch is my java function), but since it's not drawn to the top of the diagram I can conclude other things are happening at the same time that use the CPU? Or even GPU stuff that isn't shown in this diagram.

I am not sure how the GPU works on this. Does it calculate stuff in parallel to the CPU? Or is it part of the CPU usage as in SoC? I am not sure.
Anyway, in case GPU things DO happen in parallel to CPU, then I would guess that if I do this C++ Update in parallel to the thread that makes the OpenGL calls, I might make use of "dead CPU time" due to GPU stalling or maybe have the GPU calls getting processed earlier because it won't have to wait for Update to finish?

How do you suggest to improve performance based on that?

sentences: Calculating next speed of a ball Is it possible to calculate the next speed of a ball knowing only dx and dy of the ball? For example if x = 120, y = 0, dx = -10, dx = 10, gravity = 0.05. So the next position of a ball (next update) is x = 110, y = 10. But a ball will be fall faster and faster under the influence of gravity. So is it possible to calculate next speed based on current x, y, dx and dy? My equation on next update of a ball x position should be x = x + dx * speed * gravity, but I haven't information about current speed, so I must calculate it every update.

sentences:
Using Jump Flooding Alghorithm for pathfinding? I am creating a distance-to-river texture. I am using the Jump-Flood Alghorithm in a compute shader to do this using simple distance() and it works well. See code below.
I want to augment this by adding blockers/walls so raw distance-to-seed might be blocked by pixels inbetween. I need to adapt it to a more pathfinding alghorithm.
Is this possible to do with JFA? Or do I need some other solution?
cbuffer JFAConstants : register( CBUFFER_REGISTER_EXTRA )
{
    int2 gSampleOffset;
}

RWTexture2D<uint2> gJumpFloodRiverMap : register( UAV_REGISTER_0 );

void UpdateClosest( inout int2 currentValue, int2 currentTexcoord, int2 jumpTexcoord )
{
    int2 jumpValue = gJumpFloodRiverMap[ jumpTexcoord ];
    if ( IsZero( jumpValue ) )
    {
        return;
    }

    float jumpDistance = distance( (float2)currentTexcoord, (float2)jumpValue );
    if ( IsZero( currentValue ) )
    {
        gJumpFloodRiverMap[ currentTexcoord ] = jumpValue;
        currentValue = jumpValue;
        return;
    }

    float currentDistance = distance( (float2)currentTexcoord, (float2)currentValue );
    if ( jumpDistance < currentDistance )
    {
        gJumpFloodRiverMap[ currentTexcoord ] = jumpValue;
        currentValue = jumpValue;
    }
}

[numthreads(TERRAIN_NORMAL_THREADS_AXIS, TERRAIN_NORMAL_THREADS_AXIS, 1)]
void cs_main(uint3 groupID : SV_GroupID, uint3 dispatchTID : SV_DispatchThreadID, uint3 groupTID : SV_GroupThreadID, uint groupIndex : SV_GroupIndex)
{
    int2 texCoord = dispatchTID.xy;
    int2 currentValue = gJumpFloodRiverMap[ texCoord ];

    int2 texCoordT = texCoord + int2( 0, gSampleOffset.y );
    int2 texCoordTR = texCoord + gSampleOffset;
    int2 texCoordR = texCoord + int2( gSampleOffset.x, 0 );
    int2 texCoordBR = texCoord + int2( gSampleOffset.x, -gSampleOffset.y );
    int2 texCoordB = texCoord + int2( 0, -gSampleOffset.y );
    int2 texCoordBL = texCoord - gSampleOffset;
    int2 texCoordL = texCoord + int2( -gSampleOffset.x, 0 );
    int2 texCoordTL = texCoord + int2( -gSampleOffset.x, gSampleOffset.y );

    UpdateClosest( currentValue, texCoord, texCoordT );
    UpdateClosest( currentValue, texCoord, texCoordTR );
    UpdateClosest( currentValue, texCoord, texCoordR );
    UpdateClosest( currentValue, texCoord, texCoordBR );
    UpdateClosest( currentValue, texCoord, texCoordB );
    UpdateClosest( currentValue, texCoord, texCoordBL );
    UpdateClosest( currentValue, texCoord, texCoordL );
    UpdateClosest( currentValue, texCoord, texCoordTL );
}

sentences:
How to define 648 units, with 22 different values in Java A friend and I are currently looking at developing a game. We have 648 units that need to be defined, with 22 final values.

To define the units in the game, we've created an abstract class with 44 variables and two methods. For example, if I encounter this unit in the game, I would pass a method its value, and it would look at some sort of lookup table which give all these base, final values. The problem we've encountered is finding a method of doing this effectively, and securely.

For now I have a few units defined through enumeration, and have their values stored in an array. My partner suggested to create a defining class with a plaintext lookup table. However, I see the problem with such a solution would either be the length, or quantity of lookup tables. I have searched around, but most solutions entail the use of a server. Our current goal is to just release an offline client with everything already defined.

Does anyone have any suggestions on how to store 648 units with 22 different final attributes effectively, so that such an entity could be called later and examined?

sentences:
What are the cons of a 3 team FPS? In creating a video game concept, there are very little video games that offer a 3 team multiplayer FPS (think like Overwatch/Call of Duty but with 3 teams instead of 2). The only 'mainstream' games that offer this are RTS games.

What are the cons of implementing a 3 team multiplayer FPS game?

sentences: When importing Mixamo animated characters into Unity, they come without avatar? I'm using Unity 2019.3.3f1. I create the character in Adobe Fuse. I uploaded it to Mixamo and choose an animation. I then downloaded the fbx for unity file. When imported into Unity, it is visible that the file has no avatar or animator component. How can I fix this? Is it a Unity version issue?

sentences: Drag and Flick Objects to any position (Unity3D) In unity, I have several boxes in one cluster. I want the user to be able to move any of these boxes to any position that they desire in the app, and have it stay there until they move it again. Also, I want the user to be able to flick any boxes and when it is flicked, have it bounce around the screen, as if it were trapped inside of the phone (but never leaving it). Any way I can do this? (This will be used for an Android Experiment)

sentences:
Robust Architecture for Flash Games? What's a good architecture for Flash games? I've read that MVC is great, with symbols just used purely for views (set states, use the class to manage which state/frame to show).

I would presumably then stick all my code in one or more .AS files, use object-oriented programming, try to unit test whatever I can, and make my art and symbols purely view-state stuff with no code.

Has anyone tried this? On anything other than a small game? How do these big flash RPGs and MMORPGs architect their games?

sentences:
as3 3D camera lookat I'm making a 3D camera scene in Flash, draw using drawTriangles() and rotated and translated using a Matrix3D. I've got the camera to look after a specific point, but only on the Y-axis, using the x and z coordinates, here is my code so far:

var dx:Number = camera.x - lookAt.x;
var dy:Number = camera.y - lookAt.y;
var dz:Number = camera.z - lookAt.z;

camera.rotationY = Math.atan2(dz, dx) * (180 / Math.PI) + 270;

so no matter the x or z position, the point is always on the mid of the screen, IF and only if y matches with the camera. So what I need is to calculate the rotationX (which are measured in degrees not radians), and I was wondering how I would do this?

sentences:
How do I calculate the points of a brush from a Source engine VMF? I'm trying to render the brushes from a Source engine .vmf file in C++, using OpenGL.

The .vmf stores solid brushes as a series of planes which I would like to use to calculate the points for each brush. I'm pretty sure this would be done exactly the same as for all Quake engine based .map files as well.

Basically each point of the brush is the point where 3 planes intersect. I found a similar question to mine on stackoverflow and the explanation is to get the unit normals for the 3 planes, then use equation 8 on this page mathworld.wolfram.com/Plane-PlaneIntersection.html. My problem is that I have no idea how to implement that

Here's some code for a single 6 sided cube shaped brush:

"plane" "(0 0 256) (0 256 256) (256 256 256)"
"plane" "(0 256 0) (0 0 0) (256 0 0)"
"plane" "(0 0 0) (0 256 0) (0 256 256)"
"plane" "(256 256 0) (256 0 0) (256 0 256)"
"plane" "(0 256 0) (256 256 0) (256 256 256)"
"plane" "(256 0 0) (0 0 0) (0 0 256)"

I really have no idea where to start.

sentences:
Closest circle intersection within a triangle (Context: I use a Delaunay triangulation for pathfinding, and have circular points of interest, of varying sizes, being randomly placed around the map. Units need to be able to determine the closest such point of interest to path to, using a Dijkstra search across the triangulation.)
Given a triangle, and a set of circles which overlap or intersect it, I'm trying to find the closest circle to a given point within the triangle.
My first thought was to just take the distance from the point to each circle center, minus the radius. But there are some cases where that does not give the correct result. See the following image:

Measuring from point P within the triangle, to circles A and B. Using only the radius of each circle, as with d1 and d2, would result in circle A being considered closest. However, the closest edge of circle A used to measure d1 is outside of the triangle. Staying within the triangle, the closest edge from point P to circle A would be d3, which is much further away than d2, indicating that circle B is actually closest within the triangle.
Is there a method for determining this difference, finding d3 for circles where d1 would be outside the triangle? How do you determine the intersection point between circle A and the triangle?

sentences:
Draw contour around object in Opengl I need to draw contour around 2d objects in 3d space. I tried drawing lines around object(+points to fill the gap), but due to line width, some part of it(~50%) was covering object. I tried to use stencil buffer, to eliminate this problem, but I got sth like this(contour is green):

http://goo.gl/OI5uc (sorry I can't post images, due to my reputation)

You can see(where arrow points), that some parts of line are behind object, and some are above. This changes when I move camera, but always there is some part, that is covering it.
Here is code, that I use for drawing object:

    glColorMask(1,1,1,1);
    std::list<CObjectOnScene*>::iterator objIter=ptr->objects.begin(),objEnd=ptr->objects.end();
    int countStencilBit=1;
    while(objIter!=objEnd)
    {
        glColorMask(1,1,1,1);
        glStencilFunc(GL_ALWAYS,countStencilBit,countStencilBit);
        glStencilOp(GL_REPLACE,GL_KEEP,GL_REPLACE );
        (*objIter)->DrawYourVertices();

        glStencilFunc(GL_NOTEQUAL,countStencilBit,countStencilBit);
        glStencilOp(GL_KEEP,GL_KEEP,GL_REPLACE);
        (*objIter)->DrawYourBorder();

        ++objIter;
        ++countStencilBit;
    }

I've tried different settings of stencil buffer, but always I was getting sth like that.
Here is question:
1.Am I setting stencil buffer wrong?

2. Are there any other simple ways to create contour on such objects?

Thanks in advance.

EDIT:

1. I don't have normals of objects.

2. Object can be concave.

3. I can't use shaders(see below why).

sentences: What exactly does SDL_RenderSetClipRect do? I assumed that this function would move the area which is clipped out of conceptual space and copied onto the renderer (and subsequently drawn to the window) - i.e. change the origin of rendering - but it doesn't seem to do this. Anybody know how it works?

sentences:
Android/OpenGL ES2: How do I set fragment shader value using C; This should be easy So I am using the following to create a fragment shader.

 GLbyte fShaderStr[] = "precision mediump float;"
    "void main()                                \n"
    "{                                          \n"
    "  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); \n"
    "}                                          \n";

I then render a circle (collection of lines) the circle comes our red. If I change the code to...

GLbyte fShaderStr[] = "precision mediump float;"
    "void main()                                \n"
    "{                                          \n"
    "  gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0); \n"
    "}                                          \n";

The circle is now purple. My question is how do I control this dynamically? So for example when I receive an input I toggle the two colors?

I tried...

GLbyte vShaderStr[] = "attribute vec4 vPosition;   \n"
            "attribute vec4 inColor;   \n"
    "uniform mat4 Projection;   \n"
    "varying vec4 fragColor;   \n"
    "void main()                 \n"
    "{                           \n"
    "   gl_Position = Projection * vPosition; \n"
    "   fragColor = inColor; \n"
    "}                           \n";

GLbyte fShaderStr[] = "precision mediump float;"
    "varying vec4 fragColor;                   \n"
    "void main()                                \n"
    "{                                          \n"
    "  gl_FragColor = fragColor; \n"
    "}\n";

void initColor(){
    LOGD("Initing Color");
    GLfloat vVertices[] = { 1.0f, 0.0f, 0.0f, 1.0f };
    glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 0, vVertices);
}

However, this doesn't seem to work as the circle is now black.

sentences:
Rotate an object with 'Quaternion.Slerp' in world space I'm currently working on a multiplayer skydiving Unity game in which i rotate the players like this:

transform.rotation = Quaternion.Slerp(transform.rotation, desiredRotation, delta);

Now this rotates the player relative to it's own rotation. I know rotation in world space is done by multiplying the quaternion of the desired positon with the quaternion of the current position like this:

localRotation = transform.rotation * desiredRotation
worldRotation = desiredRotation * transform.rotation

But how do i slerp to that position in world space?

Thank you all in advance and have a great day!

sentences:
Auto key bones with controller helpers I have skinned and rigged a human character with IK / FK and helper objects to control the position of the IK goals and the rotation of the bones. For example, the characters' left arm IK goal is parented to a point helper, to make it easier to select and move around and the arm IK solves accordingly.

I have the skeleton (without the helpers) set up as an avatar in Unity and I want to use this rig to create and export animations to work with the avatar.

I create animations by moving the helpers in Auto Key mode in 3DS Max, so that when the helpers move, their new transform details (pos, rot, scale) are recorded in key frames.

My questions is this: using Auto Key only records the transform of the helpers I'm moving, it does not record the bone transforms, even though they have been changed by moving the linked helpers. Is there any way to record bone positions using Auto Key with this rigging method, or do I have to select the affected bones every time a movement is made and use Set Key?

sentences:
Web single player 2d top-down RPG - background image, sprites, and new level loading I'm making a web single player 2D top-down rpg using JavaScript (create js library) and have a couple questions.

For the background image, I've currently loaded a 1000x1000 bitmap to represent the background for my rpg world (per level). It's drawn in relation to the camera (aka the canvas - 500x500) so not all of it is on the screen at the same time. If it's not on the screen, is it still using resources to be drawn? I eventually want to have a much larger "world", which will require a much larger bitmap... What is the best way to load a background image?

And what about sprites? I'm assuming if I create several sprite objects with bitmaps... even if they aren't on the camera, they are still using resources? This may slow down the game.

Level loading: If I walk to another level, or go inside a building, I'd like to load that bitmap... Is there a specific way to architect level loading?

Thank you!

sentences: Character axis gets messed up when I add the armature into it So basically Ive been working on a walking animation in Blender, but theres a problem when I import it to Unity, the axis get inverted… The only thing that is messing it up is the armature that animates the character, if I only import the character itself the axis are normal, if I also import the armature, the axis get inverted...

sentences:
How to calculate Joystick margins/thresholds? On a joystick that gives float position values from -1 to 1 on either of x and y axis, how do I implement the math that adds "lower" and "higher" circular margins?

For example if lower margin is 25% (0.25 float) of radius, and higher margin is 50% (0.5 float), it might look like this:

The actual "hot" zone is green,  meaning:

Grey area should always give 0,0 readings of x/y.
Green area should give actual values of x and y form range -1 to 1.
Blue should always give 1 or -1.

sentences:
My intersect detector isn't working I'm trying to create rooms dynamically by creating them in random places and checking if they do overlap each other. The idea is that if the new room intersects with another one, it must be recreated so it doesn't intersect with anyone.

This is the room creating loop:

void GenerateBasicLevel(){
    roomsList = new List<Room> ();
    int initX = 0, initY = 0;
    for (int roomsCreated = 0; roomsCreated < 10; roomsCreated ++) {
        //Room size
        height = Random.Range (minSize, maxSize);
        width = Random.Range (minSize, maxSize);
        if(roomsCreated == 0){
            initX = 1;
            initY = 1;
        }else{
            bool loopBreaker = true;
            while(loopBreaker){
                initX = Random.Range(0,mapWidth);
                initY = Random.Range(0,mapHeight);
                foreach(Room r in roomsList){
                    loopBreaker = RoomIntersects(initX - 1, initX + width +1, initY - 1,initY + height + 1,r);
                    if(loopBreaker){
                        Debug.Log ("I do intersect");
                        break;
                    }
                }
            }
        }
        roomsList.Add(new Room(initX - 1,initX + width + 1,initY - 1,initY + height + 1,floorTiles,wallTile));

    }}

This is the Intersect checker function:

bool RoomIntersects(int x1, int x2, int y1, int y2, Room cR){
        if (x1 <= cR.x2 && x1 >= cR.x1 && y1 >= cR.y1 && y1 <= cR.y2)
            return true;
        else if (x2 <= cR.x2 && x2 >= cR.x1 && y1 >= cR.y1 && y1 <= cR.y2)
            return true;
        else if (x1 <= cR.x2 && x1 >= cR.x1 && y2 >= cR.y1 && y2 <= cR.y2)
            return true;
        else if (x2 <= cR.x2 && x2 >= cR.x1 && y2 >= cR.y1 && y2 <= cR.y2)
            return true;
        else
           return false;
    }

Rooms are objects with just 4 parameters: x1,x2,y1,y2.

This is my final result, overlaping rooms:

sentences:
Conditional Variables in Scriptable Objects While using ScriptableObjects, how can I make some variables conditional?

Example Code:

[System.Serializable]
public class Test : ScriptableObject
{
      public bool testbool;
      public string teststring;
      public int testint;
}

Goal: When testbool == true then teststring is available to edit, when testbool == false then testint is available to edit while the other one is "grayed out".

sentences:
Pygame making Snake, need help with generating fruit with a random color This is my function for generating an apple, I want it to generate a random color each time the snake eats it.

    def AppleGenerator():
        fruit_colors = [crimson,powderblue,yellow,hotpink,orange,darkorchid,lime]
        x = random.randrange(1,6)
        return fruit_colors[x]

This is when I call it, AppleX, AppleY, and size are just the dimensions of the rectangle. The problem is that the 'apple' just flashes random different colors from the list and doesn't stick to one color.

 pygame.draw.rect(gameScreen,AppleGenerator(),[AppleX,AppleY,size,size])

By the way, the reason why I didn't just simply do

def AppleGenerator():
   fruit_colors = [crimson,powderblue,yellow,hotpink,orange,darkorchid,lime]
   return random.randrange(fruit_colors[0],fruit_colors[6])

is because the colors are tuples, and randrange() only accepts integers.

sentences:
Accelerate a Bullet on The Right Direction I'm creating a simple asteroids 2D game with XNA so I can learn more on game development, I've started by reading this tutorial and, with my previous knowledge from developing Windows Phone applications, I've started changing the code. I've designed a simple isosceles triangle that is rotated with the accelerometer, like this:

private void CurrentValueChanged(MotionReading e)
{
    // Check to see if the Motion data is valid.
    if (motion.IsDataValid)
    {
        triangle.Update(MathHelper.ToDegrees(e.Attitude.Yaw));
        System.Diagnostics.Debug.WriteLine("Yaw: " + MathHelper.ToDegrees(e.Attitude.Yaw));
        System.Diagnostics.Debug.WriteLine("Angle: " + triangle.getAngle());
    }
}

The triangle.Update just changes the batch.Draw rotation parameter.

I'm also creating a "bullet", when the user clicks on the screen, using a circle texture, what I want to know is how I can point this "bullet" to the direction that the triangle sprite is heading.

PS: The triangle "point", where the bullet should be fired, is exactly the width / 2.

sentences:
What's the most efficient way to create underground layers of procedural terrain? Background information

I am in the process of making a game engine so I have complete, explicit control over everything, anything is an option. I desire to make procedurally generated 3D terrain. It's mostly coming along quite well actually.

I am however, having a difficult time finding any good information on how exactly destructible terrain can be done optimally. I think the mesh deformations could be done at run-time and written to disk but the issue I encounter there is the desire to have ore and similar resources under the ground. I've had the idea to layer additional maps for each unit length of depth but that just seems like it'd have a heavier impact on performance than I'd like.

I know it's of course possible to do that but how to do it efficiently is what I'm interested in here. Perhaps I'm just using bad keywords when I search for information but I'm not turning up much of anything of use on this topic.

I've gone beyond just Perlin Noise for the generation as well using various other algorithms for layers such as vegetation, ground cover like small rocks, etc. By generating the texture maps using the techniques I'm sure we're all familiar with.

A lot of the ideas I've been coming up with would work I suppose but I don't like the obvious impact of performance my ideas have been so far.

Eventually of course I'd have a layer of solid indestructible bedrock but I can't figure out a way better than having a texture map for each layer down per unit length. So if I had a depth of 60 units before hitting the layer of solid bedrock that would mean 60 texture maps. I don't like that at all. Surely there is a better way. I've seen a lot of games not render or even generate the underground at all during initial creation of the game world and do that at run-time but I can't figure out how ore and similar resources could be generated in varying depth layers effectively on initial creation of the world. If the map is color coding by resource it wouldn't exactly work to also color code the height as you would with a height map. It must be one or the other.

Question

The problem I'm having now is underground. What would be the best way to implement underground layers in a performance friendly way that doesn't involve an excessive number of textures used?

sentences:
Deferred shadow mapping Question:

What am i doing wrong in the CalcShadowFactor method? It looks like the depth check is not working correctly.

Body:

I'm using deferred rendering in my engine and i have generated the following shadow map:

Which is draw by the following fragment:

void main()
{
    gl_FragColor = vec4(texture(gColorMap, TexCoord0).x);

}

The position texture is generated like this:

WorldPos0      = (gWorld * vec4(Position, 1.0)).xyz;

Where gWorld is the transformation of the object being draw(translation * rotation* scale)

Finally, in the light pass, i want to generate the shadow produced from this spotlight with the following code:

float CalcShadowFactor(vec3 WorldPos)
{
    vec4 ShadowCoord = gLightWVP  * vec4(WorldPos,1);
    ShadowCoord /= ShadowCoord.w;
    vec2 UVCoords;
    UVCoords.x = 0.5 * ShadowCoord.x + 0.5;
    UVCoords.y = 0.5 * ShadowCoord.y + 0.5;
    float z = 0.5 * ShadowCoord.z + 0.5;
    float Depth = texture(gShadowMap, UVCoords).x;
    if (Depth < z + 0.00001)
        return 0;
    else
        return 1.0;
}

It returns a float which multiplicates the color output. I know, im just returning 0 to set the color to complete transparent, it is intensional. The variables used were:

gLightWVP: It is the ProjectionView of the camare set at the light:

Projection * LightCameraRotation * LightCameraTranslation
WorldPos: It is the position got from the Position Texture:

vec3 WorldPos = texture2D( gPositionMap, TextCoord0 ).xyz;
gShadowMap: It is the shadow map texture sampler.

This is what is displayed(notice how the spotlight looks at the first image):

The engine passes are:

Shadow pass: Render the scene for every light using a alternative camera which is placed in their position with their orientation. It generates the shadow maps for every light. Currently i just have one shadow map for that spot light.
Render pass: It renders all the scene using the main camera. It generates the position map, normal map, diffuse map and a specular map.
Light pass: It uses all the textures generated to place the illumination. Here is where the shadow map is being checked for generate the shadows.

EDIT: I'll also leave here the shadow map texture definition.

glGenTextures(1, &m_shadowMap);
glBindTexture(GL_TEXTURE_2D, m_shadowMap);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, WindowWidth, WindowHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_shadowMap, 0);

sentences:
XNA games C# application executable work on one win7 not the other one Our company wrote a game in XNA studio 4 almost ten years ago. we try to reinstall it in win7 with only the executable. Both installed XNA Game Studio 4.0. Below is the environments parameter I can find. The one on the laptop is not rendering the effect(I am new to this, this is my guess).

Laptop
Desktop

OS
win7 Service Pack1
win7 Service Pack1

DirectX version
11
11

Graphic Card
AMD firepro M4000 Mobility Prographics
integrated GPU Intel HD graphics 4600

Chip Type
AMD FirePro(0x682D)
Intel(R) HD graphics family

We don't know what make these two executable behave differently. Part of the window image just not shown. Second check on the source code, the different between the image that can be show and can not be shown on the failed Laptop is working one is using Bitmap and the not working on is using Texture2D with  Microsoft.Xna.Framework.Graphics Effect with passes. Any ideas. Thanks.

sentences: Is there any different between these 2 command? I came across this question on stackoverflow https://stackoverflow.com/questions/17147553/int-num-new-int-what-happens-when-this-line-executes . Wonder if there is any difference for sprite and spriteRender in unity between both of these commands sprite y=new sprite() and sprite y; or SpriteRenderer x=new SpriteRenderer() and SpriteRenderer x;? I tested in unity, both commands also generate the same option to attach game object, so do both have the same meaning as well?

sentences:
Can the different computation power in a multi-player game affect each player's performance? In case an RTS game allows the clients to perform some calculations such as path-finding after the player clicks the map for a destination, and taking into account the game should be synchronised for all clients, there is clearly a chance that one of the machines is so slow that such computation (if it is done on a different process) might take much longer than in another client.

Therefore, the first player would experience a processing delay of his commands (and his units would be stopped for some time), giving the second player a clear advantage.

Now, how is this usually managed in the commercial RTSs?

Are all computations handled by the server and sent back to the clients?
In case processing in the client would be preferred, how would you implement a system to avoid such a player advantage?

Note: In SC2 I have seen how the server notifies the players that someone is slowing down the match. But I guess that is just the client has not enough speed to compute the visualisation.

sentences:
Character Movement and Collision with Ragdoll Rigidbodies/Colliders? I have a player character that I'm moving with a character controller script and it is moved by applying velocity to a Ridigbody.

This works when I have a rigidbody component on the player but my character also has ragdoll colliders and rigidbodies on each body parts (set up with Untiy's ragdoll wizard).

What I'd like to do is remove the ridigbody and collider that are on the player and use the ragdoll colliders and rigidbodies instead for physics movement and collision.

But it's not working! When I use the rigidbody from the skeleton Root and try to apply velocity the character won't move (animation plays but she keeps running on the same spot). What do I need to do to get this working?

Another issue is that if I leave the player rigidbody on but remove the large capsule collider I can move the character but collision doesn't work and she runs through static objects. I already tried with convex set to true on static meshes but it doesn't make a difference.

Does somebody know what causes movement and collision not to work with the ragdoll rigidbodies and colliders?

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:
Lengthen Line (bidirectional) - crossing zero line I'm trying to lengthen a line, by a certain amount.
I want to apply the modification to both points on the line, expanding it in both directions. without moving it from it's current position (center point expansion would be acceptable, but I'n not sure how to apply it).
Exact details:
Line:
Point 1 [X = 1 , Y = 4], Point 2 [X = -1, Y = 6]
Line Normalized Vector: V = [X = -0.707106, Y = 0.707106]
Expand by: E = 1
So the result I'm looking for is
New Line = [ 1.707 , 4.707 ] ~ [ -1.707 , 6.707 ]
My problem happens when I multiply Point2[X] + ((0-V[x])*E) = - 0.292
Can someone give a SIMPLE example.  Psudo code, is great!
I know it is because I'm crossing the zero line, but I'm sure there's a better way to do this than testing if the point is greater than zero or less than zero.

sentences:
"Systems" needed for a box-pushing game I already have an idea for a game. I also have a few years of experience with casual programming and game dev, and I know the messy while loop I had until now will not be enough for my next project.

The game I want to make is a top down tile based puzzle game. Some elements are buttons activated by boxes pushed on top of them and doors that open as a response. The player can also use a mechanic to "warp" to a different level, taking things with him to the other level and using these to solve the puzzle that's in there. It's not that simple, but I don't want to over complicate anything. I also have a lot more ideas but lets start with the core of the game.

I already implemented some of the mechanics as a prototype but it's too unorganized and I don't think it is worth coding how I did. For that reason I am thinking about game architecture. Multiple articles I read suggest that I should use a messaging / event system that connects between different systems of the game. Those could be the renderer, sound, game logic, physics, etc...

These systems are very general and I am wondering where are the game objects themselves? Do I have a separate system for the player, another one for the level elements? and one just for GUI? or are they all in one system?

Another aspect of the systems is the communication between one another. If I have a separate system for the player and for the renderer, then how does the renderer know where the player is? Having different systems seems logical at some cases but complete nonsense in others. so to summarize: Which systems are required for the type of box-pushing puzzle game I'm making?

sentences:
Using forces to reach a specific velocity In my game, I currently move the player by directly setting its velocity on key press events. This makes the game feel very responsive and allows the user to quickly change direction.

However, I would like to implement knockback and elements like conveyor belts that should push the player around. My first idea was to add a bool underControl; variable that was set to false when the player was under the effect of an external force, but it didn't work well in practice.

Then I thought of another way: how about adding the exact required force to move/stop the player at a desired velocity instead of acting on the velocity itself? It would allow the user to move and stop like if velocity itself was being set, but also allow external forces to act on the player.

Basically I want this:

if(someKeyPressed()) player.setVelocityX(100); else player.setVelocityX(0);

to be expressed like this:

if(someKeyPressed())
    player.applyForce(getForceRequiredToReach(100, player.getVelocityX());
else
    player.applyForce(getForceRequiredToReach(0, player.getVelocityX());

Vec2f getForceRequiredToReach(float mDesiredVelocity, float mCurrentVelocity)
{
    // What goes in here?
}

How can I implement the getForceRequiredToReach function?

sentences:
.NET WCF as backend server for iPhone games I'm planning to develop an iPhone game. Is it possible to use .NET WCF as a backend?
The server would be windows 2008 and MS-SQL database.

sentences:
Software for game system design overview Yes so this is a question more oriented towards the planning / project part of game development. What software do you use to plan your game, I am talking about visual stuff like a mindmap application for making some neat diagrams and so on, sort of like database design only it's for the game instead, is there any good ones?

Thanks

sentences:
Texture prefetching in GLSL I have a fragment shader which needs lots of semi-random access to 32x32 texture patch.  Fortunately, the patch is constant for each poly, so there should be no issue storing the whole thing to the texture cache.

So my question is, is there any way in GLSL to prefetch texture patches?  Normally, I would be fine letting the FS load the texture naturally, but with the nondeterministic access pattern, I'm afraid that could be producing a ton of unnecessary thrashing while it sorts itself out.

sentences:
How to work with different artists sequentially? Making games is a hobby for me and I don't always have consistent time to do it. Also, I'm terrible at art, so I plan to hire an artist. However I am concerned that after a job is done, if I want to return to the project and add more content, the same artist will not be available for any number of reasons. What can be done to help a new artist maintain the style of the previous?

Should I hire the original artist to create a graphic bible? Or is referencing the original art enough? Or is there an entirely different approach that would be better?

Note that this is not a duplicate of this question, where multiple artists are coordinating simultaneously. In this case, one artist has done their work and is gone, unavailable for contact or future work, and a new artist is expanding the assets.

sentences:
Android: Hardware Scaler I was reading through this: using-hardware-scaler-for-performance and am a little confused by it.  It says all you need to do to invoke the scaler is to set it like so:

surfaceView = new GLSurfaceView(this);
surfaceView.getHolder().setFixedSize(1280, 720);

They says to use a fixed size for all devices.  On my Google Nexus 10 (which has a resolution of 2560 x 1600).  I've used 1280*800.  It then goes on to say that the system will scale it to match the device's actual resolution.

So this is what I get:

What am I missing here? Unfortunately the above link says that examples will be added soon but as yet there is nothing.

sentences:
Simple puzzles in platform games I'm working on simple platformer game. I've got already finished programming the main part of game, which is moving and collecting items.

I want a unique game puzzle in every level, but I can't think up enough. I've been thinking for hours but I've got only few puzzles which are not very good. I would be grateful for any ideas or help you can provide.

sentences:
how to make client and server to develop independently? Currently,  all i want to do is rapid prototyping of Tower-Defense-Like game, which means that i just need write client code only,single player, play with AI system. but shortly afterwards, maybe it's going to be a multiplayer game .
my question is how can i design my game architecture suited for singleplayer mode firstly, and for multiplayer mode latterly, it doesn't mess up my previous effort(single player only). any design pattern, or architecture , or hint?

I really appreciate for your answer, thank your guys in advance.
Have a good day!

sentences:
Arbitrary number of VBO to Vertex Shader I am currently using standard modern OpenGL way to render a mesh via VBO and attributes

    glEnableVertexAttribArray(aVertexPosition);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glVertexAttribPointer(aVertexPosition, 3, GL_FLOAT, GL_FALSE, 0,0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

and in the GLSL code also the standard way to received into as in vec3 aVertexPosition.

However, I wonder if there is anyway to make this for a dynamic amount of VBOs. Let's say my software creates a number of VBOs that depend on the inputs, and I successfully create and allocate memory for all of them, how do I pass all of them to the shader? Does the number need to be constant? If so, what is the best way to do it?

sentences:
Godot doesn't loop the sound Basically it's the sound of a fuse for a bomb, until the timer sends the signal the sound should stop playing and play the explosion sound, but right now only plays once and the stop.
What i did wrong/ what i did missed?
the code i use for the bomb scene:
extends StaticBody2D

func _ready():
    $AnimatedSprite.animation = "bomb"
    $CollisionShape2D.disabled = true
    $BombTimer.start()
    $FuseSound.play()

func _on_BombTimer_timeout():
    $AnimatedSprite.animation = "explosion"
    $CollisionShape2D.disabled = false
    $RemoveTimer.start()
    $ExplosionSound.play()

func _on_RemoveTimer_timeout():
    queue_free()

func _on_Bomb_body_entered(body):
    print("bomb collided with:" + body.get_name())

sentences:
UDK - Packaging the Game I have set up all the config files to my game classes and am able to launch the game to test everything.

Although when I package the game, it still runs the UT deathmatch game??

What other lines in the config files should be changed to make it default to my game and default map once published?

sentences:
Update single variable in DirectX Shader I am trying to update a single variable within a CBuffer but I am unsure of how to do this.

I have a LightingBuffer which is passed to the GPU containing, ambient color, diffuse color etc and I want to be able to update the specularPower component of this CBuffer but not the rest.

In openGL I could just do glUniform1f and update it, however I cannot do this is DX / HLSL

How would I go about doing this?

sentences:
GLSL Sphere from Vertex I am working on a particle simulation where we have a lot of spheres which can have different radii. Using this tutorial http://mmmovania.blogspot.de/2011/01/point-sprites-as-spheres-in-opengl33.html (see also code below) I was able to create a sphere from a point, but they all have the size from glPointSize(). Is it possible to extend this with a radius?

#version 330
out vec4 vFragColor;

uniform vec3 Color;
uniform vec3 lightDir;

void main(void)
{
    // calculate normal from texture coordinates
    vec3 N;
    N.xy = gl_PointCoord* 2.0 - vec2(1.0);
    float mag = dot(N.xy, N.xy);
    if (mag > 1.0) discard;   // kill pixels outside circle
    N.z = sqrt(1.0-mag);

    // calculate lighting
    float diffuse = max(0.0, dot(lightDir, N));

    vFragColor = vec4(Color,1) * diffuse;
}

Maybe of interest: I am using #version 120 for my shaders.
Or, is there a better way to do this?

So, combining the two answers I now have:

void
Draw::setGeometry(float* geometry, float* velocity, float* radius, GLuint size){
    this->_size = size;

    glGenBuffers(1, &_vertexData);
    glBindBuffer(GL_ARRAY_BUFFER, _vertexData);
    glBufferData(GL_ARRAY_BUFFER, _size * 3 * sizeof(float), geometry, GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

    glGenBuffers(1, &_velocityData);
    glBindBuffer(GL_ARRAY_BUFFER, _velocityData);
    glBufferData(GL_ARRAY_BUFFER, size * 3 * sizeof(float), velocity, GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

    glGenBuffers(1, &_radiusData);
    glBindBuffer(GL_ARRAY_BUFFER, _radiusData);
    glBufferData(GL_ARRAY_BUFFER, size * sizeof(float), radius, GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

}

And the drawing method:

void
Draw::paint(GLenum mode){
    glBindBuffer(GL_ARRAY_BUFFER, _vertexData);
     glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(2);
    glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, 0, 0);

    glDrawArrays(mode, 0, _size * 3 * sizeof(float));
    glDisableVertexAttribArray(0);
}

And the Vertex Shader:

#version 130

attribute vec3 position;
attribute vec3 velocity;
attribute float size;

uniform mat4 MVP;
uniform mat4 MV;

void main(){
   gl_PointSize = size;

   gl_Position = MVP * vec4(position, 1.0);
}

The problem is that when gl_PointSize = 15 is set, they are drawn well. When I make it equal with size, then it looks like this: http://picpaste.com/Big_particles-daIBnJCG.png

Works better now. Particles still getting bigger as they move along.

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:
Armature rest matrix - why does this exist? I'm not sure I have a clear idea on what purpose the rest matrix/bindpose is supposed to serve in skeleton animation. If it is supposed to transform a bone into the rest pose and the mesh itself is always exported in the rest pose then shouldn't the rest matrix always be the identity matrix? But then why is it not the identity matrix in Blender?

I also find that if I transform my mesh (exported in the rest pose) by the rest matrix for each bone then it is very incorrectly deformed (it was after all already in the rest pose).

sentences: Smooth movement in a tile based game How can we make our character move smoothly across tiles? He moves tile by tile, but that looks unprofessional. In addition, when you hold down the arrow keys he zips across the screen. How can we prevent that from happening?

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:
How can I create Portrait game assets to have same with gap for both iPhone 7 Plus and iPhone X? In my Unity game I made changed my Pixel Per Unit value to 243 since the height of a Portrait game for iPhone X is 2436. The game looks great and the asset sizes look just right on the iPhone X simulator. But when I change to iPhone 7 Plus I get considerable space on the sides and it gets worse when I change to the iPad. How can I make my game have the same width gaps for iPhone 7 Plus and iPhone X without making assets look stretched horizontally or vertically?

UPDATE

The images below give an idea of my game on both 1080x1920 (for iPhone 7 Plus) and 1125x2436 (for iPhone X). It's not a match3 game. All the game objects below are static and have colliders. The gaps between are quite significant for other dynamic objects to move between. Reducing the gaps significantly would alter the movement of the dynamic objects and their sizes too, making the ratio in object sizes look wrong. I haven't started worked on scores or menus yet, so I haven't added a UI canvas yet.

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:
Collision with User Input and Object I am curious on how to handle collision detection involving a moving target and user input. Basing myself in the mobile space, I get events from a set framework, but I do wonder about the amount of lag involved.

Say the object moves faster and faster, then position of the input and the object is very important. What I want to know is what is the best design for handling user input and then also the best way to make sure to accurately work out when the input point collides with the object, keeping threads in mind?

sentences:
Missing texture coordinates for channel 0 Fbx and XNA 4.0 I'm getting this error while trying to load a model in XNA 4.0 :
Error   2   The mesh "transform1", using SkinnedEffect, contains geometry that is missing texture coordinates for channel 0.
The model was dxf format then I upload it to maya then I added some skeleton and some texture (viewed it on the UV) but I still get this error.

this is the load function.

    protected override void LoadContent()
    {
        // Load the model.
        currentModel = Content.Load<Model>("myModel");

        // 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["Take 001"];

        animationPlayer.StartClip(clip);
    }

this is the draw function :

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice device = graphics.GraphicsDevice;

        device.Clear(Color.CornflowerBlue);

        Matrix[] bones = animationPlayer.GetSkinTransforms();

        // Compute camera matrices.
        Matrix view = Matrix.CreateTranslation(0, -40, 0) * // x, y, z
                      Matrix.CreateRotationY(MathHelper.ToRadians(cameraRotation)) * //rotate y
                      Matrix.CreateRotationX(MathHelper.ToRadians(cameraArc)) * //rotate x
                      Matrix.CreateLookAt(new Vector3(0, 0, -cameraDistance),
                                          new Vector3(0, 0, 0), Vector3.Up);

        Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
                                                                device.Viewport.AspectRatio,
                                                                1,
                                                                10000);

        // Render the skinned mesh.
        foreach (ModelMesh mesh in currentModel.Meshes)
        {
            foreach (SkinnedEffect effect in mesh.Effects)
            {
                effect.SetBoneTransforms(bones);

                effect.View = view;
                effect.Projection = projection;

                effect.EnableDefaultLighting();

                effect.SpecularColor = new Vector3(0.25f);
                effect.SpecularPower = 16;

            }

            mesh.Draw();
        }

        base.Draw(gameTime);
    }

PS : 1-My knowledge with Maya & XNA is very limited cause I used to use OpenGL/C++ for some time.

2-Also I change my Content Processor to SkinnedModelProcessor not Model - XNA Framework.
thanks in advance.

sentences:
How can I select an enemy to act next, biased toward smaller enemies? Suppose there are X number of enemies in the game. They all have to attack one by one. Each enemy is picked randomly, and can be of Y size.

How can we attain biased randomness in such a way that small enemies are attacking more often than big ones?

My current algorithm is "pick any random enemy" no matter the size, and I'd like to improve on this.

sentences:
How to destroy bullet on collision but only after it makes the collided object to bounce? I made a scenario that shooting a bullets on crates make them both bounce nicely (both the bullet and crates are RigidBody2D & Colliders).
When I use OnCollisionEnter2D to destroy the bullet when it hits the crate then the bullet destroyed before it pass the force to the crate and thus the crate stay still and not move physically...

How to make the crate move because of the bullet hit and also make the bullet to destroyed?
There is more elegant way from just destroy the bullet a frame after the hit?

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:
Implementing time step in main game loop So ive read both http://gameprogrammingpatterns.com/game-loop.html and http://gafferongames.com/game-physics/fix-your-timestep/ and I kind of understand how I'm supposed to do it, but some parts are still blurry and I would like some guidance.

By the way, I have programmed my game from scratch and i do not want to change to some framework or anything that has an built in main loop, i want to do this by myself.

Anyway, this is what I have accomplished code-wise, I will re-produce my solution it in psudocode below.

func createPlayer()
{
oData = Empty Object()
oData.id
oData.name
oData.etc.....
Player = LoadSprite("filename", oData)
// Properties
Player.oSprite.x
Player.oSprite.y

Player.oSprite.scale
Player.oSprite.width
Player.oSprite.height
//Methods (Self-explanatory)
Player.oSprite.width()
Player.oSprite.height()
Player.oSprite.centerX()
Player.oSprite.centerY()

return Player
}

// Startup
oPlayer = createPlayer()
oWorld = 1D array of objects which has identical properties and methods from createPlayer()

// Main game loop
while(game){

 //User inputs
 _game_userInputs(byref oPlayer)

 // "Physics" jumps and world collission is done here.
 _game_Physics(byref oWorld, byref oPlayer)

 // rendering, draws the world frame with all inputs and physics done beforehand
 _game_render(byref boWorld,byref oPlayer)

}

This is how I "understand" what flow the loop should have

t = 0.0
dt = 0.0
currentTime = 0.0
accumulator = 0.0

while(game)
{

  newTime = _Timer_QueryPerformanceCounter() // Im feeling like this need something more than just the QueryPeformenceCounter?
  frameTime = newTime - currentTime

  if (frameTime > 0.25) {
        frameTime = 0.25
  }
  currentTime = newTime

game_input()

//This is causing my game to get stuck here, i belive it has something to do with my type of timer
 while accumulator > dt
 {
  game_physics(t, dt) //how is the deltatime helping me in my physics?
  t += dt
  accumulator -= dt
 }

 alpha = accumulator / dt
  game_render(alpha) // I dont know what im supopsed to do with this.
}

TLDR, what do i do with the t, dt in my physics? before i render?

sentences:
Camera rotate at target? I have free camera that move and rotate around the level. In this script if tb = true, I want my camera to rotate at target. Camera will show my character not rotate at character direction. image

public Transform avatar1; // character
public Camera cam;
public bool tb;

void Start()
{
    tb = false;
}

void Update()
{

    if (tb == true)
    {
        StartCoroutine(bu1());
    }

}

IEnumerator bu1()
{
    cam.transform.position = Vector3.Lerp(cam.transform.position, new Vector3(avatar1.transform.position.x + 6, 10, avatar1.transform.position.z + 7), 0.1f);
    cam.transform.rotation = Quaternion.Lerp(cam.transform.rotation, avatar1.transform.rotation, 0.4f); // here is my problem
    yield return new WaitForSeconds(2);
    tb = false;

}

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: MonoGame for iOS - getting started I can't find any clear directions on how to get started. I only see a Windows installer for MonoGame but what little documentation I've found seems to say you install it on the Mac and do the work there. If someone could simply tell me which parts go where that would be a big help.

sentences:
Camera Movement Smoothing I am trying to smooth a camera I create in my game, but I can't seem to find a way to actually do this correctly.

What I have :

//Calculate the "current" Forward vector
var cameraForward =
    -Vector3.Cross(-Self.forward, target.up)
    .normalized.Cross(target.up).normalized;
//Rotate the camera on the Y axis of the current target,
// and X Axis based on delta.y and CurrentVerticalLook
cameraForward =
    Quaternion.AngleAxis(delta.y, ViewTarget.transform.up) *
    Quaternion.AngleAxis(CurrentVerticalLook, Self.right) * cameraForward;

var offset = cameraForward * CameraDistance;
var pos = LookAt + offset;
Self.Position = pos;
Self.transform.LookAt(ViewTarget.position)

So what I ahve tried :

I tried Lerping the Vector Position, I tried smoothing the delta.y based on the last N frames.

The Camera I need is something like this :

Rotate on the Around UP Axis of the target and Rotate on Right Axis of the Camera, Camera Up is always = to Target UP.

So this is sort of Orbital Camera, but I am having trouble finding the correct rotation/operations.
The way its set right works, but the camera movement is jaggy, but I can't seem to find a way to add Slerp in there without messing everything.

Thanks!

Edit :
<>

sentences:
Right-To-Left Text Direction in Cocos2dx I want to use Persian/Arabic text beside English in whether Label or ui::Text.

Persian is a Right-to-Left and English is a Left-to-Right language and so I have problem to combine them in one string.

Scnario:

I want to show this text: 1."من1" then 2."emadpres2" and finally 3."3هستم".

If I write this text in a Left-to-Right editor it show as : ( Wrong Direction:  =====>  )

  1من emadpres2 هستم3

But actually it should be shown as : (  Correct Direction:  <=====  )

  هستم3 emadpres2 من1

This is my code :

auto rtl = Label::createWithSystemFont("سلام emadpres چطوری", B_NAZANIN, 25, Size(480, 100));
// The string here is also in wrong direction because the Visual Studio editor is Left-to-Right.
rtl->setColor(Color3B(0, 0, 0));
rtl->setPosition(...);
rtl->setHorizontalAlignment(TextHAlignment::RIGHT);
this->addChild(rtl, Z_NORMAL);

and this is the screenshot of this code:

As you see, I tried to use TextHAlignment but It doesn't help. I need something to change Direction not Alignment .

How should I make it Right-to-Left ?

PS: Cocos2dx v3.3

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:
How to encode a save game / game state as a string? I'm building an HTML game. For this game I want to implement a save-feature that should work like in some already existing games:

The user can chose export, this will create a string, representing the game state (I guess).
This string can be pasted into an import input and will load the save game.

I thought about storing the state in a JSON, minifying it, stringifying and encoding it in Base64.
But I don't think this is a good idea, users could easily cheat in this game by decoding the string, changing whatever they want, encoding it again and loading this string.

I already tried generating save files in games with this feature and decoding them in Base64 which didn't work, so I assume they use a different encoding.

How can I encode the JSON like this?

sentences:
Can I change the order of these OpenGL / Win32 calls? I've been adapting the NeHe OpenGL/Win32 code to be more object-oriented and I don't like the way some of the calls are structured.
The example has the following pseudo-structure:

Register window class
Change display settings with a DEVMODE
Adjust window rect
Create window
Get DC
Find closest matching pixel format
Set the pixel format to closest match
Create rendering context
Make that context current
Show the window
Set it to foreground
Set it to having focus
Resize the GL scene
Init GL

The points in bold are what I want to move into a rendering class (the rest are what I see being pure Win32 calls) but I'm not sure if I can call them after the Win32 calls.
Essentially what I'm aiming for is to encapsulate the Win32 calls into a Platform::Initiate() type method and the rest into a sort of Renderer::Initiate() method.
So my question essentially boils down to: "Would OpenGL allow these methods to be called in this order?"

Register window class
Adjust window rect
Create window
Get DC
Show the window
Set it to foreground
Set it to having focus
Change display settings with a DEVMODE
Find closest matching pixel format
Set the pixel format to closest match
Create rendering context
Make that context current
Resize the GL scene
Init GL

(obviously passing through the appropriate window handles and device contexts)
Thanks in advance.

sentences:
Three.js— how to rotate sphere without moving light (using OrbitControls)? Okay, I think the problem that I'm having is that when I create my DirectionalLight with three.js, when I then rotate my object with OrbitControls the entire scene is rotating, not just the sphere I have in the middle of it ( the only object I have in my scene ).
I want to make it so that I can rotate my sphere with my mouse like OrbitControls does, but not have the camera move. Or have the light not move with the camera? Here's a gif of my scene so far that might better explain my dilemma—

I want the light to be.. y'know.. more like the sun, coming from one point in space and shining at (0,0,0) in my scene, while still being able to rotate the sphere independently. Am I using OrbitControls wrong here? Here is what I have to get to the point I have in the gif above:
var width = section.offsetWidth,
height = section.offsetHeight;

var topOfElement = section.getBoundingClientRect().top - height;
var bottomOfElement = section.getBoundingClientRect().bottom;

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
camera.position.z = 10;
camera.position.x = -2.5;

const controls = new THREE.OrbitControls( camera, renderer.domElement );
controls.enableZoom = false;
controls.maxPolarAngle = Math.PI;

const renderer = new THREE.WebGLRenderer( { alpha: true } );
renderer.setClearColor( 0x000000, 0 );
renderer.setSize(width, height);
section.appendChild(renderer.domElement);

const onEverythingLoaded = () => {
    render();
};

const loadingManager = new THREE.LoadingManager(onEverythingLoaded);
const loader = new THREE.TextureLoader(loadingManager);

const earthGeomerty = new THREE.SphereGeometry( 5.5, 32, 32 );
const earthDiffuse = loader.load('assets/drought_earth_texture.png');
const earthSpec = loader.load('assets/drought_earth_texture_bump.png');

const material = new THREE.MeshPhongMaterial( {
    specular: 0xffffff,
    map: earthDiffuse,
    specularMap: earthSpec,
    normalScale: new THREE.Vector2( 1, 1 ),
    shininess: 30,
    transparent: true,
    depthTest: true,
    depthWrite: false,
    polygonOffset: true,
    polygonOffsetFactor: - 4,
    wireframe: false
} );

const sphere = new THREE.Mesh( earthGeomerty, material );
const ambientLight = new THREE.AmbientLight( 0x667777 );

const directionalLight = new THREE.DirectionalLight( 0xffffdd, 2 );
directionalLight.position.set( 4, 0, 0 );
scene.add( sphere );
scene.add( ambientLight );
scene.add( directionalLight );

const render = () => {
    animationFrame = requestAnimationFrame( render );
    sphere.rotation.y += 0.001;
    renderer.render( scene, camera );
};

For further clarification, I want to have my light work like this:

while still being able to rotate the earth with my mouse like with OrbitControls. But the light doesn't move.
Is OrbitControls the wrong tool here? Any documentation / helpful links would be appreciated I am so, so lost.
(I cross-posted this from stackoverflow because I thought maybe the people over here would know more about this, hope that's ok!)
Update
After much fussing about with the OrbitControls functions I realised that what I'm trying to do isn't what OrbitControls is for, because "orbiting" isn't what I'm trying to do— I'm trying to rotate the actual sphere with my mouse, which is entirely different. Welp.

sentences:
Change material emission for a second then go back to default I'm looking for a way to change the emission of a material for a second then get it back to where is was by default

Here's what I have for now

float emission_lvl = 5.0F;
float emission_lvl_start = 0.5F;

public Update(){
    mat.SetFloat("_Emission",emission_lvl);
    Invoke ("SetEmissionBack", 1.0f);
}

public void SetEmissionBack(){
    mat.SetFloat("_Emission",emission_lvl_start);
}

sentences:
How can I keep two racing players synchronised? I am working on a Unity mobile game, much like a multiplayer version of Temple Run. I'm seeing a fluctuating network latency (generally 200-500ms) because of the mobile platform.

The two player characters are shown as running along the same path and must do simple actions (jump, slide, powerup, etc.) to pass obstacles.

When a message comes late, the game assumes the remote player passed an obstacle. This usually works well, but in case a player is killed by an obstacle, I want the remote player to appear to die on the same obstacle/position as local player. Due to latency, the remote player appears to have crossed the obstacle before the message announcing their death even arrives.

How can I keep the players synchronised?

I tried moving the remote player back to the local players death position immediately as the death message arrives, it looks awkward visually and might raise other syncing issues.

sentences:
Send mesh to a video card with the help of ngui instead of DragonBones in Unity I am working at the project. It is pretty huge. And there is ngui at its core, so I can not go away from it (from ngui).

Now I am assigned to incorporate the DragonBones into the project. There are visual elements made with DragonBones which are (those elements) displayed behind the ngui elements.

I know that ngui works as follows: it gathers all the meshes and sends them all to the video card at once.

Is it possible to make DragonBones put the meshes in that gathering, so that DragonBones visual elements were sent to the video card along with ngui elements and hence were displayed in accordance with ngui elements?

Will extending the UIBasicSprite help me to tackle the issue?

sentences:
Unity prefab object limitations TLDR: What are limitations on how many objects a single prefab can handle safely? keeping in mind that I could potentially have almost a 100 of these

I am busy creating a system to essentially load the game world in chunks as the player moves.
This means that every single object in the world will be streamed into the game through script when needed(still designed in the editor, impossible otherwise)
The problem I am having is with methods to store and load objects.

I have looked at everything I could think of or get information on. After researching all the methods I found, I started thinking that prefabs is the best solution since it can live anywhere in the project(unlike streaming assets folder, which is also not recommended for many assets, let alone every single asset). Creating Game Objects at runtime is not as easy once GO's get complex with components and settings, also I assume the performance hit from creating GO's this way is worse than using an existing prefab.

So my question is if prefabs can handle massive amounts of objects(lets say 1000) safely? testing this is hard because i would have a prefab(or a few) for each tile that gets loaded.

sentences:
Using canvas graphics instead of traditional sprites in phaser I'm trying to learn Phaser (total beginner with mild JS experience) and I'm following tutorials and such where everything is using sprites. I'm trying to get by with basic canvas shapes instead of creating sprites, but I'm having trouble implementing them in some situations.

I have a working player shape:

var playerGraphic = this.game.add.graphics(100, 100);

// set a fill and line style
playerGraphic.beginFill(0x555555);
playerGraphic.lineStyle(2, 0xffffff, 0.5);

// draw a shape
playerGraphic.drawCircle(0, 0, 20);
playerGraphic.drawCircle(5, 5, 10);

this.player = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY, null);

this.player.addChild(playerGraphic);

But I'm unsure if this is the correct way of doing it.

I'm also struggling to get a tiled background to work, as it doesn't seem to work in the same way as above:

this.game.background = this.game.add.tileSprite(0, 0, this.game.world.width, this.game.world.height, null);

this.game.background.addChild(bgGraphic);

Any advice/help?

sentences:
What is the proper way to handle data between scenes? I am developing my first 2D game in Unity and I have come across what seems an important question.

How do I handle data between scenes?

There seems to be different answers to this:

Someone mention using PlayerPrefs, while other people told me this should be used to store other things like screen brightness and so on.
Someone told me that the best way was to make sure to write everything into a savegame everytime that I changed scenes, and to make sure that when the new scene loads, get the info from the savegame again. This seemed to me wasteful in performance. Was I wrong?
The other solution, which is the one I have implemented so far is to have a global game object that isn't destroyed between scenes, handling all the data between scenes. So when the game starts, I load a Start Scene where this object is loaded. After this ends, it loads the first real game scene, usually a main menu.

This is my implementation:

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

public class GameController : MonoBehaviour {

    // Make global
    public static GameController Instance {
        get;
        set;
    }

    void Awake () {
        DontDestroyOnLoad (transform.gameObject);
        Instance = this;
    }

    void Start() {
        //Load first game scene (probably main menu)
        Application.LoadLevel(2);
    }

    // Data persisted between scenes
    public int exp = 0;
    public int armor = 0;
    public int weapon = 0;
    //...
}

This object can be handled on my other classes like this:

private GameController gameController = GameController.Instance;

While this has worked so far, it presents me with one big problem: If I want to load directly a scene, let's say for instance the final level of the game, I can't load it directly, since that scene does not contain this global game object.

Am I handling this problem the wrong way? Are there better practices for this kind of challenge? I would love to hear your opinions, thoughts and suggestions on this issue.

Thanks

sentences:
Does LibGDX abstract OpenGL ES away or can I still use my OpenGL ES knowledge? I've been learning OpenGL ES, and am now turning my attention to using LibGDX.

My main concern with LibGDX is, if needed, will I be able to apply my OpenGL ES knowledge to something if needed and essentially override bits and pieces of the framework, or does LibGDX essentially hide any implementations of OpenGL?

sentences:
Rotate bone on 1 axis to look at another object - Unity 3D I'm new to game development and I'm trying to create a basic 3D Tower Defence game as my first project. I've created a basic turret in Blender and I'm now trying to rotate 2 different bones to make the turret follow the enemy. The first bone (which I have working) rotates the turret to face the direction of the enemy. The second which I can't get right needs to rotate the gun at the top of the turret to look down at the enemy. I need it to keep facing the same direction as the rest of the turret and don't want it to tilt to either side. So it needs to move on 1 axis only.

I have tried various things, including examples from the Internet but I can't figure it out. So far I've managed to get it to look down at its base, up at the sky and spin like a wheel. Basically everything except where it's supposed to be looking.

Here is the code I have at the moment:

if (enemiesInRange.Count > 0)
    {
        //Rotate Platform //#### This section works fine
        Transform platform = transform.root.Find("Armature/BaseBone/PlatformBone");

        Quaternion targetRotation; //Final rotation (I.e. facing the enemy)

        Vector3 turretPosition = platform.position; //Store the turrets current position
        turretPosition.y = 0; //0 the Y axis to stop the turret tilting up or down

        Vector3 targetPosition = enemyManager.activeEnemies[enemiesInRange[0]].transform.position;

        targetRotation = Quaternion.LookRotation(targetPosition - turretPosition);

        float rotateSpeed = 2.0f * Time.deltaTime;
        platform.transform.rotation = Quaternion.Lerp(platform.transform.rotation, targetRotation, rotateSpeed);

        //Rotate GunBox //####TO DO: This part is not working
        Transform gunBox = transform.root.FindChild("Armature/BaseBone/PlatformBone/LowerArmBone/UpperArmBone/GunBoxBone");
        Vector3 gunBoxPosition = gunBox.position;

        float angle = Vector3.Angle(gunBoxPosition, targetPosition);

        gunBox.RotateAround(gunBox.position, Vector3.left, angle);

        Debug.Log(angle);

    }

Here's a picture of the turret to give you an idea what I'm working with. You can see in the screenshot that the bone's default X rotation is roughly -50.

Enemies walk through the trench around the turret. The PlatformBone rotates everything from the silver platform upwards.

I also don't understand why the line below makes the turret rotate instead of tilting it. I would expect to rotate the turret around the Y axis to keep it flat on the floor and face another direction. Yet I seem to have to do the opposite (If I select the PlatformBone its Y axis is facing up as expected):

turretPosition.y = 0; //0 the Y axis to stop the turret tilting up or down

sentences:
Why does the order matter in multiplication of matrixes? I stumbled on this question because I had the same problem with my camera, and changing the multiplication order worked.

I ran into a similar problem when scaling a model. This code produced the wrong result:

// world is an existing Matrix
var scale = world * Matrix.CreateScale(3.2f);

whereas this worked perfectly (scaled a model to 3.2x it's size):

var scale = Matrix.CreateScale(3.2f) * world;

I don't understand why the order matters though - in "normal" math (that is, 5*3 vs 3*5), swapping the factors yields the same result. I understand differences if there are more than 2 factors (like in this question), but I don't see the issue here?

I don't know much about how Matrices really work and so I don't know if that's an XNA quirk or if it would happen in OpenGL as well?

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:
What is a reasonable terminal size across Linux distributions? I'm working on a Curses-based roguelike; it should (and does) work in both Linux and Windows (various flavours of each).

Currently, I'm enforcing a hard requirement of "your terminal size must be 80x25 to play. Please fix it and come back" to ensure I have a consistent UI.

This works on Windows. But not on Linux; it seems that Ubuntu, at least, uses a terminal size of 80x24 instead.

Since Google is not useful, what can I reasonably expect as far as terminal size support across various Linux distros?

(If it is 80x24 or even as low as 80x20, I can probably work with that.)

sentences:
Is a SQLite Database Suitable to Store the Building Blocks for Dynamic Content? I am trying to make my own game for fun, it is basically a 2d side scrolling shooter, with dynamically generated enemies, levels, loot, and some other things. Currently I have dozens of XML files that define pretty much everything when it comes to the content, along with some constraints to keep things sane. Often times certain things like Weapons or Monsters are composed of several randomized sub components, that get picked out of a pool, according to factors such as rarity, the player level, and the game level.

Currently the way I have it setup, is where during initialization the game creates several factory classes (stuff like WeaponFactory and EnemyFactory), these parse the XML and store the XML's data in a more manageable format. Creation is simply done by invoking a create method, and passing the required parameters (i.e. player level, monster level, etc), these parameters are taken into consideration for what should be generated.

Anyways I was wondering if it would be a better idea to use a SQLite database to store all this information? I have looked around, and it seems to be a mixed response. Does anyone have any sort of insight into this? I am using C++ and OpenGL currently.

EDIT

I probably should have been more clear, I was more or less asking is it actually a usable way of doing this kind of stuff. My main concerns lie in the fact of choking the Database with requests. Reality is this game will never see the light, and has technically been done as of a few weeks ago, however I decided to go back retool the engine to use Box2D Physics. This is more a learning process, than anything.

sentences:
Voice recognition libraries - C++ I need to implement voice recognition in my game, the target is that the user speaks into the microphone and the game responds accordingly to some commands.

What libraries could help me with such task? I need them for C++ and as lightweight as possible to plug into the game(it will be used in mobile games).

An ideal usage would be having it capture input sound or receiving the audio samples, and outputting strings with the recognized text.

Thanks

sentences:
Where to hire 2D sprite artists? I'm looking for high quality original 2D sprite collections which are animated where appropriate.  (IE not simply collections I can buy, we want original work).

I've had a look online but am struggling to find out where I can hire such people!

Where do I find such people?
How much should I expect to pay?

sentences:
Determine facing direction mecanim 2d movement I'm using this script to move my character in my 2d world:

    public float speed;   //Movementspeed

public Rigidbody2D rbody;
Animator anim;

void Start () {

    rbody = GetComponentInChildren<Rigidbody2D> ();
    anim = GetComponent<Animator> ();
}

void FixedUpdate () {

    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 * speed * Time.deltaTime);

}

}

What I want is to somehow register where my character is facing/walking towards to be able to Instansiate a gameobject infront of it.

How do I do that?

sentences:
Why are my polygons not opaque? A newbie to XNA here.  This is a followup to my previous question that showed me part of what I was doing wrong but I'm still not getting what I want.  I'm setting up a BasicEffect thus:

Effect = new BasicEffect(GraphicsDevice);
Effect.VertexColorEnabled = true;
Effect.Alpha = 1.0f;
Effect.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
Effect.GraphicsDevice.BlendState = BlendState.Opaque;

and the draw loop:

GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, MaxDepth, 0);

All polygons are being rendered where and how I wish except they should be fully opaque and they aren't.  The actual image looks more like the various colors are being combined in a fashion I'm not sure about:

sentences:
Are the Marek-knows tutorials any good or still relevant? Anyone have any experience with this? This hasn't been refereed as mush as it 'looks/sound' like.

https://www.marekknows.com/

Among many other products, the site provides game engine development video, which is around 45hours long. Starting from context creation, model loading, scene graph, animation. But it looks like a little old. Is it still useful?

sentences:
How to make character respawn the position needed in Andengine? I want to make my character respawn in the last Checkpoint he has reached. I've already stored the position of the checkpoint but I'm not very sure of how to set that position to the Sprite/Body of the character to make it appear in the position I want to. Do I have to use the Sprite or the Body? Here's how I initialize my character:

    mPlayerSprite = new AnimatedSprite(mapOffset, 0, playerTexture);

    final FixtureDef mPlayerFixtureDef = PhysicsFactory.createFixtureDef(0, 0f, 0f, false, CATEGORYBIT_PLAYER, MASKBITS_PLAYER, (short) 0);
    mPlayerBody = PhysicsFactory.createBoxBody(this.mPhysicsWorld, mPlayerSprite, BodyType.DynamicBody, mPlayerFixtureDef);

    mPlayerSprite.setUserData(playerName);
    mPlayerBody.setUserData(playerName);
    this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(mPlayerSprite, mPlayerBody, true, false));

    mScene.attachChild(mPlayerSprite);
    mEntityList.add(mPlayerSprite);

Thanks in advance!

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:
Unity: how to change runtime code for different platforms? In Unity, how can I programmatically control what source code is compiled?

I have a script with various BuildPipeline.BuildPlayer calls, allowing me to build all versions of my game. However, I'm using the AVPro Video asset to play video, and it doesn't support 32bit Mac. As such, I need to fall back other video playing code on 32bit Mac. There's no preprocessor directive to differentiate 32bit OSX (like you can do for other platforms https://docs.unity3d.com/Manual/PlatformDependentCompilation.html ).

However, since I'm building each version in sequence, it seems like I should be able to set some state so that during compilation, the right code is used. I tried this:

VersionHandler.onMac32 = true;
BuildPipeline.BuildPlayer(levels, path, BuildTarget.StandaloneOSXIntel, BuildOptions.None);
VersionHandler.onMac32 = false;

And then checking that static variable in game. However, that static is "never set", presumably because the the state of the variable during compilation doesn't affect the value at runtime. Is there any other way I can "get at" the compiled code and set a flag for certain builds?

As a fallback, I can manually swap code in every time I build for OSX 32-bit, but I'd prefer not to do that.

sentences:
How do I determine the forward/right direction when I have the "up" vector? - Unity I am trying to fix a gameobject for e.g. a cube (which i am using as a sensor) on my character. I need the cube to rotate (with orientation control from the inspector - I have a public quaternion rotation variable set). I have identified 3 vertices using ray cast to fix my sensor onto the character. I already have determined the normal of these vertices which will be the "up" direction of the cube. I am wondering how I can determine the forward/right vector to use in the LookRotation() function. I need to basically be able to rotate the cube ON the character even as the character moves on animation. This is my code, and as of now there is no rotation happening. I'm sure I am missing something and would really appreciate help. I really hope this is enough explanation.

using System.Collections;

using System.Collections.Generic;
using UnityEngine;

public class orientation : MonoBehaviour
{
    // importing from Vertex Finder Script to use InterpolatedNormalInWorldSpace value

private VertexFinder script;
public Transform target;

// to edit orientation of sensor in Unity Inspector
public Quaternion rotation_edit;

// Start is called before the first frame update
void Start()
{
    script = GetComponent<VertexFinder>();
}

Quaternion TurretLookRotation(Vector3 approximateForward, Vector3 exactUp)
{
Quaternion rotateZToUp = Quaternion.LookRotation(exactUp, -approximateForward);
Quaternion rotateYToZ = Quaternion.Euler(90f, 0f, 0f);

return rotateZToUp * rotateYToZ;
}

// Update is called once per frame
void Update()
{
    Vector3 relativePos = target.position - transform.position;

    // aligning axes of sensor to z axis and y axis respectively
    Quaternion rotation1 = TurretLookRotation(relativePos, script.interpolatedNormalInWorldSpace);

    // setting rotation of sensor to values entered in Inspector with respect to the above aligned axes
    transform.rotation = rotation1 * rotation_edit;

}

}

sentences:
game state saving/loading? what is the most used method or algorithm for saving game state (profiles), databases text files how there encryption goes and things related.

I have seen Caesar IV used mySQL.

any suggestions.

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:
Some advice for settling on a map format for a tile game? I am using XNA 4.0 and am currently working on a simple tile game to pass the time. Basically, I'm using the tried and true method of having numbers refer to tile types, where in 0 would be an empty tile, 1 would be grass, et cetera.

This is all well and good and works fine but I was wondering how to incorporate other assets. For example, a map may have parallax backgrounds, background music, and of course the tileset from which the tile map refers to draw its textures.

Ignoring ambient music and gratuitous scrolling backgrounds, I am still unsure of how to implement just the joining of the tile map (text) and tileset (png image). I see several solutions:

1) Embed the texture data for the tileset directly within the map file. This could be extended to other assets as well and would allow for all map files to be together in a single file. Unfortunately, the file sizes quickly become massive as raw texture data is several times larger than compressed images. For this I'm using GetData and WriteBase64.

2) Somehow mention the directory or filename of the tileset from within the text map file. This is how I typically see it done, but because I am using the content loader and not simply loading off the hard drive, this may not be possible. Perhaps the asset name could be stored but this solution seems a bit error-prone.

3) Completely separate the textual map data from the tileset image. At runtime, first load the map tiles and then allow any sort of tileset image to be loaded afterwards. This has the advantage of different map files using the same assets without duplicated data and very small file sizes. However, with this solution the width of the tileset would still have to be known before hand in order to correctly offset tile values. Also, map files may become lost and more easily edited by the user.

4) Create some sort of ZIP derivative in which all map files are contained in this package. Then, the textual map file can refer to the assets within this container. I'm not exactly sure whether or not this would work with XNA's content loader or how to implement it either, so I'm not sure of the this solution.

How do most developers typically solve this problem with XNA?

sentences:
Collision detection optimization for a top down shooter I'm relatively new to game development and have been trying to learn how collision detection is coded. I mostly work with Actionscript 3, but I'm learning C++ on the side.

I've been wondering how "bullet hell" and top-down shooters optimize their collision detection with so many objects.

Any information/theories would be great.

sentences:
How to access files in Chrome So, I am making a game-like html file that needs to load a few assets. I have a loading animation which uses the timing of the loading files to create a progress bar. This all goes fine. The files all load, and the app launches. However, none of the files can access each other as they are all in different script tags. And I cannot merge them because the JS is never actually put into the html. So what I need to do is to access the local file system (it uses the file:// prototype) and read the file, then stick the text into a script tag. However, all of the examples I have found on the web throw this error:

  Xhtmlrequests can only access (list of protocols not including file)

What I need is a JS way to access the files with no input from the user (other than opening the application). How can this be done?

sentences:
How can i run my .LÖVE game directly from the lua interpreter? I've just started with LOVE and LUA , i'm interested in LOVE because i want to  play around with something different from my dayjob(i'm a webdeveloper) and since it uses LUA and is interpreted , i though it would be a great way to try out the API.

but i couldn't find how to run my .LÖVE game directly from the lua interpreter? i'm finding it bothersome to package the game each time i make a little test with the API.

sentences:
Algorithm for exploring/filling grid map I'm working on a small game that takes place on a grid map. I'd like to write an AI that is able to explore the grid map by filling as much of its available space as possible.

From any given position there are four possible moves (north, south, east, west), but some of these may be blocked by walls. Also, once I visited a cell I don't want to visit it again. What's more, I want to avoid getting stuck: if moving in one direction means I'm going in a dead end, I'd rather not fill out that part of the grid.

Can you please help me with some pointers as to how I can do this?

sentences:
How to make player stay on a moving object I've made an obstacle course with various moving parts to test out movement of a player. In the obstacle course there is a section where there are multiple cubes moves from side to side, and you have to jump from one to the other. But regardless of their speed, I can't seem to get the player to stay on top of any of the moving cubes. I have no clue how to fix this my only guess would be to use materials, but I can't apply any to the character controller. I appreciate any suggestion that you can give. Also the movement is done as an animation that I created in unity in the animation window.

Thanks, Nova

sentences:
How to display top-down 2D online game I'm new to game development (but not new to software development). As a personal/learning project, I'm designing an overhead-view 2D online RTS game (static, no scrolling). The first cut will pretty much only require simple sprites, with typical menus, text, and buttons.

Most of the game logic will happen server-side, with unit positions and other vitals sent to the browser at about 30 fps. The client won't do much, aside from the display and UI.
The server stuff is easy for me, but I need a little guidance on the browser display.

Having read up on several new browser technologies/HTML5 libraries, I'm getting more overwhelmed by the options, not less! I don't necessarily need the absolute best tool; what I want is a technology that will make it easy to implement a simple sprite-based game, and do a decent job of it.

I know JS itself well enough, but not any of the fancy graphics/game libraries. I know Flash/AS3 (doing what I want in Flash would be easy enough, but the mobile browser support concerns me--should I steer clear if I want iOS support?). I have the entire Adobe suite (subscription), if that helps. I'm not averse to learning a new language/API/tool, of course, but the more I can put what I know to good use, the better.

So, my question (yes, there is one in here somewhere!) is, what are my (best) options today for implementing the in-browser (display) part of said 2D online browser-based game, based on the above goals and stated skillset/available tools? Since it may be difficult to be completely objective, please do include a little rationale on why you believe your answer is the right tool for this job. I'm not asking for a doctoral thesis, here, just a paragraph or two. :-)

sentences:
Is it clever to use some engine to start game developing? I started C# programming, in order to later develop games with XNA. I read a good game development book for C#. Since I already knew other languages, I could quickly learn C# features and syntax code. I then stepped over into XNA. Since the book I was reading was a bit old, I put it aside, and started to look at game development tutorials about XNA over the Internet. I could accomplish and understand most of them, using 2D graphics. I created animated sprites, made my characters move in any direction, scrolled my background together with my characters movement, and so on. Everything was done with "raw" XNA.

I found some of those things hard to understand, and I found that some things wee already be built into the framework. I found other game engines, which I could clearly understand at least the simple line codes, such as "FlatRedBall", "Axiom" and "Quick Start Engine". I already knew of the famous ones, like "OGRE", "Unreal" and "Unity". At the same time, I was tempted to throw it all away, and start learning some famous game engine programming. I wanted to stay with XNA, as it took me time to learn; time I wouldn't like to waste it.

This time, I leave it up to the experienced ones. Can I go through some game engine, and use what it has to offer, even if I'm starting with game development? Some people could think that it is good to get use to the boring routines of a naked framework. If so, what would be the recommended one to start off with? I heard that it varies from market to market. We could perhaps consider that I want an RPG-specific.

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:
Checking Collisions In 2D Platformer With Tiles My team and I are developing a 2D platformer with C++/SDL/OpenGL, and we already defined a collision system, but we have a problem checking collisions with the tilemap.

The tiles of the tilemap are 32x32, so we try to define that the max speed in X and Y of the player it's less than 32 because in this case we found the problem that if the speed it's bigger than the tile size, when checking the collisions the position it's updated with the speed which it's more than 32, so in that case, the position skip a tile which causes a huge problem for verification, so at the momento we limit the X and Y speed to 30, but we don't know how make the speed bigger than the tile size without losing the complete collision detection with some possible tiles that may be skiped.

Thanks a lot

sentences:
I can't add script in unity I'm a beginner in unity so I got this problem.
Here is the script:

using UnityEngine;
using System.Collections;
public class Playercontrol: MonoBehaviour {
    public float maxspeed = 10f;
    bool facingRight = true;

    void FixedUpdate () {
        float move = Input.GetAxis ("Horizontal");

        GetComponent<Rigidbody2D>().velocity
             = new Vector2(move * maxspeed, GetComponent<Rigidbody2D>().velocity.y);

        if (move > 0 && !facingRight){
            Flip ();
        } else if (move < 0 && facingRight) {
            Flip ();
        }
    }

    void Flip() {
        facingRight = !facingRight;
        Vector3 theScale = transform.localScale;
        theScale.x *= -1;
        transform.localScale = theScale;
    }
}

I don't know why but it keep saying that
Can't add script component 'Player control' because the script class cannot be found.Make sure that there no compile errors and that the file name and class name match.

sentences:
How do I create menu with text in OpenGL? How would I go about creating a menu system with fonts in OpenGL? I want to make a dungeon crawler and will need a menu for inventory and stats for the weapons. I can draw a world made out of blocks ok but I'm not quite sure how to do this.

I think I need to use the matrix that glortho applies to the matrix stack. Specifically I'm using WebGL and I don't have access to fonts so it seems like I have to create my own.

Any help with how I would go about doing this would be appreciated.

sentences:
What type of networking archtitecture does Unreal Engine 4 have? I am working on online multiplayer FPS on UE 4 with up to 16 players.
I am now at the making architecture model, stage.

I am doing research on possible server architecture model with respect for future scalability, bandwidth support etc.
However I could not find any good information on how UE 4 networking work and what it's architecture. In order to know whether it will suit my needs and whether I will be able to modify it

sentences:
Use "Google Play Game Services" (Multiplayer feature) with LibGDX I'm developing a simple game (for Android, using LibGDX Framework) and I would like to implement multiplayer feature to it. So, since the main project with the logic of the game in LibGDX is separated from the android project, I have created an interface to allow my game to call the GPGS API in order to implement its services. But, it doesn't work. Have someone an example to show me how to do this? However, this is what I have done (premise: GPGS SDK is already installed and its library is linked to my Android project):

Copy the GameHelper class of BaseGameUtils (downloaded from Google) in my Android project.
Make the interface in the main libgdx project
Create a class (named MultiplayerOperations) that implement the interface, in my android project. This class is more similar of the BaseGameActivity available in the BaseGameUtils.
In the activity of my Android project a make an object of the last class type and pass it to the constructor of the main libgdx project.

mpOperations = new MultiplayerOperations(this);
mpOperations.onCreate();

initialize(new CloseWall(mpOperations), cfg);

When I start the application, it doesn't work and it exit with an exception.

sentences: How do I enlarge a SpriteFont without it becoming blurry? How do I make spritefonts not blurry when I make them bigger? I have searched Google and haven't found any useful answer.

sentences: Is it possible to develop a game with Lua/Löve and have the source code compiled? I've been looking at Lua and Löve for developing simple 2D games. But since Lua is interpreted and I know it can be compiled to some point, but how secure is that to decompiling. Or is there a better way to distribute the game?

sentences:
Draw wireframe models for Gear VR app in Unity I want to create a 3D Android app for Gear VR that does/lets me do the following:

Read an input file with a bunch of coordinates of points (including information about how they should be connected)
Draw a wireframe model with these points
Walk around and through the model in first person to look at it from different angles using a gamepad/controller. I don't want to directly interact with it!
(Maybe have more than one model displayed at the same time, including filled ones)

Is it possible to draw 3D wireframe models in Unity using coordinates instead of using already finished models that were created in Blender/Maya/etc, and if so, how?

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:
A shader that casts shadows, doesn't receive shadows and doesn't render any textures/models at all? Bit of a strange one but I'm in the situation where i need a shader to essentially render nothing and cast a shadow!

I found this though some googling but sadly that casts shadows onto itself which is undesirable.

sentences:
I cant Instantiate a particle system for the duration of a subroutine I have a sub routine that lowers the timescale to 0.3 for 2 seconds. while in those two seconds i would like to spawn a trail of particles that follow the player.

I can get the particles working if I attach them to the player in the editor but I'm having trouble spawning them at the start of the time slow down.
The slow down subroutine works fine its just the particles that i cant spawn.

Thanks, any help is appreciated.

public GameObject particles;
public Transform playerParticles;
// Start is called before the first frame update
void Start()
{
    slowDownActivateNoise = GetComponent<AudioSource>();
}

void Update()
{
    if (hasCollided)
    {
        if (!activated)
        {
            StartCoroutine("SlowDownActive");
        }
    }
}

public IEnumerator SlowDownActive()
{

    Debug.Log("subroutine Start");
    activated = true;
    Instantiate(particles, playerParticles.position, playerParticles.rotation);

    Time.timeScale = 0.3f;
    GetComponent<Collider>().enabled = false;

    yield return new WaitForSeconds(2);

    GetComponent<Collider>().enabled = true;
    Time.timeScale = 1.0f;
    hasCollided = false;
    activated = false;
    Debug.Log("subroutine end");

}

sentences:
Which Box2D-like physics engine parameters need pixel conversion? The official guide does not have any useful details on the matter:

http://www.box2d.org/manual.html

Position is an obvious one. What about velocity? Density? Anything else?

Update: the context is wrapping/interfacing a physics engine to make it more usable. E.g. units of measure in the game editor should be consistent.

sentences:
Data overwritten in MapSubresource() method I am trying to dynamically update the vertex buffer in a UWP project using SharpDX, once every time I call the following method, where context is the device context member.

public void UpdateVertexBuffer(ScatterVertex data)
            {
                DataBox dataBox =
                this.context.MapSubresource(
                    scatterPointVertexBuffer,
                    0,
                    D3D11.MapMode.WriteNoOverwrite,
                    D3D11.MapFlags.None
                    );
                var pointer = dataBox.DataPointer;
                pointer = Utilities.WriteAndPosition(pointer, ref data);

                this.context.UnmapSubresource(scatterPointVertexBuffer, 0);
            }

I am expecting to keep the old data during the update process. However each time I call this method, the previous data is overwritten. I checked the pointer of dataBox.DataPointer and it remains the same value in every call.

Using DataStream as output doesn't help either. In either cases if I check the vertex buffer I get only one vertex.

But shouldn't the MapSubresource method protect the old data if I choose the WriteNoOverwrite mode?

What should I do to keep the previous data during update?

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: How to put an invisible marker on a model and refer to it in the game? I am using XNA/C# to load up 3ds Max models exported in FBX format. Is there some way to mark a specific point in the model like the pipe of a gun so I can just refer to it and place a bullet in there directly to make shooting look good?

sentences: How to create a 2D ocean effect in cocos2dx and box2d for iphone, android, windows phones Currently my game needs a top ocean view. Can this ocean effect done using box2d? or should I dive into write my own physics (liquid/water simulation). Ideas and suggestions are welcome.

sentences:
Investigation stage before starting a game I was thinking about how to organize the stage about getting informed about whatever game is needed to develop, what would others do.

For example, if I wanted to develop a game about car racing, I should figure out all the factors during the race, from the car factor to the pilots, etc., environmental factors like weather, circuit conditions, etc.

How does one manage this stage?

Thanks.

sentences:
Trying to make a box move around the screen with the arrow keys I have a box and it moves around the screen when the user presses the arrow keys. It seems a bit bulky and awkward though. Any thoughts on how to make it more efficient/less resource intensive?

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;

public class Box {

private float boxWidth, boxHeight;
private int gameWidth, gameHeight;
private Color boxColor;

private Vector2 position;
private Vector2 velocity;
private Vector2 acceleration;

private boolean goRight, goLeft, goUp, goDown, stopRight, stopLeft, stopUp, stopDown;

public Box(int boxWidth, int boxHeight, Color boxColor, int gameWidth, int gameHeight) {
    this.boxWidth = boxWidth;
    this.boxHeight = boxHeight;
    this.boxColor = boxColor;

    this.gameWidth = gameWidth;
    this.gameHeight = gameHeight;

    position = new Vector2(gameWidth/2 - boxWidth/2, gameHeight/2 - boxHeight/2);
    velocity = new Vector2(0, 0);
    acceleration = new Vector2(0, 0);
}

public void update(float delta) {

    velocity.add(acceleration.cpy().scl(delta));

    if(velocity.x >= 100) {
        velocity.x = 100;
    }

    if(velocity.x <= -100) {
        velocity.x = -100;
    }

    if(velocity.y <= -100) {
        velocity.y = -100;
    }

    if(velocity.y >= 100) {
        velocity.y = 100;
    }

    if(stopRight) {
        if(velocity.x > 0) {
            velocity.x -= velocity.x/20;
            if(velocity.x <= 0) {
                velocity.x = 0;
                stopRight = false;
            }
            if(goLeft) {
                acceleration.x = -100;
            }
        }
        else {};
    }

    if(stopLeft) {
        if(velocity.x < 0) {
            velocity.x -= velocity.x/20;
            if(velocity.x >= 0) {
                velocity.x = 0;
                stopLeft = false;
            }
            if(goRight) {
                acceleration.x = 100;
            }
        }
    }

    if(stopUp) {
        if(velocity.y < 0) {
            velocity.y -= velocity.y/20;
            if(velocity.y >= 0) {
                velocity.y = 0;
            }
            if(goDown) {
                acceleration.y = 100;
            }
        }
    }

    if(stopDown) {
        if(velocity.y > 0) {
            velocity.y -= velocity.y/20;
            if(velocity.y <= 0) {
                velocity.y = 0;
            }
            if(goUp) {
                acceleration.y = -100;
            }
        }
    }

    if(position.x >= gameWidth - boxWidth) {
        position.x = gameWidth - boxWidth;
    }

    if(position.x <= 0) {
        position.x = 0;
    }

    if(position.y >= gameHeight - boxHeight) {
        position.y = gameHeight - boxHeight;
    }

    if(position.y <= 0) {
        position.y = 0;
    }

    position.add(velocity.cpy().scl(delta));

}

public Box getBox() {
    return this;
}

public Color getBoxColor() {
    return boxColor;
}

public void goRight() {
    goRight = true;
    acceleration.x = 100;
    stopRight = false;
}

public void goLeft() {
    goLeft = true;
    acceleration.x = -100;
    stopLeft = false;
}
public void goUp() {
    goUp = true;
    acceleration.y = -200;
    stopUp = false;
}
public void goDown() {
    goDown = true;
    acceleration.y = 200;
    stopDown = false;
}

public float xPos() {
    return position.x;
}

public float yPos() {
    return position.y;
}

public void stopRight() {
    acceleration.x = 0;
    stopRight = true;
    goRight = false;
}

public void stopLeft() {
    acceleration.x = 0;
    stopLeft = true;
    goLeft = false;
}

public void stopUp() {
    acceleration.y = 0;
    stopUp = true;
    goUp = false;
}

public void stopDown() {
    acceleration.y = 0;
    stopDown = true;
    goDown = false;
}

}

Any ideas on how to do this with fewer lines of code? Thanks!

sentences:
Unity: Simple “pass through” geometry shader I would like to implement a geometry shader that does nothing, just for the purpose of learning and to go ahead with that and do something useful with it.

I currently have:

A compute shader creating "particles".
A vertex shader doing the transformation
A fragment shader...

This is the shader file:

StructuredBuffer<float3> particles;

struct fsInput {
    float4 pos : SV_POSITION;
};

fsInput vert(uint id : SV_VertexID)
{
    fsInput fsIn;
    float3 worldPos = particles[id];
    fsIn.pos = mul(UNITY_MATRIX_VP, float4(worldPos, 1.0f));
    return fsIn;
}

//[maxvertexcount(1)]
//void geom(point fsInput p[1], inout TriangleStream<fsInput> output)
//{
//  fsInput fsOut = (fsInput) 0;
//  fsOut.pos = p[0].pos;
//  output.Append(fsOut);
//}

float4 frag(fsInput fsIn) : COLOR
{
    return float4(1.0, 0.2, 0.2, 1);
}

I'm drawing my particles with this call:

Graphics.DrawProcedural(MeshTopology.Points, NUM_PARTICLES);

In my understanding, which is quite limited due to the perfect documentation of geometry shaders, my geometry shader should do nothing. Just forward the points to the fragment shader. However, if I use that shader (comment in those lines), I wont see my particles anymore. Without the geometry shader, I can see every particle.

So the first question is, where is the error? The second question is: Can I, starting with points and using the geometry shader, go from points to a, for example, cube? Or should I do it in the compute shaders? But if so, which MeshTopology should I use to draw the data from the compute shader as Cube, Sphere, etc...?

Thank you for help!

sentences:
How to access an uniform array with a float as index in GLSL? I'm trying to do basic multitexturing of terrain in OpenGL.

Im building the terrain with an image representing different elements (beach, water, jungle...) :

Im trying to map each color of this image with a texture in my game: green color means grassTexture (id 0), blue color means waterTexture (id 1), etc...

My fragment shader contains an uniform array containing all textures that I use (grass, water, ...) :

// Terrain.frag
uniform sampler2D terrainTextures[50];

For each vertex of the terrain, I pass a float in_TextureId corresponding to a texture id :

// Terrain.vert
layout (location = 0) in vec3 in_Vertex;
layout (location = 1) in vec4 in_Color;
layout (location = 2) in vec3 in_Normal;
layout (location = 3) in vec2 in_TexCoord;
layout (location = 4) in float in_TextureId;

Then im trying to display the correct texture for a vertex with this textureId in the fragment shader :

outputColor = texture(terrainTextures[int(textureId)], texCoord);

With this line, I have this result :

If I modify the code of the fragment shader with the following code :

highp int tid = int(textureId);
if(tid == 2)
{
   outputColor = texture(terrainTextures[int(textureId)], texCoord);
}
else if(tid == 1)
{
   outputColor = texture(terrainTextures[int(textureId)], texCoord);
}
else outputColor = texture(terrainTextures[int(textureId)], texCoord);`

It works better :

I can't understand why it's working with this code, i'm doing exactly the same thing in the first example.

Maybe it's not the good way to access an uniform array ?

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:
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:
translation and rotating at the same time and waiting before animation? I am having difficulties here. I want to move my character with the buttons and I want the character to rotate wherever he is going.

Also I want to play an animation when there is no keys pressed. I am able to do that but I want the animation to play after 10 seconds of no key being pressed, and only once. Than after a movement that resets and again after 10 seconds of no key the animation plays. (The animation works but it happens right after I stop pressing a key and continuously.)

IEnumerator Test()
{
    yield return new WaitForSeconds(10.0f);
}

void Update()
{
    if (Input.GetKey(KeyCode.W))
    {
        counter += Time.deltaTime;
        transform.Translate((Vector3.forward) * moveSpeed * Time.deltaTime);
        Debug.Log("Pressing W key");
    }
    if (Input.GetKey(KeyCode.S))
    {
        counter += Time.deltaTime;
        transform.Translate((Vector3.back) * moveSpeed * Time.deltaTime);
        Debug.Log("Pressing s key");
    }
    if (Input.GetKey(KeyCode.A))
    {
        counter += Time.deltaTime;
        transform.Rotate(Vector3.down * rotateSpeed);
        Debug.Log("Pressing a key");
    }
    if (Input.GetKey(KeyCode.D))
    {
        counter += Time.deltaTime;
        transform.Rotate(Vector3.up * rotateSpeed);
        Debug.Log("pressed D");
    }
    if (!Input.GetMouseButton(1))
    {
        moveSpeed = 20;
    }

    if (!Input.anyKey)
    {
        if (counter >= 2)
        {
            StartCoroutine(Test());
            anim.Play("Animation");
            counter = 0;
            Debug.Log("A key or mouse click has been detected");
        }
    }
}

sentences:
Efficient removal and adding of Components in ECS i'm working with the Ashley Entity-Component-System (related to libGDX) to program a server-side simulation for an online game and i stumbled upon a serious performance drawback, that is probably caused by how it manages Entity-Sets:

"Family", these are basically descriptors for Entities with a specific set of components.
Removing a component is an costly operation because the Family-instance needs to search through an Array of entities that it manages and remove the Entity from that Array. This is O(n) for every single removal at worst.

And here's my problem:
I have a Family that describes all Entities that do have a position and a velocity component. If i want to remove the velocity-component, for example, to turn it into an static entity and re-add it later to make it move again, this completely eats up my budget of frame time (50ms->20fps) with only ~7000 Entities changing Family back and forth within a frame. At the same time, moving 100000 entities takes only about 15ms at max (without multithreading ~30ms).

I have thought of these options yet:

-Change the data-structure that the Entities are sorted into, this creates new problems, but may still be the most viable Solution, i thought of mapping the Entity IDs to Objects or keeping them in a sorted data-structure.

-Sort everything once after a System has finished execution, requires redesigning a lot of code but probably reduces the time-consumption greatly

-Changing the Entity System, i know of Artemis, but it would be great if you could point me at something else for Java if you know a library that does it better.

-This whole thing may not even become a bottleneck when running the final game-simulation, it might or might not, so just going on and thinking about this later may be acceptable, since I'm probably over-engineering again.

What do you think is the way to go?

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:
how should I network my turn based game? I'm writing a very basic turn based strategy game which allows a player to select units and attack enemy units on their turn. The game is written in Java using the slick2d library and I plan to use kyronet for the networking api.

I want the game to be networked, but I do not know how I should go about it. My current idea is to connect two users together, and the first one to join the game becomes the game host, while the other becomes the client.

However after reading http://gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking/ it seems my game would be suited to a peer to peer lockstep model. Would that make programming the networking side much easier?

Any suggestions on how I should structure my networking would be greatly appreciated

sentences:
How to handle cutscenes in XNA? I am making a 2D RPG in XNA, and I want to be able to have basic cutscenes, kinda like those in the handheld Pokemon games.

What is the easiest way to do this? Sorry for the vagueness of my question, but I'm new to game development, and nothing I've found says how to do this.

sentences:
Generating a town layout in a grid I want to generate a town layout in a square grid (rendered isometrically, but that doesn't matter) using the following elements:

2x2 Houses
Roads, 1 unit wide
Canals, 1 unit wide

Sample layout:

I always have a specific number of houses, and as many roads and canals as necessary to connect them all.
The houses need to have two pieces of road in front of their front door (which is always pointing to the right)
It would be nice to have fields of grass (emptiness) inbetween.

Is there a ready-made algorithm for this? If not, what direction should I be thinking of to implement this?

sentences:
render with const depth value This is a question that may have an answer that differs for vanilla desktop GL and GL ES 2.0 (and wishful thinking is that ES 3.0 would have the same answer as vanilla GL).

What I'm doing is rendering a cubemap with a FS quad and I'd like to know if there's a way to specify a constant depth value for an entire render call rather than to get involved at the fragment shader level, in hopes of chasing a little bit of performance as well as flexibility in that I can use the same shader for drawing to different const depth values.

As for why it might benefit performance, the note at the bottom here offers some ideas, such as early-z testing... I suppose realistically if I emit a constant distant fragment depth, then early-z can still happen while maintaining the flexibility of pixel-programmable depth in general (necessary for proper impostors as shown). In this case I may be splitting hairs unnecessarily at this point. However that note does mention that if I can avoid specifying gl_FragDepth, I should, but it'd be up to the driver whether it will do something smart if I e.g. set gl_FragDepth to a constant.

As an example I could render my 3D scene, then set depth draw value to maximum, keep depth test on, and then render a fullscreen quad for my cubemap skybox, and it would just do the right thing.

Otherwise, choices include:

render skybox first with depth testing switched off, then render scene
use a fragment shader for the skybox that specifies the requisite depth value (this may very well just be the answer)

sentences:
Pygame window becomes unresponsive when I click it I'm new to programming, python and pygame.  This is some code I wrote to draw random colored rectangles on an 800 x 600 canvas.  It does what I expected it to do but becomes unresponsive if I click anywhere on the window.  I am on a 64 bit windows 7 system running 32 bit python 2.7 with the appropriate pygame 1.9.1.

    import pygame as pg
    from random import randint as rand

    pg.init()
    screen_size = (800,600)
    canvas = pg.display.set_mode(screen_size)
    pg.display.set_caption('Random Rects')
    curEvent = pg.event.poll()
    running = True
    todraw = []

    class rect:
        def __init__(self, x, y, (width, height)):
            self.x = x
            self.y = y
            self.width = width
            self.height = height
            self.color = (rand(0,255),rand(0,255),rand(0,255))
        def topygame(self):
            return self.color,(self.x,self.y,self.x+self.width,self.y+self.height)

    for x in range(100):
        todraw.append(rect(rand(0,800), rand(0,600), (rand(0,100), rand(0,100))))

    for x in todraw:
        pg.draw.rect(canvas, *(x.topygame()))

    while running:
        pg.display.flip()
        for event in pg.event.get():
            if event.type==pg.event.QUIT:
                running = False

sentences:
LibGDX drawing portion of tmx map I am trying to make a tile based game in LibGDX and I have run into some problem.
In earlier versions of LibGDX you were able to draw a certain section of a .tmx map instead of a whole and even a section of a layer.
Even though , in the nightly builds I cannot find anything about this methods the only thing I have found was drawing of a whole map or one of its layers.

Ideally I would like to draw portion of a map something like draw nao from coords (5,5) to (25,25) . Meaning only the square 20x20 tiles starting from tile in the 5th row/column at position no. 5.

Is it even doable in the newer builds ?

sentences:
How hard is it to port games from the PC to other platforms? I am trying to learn game development with the Unreal Development Kit and Unity, trying both out, and trying to get an idea how they work. For now, I'm mostly focusing on PC games.

How hard is the technical aspect of porting a PC game that I made in the Unreal Development Kit or Unity to another platform, such as Play Station 3, or Xbox 360? is there some kind of option where we can just select the target platform from a combo box and press deploy, or do we need to modify the game for each platform?

sentences:
Outlining external edges on a complex shape made of cubes? A gallery of my problem can be found here. I had to do it this way as it won't let me post more than 2 links due to my reputation.

I'm trying to use 3D cubes to generate an isometric cube world.

I got that working great and I merge only the visible vertices/indices into a buffer and draw from that.

Only problem is, as with any isometric game, it becomes difficult to differentiate between heights. For example in the first image: this archways top merges with the cubes below.

I ended up finding this shader and got it working by using it against a rendered normal map (second image) of the cubes.

You may be able to guess my problem from that image. The final result looks like the third image. The back edges are not draw with an outline, which are the most important. Which based on the normal map also means that diagonals also have the same problem on their sides (fourth image).

Is there any solution I can do for this? Either in the shader itself or perhaps when calculating the normals? I almost need to add something to the normal to distinguish their depth/height so faces on similar planes don't merge on edge detection. Or maybe there's a totally different option I could use.

Ideally I was aiming more for only edges to the air to be outlined so the archways bottom edges would not be outlined like they are now =/

sentences:
How do I rotate a sprite with ccbezierTo in cocos2d-x? In cocos2d-x, I move a sprite with ccbezierTo like this:

// use for ccbezierTo
bezier.controlPoint_1 = ccp(m_fish->getPositionX() + 200, visibleSize.height/2 + 300);
bezier.controlPoint_2 = ccp(m_fish->getPositionX() + 400, visibleSize.height/2 - 300);
bezier.endPosition = ccp(m_fish->getPositionX() + 600,visibleSize.height/2);

bezier1.controlPoint_1 = ccp(m_fish->getPositionX() + 800, visibleSize.height/2 + 300);
bezier1.controlPoint_2 = ccp(m_fish->getPositionX() + 1000, visibleSize.height/2 - 300);
bezier1.endPosition = ccp(m_fish->getPositionX() + 1200,visibleSize.height/2);

bezierForward = CCBezierTo::create(6, bezier);
nextBezier = CCBezierTo::create (6,bezier1);

m_fish->runAction(CCSequence::create( bezierForward, nextBezier, NULL));

How can I make my sprite rotate while moving it with CCBezierTo?

sentences:
Only 1 TextMeshProUGUI being affected by coroutine I have a prefab m_wordContainer which is empty other than having a TextMeshProUGUI as a child (I did this so that I could position this container freely not being bugged by an animation played by the TMPUGUI object). At the start of the program I start a coroutine (SpawnWordPopups) which splits the words in a sentence, making a copy of m_wordContainer and assigning that word to the text property of its TMPUGUI, spawning such m_wordContainer in a random location within the screen, and then starting a coroutine (FadeText) that fades in the text of every TMPUGUI.
The problem is that only one of the TMPUGUI has its text faded, even though the FadeText coroutine is called seemingly correctly.
All words are shown as expected, only thing missing is the fading effect on all but the first word that fades.
If I called FadeText like this: if (i > 0) { yield return FadeText(true, tmpText, 2); } then only the second word will be faded.
 [SerializeField] private GameObject m_wordContainer;

    void Start()
    {
        yield return StartCoroutine(SpawnWordPopups("test foo bar"));
    }

private IEnumerator SpawnWordPopups(string l_line)
    {
        string[] words = l_line.Split(' ');
        List<Vector3> wordPositions = new List<Vector3>();
        for (int i = 0; i < words.Length; ++i)
        {
            Vector3 spawnLocation = new Vector3(Random.Range(m_wordScreenDistanceOffset, Screen.width - m_wordScreenDistanceOffset), Random.Range(m_wordScreenDistanceOffset, Screen.height - m_wordScreenDistanceOffset), 0);
            if (IsWordOverlapping(wordPositions, spawnLocation))
            {
                --i;
                continue;
            }
            wordPositions.Add(spawnLocation);
            GameObject wordContainer = Instantiate(m_wordContainer, transform.parent);
            wordContainer.transform.position = spawnLocation;
            TextMeshProUGUI tmpText = wordContainer.GetComponentInChildren<TextMeshProUGUI>();
            tmpText.text = words[i];

            yield return FadeText(true, tmpText, 2);
        }
    }

    private IEnumerator FadeText(bool l_fadeIn, TextMeshProUGUI l_textBox, float l_time)
    {
        float time = Time.time;
        float until = Time.time + l_time;
        int alphaFrom = l_fadeIn ? 0 : 1;
        int alphaGoal = l_fadeIn ? 1 : 0;
        Color textColor = l_textBox.color;
        textColor.a = l_fadeIn ? 0 : 1;
        l_textBox.color = textColor;

        while (time < until)
        {
            textColor = l_textBox.color;
            textColor.a = Mathf.Lerp(alphaFrom, alphaGoal, Time.time / l_time);
            l_textBox.color = textColor;
            time += Time.deltaTime;
            yield return null;
        }
        textColor.a = l_fadeIn ? 1 : 0;
        l_textBox.color = textColor;
    }

Could anyone shed some light into this issue I'm having? Why are not all the words being faded?

sentences: Directional light view frustum stabilisation Calculating directional light view frustum based on scene objects(bounding frustum) results in noticeable scene jittering on camera movement in CSM and non-CSM rendering code paths. What are the techniques to reduce or eliminate these jittering artifacts?

sentences:
What is better for the overall performance and feel of the game: one setInterval performing all the work, or many of them doing individual tasks? This question is, I suppose, not limited to Javascript, but it is the language I use to create my game, so I'll use it as an example.

For now, I have structured my HTML5 game like this:

var fps = 60;
var game = new Game();

setInterval(game.update, 1000/fps);

And game.update looks like this:

this.update = function()
{
    this.parseInput();
    this.logic();
    this.physics();
    this.draw();
}

This seems a bit inefficient, maybe I don't need to do all of those things at once. An obvious alternative would be to have more intervals performing individual tasks, but is it worth it?

var fps = 60;
var game = new Game();

setInterval(game.draw, 1000/fps);
setInterval(game.physics, 1000/a); //where "a" is some constant, performing the same function as "fps"
...

With which approach should I go and why? Is there a better alternative? Also, in case the second approach is the best, how frequently should I perform the tasks?

sentences:
Calculation of distance while switching between two speeds There are two speed values, that are used by moving object. After a while speed switching occurs from V1 to V2. I need the formula that can be used for calculation of current distance (at specified time).

Input variable:

T - Current time

Constants:

V1 - first speed
V2 - second speed
Ts - switching time between V1 and V2
P - switching power

Output variable:

S = ?

I tried to use next formula:
S = Lerp[Clamp(T / Ts, 0, 1) ^ P), V1, V2] * T

But in this case the moving object will be returned back after time and moves forward again.

Probably acceleration should be used in the formula?

sentences:
Handling game logic events by behavior components My question continues on topic discussed here

I have tried implementing attribute/behavior design
and here is a quick example demonstrating the issue.

class HealthAttribute : public ActorAttribute
{
public:
    HealthAttribute( float val ) : mValue( val ) { }

    float Get( void ) const { return mValue; }
    void Set( float val ) { mValue = val; }

private:
    float mValue;

};

class HealthBehavior : public ActorBehavior
{
public:
    HealthBehavior( shared_ptr< HealthAttribute > health )
        : pHealth( health )
    {
        // Set OnDamage() to listen for game logic event "DamageEvent"
    }

    void OnDamage( IEventDataPtr pEventData )
    {
        // Check DamageEvent target entity
        // ( compare my entity ID with event's target entity ID )

        // If not my entity, do nothing
        // Else, modify health attribute with received DamageEvent data
    }

protected:
    shared_ptr< HealthAttribute > pHealth;

};

My question - is it possible to get rid of this annoying check for game logic events?
In the current implementation when some entity must receive damage, game logic just fires off event that contains damage value and the entity id which should receive that damage.
And all HealthBehaviors are subscribed to the DamageEvent type, which leads to any entity possesing HealthBehavior call OnDamage() even if he is not the addressee.

sentences:
Unpausing a game when a TouchScreenButton node is released I'm making a mobile game in the Godot game engine.
I made a spike scene where the spikes will respawn at a random time in a particular position moving upwards.
Then I instanced the scene in the main scene, it worked perfectly, the spikes moving up and appearing in a particular position.
Then I created a TouchScreenButton node in the main scene and changed it pause property to process and then added a _OnPressed and _OnReleased signal to the main scene script then added this code to the _OnPressed function
get_tree().paused = true
And added this code to the _OnReleased function
get_tree().paused = false
But when ever I press and release the button it only pauses the scene
What should I do?

sentences:
AndEngine GLES2 - getting Black screen on emulator 4.1 I'm new in andengine . I create following code

public class MainActivity extends BaseGameActivity {

static final int CAMERA_WIDTH = 800;
static final int CAMERA_HEIGHT = 480;

public Font mFont;
public Camera mCamera;

//A reference to the current scene
public Scene mCurrentScene;
public static BaseActivity instance;

public EngineOptions onCreateEngineOptions() {
    instance = this;
    mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);

    return new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
}

@Override
public void onCreateResources(OnCreateResourcesCallback arg0)
        throws Exception {

    mFont = FontFactory.create(this.getFontManager(),this.getTextureManager(), 256, 256,Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32);
            mFont.load();
}

@Override
public void onCreateScene(OnCreateSceneCallback arg0) throws Exception {

    mEngine.registerUpdateHandler(new FPSLogger());
    mCurrentScene = new Scene();
    Log.v("Scene","enter");
            mCurrentScene.setBackground(new Background(0.09804f, 0.7274f, 0.8f));
 //             return mCurrentScene;

}

@Override
public void onPopulateScene(Scene arg0, OnPopulateSceneCallback arg1)
        throws Exception {
    // TODO Auto-generated method stub

}

 }

I got code on sites there is returning scene but in AndEngine GLES2 in method onCreateScene() there is no return scene ... so my First run is BLACK .. any suggestion  :)

sentences:
Rotation with respect to world instead of the object itself using Quaternion.Euler in unity [Other answers on similar questions on stackexchange didnt help]

This script is giving some weird outputs

On running this script If I press rightarrow once followed by 's' the object rotates on 'z' axis and 'x' axis correctly but there after if I press arrowkeys or 'a/s' in both the cases the object rotates on y axis forever. I dont understand why this is happening.

I want it to rotate w.r.t. the world axis always.

code:

public float speed = 1;
private int xtimesHit = 0;
private int ytimesHit = 0;
private int ztimesHit = 0;

void Update () {
    if( Input.GetKeyDown( KeyCode.RightArrow ) ){
        ztimesHit--;
    }
    if( Input.GetKeyDown( KeyCode.LeftArrow ) ){
        ztimesHit++;
    }

    if( Input.GetKeyDown( "a" ) ){
        ytimesHit++;
    }
    if( Input.GetKeyDown( "d" ) ){
        ytimesHit--;
    }

    if( Input.GetKeyDown( "w" ) ){
        xtimesHit++;
    }
    if( Input.GetKeyDown( "s") ){
        xtimesHit--;
    }

    this.transform.rotation = Quaternion.Lerp(this.transform.rotation, Quaternion.Euler(xtimesHit*90,ytimesHit*90,ztimesHit*90), Time.deltaTime*speed);

How can I do that?
I have created this code with help from other, so I'd wish to edit it rather than using totally new functions.

[Optional]
Code explanation:
My code is fulfilling partial requirements, I want to rotate my object on x,y,z axis by 90 deg on  respective keyboard inputs. (Example: keys a and s should rotate the object by 90 deg on z axis, w and s should rotate the object by 90 deg on y axis and arrow keys should rotate the object by 90 deg on y axis). Also pressing 'a' n times should rotate the object by 90 deg n times.

sentences:
How do i make turn based combat with 10+ players work? I am currently developing a game with a turn based combat as focus.

The games battles will need to be able to handle 1 to 20 players (Multiplayer).

Each unit (Player and AI) each has an initiative (higher initiative the higher in order you are)

I am now in the stage where i will start writing the game mechanics for the turn based combat and i believe the classic turn based (individual turns) will take too long especially if someone is AFK or just slow. My initial idea was to add a timer based on the number of players min-capping at 10 seconds, but i don't want to stress out my players.

My other idea is to allow every player and AI select their actions at the same time with a higher timer at 1 minute. When all the players has selected or the time has run out the initiative order are run for each unit with their action.

I am aiming for the second one but i want to know if this is the best way to take. It will add an other dimension of strategy since each player will have to calculate what the opponent will do so they cant take action for what they have done.

Do anyone know an other way to do this?
What would you chose and why?

sentences:
Are there any dedicated rules/scoring libraries/frameworks/engines? Note that this is not about graphics/physics/2D/3D/etc.! Rather I'd like to know whether there are dedicated solutions available for implementing custom rules/scoring on top of an existing framework, ideally addressing most common concepts already, for example players, matches, rule variations, game selection, preferences, high scores and the like?

Or is this functionality usually included in all those graphics oriented libraries/frameworks/engines? If so, are there any that stand out in this regard and do allow reusing the rules/scoring components easily without using the graphics part of the engine for example?

Alternatively, would you consider this topic to be better addressed by a standard Business rules engine instead, as suggested in Java Rule Engine for Game AI?

sentences:
In Game Window Frame Size Consistency I'm currently building a game that utilizes many of its own 'windows' to display various information and dialogue to the user.  Since there are multiple sizes and proportions these windows must be displayed at, we need a consistent way to draw the frame around the window itself so that it does not become stretched as we change the default size/proportion of the art asset during runtime.

The solution we have currently come up with is drawing the frame in pieces, and the background of the windows separately.  We would have the background, a 'corner piece', and a 'connector piece'.  The background would be drawn and resized to whatever size and proportion not caring about if this particular piece was stretched .  The corner would be drawn and rotated to fit at each corner of the window.  Finally the connectors would be 1 pixel wide pieces that would be drawn and rotated/stretched to fill the gap between the 4 corner pieces.

While I feel this is an adequate solution to the problem I am not sure if this is the solution most games use when they have windows they would like to keep consistently framed.  Is there a more commonplace solution for this issue, or does what we've come up with pretty much nail it on the head?

sentences:
How do you get textures out of a png file I have 1 png of many different textures. I want to use these textures in my iphone game using cocos2d. I found the program "Zwoptex" where you can combine many textures to one png and create a plist file that you can use in your program.

But if you have already a png file how do you get all these textures out of this file automatically OR how do I create a plist file from this png file?

sentences:
Good basemap generator I am currently making a board game and cannot seem to find any vector world map creators where I can select a region of the world to capture and have it download that section. I just want a base map so no city names and preferably no borders.

The map doesn't have to be vector if it is of good enough quality.

sentences:
Why is transform.up behaving differently for different functions? Can anyone please explain to me what i'm doing wrong here?

As I see it the raycast is the only one using transform.up correctly, though why not Debug.DrawLine() and _lineRenderer.SetPosition(1, transform.up * maximumBeamLength);

using UnityEngine;

[RequireComponent(typeof(LineRenderer))]
public class LaserBeam : MonoBehaviour
{
    [SerializeField]
    private float maximumBeamLength = 5f;

    private LineRenderer _lineRenderer;

    private void Start()
    {
        _lineRenderer = GetComponent<LineRenderer>();
    }

    void Update()
    {
        _lineRenderer.SetPosition(0, transform.position);
        RaycastHit2D hit = Physics2D.Raycast(transform.position, transform.up);

        Debug.DrawLine(transform.position, transform.up * maximumBeamLength, Color.blue);
        Debug.DrawLine(transform.position, transform.up , Color.red);

        if (hit.collider)
        {
            _lineRenderer.SetPosition(1, new Vector3(hit.point.x, hit.point.y, transform.position.z));
        }
        else
        {
            _lineRenderer.SetPosition(1, transform.up * maximumBeamLength);
        }
    }
}

sentences:
Random 2d terrain algorithm for map generator I'm new to game development and I need some advice. I'm building a web based 2d random map generator and I wonder which algorithms there are to create such random terrains in a simple matrix as seen in the images below. It would be great if anyone could point me to some terms/algorithms as I have absolutely no clue what to search for.

Note: I'm not interested in depth/biomes - just the generation of those 2d shapes that grow from a starting point.

I tried implementing it in several ways - but all attempts seem rather childish and don't really produce the desired result. First I started with a small pattern like a plus (5 cells) and replicated it always on the edges of the already generated cells. Another way was to define cubes in different sizes and then start to generate big cubes in any direction, after that put medium cubes on some random edges, then again with smaller ones etc.

Any tips are very much appreciated!

sentences:
2-Color Fonts in Unity? (so maybe called 3-Color including transparent alpha?) I have been trying to make my game title screen look better. I realised it was because all my fonts have just one colour.
I read some very old threads about a Editor Scripts to extract the font to png format. I then see there is now a way to do it in the 'hamburger' menu of the Font in Inspector.
I had to change my font to be not 'Dynamic' then it allowed me to extract a copy to PNG. I opened this in GIMP and added my white inside the outlines of each character (it had been alpha before this, giving a horrible see-thru effect on the letters).
I put this back into Unity (the new PNG) and used it as the source texture for my Text Shader. However it is still not handling both colours. (Screenshot below). So what can I do using Unity 2020 to achieve better looking text? I've read this: (https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/StyledText.html) and many other pages on Unity site but I am now going around in circles not achieving anything.
Thanks for any help.

EDIT: Since DMGregorys comment. I am posting picture of my import settings on the modified (coloured-in) font PNG file:

EDIT 2: The 3rd screenshot shows the 'Text' objects settings. Note I have changed Material to be my extracted one. 4th screenshot shows that Material's settings
enter image description here

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:
Particles emit even though emission is disabled I have created a basic particle system which is a single burst around a sphere.

I have a script that disables this emission upon Start.

If I don't disable the emission, then the particles continuously emit in bursts.

However when I disable the emission, it does not completely prevent particles from being emitted. There is still a single burst at the beginning.

Here is how it looks with emission disabled:

Here is the script which is setting emission.enabled = false. This is attached to the sphere and the particle system is a child of the sphere.

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

public class BalloonPop : MonoBehaviour
{
    public new Renderer renderer;
    public ParticleSystem emitter;
    public float explosionTime = 0.5f;

    private ParticleSystem.EmissionModule emission;

    void Start() {
        if (!renderer) { renderer = GetComponentInChildren<Renderer>(); };
        if (!emitter) { emitter = GetComponentInChildren<ParticleSystem>(); }
        emission = emitter.emission;
        renderer.enabled = true;
        emission.enabled = false; // <===================================== this
    }
}

All I want to do right now is to make it not emit any particles at all.Then I'll add an event to re-enable the emission, but that's not the issue I'm asking about here. I also tried emitter.enableEmission = false, which is deprecated, and it didn't work.

Here is the particle system in the inspector:

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:
Make the texture array node work with cubemaps? I am working on a procedural interior mapping shader in Unity's Shader Graph. Ideally, I'd like to feed it a set of cubemaps it can pick from semi-randomly.
However, it seems that by default the texture array asset one can provide to a graph does not support reading cubemaps.
Does anyone have a way to use this, or perhaps a clever custom node or alternate texture mapping, so that I can read a number of cubemaps into the shader semi-randomly? Preferably an arbitrary number, but even a fixed number would be somewhat of an improvement.

sentences:
convert view space normal to world normal Im writing a shader that uses Unity's _CameraDepthNormalsTexture to get both the view normal and depth values. I return a color from my fragment shader equal to the normal values sampled.

I am having problems converting the view normal into a world normal so that when my camera tilts around, the fragment colors shouldnt change.

How can turn my view normal-> world normal in my fragment shader? Relevant code is marked with TODO below:

Shader "Custom/DepthNormal"{
    Properties {
       _MainTex ("", 2D) = "white" {}
       _HighlightDirection ("Highlight Direction", Vector) = (1, 0,0)
    }

    SubShader {
        Tags { "RenderType"="Opaque" }
        Pass{
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            sampler2D _CameraDepthNormalsTexture;
            sampler2D _CameraDepthTexture;

            struct vertexOutput {
                float4 position_in_clip_space : SV_POSITION;
                float2 depth : TEXCOORD0;
                float4 scrPos : TEXCOORD1;
                float4 position_in_world_space : TEXCOORD2;
            };

            vertexOutput vert(appdata_full v){
                vertexOutput output;
                output.position_in_clip_space = UnityObjectToClipPos(v.vertex);
                //use the helper function instead of MATRIX_MVP as per documentation
                //mul(UNITY_MATRIX_MVP,float4(v.vertex,1.0));

                output.position_in_world_space = mul(unity_ObjectToWorld,v.vertex);
                //recall computeScreenPos does not divide by w, but because this is not an image effect,
                //diving by w here will WARP things unless we are completely parallel to viewing camera

                output.scrPos = ComputeScreenPos(output.position_in_clip_space);

                return output;
            }

            float4 frag(vertexOutput input) : COLOR
            {
                float3 normalValues;
                float depthValue;
                //extract depth value and normal values

                //recall computeScreenPos does not divide by w, so if you want proper screenUV for use in tex2D divide
                //xy by w
                //https://forum.unity3d.com/threads/what-does-the-function-computescreenpos-in-unitycg-cginc-do.294470/

                float2 screenUV = input.scrPos.xy / input.scrPos.w;
                //DecodeDepthNormal(tex2Dproj(_CameraDepthNormalsTexture, input.scrPos), depthValue, normalValues);
                //Alternatively:
                    DecodeDepthNormal(tex2D(_CameraDepthNormalsTexture,screenUV), depthValue, normalValues);

                 //TODO: CONVERT TO WORLD NORMAL?
                 float4 worldNormalValues  = mul(unity_ObjectToWorld,mul(UNITY_MATRIX_IT_MV, float4(normalValues,1.))); //THIS ISNT RIGHT :(

                float d = pow(depthValue,2);
                return float4(normalValues.x,normalValues.y,normalValues.z,d);
            }

         ENDCG
        }

    }
fallback "Diffuse"
}

sentences: Dynamic Difficulty Adjustment Isn't there any algorithms for Dynamic Difficulty Adjustment? like a universal algorithm. Or is it made depending on the game that it will be implemented to?

sentences:
Framebuffer formats with enhanced Alpha precision I render some lines with alpha values into an FBO. Because I play a lot with alpha, I need the alpha channel to have more detail than RGBA8. For example, RGBA32F works like a charm.

As I have only a Quadro GPU to test. Is there a general advice on which FBO format works best (in terms of speed) on most cards?

Would there be a benefit in using RGBA16F, RGBA16 etc.?
What formats
can I expect a GPU to support?
Is RGBA32F a regular feature for a
GPU    not older than 5 years?

sentences:
Where can I find info on grid based algorithms for stateless AI? There seems to be an overwhelming amount of info out there on AI of all kinds, and it's kind hard to digest at once.

For my testing purposes, I'm creating a "typical stateless AI", as described in this article, and now I need to implement the following functions for a 2D square based game board:

-(void)runAway;
-(void)attackPlayer;
-(void)moveTowardsPlayer;
-(void)tacticalMoveAwayFromPlayer;
-(void)waitOrStationaryAction;

For example, I can run my own run away function like this:

-(void)runAway
{
    DLog(@"runAway");
    [self debugMessage];

    int bestTileIndex = 0;
    int largestDistance = 0;
    int distance = 0;
    if(validMoves.count>0)
    {

        for(NSNumber* tileNumber in validMoves)
        {
            distance = [self distanceToTargetFromTile:tileNumber.intValue];
            if(distance >largestDistance)
            {
                largestDistance = distance;
                bestTileIndex = tileNumber.intValue;
            }
        }
    }
    //move to best tile

}

but this method only checks the distance from 1 target, which may not be the best if there are multiple enemies on the game board.

Where can I find good/efficient implementations of algorithms for searching a 2D grid for these functions? For example finding a point that is furthest away from multiple opponents and is accessible within a certain number of moves.

Other functions that come to mind is picking the best/weakest target, moving towards a specific target while accounting for variable terrain cost, etc

I'm certain someone has already done this before.

sentences:
Making a gameObject push the player I am working on a Unity 3D game for Oculus and I have problems with making my objects to apply physics on a player. So getting rid of a CharacterController and using something like a rag doll is not an option.

I am using OVRPlayerController, that has a Rigidbody with mass 1 and a box collider on it. My gameObject has a Rigidbody of mass 100, and a box collider. But when the object hits the player it just goes through it, whereas I want it to push the player in x direction.

I tried using onColliderHit but it doesn't even recognize the collision between the player and the object, so I checked box collider on the object to be a trigger and I use OnTriggerEnter() to recognize the collision.

I tried to translate the player's position on collision, but player gets positioned to weird places out of my map for some reason. Here is what I use:

 info.transform.Translate(new Vector3( -0.5f, 0.0f, 0.0f));
 info.transform.rotation = Quaternion.identity;

I also tried to manually set the x position of the player but this doesn't work, and I know I am not supposed to do it.

I searched for answers for a long long time, so please don't answer to this with something like "oh, have you tried googling it, there are a lot of similar questions" etc.

sentences:
How can I draw lines in editor between waypoints when creating the waypoints? public List<Vector3> destinations = new List<Vector3>();
    public int numberOfDestionations;
    public float moveSpeed = 5f;
    public bool loop = false;
    public bool moveBack = false;
    public Text textCounter;

    private Coroutine movementCoroutine;
    private bool pause = false;
    private bool coroutineRunning = false;
    private Vector3 startPosition;
    private int countDestionations;

    private void Start()
    {
        for (int i = 0; i < numberOfDestionations; i++)
        {
            destinations.Add(new Vector3(UnityEngine.Random.Range(-300, 25), -1f, 0));//25, -1f, 0);
            if(i > 0)
            {
                Gizmos.DrawLine(destinations[i], destinations[i + 1]);
            }
        }

I'm trying to use gizmos but getting exception :
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

On line 33 :
Gizmos.DrawLine(destinations[i], destinations[i + 1]);

I want that while it's creating the vectors draw lines from the current created vector destination and the next one. A line from index 0 to index 1 to index 2 and so on. So when running the game I will see a net of all the lines connected between the vectors destinations.

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: Which size do I need to use in Blender to import to Unity I want to create a cube with different textures in Blender. But if I import the model to Unity 2017 the cube has not the same size as a cube with scale x,y and z = 1 from Unity's default components. Which size do I need for my cube in Blender so it has the same size as a default cube in Unity?

sentences:
How does braking assist of car racing games work? There are a lot of PC car racing games around which have this unique driving assist which helps brake your car so that you can safely turn it. While in some games it just an 'assist', it will just help your car brake but won't ensure a safe turn. While in others, the braking assist will help you get a safe turn. I was wondering on what could be the algorithm that is followed to achieve it.

A very basic algorithm I could think of was,

Pre-determine the braking distance of an ideal car for every turn of the track, depending on the radius of the turn, and then start braking the car accordingly. For example, for a turn of less than 90o, the car would start braking automatically at 50m distance from the start of the turn.

A more advanced algorithm, which would ensure a safe turn, could be

Pre-determine the speed of the car at the start of each turn, individually for each track, turn and car. Also, pre-determine the deceleration rate of each car individually, which varies because of the car's performance.
The braking assist would keep recording the speed of the car at a certain instant of time.
Start braking the car appropriately so that the car gets to the exact speed needed at the start of the turn.
For example, let the speed of a particular car at the start of a turn 43m in radius, be 120km/h. Let the deceleration rate of the car be 200km/h2. If, at some instant of time, the speed of the car is 200km/h, then the car would automatically start braking at 400m from the start of the turn.

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 do I identify mouse clicks versus mouse down in games? What is the most common way of handling mouse clicks in games?

Given that all you have in way of detecting input from the mouse is whether a button is up or down.

I currently just rely on the mouse down being a click, but this simple approach limits me greatly in what I want to achieve. For example I have some code that should only be run once on a mouse click, but using mouse down as a mouse click can cause the code to run more then once depending on how long the button is held down for. So I need to do it on a click!

But what is the best way to handle a click? Is a click when the mouse goes from mouse up to down or from down to up or is it a click if the button was down for less then x frames/milliseconds and then if so, is it considered mouse down and a click if its down for x frames/milliseconds or a click then mouse down?

I can see that each of the approaches can have their uses but which is the most common in games? And maybe i'll ask more specifically which is the most common in RTS games?

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: How can I upload a pygame that I made on a website? I'm a beginner programmer and I want to know how can you upload your pygame on websites like coolmathgames or any game websites, do you upload your code after you get a deal with them? do you save it into a file and then upload it through some button? Like how does the whole thing work. Thanks!

sentences:
RTS Networking in Unity: Client-Server vs. Lockstep I am trying to make a RTS game in Unity, and I've got a few non-networked features working and so I want to start working on the multiplayer aspect so I don't dig myself into too deep a hole with mechanics I have to recreate to make it online.

I've done a bunch of research into using either a lockstep model (http://www.gamasutra.com/view/feature/131503/1500_archers_on_a_288_network_.php?page=1), or a more typical client-server model where all of the units' positions, velocities, and other traits are synced every fraction of a second.

From what it seems, using the client-server model used to require way too much bandwidth, hence the development of lockstep, but nowadays internet has improved to the point where people actually have enough bandwidth to do this practically. The client-server method seems like it would be easier to implement in Unity also, although UNET seems to be designed for games where the player controls one character, as opposed to the syncing of possibly hundreds of units required in an RTS. The lockstep model would most likely require going somewhat underneath Unity's high level API and implementing a whole slew of time step stabilizers and checks to make sure all the commands are received and executed in the exact same way.

What I'm curious about, however, is something in between the two, where most of the time, I send simple commands to the other clients, saying something like "at xx:xx game time, the player told this unit to move here." The other clients then receive that, and discover that two ticks have passed since that game time, run the two ticks on that object, and then let it continue running in that state until it receives that next update. Every second or so, I could then sync up all of the positions and other data to iron out any inconsistencies. I feel like this could be the best of both worlds in terms of not requiring the insane amount of synchronicity for lockstep but also not requiring as much bandwidth guzzling. I'm probably missing something big or understating the simplicity of implementing such a system, because to me it seems this would be simpler than implementing pure lockstep.

What networking model should I use?

Thanks!

sentences:
What resources are available for Mac OS game development? Are there are any modern resources on how to develop games for Mac OS?  I suppose this would include objective c, cocoa and opengl 3+.

The book Beginning Mac OS X Game Development with Cocoa looks very promising but isn't out until early next year.

sentences:
Bukkit saving inventory enchantments I am working on a bukkit plugin.  One thing I want this plugin to do is teleport you to other worlds on the server.  However, I don't want the player's inventory to be saved.

Right now, I have this code:

File playerInvConfigFile = new File(plugin.getDataFolder() + File.separator + "players" + File.separator + sender.getName(), "inventory.yml");
FileConfiguration pInv = YamlConfiguration.loadConfiguration(playerInvConfigFile);

        Player user = (Player)sender;
        PlayerInventory inv = user.getInventory();

        String worldName = user.getWorld().getName();
        int i = 0;
        for (ItemStack stack : inv.getContents()){
            i++;
            String start = worldName + "." + Integer.toString(i);

            pInv.set(start + ".amount", stack.getAmount());
            pInv.set(start + ".durability", stack.getDurability());
            pInv.set(start + ".type", stack.getTypeId());
        }
        inv.clear();

This works great, but there is a big problem: enchantments are now saved!  This is a big problem.  I want to know how to both save enchantments to a file, and then read them back in and set them!

Thank you all!

sentences:
Pathfinding with Less Desirable Squares that are still passable I have been looking at different path-finding algorithms for my game. I have almost settled upon D* Lite, but have a question. (perhaps I missed it in the documentation) -
Are there any algorithms, D* included, that allow for squares that are less desirable to pass over, but still possible, should there be no other way? I believe that I saw this in A* but I believe that I need it dynamic, as I will be having objects placed and removed from the map.

UPDATE: Is it possible to have levels of undesirable squares? Eg. Some still arent desirable, but are better than really undesirable ones

sentences:
Immediate GUI - yae or nay? I've been working on application development with a lot of "retained" GUI systems (below more about what I mean by that) like MFC, QT, Forms, SWING and several web-GUI frameworks some years ago. I always found the concepts of most GUI systems overly complicated and clumsy. The amount of callback events, listeners, data copies, something to string to something - conversions (and so on) were always a source of mistakes and headaches compared to other parts in the application. (Even with "proper" use of Data Bindings/Models).

Now I am writing computer games :). I worked with one GUI so far: Miyagi (not well-known, but basically the same Idea as all the other systems.)

It was horrible.

For real-time rendering environments like Games, I get the feeling that "retained" GUI systems are even more obsolete. User interfaces usually don't need to be auto-layouted or have resizable windows on-the-fly. Instead, they need to interact very efficiently with always-changing data (like 3d-positions of models in the world)

A couple of years ago, I stumbled upon "IMGUI" which is basically like an Immediate Graphics mode, but for user interfaces. I didn't give too much attention, since I was still in application development and the IMGUI scene itself seemed to be not really broad nor successfull. Still the approach they take seem to be so utterly sexy and elegant, that it made me want to write something for the next project using this way of UI (I failed to convince anyone at work :(...)

let me summarize what I mean by "retained" and "immediate":

Retained GUI:
In a separate initialization phase, you create "GUI controls" like Labels, Buttons, TextBoxes etc. and use some descriptive (or programmatical) way of placing them on screen - all before anything is rendered. Controls hold most of their own state in memory like X,Y location, size, borders, child controls, label text, images and so on. You can add callbacks and listeners to get informed of events and to update data in the GUI control.

Immediate GUI:
The GUI library consists of one-shot "RenderButton", "RenderLabel", "RenderTextBox"... functions (edit: don't get confused by the Render prefix. These functions also do the logic behind the controls like polling user input, inserting characters, handle character-repeat-speed when user holds down a key and so on...) that you can call to "immediately" render a control (doesn't have to be immediately written to the GPU. Usually its remembered for the current frame and sorted into appropiate batches later). The library does not hold any "state" for these. If you want to hide a button... just don't call the RenderButton function. All RenderXXX functions that have user interaction like a buttons or checkbox have return values that indicate whether e.g. the user clicked into the button. So your "RenderGUI" function looks like a big if/else function where you call or not call your RenderXXX functions depending on your game state and all the data update logic (when a button is pressed) is intermangled into the flow. All data storage is "outside" the gui and passed on-demand to the Render functions. (Of course, you would split up the big functions into several ones or use some class abstractions for grouping parts of the gui. We don't write code like in 1980 anymore, do we? ;))

Now I found that Unity3D actually uses the very same basic approach to their built-in GUI systems. There are probably a couple of GUI's with this approach out there as well?

Still.. when looking around, there seem to be a strong bias towards retained GUI systems? At least I haven't found this approach except in Unity3D and the original IMGUI community seems to be rather .... ..  quiet.

So anyone worked with both ideas and have some strong opinion?

Edit: I am most interested in opinions that stem from real-world experience. I think there is a lot of heated discussions in the IMGUI-forum about any "theoretical weakness" of the immediate GUI approach, but I always find it more enlightening to know about real-world weaknesses.

sentences:
Component-based programming with child objects I am presently working on a game in Unity3d and have come to a cross road regarding scripting for repetitive child objects.  Should these child objects handle its own scripting for best practice?

For example, I have a parent game object, Game Board, that spawns repetitive child objects, Tiles, on the board.  Right now, I let these child objects handle its own position on the board and its own animation when the tiles move.  However, I can just as easily do this with the parent object's scripting class.

The reason I chose to let the child object do so is because I believe that child objects should be as independent to the parent object as much as possible.  But since these are repetitive child objects, I start to wonder if it is just as easy to do all the scripting in the parent object. This way I decrease the number of class instances in the child objects.

According the component-based programming, which method is recommended?

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:
What was game development on the Apple II like? I've asked a similar question about DOS development a while ago and got an excellent answer:
What was the typical toolchain for DOS game development?

Now I'm wondering what game development was like on the Apple II in the late 70s/early 80s. I'm mainly interested in the early ones: II and II+, but I'd like answers about IIe etc. as well.

So here are my questions:

What languages were used?

I presume 6502 assembler, but BASIC was bundled and probably used a lot, too. Can you think of popular games written in BASIC? How about C?

What was 6502 assembler development like?

I've noticed that you can enter op codes directly if you start the system monitor, and you can even execute assembler directly with the mini assembler. But I cannot imagine that games were written like that, were there editors/IDEs? How were programs stored on disks/tapes?

What was BASIC development like?

The Apple II BASIC interpreter is not half bad, I guess you can write full programs in there. It also allows you to SAVE/LOAD programs, I presume to disk/tape. But was there no visual editor?

Were there any APIs or Middleware?

Or was it necessary to talk directly to the hardware all the time if you wanted to draw something or play a sound? Were there any libraries at all?

Anything else that's different from today?

I'd be happy to hear any other differences, like what image/audio formats were used. Given that there wasn't really a concept of files if I understand it correctly, I'm wondering how that worked. Did you have to type your graphics and sounds in assembler? How did that work in BASIC?

sentences:
How do I check if a key is down in XNA when I'm only given a string that has the key's name? I'm trying to get access to the keyboard state in XNA from an embedded JavaScript runtime.

I'd like to do something similar to the following, but I can't seem to figure out how to get from "Left" to Keys.Left, in one line, for all 100+ keys or so.

js.SetParameter("XNA_Keyboard", new {
    keyDown = (Func<string, bool>)((name) => {
        return keyboardState.IsKeyDown(Keys[name]); // ! Can't index keys enum by name
    }),
});

Is there some kind of reflection that will make this easier?

sentences:
Why do games dynamically link to the CRT? Almost all big titles that I have played require you to install the MSVC runtime. There have been numerous questions about "statically vs. dynamically linked CRT" on StackOverflow, the reasons for dynamic CRT generally boil down to:

Reduced memory usage if other programs are using the same libs
Can update the libraries independently.

But I wonder, how often are these reasons related to game development?

Most games spend at least a hundred MB of RAM and it's not like saving some KBs really matter. Besides, games are supposed to capture the user's sole attention so he'll probably not be running other programs to share the CRT.
I don't think I have seen a game needing to upgrade its CRT in its life-cycle.

So, why don't games statically link their CRT so they can reduce the extra step of installing MSVC runtime?

sentences: Pseudo 3D Track editor Does anyone know of a pseudo 3D track editor ? I now need one to design my stages, as manually trying to create segments, and position static and movable objects would be too time consuming.

sentences:
Libgdx: How to rotate a button on main menu How to keep rotating a button on main menu screen around its center, here's the code for the button

final ImageButton btnSett=UIFactory.createButton(txtrSettings);
btnSett.setScale(1,1);
btnSett.setPosition(Gdx.graphics.getWidth()/ 2,0.f, Align.center);
stage.addActor(btnSett);

sentences:
C++ and SDL resource management for 2D game My first question is about stateManagers. I do not use the singleton pattern (read many random posts with various reasons not to use it), I have gameStateManager which runs the pointer cCurrentGameState->render(), etc. I want to make a transitioning game, this engine should ideally cover both a platformer and a bird's eye RPG (with some recoding, I just mean the base engine), both of which will load different levels and events, such as world map, dungeon, shops, etc. So I then thought, rather then having to store all this data within all the states, I would break the engine into gameStates, and playStates... when gameState reaches gameStatePlay(), gameStatePlay simply runs the usual handleInput, logic, and render for the playStates, just as the low level gameStateManager does. This lets me store all the player data within the base playstate class without storing useless data in the gameStates. Now I have added a seperate mapEditor, which uses editorStates from gameStateEditor. Is this too much usage of the gameState concept? It seems to work pretty well for me, so I was wondering if I am too far off a common implementation of this.

My second question is on image resources. I have my sprite class with nothing but static members, mainly loadImage, applySurface, and my screen pointer. I also have a map pairing imageName enums with actual SDL_Surface pointers, and one pairing clipNumber enums with a wrapper class for a vector of clips, so that each reference in the map can have different amounts of clips with different sizes. I thought it would be better to store all these images, and screen within one static body, since 20 different goblins all use the same sprite sheet, and all need to print to the same screen, and of course, this way I do not need to pass my screen reference to every little entity. The imageMap seems to work very well, I can even add the ability to search through the map at creation of entity type to see if a particular image at creation, creating if it doesnt exist, and destroying the image if the last entity that needs it was just destroyed. The vectored clip map however, seems to take too long to initialize, so if i run past the state that initializes them to fast, the game crashes ><. Plus, the clip map call is half of this line =P

SPRITE::applySurface( cEditorMap.cTiles[x][y].iX,
    cEditorMap.cTiles[x][y].iY,
    SPRITE::mImages[ IMAGE_TILEMAP ],
    SPRITE::screen,
    SPRITE::mImageClips[IMAGE_TILEMAP]->clips.at( cEditorMap.cTiles[x][y].iTileType ) );

Again, do I have the right idea? I like the imageMap, but am I better off with each entity storing its own clips?

My last question is about collision detection. I only grasp the basics, will look at per-pixel and circular soon, but how can I determine which side the collision comes from with just the basic square collision detection, I tried breaking each entity into 4 collision zones, but that just gave me problems with walking through walls and the like ><. Also, is per-pixel color collision a good way to decide what collision just occured, or is checking multiple colors for multiple entities too taxing each cycle?

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: How can I make a trail renderer flat with the normal of the nearest face? I'm making a basic skid system for a car model using a trail renderer. I have everything setup and working properly except that the trail renderer always faces the camera. I want the trails to be perfectly flat with the ground. So I thought if unity can make the faces all rotate towards the camera, then would it be able to rotate towards the normals of the nearest faces?

sentences:
Designing the Update system (read very basic game engine) for an XNA game I am trying to determine the best way to implement the "update" system or engine for a simple XNA game.

Description of situation

I have a few classes, lets call them:

Player [will be an array/list/collection of 1-4 local players]
Enemy [will consist of all enemy characters in the given "zone"]
Future [not implemented, may not be implemented for this game, but may be needed in future]
Future

I'm trying to decide what the best way to manage this will be, I'm going back and forth between a couple options.

First Approach

In the Update() method of my game, write code like this:

void Update(GameTime gameTime)
{
    var ctlInput = GetControllerInput();
    for(int i = 0; i < 4; i++)
    {
        if(Player[i] != null) { Player[i].Update(gameTime, ctlInput); }
    }

    for(int i = 0; i < Enemy.Count; i++)
    {
        Enemy[i].Update(gameTime, Player);
    }
}

In this version, I would add "FrameStatus" fields to the Player class, which would look like bool IsShooting and Vector2 TargetedLocation etc. This also means that each class would be responsible for knowing how to update itself in the game world.

In my eyes, the advantages of this approach are:

No new classes.
Classes become self-documenting
Easy to extend and add additional properties

but the disadvantages are:

Order of code in Game.Update is very important
Tight coupling of Player and Enemy classes

Second Approach

Implement a type of UpdateManager class, which accepts the user input, and it alone updates the Player and Enemy classes. This would relegate the Player and Enemy classes to simply dumb-data classes, and they wouldn't necessarily have any game logic in them at all.

void Update(GameTime gameTime)
{
    var ctlInput = GetcontrollerInput();
    updateManager.Update(gameTime, ctlInput);
}

The advantages of this approach, in my eyes, are:

Keeps code away from Game.Update()
Doesn't require Player and Enemy classes to know about each other at all

Disadvantages as I see it:

Adds a new class to my game
The new class, will have a lot of code as time goes on and more types of objects enter the game world

Actual Question

Of the pro/cons I've come up with for my two approaches,

do you think I've missed any, what are they?
which makes you lean for or against an approach, why?

Which approach would you take, and also why would you go that route? Would you elect for a third option? What would that option look like?

sentences:
How can I prevent a follower from participating in fights in RPG Maker? I'm developing a game with RPG Maker VX Ace. In this game, one of your followers is ghost-like demon that observes the player. I was going to have him appear during dialogues, but all of the playtesters were getting confused as he looks like the character the player interacts with.

I decided to make him a follower so it gets less confusing, but I don't think it would be interesting for him to participate in fights, as he would be too overpowered. I was able to prevent him from attacking, but not able to prevent him from being attacked.

How can I make this follow not participate in fighting at all?

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:
Random numbers inside instance (Game Maker) I've recently run into a weird problem. When I create instances through with(instance_create){ ... }, I can always randomize their variables individually (inside {...}). However, when I try running

randomize()
random(...)

inside their object (in one of the events), they are all synced. Please tell me this isn't a major Game Maker flaw and, most importantly, how do I fix this. Thank you!

sentences:
Best practices for client-server communication in an online Android game I'm developing an online RPG game for my "Object-Oriented Programming" module laboratory project. The client part must be written in C#, also using Unity 3D as a graphics engine.

The problem is that I don't know how to make the client-server communication rapid. How to achieve that every player sees other players' actions in real time on his device.

I want to get some recommendations on how to implement the client-server communication so that everything happens very quickly, i.e. when some player changes his position in a game, this change is immediately sent to all the other players' devices.

Of course, I also want to save all the players' current states in a database, so that they start where they left off the last time they logged out.

For the server side development, I'd prefer linux environment, but the language in which the server part will be written doesn't really matter to me. I just want it to be very fast.

sentences:
How can I move a polygon edge 1 unit away from the center? Let's say I have a polygon class that is represented by a list of vector classes as vertices, like so:

 var Vector  = function(x, y) { this.x = x; this.y = y; },
     Polygon = function(vectors) { this.vertices = vectors; };

Now I make a polygon (in this case, a square) like so:

var poly = new Polygon([
    new Vector(2, 2),
    new Vector(5, 2),
    new Vector(5, 5),
    new Vector(2, 5)
]);

So, the top edge would be [poly.vertices[0], poly.vertices[1]].

I need to stretch this polygon by moving each edge away from the center of the polygon by one unit, along that edge's normal.  The following example shows the first edge, the top, moved one unit up:

The final polygon should look like this new one:

var finalPoly = new Polygon([
    new Vector(1, 1),
    new Vector(6, 1),
    new Vector(6, 6),
    new Vector(1, 6)
]);

It is important that I iterate, moving one edge at a time, because I will be doing some collision tests after moving each edge.

Here is what I tried so far (simplified for clarity), which fails triumphantly:

for(var i = 0; i < vertices.length; i++) {
    var a = vertices[i],
        b = vertices[i + 1] || vertices[0]; // in case of final vertex

    var ax = a.x,
        ay = a.y,
        bx = b.x,
        by = b.y;

    // get some new perpendicular vectors
    var a2 = new Vector(-ay, ax),
        b2 = new Vector(-by, bx);

    // make into unit vectors
    a2.convertToUnitVector();
    b2.convertToUnitVector();

    // add the new vectors to the original ones
    a.add(a2);
    b.add(b2);

    // the rest of the code, collision tests, etc.
}

This makes my polygon start slowly rotating and sliding to the left, instead of what I need.

Finally, the example shows a square, but the polygons in question could be anything.  They will always be convex, and always with vertices in clockwise order.

sentences:
Convert int to Color I am right now developing paint application in andengine because some features are only possible with andengine.

For this I have used color dialog box to use user selected color but that dialog box return int value.
But my sprite use Color class for setting color.

Reverse thing is possible using,

getColor().getABGRPackedInt()

Using this I provide source color but after choosing I can't able to receive chosen color.

At present I use following dialog box.

Android Color Picker

So I need to convert int value return by the dialog in Color class object. So members please help me in this.

sentences:
Is it possible for automated testing applied to Angry bird In simple case, just the first release of Angry Bird is OK

I am thinking if the testers can automated to find out all possible routes ( removing those shooting back) to get the marks stats (and also fix hidden bugs)

thx, though this may be a very simple question here

sentences:
Space between randomly generated objects Im not sure there is a going to be a simple answer for this question but Ill ask anyway. I am programming an endless scrolling game where the player's character is constantly "falling." As they fall  they dodge pinecones. I want the program to randomly generate pinecones (which it does right now); however, I need a way to check that there is enough space between pinecones so that the player's path is never accidentally blocked.

Simply programming a minimum distance between pinecones isn't hard. The problem is that I want to  allow some cones to be right next to each other, but still check to make sure there is space between others for the player to safely dodge pinecones. Basically, I do not want an equal amount of space between each pinecone all the time.

I've considered making a grid pattern that the pinecone spacing must abide by, but Im having trouble comparing spaces on the grid so that while some cones are allowed to be next to each other, others are not. If the question is unclear let me know and Ill try to explain better and include pictures or something.

sentences:
Pygame time.get_fps() value I was looking at the pygame.time.Clock.get_fps() method and after puting it inside of the while loop printing and checking it some times, i see that i starts to give its value after five frames (and not 10 as said in the documentation). I did put this inside the while loop (clock is the object of the pygame.time.Clock() class created inside my class):

 print "clock.tick:", self.clock.tick(self.fps)
 print "clock.get_fps", self.clock.get_fps()

and the result by having the fps=60 was:

clock.tick: 48
clock.get_fps 0.0
clock.tick: 16
clock.get_fps 0.0
clock.tick: 16
clock.get_fps 0.0
clock.tick: 16
clock.get_fps 0.0
clock.tick: 16
clock.get_fps 0.0
clock.tick: 16
clock.get_fps 51.8134689331
clock.tick: 16
clock.get_fps 51.8134689331
clock.tick: 16
clock.get_fps 51.8134689331
clock.tick: 16
clock.get_fps 51.8134689331
clock.tick: 16
clock.get_fps 51.8134689331

As one can see the first clock.get_fps comes out after the first 5 calls, but it supposedly should calculate the average of the last 10 calls to tick(). What am i missing here? Can anyone help explain this?

sentences:
Positioning partials of character sprite animations I'm not entirely sure how to best explain what I'm doing. Maybe I'm going about this completely the wrong way. If any of you find that that is in fact the case, I would appreciate it if you told me how I can do this better.

I've started looking into game development about a week ago and came across a cross-platform framework called LibGDX. So I started working on a practice project which is an incremental game. I'm using the sprites supplied by a program called BannedStory. I want every part of the player's body to be customizable. That means that I'm using every sprite's animations separately.

This is a snippet of code to illustrate how I'm building the character right now.

float playerScreenWidth = HackerStory.WORLD_WIDTH;
    float playerScreenHeight = HackerStory.WORLD_HEIGHT;

    float playerPositionX = playerScreenWidth*0.3f;
    float playerPositionY = playerScreenHeight*0.7f;

    manager = new AssetManager();

    textureAtlas = new TextureAtlas(Gdx.files.internal("spritesheets/body/light/walking.atlas"));

    bodyAnimation = new Animation(0.25f , textureAtlas.getRegions()); // textureAtlas.getRegions()
    bodyAnimationActor = new AnimatedImage(bodyAnimation);
    bodyAnimationActor.setPosition(playerPositionX, playerPositionY);

    float bodyWidth = bodyAnimation.getKeyFrame(0).getRegionWidth();
    float bodyHeight = bodyAnimation.getKeyFrame(0).getRegionHeight();
    float bodyX = bodyAnimationActor.getX();
    float bodyY = bodyAnimationActor.getY();

    Group body = new Group();
    body.addActor(bodyAnimationActor);

    Group head = new Group();

    textureAtlas = new TextureAtlas(Gdx.files.internal("spritesheets/head/light/walking.atlas"));

    headAnimation = new Animation(0.25f , textureAtlas.getRegions()); // textureAtlas.getRegions()
    headAnimationActor = new AnimatedImage(headAnimation);
    headAnimationActor.setPosition(bodyX - bodyWidth * 0.05f, bodyY + bodyHeight * 0.87f);

    float headWidth = headAnimation.getKeyFrame(0).getRegionHeight();
    float headHeight = headAnimation.getKeyFrame(0).getRegionHeight();
    float headX = headAnimationActor.getX();
    float headY = headAnimationActor.getY();

    head.addActor(headAnimationActor);

    textureAtlas = new TextureAtlas(Gdx.files.internal("spritesheets/face/male/002/walking.atlas"));

    faceAnimation = new Animation(0.25f, textureAtlas.getRegions());
    faceAnimationActor = new AnimatedImage(faceAnimation);
    faceAnimationActor.setPosition(headX+headWidth*0.25f, headY + headHeight*0.1f);

    head.addActor(faceAnimationActor);

    textureAtlas = new TextureAtlas(Gdx.files.internal("spritesheets/hair/male/003/black/walking.atlas"));

    hairAnimation = new Animation(0.25f, textureAtlas.getRegions());
    hairAnimationActor = new AnimatedImage(hairAnimation);
    hairAnimationActor.setPosition(/*headX+headWidth*0.085f*/headX+hairAnimation.getKeyFrame(0).getRegionWidth()*0.04f, headY + headHeight*0.39f);

    head.addActor(hairAnimationActor);

    Group player = new Group();
    player.addActor(body);
    player.addActor(head);

As you can see, I am currently setting the X position for (for example the hair) by using its parent's X co-ordinate plus a fraction of its own width. However, this causes issues when the hair is different widths. What works for one hair sprite, won't work for another.

This is what the previous code results in: http://imgur.com/a/ogP5K

I am at a loss for where to go next. I also couldn't find anything on the subject in other questions, so again, I might be completely wrong in my approach to this.

Does anyone have any idea as to how I could solve this issue?

sentences:
Most efficient 3d depth sorting for isometric 3d in AS3? I am not using the built in 3d MovieClips, and I am storing the 3d location my way.

I have read a few different articles on sorting depths, but most of them seem in efficient.

I had a really efficient way to do it in AS2, but it was really hacky, and I am guessing there are more efficient ways that do not rely on possibly unreliable hacks.

What is the most efficient way to sort display depths using AS3 with Z depths I already have?

sentences:
How do I create a single tile in Unity 2019+ I going through the "Ruby's Adventure: 2D Beginner" tutorial, chapter 4, section 3 with Unity 2019.11.

In the tutorial you create a folder for tiles and you are then supposed to right-click in the asset folder and select "Create > Tile" from the menu. There's even a screenshot showing the menu where the option is right below the sprite sections.
However, in version 2019.11 of unity, there is no such option :)

I checked the documentation, and for 2019.3 and 2020.1 the manual states that this should be possible via the assets menu   (there's no docs for 2019.11 specifically), but my Unity editor doesn't have the option.

It seems unlikely that the option is just missing from my version, so I'm guessing something about my project setup is wrong. Is there anything special I need to set up to have the project support tiles?

Edit: I found the feature in the 2018 LTS version. I'm new to Unity, so maybe out of date documentation is the norm.

sentences:
How can I use spectrum data to calculate energy values of certain frequency bands? I'm working on a rhythm game, and need to detect beats in a piece of music.

After all the research and reading through old posts in unity forum/reddit etc., as far as I understood, I need to calculate the average energy, and if there is a sudden energy change/spike, I want to register them as beats.

So here's the thing as far as I understood ;

 public class something : MonoBehaviour {

     public AudioSource audioSource;

     public float[] freqData = new float[1024];

     void Start ()
     {
         audioSource = GetComponent<AudioSource> ();
     }

     void Update ()
     {
         audioSource.GetSpectrumData (freqData, 0, FFTWindow.BlackmanHarris);
     }
 }

Let's say I have this code in place. My sampling rate is at 48000 Hz. The array size determines the frequency range of each element. So with a size of 1024, my frequency resolution is 23.4 Hz. So freqData[0] represents the freq between 0-23.4 Hz. freqData[1] represents 23.4-46.8 Hz. so on and so forth. And I want to detect, let's say bass beats between 60Hz and 250 Hz.

How can I translate this data into the average energy value for this frequency band?

sentences:
How to choose cell to put entity in in an uniform grid used for broad phase collision detection? I'm trying to implement the broad phase of my collision detection algorithm. My game is an arcade game with lot of moving entities in an open space with relatively equivalent sizes.

Regarding the above specifications, i decided to use an uniform grid for space partitioning. The problem i have right know is how to efficiently choose in which cells an entity should be added. ATM i'm doing something like this:

for (int x = 0; x < gridSize; x++) {
    for (int y = 0; y < gridSize; y++) {
        GridCell cell = grid[x][y];
        cell.clear(); //remove the previously added entities
        for (int i = 0; i < entities.size(); i++) {
            Entity e = entities.get(i);
            if (cell.isEntityOverlap(e)) {
                cell.add(e);
            }
        }
   }
}

The isEntityOverlap is a simple method i added my GridCell class.

public boolean isEntityOverlap(Shape s) {
    return cellArea.intersects(s);
}

Where cellArea is a Rectangle.

cellArea = new Rectangle(x, y, CollisionGrid.CELL_SIZE, CollisionGrid.CELL_SIZE);

It works but it's damn slow. What would be a fast way to know all the cells an entity overlaps?

Note: by "it works" i mean, the entities are contained in the good cells over the time after movements etc.

sentences:
Transactions on lists of coins of different values For learning purposes, I am developing the first steps of an idle game with exponentially higher income numbers. Usual int, long, etc. can't store big enough numbers for that.
I looked through many threads which I found on google and using a list (or an array) which is separated in e.g. bronze coins, silver coins, gold coins, etc. seems to be the cleanest version.
In my first approaches I created this list:
namespace Coins
{
    public class script_coinHandler : MonoBehaviour
    {
        public List<Coin> coinList = new List<Coin>() // list based on the "Coin" class
        {
            new Coin() { Name = "bronze"},
            new Coin() { Name = "silver"},
            new Coin() { Name = "gold"},
            new Coin() { Name = "diamond"},
        };
    }

    public class Coin
    {
        public string Name { get; set; }
        public int Amount { get; set; }
        public int Multiplier { get; set; }
    }

}

I want each coin type to go up to 999999. This means 1 silver = 1000000 bronze, 1 gold = 1000000 silver.
I can't get my head around a way to do maths with this list.
Example:
Player has 3000 GOLD, 320000 SILVER, 524321 BRONZE
Player wants to buy something for 20 GOLD, 120000 SILVER, 300000 BRONZE
Just subtracting 20 from GOLD, 120000 from SILVER, and 300000 from BRONZE won't always work. For example when a Player has no BRONZE but some SILVER - you can't subtract 300000 BRONZE without converting SILVER to BRONZE first.
Q: What would be an efficient function to subtract the price from the total amount? What about multiplying and dividing?
Accuracy is not important. When spending a few GOLD, nobody will care about 10000 BRONZE.

sentences:
Problem with camera deapth culling only option and objects in front of each other I have a prefab with 2 cameras. the 1st is rendering the world, the 2nd one all the suff in front of the 1st person characters "face". Now i have a problem with a gun using a muzzleflash - both on the deapth only camera. The muzzleflash is on the very front tip of the gun and i assume because the 2nd face camera is set to "deapth only" it causes the muzzleflash to be off place. I came up with 3 ideas

1: changing the layer of the muzzleflash to world for some frames everytime a muzzleflash appears

2: having a 3rd camera rendering the muzzleflash only

3: adjusting the gun on the face camera, the muzzleflash on the world camera

I assume the 1st two options have a huge overload, i prefer the 3rd one. But is it a good way to do it? How should i proceed in this situation? Or how do others?

I also have animations so it can appear on 2 positions, normal and scoped.

Edit Here is an image i added Debug.Break() as it was instantiated, its totally correct aligned.

sentences:
Help with dropping items in a game I am making a game where i have items or blocks stacked on top of each other.

What i would like to do is, when the first item(or the item at the bottom of the stack) is removed, i would like to shift all the blocks above, down into the next position below it and add another block to the top of the stack.

Sort of like in a match 3 game.

Could someone provide instructions for doing this? or some type of psuedocode?

Thanks guys

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:
Why does the object not move correctly when I press the right mouse button? 2D Game in UNITY C#

I have an object BULLET .

After pressing the left mouse on my object (BULLET), the script allows me to rotate object according to the mouse's direction, in four directions  :

-up right

-down right

-down left

-up left

I would like to add a movement so that the object starts moving in face direction after pressing the right mouse button.

I did it, but the object doesn't move freely in face direction and doesn't bounce off the walls, it just follows the mouse.

But I just want to fire my bullet.

I don't want the object to follow the mouse, just fire in face direction.

You know, like an arrow from a bow.

I press the left mouse button and I start rotate the object - THEN I press the right mouse button and the object flies without stopping in face direction, and began to bounce off the walls.

I show what's wrong on video (link below):
enter link description here

This is my code:

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

    public class TestFollow : MonoBehaviour {

    private Transform _bullet;
    private Vector2 _screenSize;
    private float _interval = 10;
    public Sprite sp1,sp2;
    SpriteRenderer sr;
    bool mouseClicked = false;
    public float moveSpeed = 10f;
    public float speed;
    bool rightClicked = false;

    // Use this for initialization

    void Start ()
    {
        sr = gameObject.GetComponent<SpriteRenderer> ();

        if (sr.sprite == null) // if the sprite on spriteRenderer is null then
            sr.sprite = sp1; // set the sprite to sprite1

        _bullet = transform;
        _screenSize = new Vector2(Screen.width, Screen.height);

    }

    public void Update ()
{

    transform.position = Vector2.Lerp (transform.position, Camera.main.ScreenToWorldPoint (Input.mousePosition), moveSpeed);

    Vector3 difference = Camera.main.ScreenToWorldPoint (Input.mousePosition) - transform.position;
    difference.Normalize ();

    {
        if (Input.GetMouseButtonDown (0)) {
            Debug.Log ("Left Mouse Button was pressed");
            moveSpeed = 0f;
            if (sr.sprite == sp1) { // if the spriteRenderer sprite = sprite1 then change to sprite2
                sr.sprite = sp2;

            }
            mouseClicked = true; //register that the mouse has been clicked and the sprite is changed to sprite2
        }
    }

    if (mouseClicked) {        //checks if sprite has already been changed

        // Check for every 10 frames, reduce _interval if you want to check more often.
        if (Time.frameCount % _interval == 0) {
            // Use debug to learn mouse position, you can disable this if you want.
            Debug.Log (Input.mousePosition);

            // Mouse on Top Right screen
            _bullet.localEulerAngles = Vector3.zero;

            // Mouse on Bottom Right, else Mouse on Bottom Left else Mouse on Top Left
            if (Input.mousePosition.x > _screenSize.x / 2 && Input.mousePosition.y < _screenSize.y / 2)
                _bullet.Rotate (Vector3.forward, -90, Space.Self);
            else if (Input.mousePosition.x < _screenSize.x / 2 && Input.mousePosition.y < _screenSize.y / 2)
                _bullet.Rotate (Vector3.forward, -180, Space.Self);
            else if (Input.mousePosition.x < _screenSize.x / 2 && Input.mousePosition.y > _screenSize.y / 2)
                _bullet.Rotate (Vector3.forward, 90, Space.Self);
        }
    }

    {

        if (Input.GetMouseButton(1)) {
            Debug.Log ("Pressed secondary button.");
            rightClicked = true;
        }
        if(rightClicked)
            _bullet.transform.position += (transform.right + _bullet.transform.up).normalized * speed * Time.deltaTime;

    }
    }
}

PS. I'm sorry if I shouldn't post here, but I'm in a little depression. I'm working on this code for a few days and I can't change anything.

PS 2. sorry for my English. Not English-speaking country.

sentences:
Need help with physics 2D Unity I'm making a 2D game in Unity. Basically there's just a rocket that goes where ever the user touches. With the code that i have right now, the rocket instantly rotates towards the point and moves there straight.

Vector3 dir = targetPos - transform.position;
float rotZ = Mathf.Atan2(dir.x, dir.y) * Mathf.Rad2Deg;
rb.MoveRotation(-rotZ);
thrust = 10.0f;
rigidbody2d.AddForceAtPosition(transform.up * Thrust, transform.up);

This code is placed in the Update function.

I want the rocket to start moving in which ever direction It's currently facing and slowly rotate towards the point as it goes there.

sentences:
How can i add a description of gameobject when click on the gameobject? I have this DetectInteractable working script attached to Player (FPSController).

I'm using tag to detect interactable objects, each object i want to be interactable i change his tag in the editor to "Interactable". ( Maybe there is a better way to do it without using tag ? It's working but many told me not to use tag. )

I'm using Raycast to hit a gameobject detect if it's "Interactable" and if it does i display on the gameobject his name. For example "Security Door" or "Screen Monitor" or "Surveillance Camera"

Now i want to do that if i hit a gameobject with the raycast and it's "Interactable" if i will click the mouse left button it will display a description text description about the gameobject. But this time i want to use some gui box so it will be in front of the screen in the middle and not on the gameobject.

The problem is that i need to create a script for every "Interactable" gameobject and make that if i click on a button it will display a description.

Then how do i make the script and how can i make that when i attach the script to each gameobject it will make in the inspector a box of text so i can enter and type there the description of the item(GameObject) ?

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

public class DetectInteractable : MonoBehaviour
{
    public Camera cam;
    public float distanceToSee;
    public string objectHit;
    public Image image;
    public bool interactableObject = false;
    public Canvas canvas;
    public Text interactableText;

    private RaycastHit whatObjectHit;
    private RotateObject rotateobj;

    private void Start()
    {
        rotateobj = GetComponent<RotateObject>();
    }

    private void Update()
    {
        Debug.DrawRay(cam.transform.position, cam.transform.forward * distanceToSee, Color.magenta);

        if (rotateobj.rotating == false)
        {
            if (Physics.Raycast(cam.transform.position, cam.transform.forward, out whatObjectHit, distanceToSee))
            {
                if (whatObjectHit.collider.gameObject.tag == "Interactable")
                {
                    image.color = Color.red;
                    objectHit = whatObjectHit.collider.gameObject.name;
                    interactableObject = true;
                    interactableText.gameObject.SetActive(true);
                    interactableText.text = whatObjectHit.collider.gameObject.name;
                    print("Hit ! " + whatObjectHit.collider.gameObject.name);
                }
                else
                {
                    image.color = Color.white;
                    interactableText.gameObject.SetActive(false);
                    print("Not Hit !");
                }
            }
            else
            {
                image.color = Color.white;
            }
        }
    }

    public class ViewableObject : MonoBehaviour
    {
        public string displayText;
        public bool isInteractable;
    }
}

sentences:
How would a server handle sending entity updates to clients? Lately I've been looking into networking and sockets and made small test programs to get the basics down. So far I've made a TCP turn-based game from where I learnt a lot and helped me getting some fundamentals down.

Recently I also got a basic game working where multiple clients can connect and see each other move, but I feel like the architecture is not the best though.
This made me want to expand the game a little and build a more solid foundation but I've been struggling to find the answers on a few questions I have.

The approach I've had for 2D action games(which is my goal to make) is to have a dedicated server, a separate project written purely in java(I use LibGDX for clients) and in the server project I have a Client class which has a x, y, and an id. Then when a client connects to the server it creates a new Client object, gives it an ID based on the amount of clients connected and puts it in an ArrayList called players.

Then for movement I have the Game client send a message when it moves, structured like id,x,y;. The servers Client object receives the message and tells the server to broadcast() it to all the other clients which in turn receives a position message. The Game clients get a message, structured as above, and the Game client updates his own playerList.

This feels really clumsy and not well structured at all and this leads to my next question, what data should the server have?

Let's say we have a 2-player game where the players cooperate to kill mobs and receive items and exp. How would the server keep track of the mob entities? Would i create an identical Entity class from the Game Client and put in the Server project with everything but the render / graphical stuff? And collision with projectiles and stuff, do I collision check in the Game Client and then validate in the server?

All this feels very overwhelming and I would love if someone could give me some advice or point me to any forum posts they've read. I've searched around the forum but haven't managed to find anything that really answers this structuring part.

Thanks in advance, feel free to ask me anything!

sentences:
Game server for an android/iOS turn-based board-game I am currently programming an iPhone game and I would like to create an online multiplayer mode. In the future, this app will be port to Android devices, so I was wondering how to create the game-server?

First at all, which language should I choose? How to make a server able to communicate both with programs written in objective-c and Java?

Then, how to effectively do it? Is it good if I open a socket by client (there'll be 2)? What kind of information should I send to the server? to the clients?

sentences:
Trying to create a sphere in UDK on which I can stand Trying to build a globe in UDK, but when I do (create a sphere), my player falls straight through it.  How do I make a sphere that I can walk on?  Every other shape (cube, cone...etc) work just fine.

--

Edit:  Specifically, I want to build a CSG/Brush sphere, not a mesh sphere.  It appears to work just fine if I set the "sphere exptrapolation" to 1 or 2, but if I bump it up to 3 or higher, I fall right through.  I literally created 2 spheres next to each other, one set at "2" and one at "3" - I can walk from the top of the "2" sphere and jump onto the "3" sphere, but I fall right through it.

sentences:
C++ Wrapper class for raw pointer to an SDL_Texture First time in game dev, so go easy on me. I understand it's senseless to copy textures, but I'm trying to see this from a copy/move perspective since there is a lot of that going on in my code and in general, for proper memory management.

Deep copying an SDL_Texture is a no-no since its implementation is hidden. Besides I mostly initialize and destroy it using SDL_CreateTextureFromSurface and SDL_DestroyTexture. My next approach was wherever there would be an SDL_Texture*  class member I would try to wrap it in a std::shared_ptr<SDL_Texture>, but even that didn't work because of the incomplete type error.

My main question is this:
Would the proper way of handling a raw SDL_Texture* pointer getting passed around everywhere, be to create a wrapper_class, for example

class WTexture {
    public:
    // constructor, destructor and everything else needed

    private:
    SDL_Texture* tex;
    //...

}

so, that in every class that has an SDL_Texture* tex; member I would swap it with std::make_shared<WTexture> tex;? Meaning that I can safely pass around the texture and it will only be deleted at the end of the program when the reference count reaches zero?

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:
Making the AI take different paths to each other I have a top down 2d game where the AI spawn at the edges of the map and run towards the center.

I'm using A* and a node mesh to do the pathfinding.

Right now, the AI spawn at a point on the edge of the map and all take the same path which is the shortest route to the center.

Now I want them to be more surprising and interesting and take different paths to each other.

I can immediately think of two ideas for doing this but wanted to know if there are other ways or better ways that people often use?

When one enemy spawns and generates a path to the center, temporarily increase the cost of all the nodes on that path, then slowly decrease them back down over time. Then the enemy AI that spawn later will be forced to take a wider path.
The above approach will lead to AI just taking a wider and wider path though and still be very predictable. So I thought I'd also introduce a number of intermediate goal nodes around the map. When the AI spawn they randomly pick one of the intermediate goals and head there first before heading to the center of the map. Combining this with the above approach of increasing the costs might look pretty good?

What approaches have people found work best to getting the AI to vary the paths they take, look convincing and surprising?

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:
How do I create an Ubuntu snap for a MonoGame application? I've been going through the snapcraft documentation and examples and I'm still really confused about how to go about creating my snapcraft.yaml file.

Basically I have a folder with my game in it.  The folder contains all the files that are needed to run it.

I just want it to copy the files onto the end user's computer and have the shell script that launches the game targeted.

Here is my yaml file:
https://gist.github.com/c349bc23febbe73a6976b83b7757f887

Here are the contents of my directory:
https://github.com/SoundGoddess/OpenSolitaire/releases/download/0.9.2/OpenSolitaire.Classic.0.9.2.Linux.tgz

When I execute "snapcraft snap" I get the following error:
'NoneType' object has no attribute 'lstrip'

It looks like the parts folder gets generated ok, but then it fails on the build:

kati@linux:~/Development/OpenSolitaire.Classic$ snapcraft snap
Skipping pull opensolitaire-classic (already ran)
Preparing to build opensolitaire-classic
Building opensolitaire-classic
'NoneType' object has no attribute 'lstrip'

Any help would be greatly appreciated :)

sentences:
How to get smooth circular input from a thumbstick in XNA? I have a mouse-based game that I'm trying to get to work nicely with the Xbox gamepad.  My major issue is trying to get the cursor to move smoothly like it does with the mouse.  Using GamePadDeadZone.IndependentAxes makes it hard to move at slight angles, so I switched to GamePadDeadZone.Circular.

It turns out that the values that I'm getting from the controller are diamond shaped instead of being circular.  Pushing all the way up gives me (0,1), and pushing right gives me (1,0), but pushing to the top-right gives me (.7,.7).

This leads to a quite noticeable slowdown when traveling at angles.  My game requires the player to move carefully at times and quickly at others, but it's near impossible because you'll move faster or slower depending on the angle of the thumbstick.  How can I get truly circular data back?

sentences:
Verlet chain with two fixed points is not converging properly I am trying to create a simple chain between two fixed endpoints. The problem is that I can't seem to get the chain to reach a stable state. Further, the chain is always biased toward one of the endpoints.

Here are my constants and variables:

const NUMBER_OF_LINKS = 100
const CHAIN_LENGTH = 400
const DIST_BETWEEN_LINKS = CHAIN_LENGTH / NUMBER_OF_LINKS
const ITERATIONS = 20 # number of times we iterate through constraints each frame
const GRAVITY = Vector2(0, 300)

var anchor1
var anchor2

var prev_link_positions = []
var links = []

Here's what I do on initialization:

create_links(NUMBER_OF_LINKS)

var first_link = links[0]
var last_link = links[NUMBER_OF_LINKS - 1]

first_link.global_position = anchor1.global_position
last_link.global_position = anchor2.global_position

And here are the adjustments I do each frame:

links[0].global_position = anchor1.global_position
links[NUMBER_OF_LINKS - 1].global_position = anchor2.global_position

for i in range(NUMBER_OF_LINKS):
    var acceleration = GRAVITY
    acceleration *= delta * delta
    var prev_position = links[i].global_position
    if not i in [0, NUMBER_OF_LINKS - 1]:
        links[i].global_position = 2*links[i].global_position - prev_link_positions[i] + acceleration
    prev_link_positions[i] = prev_position

for iteration in range (ITERATIONS):
    for i in range(NUMBER_OF_LINKS):
        var link = links[i]

        var prev_link_position
        if i == 0 or i == NUMBER_OF_LINKS - 1:
            prev_link_position = links[i].global_position
        else:
            prev_link_position = links[i-1].global_position

        var next_link_position
        if i == 0 or i == NUMBER_OF_LINKS - 1:
            next_link_position = links[i].global_position
        else:
            next_link_position = links[i+1].global_position

        # get vector to previous link and adjust position
        var vec_to_prev_link = prev_link_position - link.global_position
        link.global_position += vec_to_prev_link.normalized() * max(vec_to_prev_link.length() - DIST_BETWEEN_LINKS, 0) / 2.0

        # get vector to next link and adjust position
        var vec_to_next_link = next_link_position - link.global_position
        link.global_position += vec_to_next_link.normalized() * max(vec_to_next_link.length() - DIST_BETWEEN_LINKS, 0) / 2.0

When I run this, I almost get what I want, except the chain contorts and never reaches a stable state. Also, it is biased in the first direction I look at when solving the constraints.

It looks something like this:

What am I doing wrong? How can I get a chain that stabilizes with links more uniformly distributed?

sentences:
In regards to real time turn based games, where should the turn handler be? I'm currently developing a pool-like browser game. I'm stuck on where should I handle the turn changing, timer, etc.
Currently, turn timer (i.e. 15 seconds left to do action, then turn will change) is handled by the server. But the changing of turns itself is handled by the client (the browser itself).
Now in my current setup, whenever a player leaves window focus, the game gets out of sync. Should I migrate the turn change handling to the server instead?

sentences:
How can I trigger to start timeline using distance and not OnTriggerEnter/Exit? using UnityEngine;
using UnityEngine.Playables;

public class GenericTrigger : MonoBehaviour
{
    public PlayableDirector timeline;

    // Use this for initialization
    void Start()
    {
        timeline = GetComponent<PlayableDirector>();
    }

    void OnTriggerExit(Collider c)
    {
        if (c.gameObject.tag == "Player")
        {
            timeline.Stop();
        }
    }

    void OnTriggerEnter(Collider c)
    {
        if (c.gameObject.tag == "Player")
        {
            timeline.Play();
        }
    }
}

The idea is to create some kind of cut scene.
Once the player (First person, in the screenshot i'm just showing the door on the left where the player will come from and the soldiers ) exit the door on the left and is in a specific distance from the soldier the first soldier the closet one will start moving to the player. Later I will make that it will change to close up view on the soldier with some text conversion. That's the main goal.

But the script the original script by the unity tutorial is using triggers.
I'm not sure if I should using this way or using somehow by calculating the distance between the player and the soldier to start the timeline ? And how to do it.

After the soldier is moving/walking to the player at some point I will make it to change to a close up view on the soldier with blurry background something like this:

But first how should I approach to the triggering part ?

sentences:
unity webgl scale page on different sizes of internet browsers on pc or phone unity only has a fixed resolution for building webgl. how can I make it changebale on users browser size change.

there are some tutorials on the internet that doesn't match. there is only

    index.html unityloader.js
    gamename.json  gamename.data.unityweb  gamename.asm.memory.unityweb
    gamename.framework.unityweb  gamename.asm.code.unityweb

how can I make multi res webgl output happen for unity?

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:
How to make the character dash forward in Roblox? In my game I want to make a skill in a tool to dash forward for a specific range
and if the character came in contact with a humanoid during the dash,
it stops right on contact and stops the other humanoid from moving temporarly too and deal damage

I don't know what functions should i do and where to look for them...
i figured how to use onActivate and getting the mouse through Equipped
Appritiate any help and guidance

sentences:
Networking middleware I'm looking for a networking middleware that may be suitable for a medium-sized MMO.

I don't care in which language it's written, just that it's high-level, stable and has many of the features that can ease my development. I am making a 2D real-time action game.

Come to think of it... I'd be happy with "just" a high-level networking framework that has a few handy features to ease the development of a general networked game.

sentences:
Reflections on moving water I've been working on a simple game with semi-realistic water. I followed some tutorials to get:

a flat water surface
reflection and refraction (blended using fresnel term)
ripples using a bump/normal map

Next step, I created a mesh to form actual waves. I'm animating it, and it looks great (for my intents and purposes).

Normally, to get the reflection, I would render everything on a second camera, which is actually the normal camera, but mirrored over the water plane, like in the image below:

Then, just sample that camera's output to find the reflected color.
Obviously, this technique doesn't work if the water level isn't consistent. In other words, with an animated mesh, this looks terrible.

Can anybody suggest a different way to implement reflections? Or show a workaround method?

sentences:
Rubik's cube array rotation I'm about to make a 3D Rubik's cube based game in Flash AS3 and Away3d.

I don't really know how to manage the 2D arrays of the Rubik's cube.

For example, how do I rotate the corresponding arrays if I rotate a side, or just rotate a middle part?

In this stage I also don't know how to rotate those smaller cube parts all together if a side is rotating. First I was thinking of "groups" ( like in sketchup or 3ds max, blender), but that would be tricky, because the group components would change every time.

So I was thinking of just rotating each individual piece along a global axis. However, I just know the Away3d functions to rotate the cube of his local X , Y or Z axis, but how to rotate in global axis?

Does anyone know of a algorithm for doing these types of rotations?

sentences:
How to know if the player is signed in? I was wondering if there's any way to know if the "player" is signed in or not?

Something like this:

if (GamePad.GetState(PlayerIndex.Two).IsConnected && !Gamer.PlayerTwo.IsSignedIn)

So that the controller is connected and it can be used, but the player is not signed in to an account. Something like a guess.

sentences:
Render error in xna DrawPrimitive for Assimp Mesh I am trying to render the vertices of a scene with a cube I exported as an OBJ from Blender. The 8 vertices become 24 when imported into XNA but when I render it I dont see all faces. This is not an issue of missing meshes because I'm pretty sure this is being stored as the first and only mesh. I suspect this is because of the vectors defined in the Assimp Mesh object but I can't seem to find any help for this.

THIS IS SOLVED! The code shows how to render a 3D model using only Assimp and XNA with vertex and index buffers. oScene is the Scene object imported using Assimp. This code only draws faces in a single color without textures.

Here is the relevant code:

   private void SetUpVertices()
    {
        mMesh = oScene.Meshes[0];
        vertices = new VertexPositionColor[mMesh.VertexCount];
        indices = new  short[mMesh.FaceCount*3];

        int i=0;
        foreach (Vector3D mVec in mMesh.Vertices)
        {
            vertices[i] = new VertexPositionColor(new Vector3(mVec.X, mVec.Y, mVec.Z), Color.Red);
            i++;
        }

        int f = 0;
        Face mFace;
        for (i = 0 ; i < mMesh.FaceCount*3 ; i=i+3)
        {
            mFace = mMesh.Faces[f];
            f++;
            indices[i] = (short)mFace.Indices[0];
            indices[i + 1] = (short)mFace.Indices[1];
            indices[i + 2] = (short)mFace.Indices[2];

        }

        vertexBuffer = new VertexBuffer(device, VertexPositionColor.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
        vertexBuffer.SetData(vertices);

        indexBuffer = new IndexBuffer(device, typeof(short), indices.Length, BufferUsage.None);
        indexBuffer.SetData(indices);

    }

    private void SetUpCamera()
    {
        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);
    }

    protected override void Draw(GameTime gameTime)
    {
        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:
How can you procedurally place objects in a non-gridded game? This is a follow-up question to this question. I mistakenly worded the question, but got a good answer before I could correct myself, so I didn't want to delete it. Sorry!

Now that I know that it is possible, I'd like to implement procedural world generation, but I don't want it to look gridded or blocky, where everything is obviously placed on an integer grid.

I know that you can do this in gridded worlds by inputting a square's x and y into a noise function, or similar, but how can I generate a more natural looking object placement using procedural methods?

This is in the context of an adventure game, if it matters.

sentences:
How do I change rasterizer state properly? To set the rasterizer state I have to ID3D11Device::CreateRasterizerState() and then ID3D11DeviceContext::RSSetState. And then I should ID3D11RasterizerState::Release() it, right?

How about when I want to change the state? Do I follow the above 3 steps again?
When I want to change just 1 setting (i.e. only CullMode) do I still have to fill and set whole structure?
Also, do I have to create and release the state object each time (assuming I don't want to set the exact same state again in the future)?
How about performance? If I set the exact same state again does it do anything? Is there a difference between changing only 1 setting or most/all of them?

sentences:
Adding an extra Pass to the Unity Standard Shader I'm experimenting with adding some procedural textures to the unity standard shader. I'd like to add an extra pass (with vert and frag functions), but am unsure about where in the sequence this should go, and how to properly integrate it with the other passes (I want to keep all the standard shader lighting features etc.).

To keep things simple, I'd like to start with adding an extra pass which simply paints the mesh one color. Where should this go (in Standard.shader)?

Note : I've tried adding a pass between passes #1 ("FORWARD"), and #2 ("FORWARD_DELTA"). This works, and casts shadows, but does not recieve shadows.

Thank you!

sentences:
Hex tile systems and the efficient use of classes So I've built myself a system of classes for what I think is an efficient way to describe an entity that would live in my game.

Is this an effective approach or am I creating entities that are too large in size? I want the game to be able to run well even with an inane amount of tiles.

I read the post (Map with 20 million tiles makes game run out of memory, how do I avoid it?) about having one million tiles and memory problems and I'm worried that my tile system I've created using the entity system will not be able to handle such large sized maps as there is so much information to be processed.

To give you an idea about what each component of a Hex Entity holds, the sprite comp maintains the following variables: the texture, position, rotation, height and width; while the hex comp of the hex entity maintains: the position, the coordinates on the board, the orientation, and what hex's are adjacent to it. Should i simplify the date types

sentences:
OSX Based Equivalents for Stacking Normal Maps? I've been looking for an OSX based alternative to the Windows based xNormal and NVIDIA textures tools for stacking normal maps in photoshop.

Can anyone recommend something, whether it's a standalone package or photoshop plugin?

sentences:
Rotating an object in OpenGL about it's centre Im writing a game for which, one of the models are loaded from an .obj file.

It's a model of a plane, and I want to rotate the propeller. The object file is broken into groups, and the propeller is identified, so that's all good.
I'm writing the game in C++ with OpenGl/GLFW
The drawing function is:

int win_width;
int win_height;
glfwGetWindowSize(&win_width, &win_height);
float win_aspect = (float)win_width / (float)win_height;
glViewport(0, 0, win_width, win_height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90, win_aspect, 1, 100.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 0, 30.0, 0, 0, 0, 0.0, 1.0, 0.0);

glEnable(GL_DEPTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_NORMALIZE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor3f(0.0f, 0.0f, 0.0f);
int vertexIndex = 0, normalIndex;
glRotatef(90, 0, 1, 0);
glPushMatrix();
for(int a = 0; a < (int)groups.size(); a++)
{
    if(groups[a].type == "prop")
    {
//Code for rotation
        glPopMatrix();
        glPushMatrix();
        float x,y,z;
        x = y = z = 0;
        int Count = 0;
        for(int k = 0; k < groups[a].faces.size(); k++)
        {
            for(int p = 0; p < groups[a].faces[k].vertices.size(); p++)
            {
                int _index = groups[a].faces[k].vertices[p];
                y += vertices[_index].Dimensions[_y] ;
                z += vertices[_index].Dimensions[_z];
                Count++;
            }
        }
        z /= Count;
        y /= Count;
        glTranslatef(0, -y, -z);
        glRotatef(angle, 1, 0, 0);
        glTranslatef(0, y, z);
    }
    for(int b = 0; b < (int)groups[a].faces.size(); b++)
    {
        glBegin(GL_POLYGON);
        for(int c = 0; c < (int)groups[a].faces[b].vertices.size(); c++)
        {
            vertexIndex = groups[a].faces[b].vertices[c];
            glVertex3d(vertices[vertexIndex].Dimensions[_x], vertices[vertexIndex].Dimensions[_y], vertices[vertexIndex].Dimensions[_z]);
        }
        glEnd();
    }
}
glPopMatrix();
glfwSwapBuffers();

Since I don't know the exact centre of the propeller, that's what the for loop before the rotation is for. It finds the average of the y and z co-ordinates.

After I find it, I translate to -y,-z , rotate it, and then translate back. This makes the propeller spin as I want it to, but it also rotates along the origin >.<
http://people.sc.fsu.edu/~jburkardt/data/obj/cessna.obj <- This is the object file.

groups is a vector of objects and each object has a vector of faces. I'm sure that the vertices and faces are being loaded correctly, since the whole model renders correctly.

sentences:
Is there a way to create a cellular automaton mod for Minecraft? I basically want to create a mod for Minecraft that does the following:

if(a sand block is next to lava block) {
   change the sand block to a glass block
}

Is it possible to create a mod like this without editing multiple Java classes?

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:
How to implement a 2D map? I am interested in implementing a map for my 2D action platformer. The map will be accessed when the player presses a certain button, and will show—at a very coarse grain—the sections of the world that the player has previously traversed. The sections are of various shapes and sizes, and I do not intend the map to show every platform and detail of each section, just a coarse grained shape of them and the various connections between them.

Ultimately, I want a map that looks similar to the one in Hollow Knight:

I am wondering what are some techniques for implementing this kind of map? It is hard to find info on how to implement this kind of map because of search result noise related to level design.

I image that I need to create an image of my final map, then define various areas on top of the image and link them to various area triggers in my level. When my player enters an area trigger in the world, I can send signal to the map to reveal and highlight the corresponding section of the map.

Is this a common technique?

How else could I implement this kind of map?

The engine I'm working in isn't important, so feel free to describe techniques in an engine-neutral way.

sentences:
Using keyword [NonSerialized] causes Property to disappear from Inspector I have the following class to represent items in an inventory:

[System.Serializable]
public class InventoryItemInfo : MonoBehaviour
{
    public int Row = 0;
    public int Col = 0;
    public int Rotation = 0;
    public InventoryItemType ItemType;
    public int Amount;
    public int EffectiveWidth = 0;
    public int EffectiveHeight = 0;

    public int Width = 0;
    public int Height = 0;

    public bool Selected = false;
    public Vector3 TilePosAccordingToCurrentRotation;
    public Vector3 TileScaleAccordingToCurrentRotation;

    [NonSerialized]
    public Transform TheNicelyPositionedMesh;

    [HideInInspector]
    private int _iCurRow = 0;
    private int _iCurCol = 0;
    private int _iRotationToCheckForDirtyness = -1;

    public Vector3 DefaultRotation;

    public bool Initited = false;

    public bool Dirty = true;
    private bool _bInitialRotationGotten = false;
    (...)

With the keyword [NonSerialized], the property "TheNicelyPositionedMesh" disappears from the Unity Inspector.

I don't see why. Why is that keyword coupled with the visibility in the Inspector?

Thank you!

sentences:
Vulkan am I creating too many graphics pipelines? I have the situation in which I require different VkPrimitiveTopology's for different models, which requires me to have a unique pipeline's that render the different models, but now I require multiple windows open at the same time. Is there any way to use the pipelines for multiple windows or will I require a different set for the new window?

The secondary windows could be a different size to the main window, that's why I ask because I know when a window resizes you require to rebuild the pipeline.

sentences:
Game maps with "counties" that are split along lines that aren't necessarily straight I want to create a game environment that supports a 2D map.  This is a really basic map, but must be split along lines that are not necessarily straight.  So imagine a country with county boundaries.  I then want to be able to detect drag / drop events within these counties.

What I'm really looking for here is a pointer to where to start on this (how it has been done before - any existing libraries out there), as I'm sure that what I'm trying to do is not new - although I can't find a beginners guide for this anywhere.

sentences:
Alternatives to raycasts in unity? I have an ai car script. The car needs to be able to slow down and or stop if it gets too close to another car. Right now I'm using 3 raycasts like so:

if (Physics.Raycast(lRay, out lHit, rs.forwardCollisionRayLength, rs.rayLayerMask) || Physics.Raycast(rRay, out rHit, rs.forwardCollisionRayLength, rs.rayLayerMask) || (Physics.Raycast(mRay, out mHit, rs.forwardCollisionRayLength, rs.rayLayerMask)))
{
    //some code...
}

However this is really long and inconvenient because it's a pain to figure out which raycast actually had the hit. And then there's other cases where multiple raycasts hit the same car, which point do I use, or if different raycasts hit different cars...Anyway, you can see that this is not ideal.

Also, depending on the size of an object, it could go between the raycasts. In the image below, the blue box is ok because its wider than the width between the raycasts, thus two of the raycasts find it. But on the other side, the green pole is too small, so the car can't see it and drives on.

I also need to get the distance between the hit.point and the car so that I know how much the car needs to slow down so that there's a reasonable distance between the two cars at all times.

I could use something like Physics.OverlapBox or Physics.CheckBox but then I can't get the distance between the closest point of the car, only the center of it. This is bad because some cars are longer than others - I need the distance between the nearest point of the car.

Also, keep performance in mind, I could solve the problem of objects going in between raycasts by adding more, but that will drain performance hugely, mainly because I have up to about 40 cars running at a time.

TL;DR: What are some alternatives for a raycast that can also give me the distance to the closest point?

sentences:
Is coroutine as good as a delay() function I'm new to Unity and I was learning the usage of coroutines.
Is calling a coroutine as good as a delay() function?
Does Unity have a delay() function?

sentences:
How do I correct the turning effects on my car in order for it to turn properly? In my game, I'm currently working on a Physics-based car driving game in Unity from scratch. My problem is that whenever I press the input controls used for turning, instead of turning, my car does barrel rolls in the air. I'm using a document written about Car Physics by Marco Monster to aid some of my calculations in this post. I've looked at my code and suspect that the problem lies within this segment of my code. Please provide any feedback as it would be greatly appreciated.
//This section relates to low-speed cornering, not really useful for drifting
            //This will determine the circle radius related to turning, in effect, calculating how much we turn
            R = L / Mathf.Sin(userRight);

            //Here, we calculate the vehicle's angular velocity in radians per second
            //Omega (fancy w) represents angular velocity
            // v represents velocity
            rb.angularVelocity = rb.velocity / R;

        //This section covers high-speed turning
            //This relates to the car
                //sideSlipAngle = Vector3.Angle(carTransform.forward, rb.velocity);
                sideSlipAngle = Mathf.Atan(rb.velocity.z / rb.velocity.x);

        //This relates to the wheels
        for(int i = 0; i < 4; i++)
        {
            //alpha represents the slip angle for each wheel
            alpha = Vector3.Angle(wheels[i].forward, rb.velocity);

            //this equation is an approxiamtion of values below the peak shown in the graph
            lateralForce = new Vector3(0f, 0f, corneringStiffness * alpha);

            //These values are supposed to represent the magnitudes of these velocities
            longVelocity = Mathf.Cos(alpha) * rb.velocity;
            latVelocity = Mathf.Sin(alpha) * rb.velocity;

            /*
                Remember that these forces are supposed to be acting upon the wheels themselves,
                so add rigidbodies accordingly
             */

            //The lateral velocity causes the cornering force to counteract it
                //This relates to only the front wheels
                frontSlipAngle = Mathf.Atan((latVelocity.magnitude + (rb.angularVelocity.magnitude * b)) / longVelocity.magnitude) - (userRight * Mathf.Sign(longVelocity.magnitude));
                for (i = 0; i < 2; i++)
                {
                    //Calculates the lateral force of the wheels
                    latFrontForce = lateralForce.normalized * (frontWeight.magnitude / 2f);
                    latFrontForce += latFrontForce;

                    corneringForce = latRearForce + Mathf.Cos(userRight) * latFrontForce;
                    lateralForce += latFrontForce;

                    frontTorque = Mathf.Cos(userRight) * latFrontForce * b;
                    //rb_wheels[i].AddForce(lateralForce);
                }

                centripedalForce = corneringForce;
                steeringRadius = centripedalForce.magnitude / (rb.mass * Mathf.Pow(rb.velocity.magnitude, 2f));

            //This relates to only the rear wheels
            rearSlipAngle = Mathf.Atan((latVelocity.magnitude - (rb.angularVelocity.magnitude * c)) / longVelocity.magnitude);
            for (i = 2; i < 4; i++)
            {
                //Calculates the lateral force of the wheels
                latRearForce = lateralForce.normalized * (backWeight.magnitude / 2f);

                latRearForce += latRearForce;
                lateralForce += latRearForce;

                rearTorque = -latRearForce * c;
                //rb_wheels[i].AddForce(lateralForce);
            }

        }

        totalTorque = frontTorque + rearTorque;
        rb.AddTorque(totalTorque);
```

sentences:
Welcoming new players to an MMO game with veteran players who have amassed lots of wealth One of the main problems in the game Knight Online has been that the servers that have been open for a long time have users with a lot of items.

If I want to join as a new player, it is not logical for me to play the game in those servers because there is no way that I can catch up with the players there (unless I buy a lot of item with real money). Because, in order to obtain "good" items, you have to be in the regions of the game where you will fight with other users, so as a newbie, there is no chance that you can compete with those users.

For example, there is a trend in KO: a new server opens, after ~two years people get quite strong and almost no new user joins the server, and then those strong users just gain more and more items and sell them. Then the server dies practically, with no new blood joining it and old users eventually leaving.

What is a strategy I can use in my MMO to regulate the wealth distribution, or keep it accessible to new players, even when other players have been accumulating wealth for a long time?

sentences: Where can I find fonts for my game? Where can I find fonts (preferably free, but a reasonable fee is acceptable) that I can use in my for-pay/commericial game?

sentences:
submeshes and dynamic batching doesnt work as expected I'm duplicating one object with submeshes frequently, and assigning a random material from five materials to each submesh. There is batching happening, but it's not quite as efficient as I would have expected (details here).
Note objects are all less 900 vertices no light maps and ... All are dynamic batching ready

So if dynamic batching works there must be only 5 draw calls right but there isn't there is really much more than 5

sentences:
Restricting movement to 3D axis A cube is constructed in a 3D and can be rotated to view any side. I want to be able to drag the cube to any position with the mouse while keeping the Y-coordinate the same. I used project and unproject functions to map the mouse to the 3d world. This method seems to work fine when the green face is parallel to the camera. However, when i rotate the cube say 45 degrees around the x-axis and the cube face is now at an angle to the camera, the y-coordinates do not track the mouse. when the camera is parallel to the red face, the tracking in the y-axis is almost nothing.

When i dont fix the y-coordinate, the cube tracks the mouse perfectly, however, the y-coordinates are changed as well. How can i go about keeping the y-axis fixed and yet having the mouse cube track the mouse?

sentences:
How does a point squared equal the radius squared? I am working on a simple ray tracer but I don't understand some of the formulas.

One that is bugging me at the moment is this:

  If a sphere is centred at origin, a point p lies on a sphere of radius r2 if
  p*p = r2

Now, as I understand it, 'p' is a point in 3D space, (x,y,z), so how is it possible to square the point and have it equal the radius squared?

For what it's worth, I'm reading this article on calculating the intersection of a ray and a sphere.

sentences:
Model won't render in my XNA game I am trying to create a simple 3D game but things aren't working out as they should. For instance, the mode will not display. I created a class that does the rendering so I think that is where the problem lies.

P.S I am using models from the MSDN website so I know the models are compatible with XNA.

Code:

    class ModelRenderer
    {
        private float aspectratio;
        private Model model;
        private Vector3 camerapos;
        private Vector3 modelpos;
        private Matrix rotationy;
        float radiansy = 0;
        public ModelRenderer(Model m, float AspectRatio, Vector3 initial_pos, Vector3 initialcamerapos)
        {
            model = m;
            if (model.Meshes.Count == 0)
            {
                throw new Exception("Invalid model because it contains zero meshes!");
            }
            modelpos = initial_pos;
            camerapos = initialcamerapos;
            aspectratio = AspectRatio;
            return;
        }
        public Vector3 CameraPosition
        {
            set
            {
                camerapos = value;
            }
            get
            {
                return camerapos;
            }

        }
        public Vector3 ModelPosition
        {
            set
            {
                modelpos = value;
            }
            get
            {
                return modelpos;
            }
        }
        public void RotateY(float radians)
        {
            radiansy += radians;
            rotationy = Matrix.CreateRotationY(radiansy);
        }

        public float AspectRatio
        {
            set
            {
                aspectratio = value;
            }
            get
            {
                return aspectratio;
            }
        }
        public void Draw()
        {

            Matrix world = Matrix.CreateTranslation(modelpos) * rotationy;
            Matrix view = Matrix.CreateLookAt(this.CameraPosition, this.ModelPosition, Vector3.Up);
            Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), this.AspectRatio, 1.0f, 10000f);
            model.Draw(world, view, projection);
        }
    }

If you need more code just make a comment.

sentences:
How to add to a MonoBehavior array from an Editor script in Unity I've made an editor which makes a list of tags and splits them into two rows of true or false values (selectable by the user). I then compile this list into a dictionary, and each entry is like so:

{"tag", bool, bool}

On my MonoBehavior script, I have two arrays:

string[] depth_tags;
string[] angle_tags;

My goal is to essentially save the dictionary data and be able to recall it/also have it affect the script. To do this, I've been trying to add to these arrays according to the values found in the Editor script's dictionary.

I've done quite a bit of searching and this was the only potential solution I could come up with, but sadly it did not work.

EDIT: Ok, I can now edit the list (added and subtracted from arraySize when doing operations on them), but I have a new problem:

The array reports as being twice as large as it should be. The first half of the arrays are correct and as they should be, but the latter half is made up of empty values. When I try to access beyond the first half, Unity throws an error saying that I exceeded the array's max range.

EDIT 2: FIXED

Answers telling you to increase and decrease arraySize are WRONG/OUTDATED. Clearing, inserting, and deleting from the table does that for you! Quick Tip: Inserting at index 0 in a serialized table takes care of the element bumping for you! No need to cycle through the table and move each array.

void update_tags()
{

    SerializedProperty depth_tags = serializedObject.FindProperty("depth_tags");
    SerializedProperty angle_tags = serializedObject.FindProperty("angle_tags");

    depth_tags.ClearArray();
    angle_tags.ClearArray();

    foreach (string tag in tag_list_values.Keys)
    {

        if (tag_list_values[tag][0] == true)
        {
            depth_tags.InsertArrayElementAtIndex(0);
            depth_tags.GetArrayElementAtIndex(0).stringValue = tag;
        }

        if (tag_list_values[tag][1] == true)
        {
            angle_tags.InsertArrayElementAtIndex(0);
            angle_tags.GetArrayElementAtIndex(0).stringValue = tag;
        }

    }

    serializedObject.ApplyModifiedProperties();

}

}

sentences:
What is actually loaded during a game's loading screen? I am at the stage of my game where I have to develop the loading screen. It's actually already there, but I don't know exactly what it should be loading while it's presented.

Why would I have a loading scene instead of just going directly to my game scene? I don't even know what else to load besides the textures with the texture SpriteCache.

Am I doing the correct content loading? I missing something to load during that loading scene?

sentences: Why do games run so much better in Windows than in OSX? For example, on my Mac Mini with Bootcamp, Team Fortress 2 runs at about 20fps in OSX and 80fps in Windows. This seems to be a common case. Why is this?

sentences: Is there a way to make a dynamic world such as a MMORPG horizontally scalable? Imagine a open-world of 500+ players with data changing as fast as 20 updates/player/second. Last time I worked in a similar MMORPG, it used SQL, so obvioulsy it couldn't query the DB all the time. Instead, it loaded all players from the DB to memory as C++ objects and used them. That is, it scaled vertically. Would it be possible to make that server horizontally scalable instead? Is there a database designed to support that amount of updates concurrently?

sentences:
Implicit conversion error - why is this code trying to convert a 'World' to an 'int'? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class World {
    Tile[,] tiles;
    int width;
    int height;

    public World (int width = 200, int height = 200) {
        this.width = width;
        this.height = height;

        tiles = new Tile[width, height];

        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                tiles[x, y] = new Tile[this, x, y];
            }
        }
    }

    public Tile GetTileAt(int x, int y) {
        if (x > width || x < 0 || y > height || y < 0) {
            Debug.LogError ("Tile (" + x + ", " + y + ") is out of range");
            return null;
        }
        return tiles [x, y];
    }

}

anyone see anything wrong with this code because on line 18 of my code i get this error "cannot implicitly convert type 'World' to 'int' and i don't know what is going wrong.

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:
How to add constant force to player with sperical gravity planet.? I have a planet and character. My player move perfect around planet with pressing key like 'w','s','a and 'D'. I want to move my player on every frame with same force around sphere. I try plane surface constant force code  like this this.rigidbody.AddForce ( 3f,3f,3f);, when start playing game this code work fine but after some movement it stop my player on specific position of planet. I want to use this code for 3D sphere.

Any one can help me how can add constant force to my player on 3d sphere.?

I want add constant force to player when game start. I don't want any kind of planet's orbits, because my player is moving on all over the planet.

I try below link but it did not working for me.
 How can i accurately simulate orbits in unity.?

Here is my Sctipts

PlayerController.cs

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

public float moveSpeed = 10;
public Vector3 moveDir;
Rigidbody rigidbody;
// Update is called once per frame3

void Start(){
    rigidbody = GetComponent<Rigidbody> ();
}
void Update () {

    moveDir = new Vector3 (Input.GetAxisRaw("Horizontal")  ,0,Input.GetAxisRaw("Vertical"));
}
void FixedUpdate(){

    rigidbody.MovePosition (rigidbody.position + transform.TransformDirection(moveDir) * moveSpeed * Time.deltaTime);

 }
}

FauxGravityBody.cs

using UnityEngine;
using System.Collections;

[RequireComponent (typeof (Rigidbody))]
public class FauxGravityBody : MonoBehaviour {

public FauxGravityAttractor attractor;
public Transform myTransform;
Rigidbody rigidbody;

// Use this for initialization++
void Awake(){

    this.rigidbody = GetComponent<Rigidbody> ();

}
void Start () {
    myTransform = transform;
    rigidbody.useGravity = false;
    rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
}

// Update is called once per frame
void Update () {

    attractor.Attract (myTransform);
  }
}

FauxGravityAttractor.cs

using UnityEngine;
using System.Collections;

public class FauxGravityAttractor : MonoBehaviour {

public float gravity = -10;
public void Attract(Transform body){

    Vector3 gravityUp = (body.position - transform.position).normalized;
    Vector3 bodyUp = body.up;

    body.GetComponent<Rigidbody>().AddForce (gravityUp * gravity);
    Quaternion targetRotation = Quaternion.FromToRotation (bodyUp, gravityUp) * body.rotation;
    body.rotation = Quaternion.Slerp (body.rotation, targetRotation, 50 * Time.deltaTime);
  }
}

I am working with this scripts, If any one help me? then please.

sentences:
Unity text component not updating text properly It was worked fine previously, but after some point, it's not working.

This is the code. It's not a pseudo code, actual code in game:

public Text healthText;

void Start() {
    healthText = GameObject.Find("UI/InGameUI/CharacterStatus/HealthText").GetComponent<Text>();
    }

void Update() {
    if(healthText) {
        print(health);
        // healthText.text = Time.deltaTime.ToString();
        healthText.text = "HP: " + health.ToString();
        // healthText.text = "HP: " + health;
    }
}

variable "health" is float value. I just want to print it to the screen, but it's always prints "Health: 100" even it changes.

So I printed the value to the console, but it prints well in the console and only text components was not printed properly.

So I printed Time.deltaTime instead of the health and it works!

Seriously, what the hell is happening? Is this a bug? If health variable wasn't changed, it should be also printed 100 in the console, but it's not!

Try this to another text component, still not working.

sentences:
Is frustum culling necessary in a Flash/AS3 game? I'm making a 2D game where the map will be scrolled frequently, and only a small part of it will be visible at any time.

Which implementation would run faster?

The naive way: Make the map a single
huge MovieClip and move it around.
The elegant way: Split the map into
multiple chunks and use a frustum
culling algorithm to render only the
ones that are visible.

Now that I think of it, this question boils down to whether Flash does its own frustum culling on big MovieClips.

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:
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:
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:
Relative vertical alignment of 3 Texts on Canvas This is a menu that appears if I press Enter on the RE4 inventory if an item is selected. I have drawn a thin red rectangle around it:

And here is a video that shows some of the menu's effects.

I am familiar with a simple text canvas.
I understand that I need to make each line a separate "Text" object so that I can scroll up and down through them.

Here is what I have so far:

The problem that I'm facing now is that the Canvas will be scaled at runtime.
I don't work with fixed values.
This is a problem since I don't see how I could easily make it so that each TextLine object fills 33,3% of the canvas.

Am I right to assume that I can only solve this by making a scripts that holds a reference to each TextLine object and which then calculates their position when the scale of Canvas is known?

Or is there any easier solution?

Thank you!

sentences:
Touch a specific area on the screen in Unity 5 I am building a Roulette game in Unity 5. I want to place bets on a Roulette table when I touch specific areas on the screen with mouse(PC) and touch(mobile).

For example when i touch Number 1 on the roulette table a bet should be placed on that number. I tried using box collider iwth trigger but I think thats for only colliders.

Screenshot attached

sentences:
Trying to use 3D vectors for a 2D ping pong game I am trying to setup a virtual ping pong table, and am getting a little stuck in trying to understand how to do 3D vector math and render it in 2D.

So far, my plan is for the ball: X = up/down, Y = left/right, and Z = forward/backwards

So as a simple start, I am just trying to move the ball forward:

ball.vel.x = 0;
ball.vel.y = 0;
ball.vel.z = 1;

in my update function:

ball.position.x += (ball.vel.x / ball.vel.z) * delta;
ball.position.y += (ball.vel.y / ball.vel.z) * delta;

Which obviously makes no sense since 0 / anything is 0.. my ball will never move forward...  So I am fundamentally missing something here.  What do I need to do so that my Z velocity will actually move the ball's position?

sentences:
Invalid operation (1282) in GLSL vertex shader My GLSL vertex shader works fine, but you if put a for loop inside or rename the uniform xxx to something else, it says the follwoing:

Exception in thread "main" org.lwjgl.opengl.OpenGLException: Invalid operation (1282)
    at org.lwjgl.opengl.Util.checkGLError(Util.java:59)
    at org.lwjgl.opengl.GL20.glGetUniformLocation(GL20.java:664)

this is the method causing the problem:

protected void getAllUniformLocations()
    {

        location_transformationMatrix   = super.getUniformLocation("transformationMatrix");
        location_diffuseColor           = super.getUniformLocation("in_color");
        location_projectionMatrix       = super.getUniformLocation("projectionMatrix");
        location_lightPos               = super.getUniformLocation("lightPosition");
        location_lightColor             = super.getUniformLocation("lightColor");
        location_viewMatrix             = super.getUniformLocation("viewMatrix");
        location_specular               = super.getUniformLocation("specularLevel");
        location_boneTransformations    = new int[32];
        for(int i = 0; i < location_boneTransformations.length; i++)
            location_boneTransformations[i] = super.getUniformLocation("xxx["+i+"]");
    }

this is my vertex shader:

#version 400 core

//data from VBO
in vec3 position;
in vec2 texture_coordinates;
in vec3 normal;
//bone data
in int bone_pointer;
in float bone_intensity;
//vertex color output
out vec4 color;
//texture coordinates
out vec2 pass_texcoords;
out vec2 texCoord0;
//normal
out vec3 surface_normal;
//vector pointing towards the light
out vec3 to_light_vector;

//position, rotation, scale
uniform mat4 transformationMatrix;
//perspective projection
uniform mat4 projectionMatrix;
//TODO: material color
uniform vec3 in_color;
//camera viewmatrix
uniform mat4 viewMatrix;
//lights
uniform vec3 lightPosition;
uniform vec3 lightColor;
//skeleton data xxx = bone transformations
uniform mat4 xxx[];
uniform int group_indices[];
uniform float group_values[];
void main()
{
    for(int i = 0; i < group_indices.length(); i++)
    {

    }
    mat4 total_transform =  transformationMatrix;
    total_transform = total_transform * xxx[0];

    vec4 worldPosition;

    worldPosition =  total_transform * (vec4(position, 1)) ; //

    vec4 pos =  projectionMatrix * viewMatrix * worldPosition;
    gl_Position = pos;

    //Texture
    pass_texcoords = texture_coordinates;

    //light
    surface_normal = (total_transform *  vec4(normal, 0)).xyz;
    to_light_vector = lightPosition * worldPosition.xyz;

    //textures
     texCoord0 = texture_coordinates;

}

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:
Game Components, Game Managers and Object Properties I'm trying to get my head around component based entity design.

My first step was to create various components that could be added to an object. For every component type i had a manager, which would call every component's update function, passing in things like keyboard state etc. as required.

The next thing i did was remove the object, and just have each component with an Id. So an object is defined by components having the same Ids.

Now, i'm thinking that i don't need a manager for all my components, for example i have a SizeComponent, which just has a Size property). As a result the SizeComponent doesn't have an update method, and the manager's update method does nothing.

My first thought was to have an ObjectProperty class which components could query, instead of having them as properties of components. So an object would have a number of ObjectProperty and ObjectComponent. Components would have update logic that queries the object for properties. The manager would manage calling the component's update method.

This seems like over-engineering to me, but i don't think i can get rid of the components, because i need a way for the managers to know what objects need what component logic to run (otherwise i'd just remove the component completely and push its update logic into the manager).

Is this (having ObjectProperty, ObjectComponent and ComponentManager classes) over-engineering?
What would be a good alternative?

sentences:
How can I add left and right movement to my sprite without reducing forward movement? I've made a character sprite that moves left and right when I press A and D, and moves forward automatically. However, whenever the character moves left or right, the forward movement is greatly reduced. Does anyone know a solution?

Here is my blueprint

sentences:
Why do loot drops contain (mostly) useless items? I was thinking about this and couldn't figure this out.  In Diablo you kill enemies and they drop random things.  But usually the drops are worthless to you relative to what you already have equipped.  Why bother building a drop system that gives you crappy drops?  Maybe I'm not communicating my question well so I'll provide an alternative implementation:

Instead of frequently dropping crappy items and rarely dropping good items, why not only rarely drop good items?

I guess that crappy items adds to the addictive-ness somehow, but I don't understand why.  Why is dropping crappy items part of the design?  What does that add?

Edit: FWIW, I have been referring to Diablo 2 as my reference, not D3.  But it's still interesting to see answers explaining why D2 was more addictive.

sentences:
Android Game-Loop (rendering & logic removed, but still 'skipping frames') Overview

Guys really hoping for some help here. My game loop is based on code from Fix Your Timestep!.

I've read the article more than a few times, but I can't quite work out what exactly is supposed to be going on within the loop.

I'm running my code on a Nexus 10 tablet which has VSync set to 60fps.

Playing catch up

When I run my code, I'm getting caught quite often in the while loop, ie it runs my logic more than once - so runs logic twice in a row before rendering).

With my understanding of the loop, this should happen when rending takes too long to fit into the time slice (which is 16.66666666666667ms).

So, maybe in 'normal circumstances', I would expect this to happen occasionally).

However, I've tried removing all rendering and logic updating and just running a skeleton loop and I'm still getting caught regularly and constantly within the 'while-loop'.

Therefore, when I'm running my game (with rendering and logic), I'm getting a lot of stuttering because I know the loop is going to skip frames.  The logic updates are however being capped at 60 which is exactly what I want.

Obviously whether or not my rendering or physics update could be more efficient is not the issue here and is a question for another day as I've already removed that from the equation.

I can smooth things out somewhat with interpolation and it really does make a difference, however, it's not as smooth as some of the games I download from the Play Store and I really need to make it better.

So, what am I missing or not understanding?  I would think it should (certainly with no rendering or logic updating to create a bottleneck):

Enter the while-loop
Exit the while-loop
Wait for next VSync
And repeat

Here is the loop I'm testing with:

@Override
public void onDrawFrame(GL10 gl) {

    newTime = System.currentTimeMillis()*0.001;
    frameTime = newTime - currentTime; //Amount of time this entire frame took
            if ( frameTime > (0.25))
                frameTime = (0.25);

            currentTime = newTime;
            accumulator += frameTime;

            //Update logic
            while (accumulator >= dt){
//              saveGameState();  //Removed for testing
//              updateLogic(dt);  //Removed for testing
                accumulator -= dt;
            }

            //Get the amount to interpolate by
//              interpolation = (float) (accumulator / dt);  //Removed for testing
//              render(interpolate);                         //Removed for testing

}

sentences:
How do I make my game (without performance problems) not stutter? I've made a game that has gameticks every 1/60 seconds. These gameticks take very little time to calculate (< 0.5 ms).

The game is written in Javascript and uses requestAnimationFrame (rAF). rAF fires roughly a few milliseconds (how many is determined by what the browser thinks is necessary) before (mostly) every frame output to the monitor.

The code does the following every rAF:

get a timestamp
figure out how many gameticks should have happened at that timestamp, and (if needed) run enough to catch up
render state after latest gametick to screen

This works fine most of the time. It runs at a consistent 60 gameticks/second, regardless of what the screen is doing (good for syncing multiplayer). It handles any framerate. The game looks smooth except, sometimes, the timestamps happen to be right around the boundary for new gameticks.

frame 10: gametick 2.01 (renders gametick 2)
frame 11: gametick 2.99 (renders gametick 2)
frame 12: gametick 4.01 (renders gametick 4)
frame 13: gametick 4.99 (renders gametick 4)
frame 14: gametick 6.01 (renders gametick 6)

When this happens, it stutters horribly. How do I make it avoid stuttering needlessly?

sentences:
UV mapping. Texture blurry and overlapping. Unity3d In my voxel game, this is how I'm calculating UV coordinates for my cubes' faces:

public static Vector2[] faceUVs(Direction dir)
{

    Vector2[] sideUV = new Vector2[4]{
        new Vector2(0, 1),
        new Vector2(1f/3, 1),
        new Vector2(1f/3, 0),
        new Vector2(0, 0)
    };
    Vector2[] topUV = new Vector2[4]{
        new Vector2(1f/3, 0),
        new Vector2(1f/3, 1),
        new Vector2(2f/3, 1),
        new Vector2(2f/3, 0)
    };
    Vector2[] bottomUV = new Vector2[4]{
        new Vector2(2f/3, 0),
        new Vector2(2f/3, 1),
        new Vector2(1, 1),
        new Vector2(1, 0)
    };
    if ((int)dir == 4)
    {
        return topUV;
    }
    if ((int)dir == 5)
    {
        return bottomUV;
    }

    return sideUV;
}

Then depending on which face is being generated, I return appropriate UV coordinates for it.

This is the texture itself(pretty clean, each block is exactly 16 pixels wide and 16 pixels tall. Total length of picture is 48 pixels):

But the result is terrible(Faces are almost correctly aligned with appropriate texture part, but the annoying keyword here is "almost"):

As you can see, edges of side faces contain few pixels of what should have been the texture of top face.

I've set filter mode to point too.

If I instead use 16x16 pixel texture, for example only side, then I get good result:

I suspect the problem here could be floating point precision. In that case, how do i resolve this error?

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:
Why are there different ways of building projection matrices? Matrix.PerspectiveFovLH documentation page says that this method uses the following formula to build a perspective projection matrix.

[w, 0, 0, 0]
[0, h, 0, 0]
[0, 0, zFar/(zFar - zNear), 1]
[0, 0, -zNear * zFar / (zFar - zNear), 0]

where

h = cot(fovY / 2)
w = h * aspectRatio

DirectXMath's DirectX::XMMatrixPerspectiveFovLH uses the same formula but with a difference. It calculates w as w = h / aspectRatio therefore creates a different matrix.

There is a difference between orthogonal projection matrix building too.

Why are there such differences or am i missing something?

sentences:
Why the layer must be created from my class and not from layer class I am confused about something.
I have the following example:

mainMenu.h

class mainMenu : public Node {
public:
    static Scene* createScene();
    virtual bool init();
    void GoToGameScene(Ref *pSender);
    CREATE_FUNC(mainMenu);

private:
    mainMenu() {};
    ~mainMenu() {};

};

mainMenu.cpp

Scene* mainScene::createScene(){
    auto scene = Scene::create();
    auto layer = mainScene::create();
    scene->addChild(layer);

    return scene;
}

Focus on this part.

auto scene = Scene::create();
auto layer = mainScene::create();

Why do we create layer from mainScene not from Layer

For example: Why we do this:

auto layer = mainScene::create();

If we can do it, like creating a scene

auto layer = Layer::create();

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:
Unity graphics lagging and leaving a trail The following are pictures of what I am describing. This happens both when I have normal lighting, graphics on low, render distance on short. I have a graphics card that can run games like Starcraft II easily. It appears to be the top of the screen that is most often affected by this lag. The lag is also seen on terrain. It happens when I build and set quality to low as well. Even if I change the camera angle. Camera movement is irrelevant. Although I am using position to make the camera not momentum. Any idea what might be causing this?

And the following is what it cuts to when the renderer catches up:

It only appears when the background is either not rendered, or very far in the distance.

Yes I have tried restarting unity, yes I have restarted my computer.

Here is the image with the camera settings:

sentences:
Why does transforming a Vector3 by a Quaternion result in reversed Z? I'm trying to transform the vector (1, 0, 0) by an orientation unit quaternion, which in XNA should be:

Vector3 v = Vector3.Transform(Vector3.Right, Orientation);

But this results in the Z value reversed from its expected value—for example, transforming Vector3.Right by Orientation (0.6532815, -0.270598, 0.270598, 0.6532815) results in the vector (0, 0.7071, -0.7071) when it should result in the vector (0, 0.7071, 0.7071).

I found another implementation here:

Quaternion o = Orientation;
Vector3 oV = new Vector3(o.X, o.Y, o.Z);
Vector3 v = 2 * Vector3.Cross(oV, Vector3.Right);
v = Vector3.Right + o.W * v + Vector3.Cross(oV, v);

But that results in the same problem. Reversing the Z value is trivial, but I'm worried that if I don't find a solution to this now the problem will manifest some other way down the road. Especially since, up until now, I thought I was playing by XNA's rules in my game engine (same coordinate system, same handedness).

For reference, this code I wrote does produce the expected result in my engine:

Vector3 v;
Quaternion o = OrientationGlobal;
double y = Math.Atan2(2 * (o.W * o.Z + o.X * o.Y), 1 - 2 * (o.Z * o.Z + o.Y * o.Y)); // yaw about global Z axis
v.Z = MathHelper.Clamp(2 * (o.W * o.Y - o.Z * o.X), -1, 1);
double m = Math.Sqrt(1 - v.Z * v.Z);
v.X = (float)(m * Math.Cos(y));
v.Y = (float)(m * Math.Sin(y));

What am I missing?

sentences:
Shader issues when creating projection using CreateOrthographicOffCenter instead of CreateOrthographic Pre. Having these matrix transformations:

var scale = Matrix.CreateScale(50f);
var eye = new Vector3(0, 0, 10.0f);
var view = Matrix.CreateLookAt(eye, Vector3.Zero, Vector3.Up);
var projection = scale * Matrix.CreateOrthographic(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 1.0f, 1000f);
var rotation = Matrix.CreateRotationX(-MathHelper.PiOver2)*Matrix.CreateRotationY(MathHelper.PiOver2);

and then for each mesh producing “world” like this:

var localWorld = transforms[mesh.ParentBone.Index] * rotation;

and then applying these parameters to the effect:

effect.Parameters["World"].SetValue(localWorld);
effect.Parameters["View"].SetValue(view);
effect.Parameters["Projection"].SetValue(projection);
effect.Parameters["Bones"].SetValue(boneTransforms);
effect.Parameters["WorldInverseTranspose"].SetValue(Matrix.Transpose(Matrix.Invert(localWorld)));

I’m getting nice model like this:

Post. But after I changed CreateOrthographic to CreateOrthographicOffCenter like this:

var projection = scale * Matrix.CreateOrthographicOffCenter(-GraphicsDevice.Viewport.Width / 2f, GraphicsDevice.Viewport.Width / 2f, GraphicsDevice.Viewport.Height / 2f, -GraphicsDevice.Viewport.Height / 2f, 1.0f, 1000f);
var rotation = Matrix.CreateRotationX(MathHelper.PiOver2) * Matrix.CreateRotationY(-MathHelper.PiOver2);

I’ve got this:

Can someone give me a hint what am I doing wrong?

sentences:
OpenGL strange lighting/model problem I've made a .obj reader in c++ and I've tried rendering some models. I've got the whole concept from here:
https://www.youtube.com/watch?v=KMWUjNE0fYI&list=PLRIWtICgwaX0u7Rf9zkZhLoLuZVfUksDP&index=9

So I've tried to copy the export settings in blender what the guy used in the video (I'm not experienced in modelling so I had troubles because I have a newer version) and I've split every edge so they staied sharp even with the smooth shader. What my model looks like in blender:

I'm not sure if this is a texture or lighting bug. The models that the guy provides in the video work just fine.

Edit:

My drawing code is this:

shader->Enable();
shader->SetUniformMat4f("vw_matrix", viewMatrix);
m_Model->GetVAO().Bind();
m_Model->GetIBO().Bind();
glActiveTexture(GL_TEXTURE0);
m_Texture->Bind();
glDrawElements(GL_TRIANGLES, m_Model->GetIBO().GetCount(), GL_UNSIGNED_INT, 0);
m_Texture->Unbind();
m_Model->GetVAO().Unbind();
m_Model->GetIBO().Unbind();
shader->Disable();

Export settings:

Write Normals
Include UVs
Triangulate faces
Objects as OBJ objects

Edit2:

I've added a pic how the model looks without edge split (above).

My vertex shader:

#version 400 core

in vec3 position;
in vec2 textureCoords;
in vec3 normal;

out vec2 pass_textureCoords;
out vec3 surfaceNormal;
out vec3 toLightVector;

uniform mat4 pr_matrix = mat4(1.0);
uniform mat4 vw_matrix = mat4(1.0);
uniform mat4 ml_matrix = mat4(1.0);
uniform vec3 lightPosition;

void main(void)
{
    vec4 worldPosition = ml_matrix * vec4(position, 1.0);
    gl_Position = pr_matrix * vw_matrix * worldPosition;
    pass_textureCoords = textureCoords;

    surfaceNormal = (ml_matrix * vec4(normal, 0.0)).xyz;
    toLightVector = lightPosition - worldPosition.xyz;
}

sentences:
How to delete Google Play Services? I want to delete Google Play Services in the Google Play Developer Console, but I can't. Here is what I did:

I published my game to Google Play without Google Play Services.

I decided that I want Google Play Services in my game, so I integrated them in the source code.
After that I created Google Play Services for my game in the Google Play Developer Console.

But the created Google Play Services didn't work. The were Unpublished at that moment. I read that in order for them to work, you have to publish them. I published them, they still don't work and I can't delete them. In order to delete them I must unlink the game, but since the game is published I can't unlink it. I asked Google Support what to do, they told me to delete the project in the Google API Console and after 7 days the game will be unlinked. There has been 15 days since then and nothing happens. Please tell me what can I do.

sentences:
Multiplayer game principles I am developing game using libGDX libraries . I want to create multiplayer mode , where several players can play at the same time in the same room , each player can create his own room and other players can connect to the room they want , I thought a mechanism like this
In this mechanism the left client is the one who has created the room and other 3 clients are connected to that room . The game physics runs on the room creator and sends the positions of physical bodies to the server , server sends that positions to other clients , other 3 clients send their input to the server and the server sends that inputs to the room creator and that inputs influence on the physic. But I think this cycle is not good because if the device of room creator runs slow then the game will start lagging and the fps will drop down and other clients will see the game with the same fps which is in the creators device . So can anyone offer me another mechanism for multiplayer game? I am using Node.js for server-side program and Java for client side .

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:
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:
Is there an XNA-like library for Java? I'm curious to know if there is an XNA-like library for Java; that is, a library that

Handles the game loop - i.e. you just implement an existing method, and it will get called every frame.
Handles the rendering - i.e. you just tell it what to render, it will take care of displaying it to the monitor, hiding implementation details such as hardware acceleration.
Contains many useful methods for graphic, sound and user input options.

I'm interested in a library which supports both 2D and 3D options.

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:
using Playerprefs on Android Mobile Platform I have a question about playerprefs on my android mobile game not initializing properly. I have already pre-set my playerprefs data on a variable with a value of 3. In my play mode on unity the value is showing 3 through the textmesh that I have it scripted on. But when I install and test it on my android mobile device it is 0. can someone help how to properly initialize my playerprefs data to the right value on android platform?

 public static Game GM;
 int maxAntiBody;
 public TextMeshProUGUI antibodyTexMesh;

void Start () {
    if (GM == null)
    {
        GM = this;
    }
 maxAntiBody = PlayerPrefs.GetInt("MaxAntiBody");
 antibodyTexMesh.text = maxAntibody.toString();
}

void Update () {
debugging();
}

//I use this method for setting or resetting my desired value for the playerprefs data I'm working with. In this case I choose 3 as a value.
void debugging() {
    if (Input.GetKeyDown(KeyCode.M))
    {

        PlayerPrefs.SetInt("MaxAntiBody", plus++);
        Debug.Log("max anti body value is : " + PlayerPrefs.GetInt("MaxAntiBody"));
    }
    else if (Input.GetKeyDown(KeyCode.R))
    {
        plus = 0;
        PlayerPrefs.SetInt("MaxAntiBody", plus);
        Debug.Log("max anti body is now reseted to : " + PlayerPrefs.GetInt("MaxAntiBody"));
    }
}

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:
Problem with drawing textures in OpenGL ES I'm developing a 2D game for Android and i'm using the framework which has been told in the book which named Beginning Android Games by Mario Zechner.So my framework is well designed and using OpenGL 1.1.It's similar to libgdx.

When i put my textures adjacent each other in my 2d surface,there are some spaces size as 1 px.But this problem only occur on my tablet.There aren't a problem like this on my phone.It's like in this picture:

What can be the problem?I can't fix it from one week.

sentences:
Unity3d:Detect a collision between an image and a sphere So, I just realized, an image with BoxCollider2D wont detect any collision with Sphere with SphereCollider.

I tried adding a BoxCollider to my image, but it behaves in a weird manner (The Canvas position keeps shifting)

So, I can see the only way for it to work is adding a 2D Collider to the sphere? Is there any other better way to solve it? Adding a 2D Collider to the sphere wont cover the whole area

sentences:
cocos2dx - Custom Fragment Shader and CCRenderTexture I have a CCRenderTexture that is filled with a sprite when the scene is loaded, as follows,

canvas = CCRenderTexture::create(this->getContentSize().width, this->getContentSize().height);
canvas->setPosition(data->position);
canvas->beginWithClear(0.0, 0.0, 0.0, 0);
this->visit();
canvas->end();

The above code is written within a class, which derives from CCSprite (Hence this).

Then, in another function applyShader(), I create a sprite named splat, from the texture of CCRenderTexture *canvas. Thus splat will contain the whole texture of canvas.

Now I apply a custom fragment shader to the splat by calling the function splat->renderShader(), which will modify some small portion of the whole  texture.

Then I draw the modified texture back to the CCRenderTexture *canvas.

Hence, applyShader() will
 * take a texture from CCRenderTexture,
 * create a sprite based on it,
 * apply a fragment shader to it
 * and draw the modified texture back to CCRenderTexture.

This applyShader() will be called repetitively and its code is as follows:

splat = Splat::createWithTexture(art->canvas->getSprite()->getTexture());
splat->renderShader();
art->canvas->begin();
splat->visit();
art->canvas->end();

My shader code is (nothing fancy)

precision mediump float;

varying vec2 v_texCoord;
uniform sampler2D u_texture;
uniform sampler2D u_colorRampTexture;
uniform float params[5];

void main() {
    gl_FragColor = texture2D(u_texture, v_texCoord);
    return;
}

So, with the above code I expect the original sprite this to get rendered over and over again without any visual changes. But on each call to applyShader(), the texture is getting stretched a little and the stretched image is getting rendered. After some 10 calls, the image gets so distorted.

Can someone please tell me where I am going wrong?

Thanks :-)

PS: All code shown here is partial, not complete code.

Edit: Adding Screens

Update:
The problem has nothing to do with shaders it seems. It happens even when I dont call renderShader(). The actual lines of code is:

splat = Splat::createWithTexture(art->canvas->getSprite()->getTexture());
splat->setPosition( ccp( art->getContentSize().width * 0.5, art->getContentSize().height * 0.5 ) );
splat->setFlipY(true);
art->canvas->begin();
splat->visit();
art->canvas->end();

sentences:
Position sprite at center of screen I am trying to get a sprite to position itself at the center of the screen but nothing seems to be working for me.
I'm trying

Viewport viewport = graphics.GraphicsDevice.Viewport;
logoPosition = new Vector2((viewport.Width - towerImage.Width) / 2,
                           (viewport.Height - towerImage.Height) / 2);

and

spriteBatch.Draw(towerImage, centre, null, Color.White, 0, baseOrigin, 1.0f, SpriteEffects.None, 0);

This is my first time using XNA and I don't really have a clue what I'm doing.

sentences:
Geometry shaders on Surface RT Can anyone tell me if geometry shaders are supported on the Microsoft Surface RT? On one hand, MSDN makes it sound like the Surface RT supports only feature level 9_1, and geometry shaders are only available in feature levels >= 10_0. On the other hand, there's this guy saying:

  Jesse Barker @incendy
  @dotMorten I am confused haha.. so my geometry shaders work on Surface rt?

  Morten Nielsen @dotMorten
  @incendy Yes ! They might run software emulation, but yes. That's why DX is so awesome. Don't worry about hardware. It'll work

Does anybody have actual experience with this? I don't have a Surface RT here to test with, so any guidance on this would be much appreciated.

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 it bad practice to for the server to request data for a client from another client? I'm making a collaborative whiteboard app so that when someone is drawing and uses a rectangle for example, a rectangle packet is sent to the server with parameters like x, y, width, height, color and then that packet is sent to everyone else in the room so that a rectangle is drawn on their screen.

So far everything works perfectly and there's also a stack on each client of all the commands thus far for infinite undo and redo. However, there server does not contain this stack because all it has to do is forward commands to clients in the room.

Everything is working perfectly so far and everyone can see everyone else drawing in real time but I'd like to implement a feature where if someone joins a room late they can see the current whiteboard. That is, the entire command stack would have to be sent to someone. However, this data isn't stored on the server, but each client has their own (identical copy).

Would it be bad for when someone joined to have the server ask one of the clients (which? round-robin?) to send his command stack to the server and have the server forward it to the client? My concerns are the delay and teh amount of data being sent in one go (congestion).

What do you all think? Are there any other options?

sentences:
(While using a cube map) box-like textures appearing around my scene whenever I move the camera I've been learning about cube map and I implemented one into my program. It seemed to work well until I started moving the camera around the scene and zooming out. As you can see in the attached gif, there seems to be a problem with the cube map since this weird behavior is occurring:

https://gyazo.com/70ad4ce027d1e032bc19258e28def66f

Main program:

        unsigned int cubemapTexture = texo.loadCubeMap(faces);

        glDepthFunc(GL_EQUAL);
        bg.bind();
        skyBox.use();

        glm::mat4 projection = glm::perspective(glm::radians(fov), (float)scr_width / (float)scr_height, 0.1f, 100.0f);
        glm::mat4 view = camera.GetViewMatrix();
        skyBox.setUniformMat4("projection", projection);
        skyBox.setUniformMat4("view", view);

        glActiveTexture(GL_TEXTURE20);
        glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);
        GLCall(glDrawArrays(GL_TRIANGLES, 0, 36));

loadCubeMap:

unsigned int Textures::loadCubeMap(std::vector<std::string> faces)
{
    unsigned int textureID;
    glGenTextures(1, &textureID);
    glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);

    stbi_set_flip_vertically_on_load(false);

    int width, height, nrChannels;
    for (unsigned int i = 0; i < faces.size(); i++)
    {
        unsigned char* data = stbi_load(faces[i].c_str(), &width, &height, &nrChannels, 0);
        if (data)
        {
            glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
                0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data
            );

            stbi_image_free(data);
        }
        else
        {
            std::cout << "Cubemap tex failed to load at path: " << faces[i] << std::endl;
            stbi_image_free(data);
        }
    }

    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);

    return textureID;
}

Vertex Shader:

#version 330 core

layout (location = 0) in vec3 aPos;

out vec3 TexCoords;

uniform mat4 view;
uniform mat4 projection;

void main()
{
    vec4 pos = projection * view * vec4(aPos, 1.0);
    TexCoords = aPos;
    //Setting z value to w (1.0) so that the cube map is always in the background
    gl_Position = pos.xyww;
}

Fragment shader:

#version 330 core

out vec4 FragColor;

in vec3 TexCoords;
uniform samplerCube skybox;

void main()
{
    FragColor = texture(skybox, TexCoords);
}

The problem probably originates from one of these snippets, but if you have any other ideas I can provide more info.

sentences:
Frustum Culling/Only rendering what's viewed by the Camera in HTML5 Canvas? I coded up a simple 2D Camera for my HTML5 Canvas-Based Game Engine but I noticed the performance wasn't very good. So a lot of people suggested only rendering things that are shown by the camera but I haven't found anything that helps how to implement this.

I'm thinking about iterating over through all my game entities then checking their rendering positions, etc. But is this efficient?

if(renderCoords[i].x >= 0 &&
   renderCoords[i].y >= 0 &&
   renderCoords[i].x <= camera.getWidth()+camera.offset.x &&
   renderCoords[i].y <= camera.getHeight()+camera.offset.y) {
       //render
}

It's not tiled-based, just thought I mentioned that. Just doesn't seem clean to me.

sentences:
How to prevent fleeing monster from backing himself into a dead end? I've been building a rogue-like for more than a year now, and so far I've only ever implemented very simple monster behaviour - such as moving toward the player when he's in the line of sight, and attacking.

I would like to implement fleeing behaviour for certain monsters that realize they're outmatched.

I have these priority based behaviour types for monsters:

Flee
Attack/Defend
Investigate (event)
Socialize / Explore / Patrol

The only code I have for fleeing is a flood fill routine which attempts to find tiles which "look" like they are doorways leading to corridors. The question is, how can I improve this to stop it from finding such tiles that deceptively look like doorways, but actually lead to dead ends?

sentences:
strategies for detecting regressions I know writing tests would be a good way to catch regressions. But what are some other strategies? TDD and game dev don't suit, but catching regressions is obviously something desirable. I would love to find some cheap and easier ways to catch regressions without having to invest a lot of effort or writing tests after the fact.

Strategies suggested don't have to be perfect, if they can give rough ideas or things to playtest rapidly then that would also be beneficial.

Please advise.

sentences:
How do I prevent floating and jittering when on the ground and using spherical gravity? TL;DR: My ship floats and jitters when it lands on a sphere.

To elaborate on the title:
I'm experimenting with a 3D space game. I have created a sphere, which in turn has a larger sphere overlapping it, within which, gravity will take place. However, once my player's ship (currently using an arrowhead) lands on the planet, it doesn't actually make contact with the surface of the sphere, and then the ship begins to rotate erratically and jitter. Code below.

private void OnTriggerStay(Collider other)
{
    if (other.CompareTag("SoI"))
    {
    inSoI = true;
    }
}

This trigger checks to see if the ship is in the larger overlapping sphere. I have another identical block for OnTriggerExit which sets inSoI to false. I also have a OnCollisionEnter which sets another variable, landed to true, and a OnCollisionExit which sets it to false.

private void FixedUpdate()
{
    if (inSoI && !landed)
        {
            gravityVector = (planet.transform.position - transform.position);
            rb.AddForce(gravityVector.normalized * planetrb.mass * rb.mass / gravityVector.sqrMagnitude);
        }
}

Simply, if in the larger sphere, then accelerate towards the planet. I tried disabling gravity if in contact with the sphere. It removed a lot of the jitter, however it still floats, and it still rotates side to side. The sphere by the way, is the standard Unity sphere, scaled 10000x in every axis.
I don't need code (though it would help), any solution is fine, even if it means abandoning the project.

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:
Keyboard shortcuts in RTS game Imagine you have a multiplayer RTS game (e.g. Dune, Age of Empires, Settlers, Warcraft). There are certain commands available from keyboard to command the troops (Stop, Attack, Move) and some more general commands like Pause or Exit. The game is localized into many languages (18+).

I can see two possible ways of using keyboard shortcuts:

A. Use first English letter of said commands ("S", "A", "M", "P", etc.) for every locale.

B. Use first letter of the word on that locale (e.g. Russian shortcuts will be "С", "А", "Д", "П". German will be "H", "A", "S", etc..)

Which of these (or suggest your own) approaches is better when choosing the shortcuts for multiple locales?

P.S. Of course the shortcuts might be customizable by player, but some sane defaults are still needed.

sentences:
Is there a name for this algorithm for 2d shape collision? A while ago I was considering my possibilities for implementing collisions between 2D shapes, and after much googling (which mostly turned up SAT), I came up with this:

let A, B = two shapes
let V = Speed of A relative to B

for a:point in vertices of A
  for b:segment in segments of B
    if segment(a, a+V) intersects b
      return intersection point
return false

Now, I'm far from the smartest person out there, so I am 99.8% sure someone must have come up with that before me and, what's more important, since I didn't find anything describing this method, I assume it's a bad one.

Can anybody identify this algorithm and/or point me towards any literature on it explaining if, when and why it should be used?

I've failed to see any significant problems at first sight; all the complex calculations can be hoisted outside of the loops and then it's just matrix multiplications within both loops, and I couldn't find any algorithm that makes do without any nested loops over two sets of elements (be they vertices, segments or normals)

Feel free to trash-talk my algo all you like, I never expected it to be the second greatest discovery right after general relativity or anything ;)

PS: Sorry for the poor title, but I can hardly explain the entire algo in one line :)

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:
How long does one have to pay the $125 per month subscription fee for Unity pro? I'm a bit confused by how the subscription for Unity Pro works. If I were to get Unity Pro, do I have to keep paying $125 per month for as long as I'm using Unity pro? Or do I have to keep paying $125 per month until certain period, after which I am no longer required to pay anything?

Furthermore, if I developed a game with the personal version of Unity and the game made over $100K, would that result in an immediate penalty or will Unity give me a deadline before which I must get Unity Plus/Pro?

sentences:
How heavy is a scene load in Unity assuming all referenced objects are in memory? From what I understand, resources that are local to a particular scene( not a prefab, or texture, material asset etc ) are embedded in the scene file itself, while external resources are just referenced and loaded if needed. The game I'm working on requires all scene be loaded from an asset bundle. Which means by the time the level is loaded, all data should be in memory.

In order to show relatively accurate load progress, I sum of the total bytes of all the needed asset bundles to load the level and divide that by the (approximate) number of bytes loaded so far( calculated using the file size of the asset bundle in bytes multiplied by Unity's AssetBundleRequest.progress value ).

However, this isn't possible with Application.LoadLevel since there's no way to weigh how long it might take relative to the time it took to load the asset bundles.

So, my question is, does Application.LoadLevel take long enough to be an issue if ignored? The presence of an async version of this method leads me to believe there is some need for this. That might only apply for scenes that were built into the game rather than into an asset bundle though.

sentences:
UI Element only showing in sceneview and not game in Unity3D I have a game and in one part, in the start of a scene its supposed to trigger an animation that shows a UI element that covers the whole screen to make a smooth transition from one scene to another.
When I click a button it will trigger a function that triggers an ienumerator (just a function basically) which starts the animation, waits some time, then opens the next scene. The animation it triggers makes the UI show up.
The code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class levelLoad : MonoBehaviour
{
    public Animator transition;
    public float waitTime = 1f;

    public void transitionLoad(int li)
    {
        Debug.Log("Message through, activating script.");
        StartCoroutine(loadScene(li));
    }

    IEnumerator loadScene(int levelIndex)
    {
        // the set trigger sets the trigger 'starts' which starts the animation that shows the ui element

        transition.SetTrigger("Starts");
        Debug.Log("animations, go");

        yield return new WaitForSeconds(waitTime);

        Debug.Log("Loading Scene");

        // loads scene
        SceneManager.LoadScene(levelIndex);

        Debug.Log("Scene Loaded");
    }
}

So in the animator tab, there is a trigger called "starts" that when triggered, activates crossfade_end which shows the UI element.
crossfade_start hides the UI element.
I get all the debug logs in the code correctly and in game I checked animator, it says that its playing the animations yet in game I don't see the UI element showing up.
Does anyone have a solution? I'm using unity 2019.17.4 lts.
Also, the UI element is in a different canvas then the main canvas, a canvas that is in the sceneloader gameobject, which has the code above. Also that canvas is in layer default, and I checked, default layer is set to showing.
Can anyone fix my problem of the UI element showing in scene view but not in game? (this isn't build)
this is an android game.

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:
Dynamic Flow Control in HLSL with Array References I'm trying to do lighting calculations for an array of point lights in HLSL. I simply want to pass light direction vectors from the vertex shader to the pixel shader. Here is sample code:

static const int MAXLIGHTS = 8;
float4 g_vLightPosition[MAXLIGHTS];
float4x4 mW : WorldTransform; // model to world
float4x4 mV : ViewTransform; // world to view
float4x4 mP : ProjectionTransform; // view to project

void VS_Lighting( in float4 PositionMS : POSITION0,
out float4 PositionCS : POSITION0,
out float4 Texcoord[MAXLIGHTS] : TEXCOORD )
{
    // view-projection
    float4x4 mVP = mul(mV, mP);

    // world position
    float4 vPosWS = mul(PositionMS, mW);

    // clip space pos
    PositionCS = mul(vPosWS, mVP);

    // compute light direction vectors
    for(int i = 0; i < g_nLightCount && i < MAXLIGHTS; ++i)
    {
        Texcoord[i].xyz = g_vLightPosition[i] - vPosWS;
    }
}

The above code forces the loop to unroll and gives the following warning:

  warning X3550: array reference cannot be used as an l-value;
  not natively addressable, forcing loop to unroll

I would like for this code to be dynamic so as to reduce the instruction count. I understand that the problem is accessing the array in the loop. How can I rewrite this code to prevent unrolling during compilation? I am using ps 2.0 or 3.0.

sentences:
What causes this graphics quality difference between WebGL Build and Unity 5 Editor? The Editor version and WebGL version of my Minesweeper clone have some graphics quality differences. I chose 'Fast' option when building this deployment.

Is this the difference between 'Fast' and 'Fastest' options of Optimization Level in Build Settings, meaning that if I choose the 'Fastest' option, the WebGL deployment will be the same as Editor version, unlike below? If not, why this happens?

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:
Does it make sense to export and use skeletal animation as sprites? As tools like Dragonbones, Spine lets you export animations as both sprite atlas and skeleton data (JSON/binary), I'm not sure which format to use when importing to Unity.

I have few concerns:

Will there be any differences between the quality of the animations, when imported as atlas vs skeleton data?
Any other pros and cons, using one over the other?

If I use a sprite atlas, I don't have to depend on a third party runtime though. It is for mobile, so performance is also a concern.

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:
Segment-Cylinder intersection What is the complete code (C#, pseudo, does not matter) for calculating the resulting segment (or its absence) for the intersection of asegment and a cylinder?

The segment is defined by Vector3(x,y,z) as Start andVector3(x,y,z) as End.

The cylinder is defined by the same parameters plus a value for Radius.

sentences:
How can I calculate respective 2D world/mouse position through different resolutions? I have been at this game of trial-and-error for days now. I cannot find a consistent method to calculate the respective mouse position in my game world after the calculations are done to stretch the game's render view to the current resolution. I've seen other, similar questions and answers on this site, but after looking at them long and hard, I can't translate the answers to my project.

I'm using XNA. First, I render everything to a RenderTarget2D at a resolution of 800x600. Then I render said RenderTarget to the screen by calculating it's size and location through a method that returns a Rectangle:

public Rectangle CalculateRenderTargetPosition()
    {
        Rectangle rec;
        Single preferredAspect = Globals.RenderSize.Width / (Single)Globals.RenderSize.Height;
        Single outputAspect = Globals.WindowSize.Width / (Single)Globals.WindowSize.Height;
        if (outputAspect <= preferredAspect)
        {
            // output is taller than it is wider, bars on top/bottom
            Int32 presentHeight = (Int32)((Globals.WindowSize.Width / preferredAspect) + 0.5f);
            Int32 barHeight = (Globals.WindowSize.Height - presentHeight) / 2;
            rec = new Rectangle(0, barHeight, Globals.WindowSize.Width, presentHeight);
        }
        else
        {
            // output is wider than it is tall, bars left/right
            Int32 presentWidth = (Int32)((Globals.WindowSize.Height * preferredAspect) + 0.5f);
            Int32 barWidth = (Globals.WindowSize.Width - presentWidth) / 2;
            rec = new Rectangle(barWidth, 0, presentWidth, Globals.WindowSize.Height);
        }
        return rec;
    }

The Camera's position is rendered during rendering to the RenderTarget2D through a Matrix in the SpriteBatch.Draw method, so there's nothing weird going on there. The Camera itself works fine at any resolution.

After days of guesswork, this is the closest method I've got:

Rectangle r = Globals.Draw.CalculateRenderTargetPosition();
MouseState ms = Mouse.GetState();

Single aspect = Globals.WindowSize.Width / (Single)Globals.WindowSize.Height;
Single pmx = (ms.X - r.X);
Single pmy = (ms.Y - r.Y);
Single mx = (pmx == 0 ? pmx : pmx / aspect);
Single my = (pmy == 0 ? pmy : pmy / aspect);
Vector2 pos = Vector2.Transform(new Vector2(mx, my),
    Matrix.Invert(Globals.Camera.GetViewMatrix()));
Globals.RelativeMousePosition = new Vector2(pos.X, pos.Y);

Even if this is almost close enough, it's still off. I don't know if there's some magical Matrix method I don't know about or if I just suck at math.

sentences:
Scale a sprite as it moves down a triangle I have a sprite that is inside a triangular like shape. How to make the sprite decrease in size as it moves down the shape?

https://ibb.co/gjc6oS

sentences:
How to distort an image using perlin noise? I'm trying to generate a 2D map and currently I'm doing so by the use of voronoi diagram. The problem I found is that all biomes have really hard edges and I would like to smooth them out a bit.

Initially I was thinking smoothing out voronoi curves, which appears to be far more complex as I imagined. Then I thought about perlin distorion, which seems far more doable. Although, I'm not sure what is the best way to implement this.

This is the function I use to generate a voronoi diagram:

void Generate()
{
    Vector2Int[] centroids = new Vector2Int[regions.Length];
    Color[] regColors = new Color[regions.Length];
    for (int i = 0; i < regions.Length; i++)
    {
        centroids[i] = new Vector2Int(Rand.Range(0, map), Rand.Range(0, map));
        regColors[i] = regions[i].color;
    }
    Color[] colors = new Color[map * map];
    for (int x = 0; x < map; x++)
    {
        for (int y = 0; y < map; y++)
        {
            int index = x * map + y;
            colors[index] = regColors[GetClosestCentroidIndex(new Vector2Int(x, y), centroids)];
        }
    }
}
int GetClosestCentroidIndex(Vector2Int pixelPos, Vector2Int[] centroids)
{
    float smallestDst = float.MaxValue;
    int index = 0;
    for (int i = 0; i < centroids.Length; i++)
    {
        if (Vector2.Distance(pixelPos, centroids[i]) < smallestDst)
        {
            smallestDst = Vector2.Distance(pixelPos, centroids[i]);
            index = i;
        }
    }
    return index;
}

While doing some research I stumbled upon this website, which shows the exact result I'm trying to achieve:
https://observablehq.com/@kerryrodden/image-distortion-with-perlin-noise

Can someone help me with this problem? Thank you

[Solved]

By the help of the user DMGregory, the map is now looking much better!
This is the new voronoi diagram, after the distortion had been applied.

Currently, I'm using these settings, but I will probably tweak them later.
Scale: 10
Octave Count: 1
Amplitude: 4
Lacunarity: 1
Persistence: 1
And for the seed, currently, I'm using just a randomly generated seed.

sentences:
When Should You Revisit Old Web/Mobile Games To Improve Them? Note: I would like this to be specific to mobile and web games, since they have easier distribution methods than other models.

Based on the examples in my interfaces question, it looks like (as expected) there's a lot of work cut out for me; there's a lot of room to improve that old, hoary chemistry game.

But should I?

In fact, when should (and shouldn't) you revisit old games and improve them significantly?

I can definitely think of a couple of reasons not to do this:

You're going to write a sequel (improve that instead)
You don't have players howling for your blood (or for improvements)
It's a one-off type of game you're unlikely to code anything similar to ever again

sentences:
Work out the point on an ellipse given centre, radius, and direction vector? I have a vector (white line), a centre and a radius along each of the semi-major and semi-minor axes of an ellipse (green line). I need to find the point where the white line intersects the green.

I have tried to work it out using Atan2, Sin and Cos but that doesn't quite work (blue line). It works when parallel to an axis but doesn't otherwise, I have a feeling this is because I am trying to perform the calculation on an ellipse where the horizontal and vertical radii are different.

Vector2 delta = (screenPos - canvasCentre).normalized;
float angle = Mathf.Atan2(delta.y, delta.x);
Vector2 position = canvasCentre + new Vector2(
                Mathf.Cos(angle) * radius.x,
                Mathf.Sin(angle) * radius.y);

sentences:
Why is my model exported from Blender vanishing when using it in UE4 mobile? My 3D models and animation vanishes when I preview it using the mobile view port. However they work just fine for the desktop viewport.

I usually model the characters using MakeHuman and import them into Blender. In Blender I animate them and then I import the model/animation into UE4. The problem is that my model/animation works when I preview it using the shader meant for desktop & consoles. When I preview my animation using the openGLES2 shader, my model vanishes. Anything I import form belnder vanishes when I view it in a mobile viewport. I cant figure out why this is so? Have any of you experienced this before ? Can you guys let me know how I can correct this issue?

Also, if I upload the models from MakeHuman into UE directly, I can upload the files properly in UE. But, when I try the workflow MakeHuman -> Blender -> UE with not much modifications to the models in Blender, the models are not visible in the openGLES2 shader. I am not sure why this is happening in Blender and why the models coming out if it is affected.

Any help would be appreciated.

sentences:
Match-three puzzle games algorithm I am trying to write a match-three puzzle game like 'call of Atlantis' myself. The most important algorithm is to find out all possible match-three possibilities. Is there any open source projects that can be referenced? Or any keywords to the algorithm? I am trying to look for a faster algorithm to calculate all possibilities.

Rules:

Diagonals don't count.
The size is 8x8

Thanks.

sentences:
LibGDX, BitmapFont strange position behavior I'm using a Stage of LibGDX to draw a text, in my case the FPS. But after resizing, the position of the text does not behave properly.

As you can see in the attached gif:

The resizing function does work correctly. Also here is my code of the UI-renderer:

GameScreen screen;
BitmapFont font;

FreeTypeFontGenerator generator;
FreeTypeFontGenerator.FreeTypeFontParameter parameter;

private Texture map;

public UIStage(GameScreen screen) {
    this.screen = screen;
    generator = new FreeTypeFontGenerator(Gdx.files.internal("font/acknowtt.ttf"));
    parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 24;
    parameter.borderWidth = 2;
    parameter.borderColor = new Color(0, 0, 0, 1F);
    parameter.borderStraight = true;
    font = generator.generateFont(parameter);
    this.map = new Texture(Gdx.files.internal("levels/map/" +
        screen.map.getLevel().getName() + ".png"));
    generator.dispose();
}

@Override
public void draw() {
    this.getBatch().setColor(1F, 1F, 1F, 1F);

    this.getBatch().begin();
    this.font.draw(
        this.getBatch(),
        "FPS: " + GameScreen.fpsLogger.getFPS(),
        10,
        this.getViewport().getScreenHeight() - 44);
    this.getBatch().end();
}

How can I make my text behave properly?

sentences: How to create bullet impact effects? I'm creating a small fps and I don't know how to create a bullet impact effect. I have a muzzle flare and I have recasting set up but I don't know how to make a bullet impact effect. I've already tried working with the particle system prefab 'Flare' but nothing seems to work for me, please can someone help?  Soon Please

sentences:
Is there a way to use other fonts, besides the default ones in OpenGLUT? I'm using OpenGLUT functions like glutBitmapString to render sentences and words in a game. However, there is a limited set of fonts to use and I need some bigger size fonts. Is there a way to add new fonts to these functions/API?

Thanks

sentences:
Are there drawbacks to resizing mesh renderer bounds? I had a problem yesterday where some of the meshes were not visible. I figured out the problem, which was that the mesh renderer bounds were not in the cameras field of view.
So, in order to make the mashes visible, I'm thinking of either making the bounds of the mesh renderer larger, or moving them forward so they are in the camera view.
If I do this, are there any drawbacks, like potential glitches, problems, more strain on the system, etc that might happen?

sentences:
Calculating the number of tiles shown on an isometric map I'm currently changing an existing computer game from a top-down view to an isometric view. The map consists of an infinite number of tiles. Only the tiles which are currently visible in the players window should be shown.

What i know is:

How many pixels the worldmap has been scrolled on x and y axis
The width and height of a single tile
The width and height of the players window

What i need to know is

The coordinates of the first tile to be shown
The amount of tiles that will fit in the players window

To visualize the old approach was something like this (the dashed square represents the players window):

So with the old approach this calculation was pretty simple.

The new one looks like this:

And this is where i'm stuck at the moment. I can't figure out how to calculate which tile is in the upper left corner of the players window and how many tiles fitting inside the players window on the two new axes.

Can anyone help me with that? If yes, it would be really nice if the solution also contains a short explanation.

Thanks a lot in advance.

sentences:
Dynamic pathing algorithm for tower defense game I'm making a Tower Defense and I need a good pathing algorithm for it.

I have thought about Dijkstra but I need one that can be dynamic; it must be able to update itself when one edge is removed or added without a full recalculation.

I'm coding in C# if it helps.

sentences:
Create YUV texture for GL_TEXTURE_EXTERNAL_OES format 0
down vote
favorite

I need to create a yuv texture for GL_TEXTURE_EXTERNAL_OES format.

source : https://github.com/crossle/MediaPlayerSurface/blob/master/src/me/crossle/demo/surfacetexture/VideoSurfaceView.java

I am doing all processing on YUV, so it would save clock cycles, if I can generate a yuv texture as output of texture2D.

To get 'y' value, I need to take dotproduct of each texel with vec3 of (0.3,0.59,0.11) Since, for my purpose I need to take 3x3 pixel block's 'y' value and take a convolution of them, this results in performance impact. So it would save clock cycles, if I can generate a yuv texture as output of texture2D.

sentences:
Should my game handle collisions in the Player object? I'm making a 2D platform game. Right now I'm just working on making a very generic Player class. I'm wondering if it would be more efficient/better practice to have an ActionListener within the Player class to detect collisions with Enemy objects (also have an ActionListener) or to handle all the collisions in the main world.

Furthermore, I'm thinking ahead about how I will handle collisions with the platforms themselves. I've looked into the double boolean arrays to see which tiles players can go to and which they can't. I don't understand how to use this class and the player class at the same time.

sentences:
How can I make custom character face editor In my game In an optimal way? In many games there Is section as customize character that you can make your own character.I always love to know how can I make something like It.

Even old game have this feature? but how ?

For Implementing It I need accurate separation for communating between values and facial parts size.
So first I made multiple height-map based on facial parts for modifying by vertex shader and work correctly but this method Isn't optimal.can I Implement It just by one texture?

then I tried by using colorful mapping texture for detecting facial parts, but I have problem for getting color values from mapping texture In my shader code.

mapping texture:

My problem Is that my vertex shader Isn't match with my mapping texture.for example If I change _NoseLength other parts will changes.how can I tell to vertex shader which part is nose,forehead,lip,cheek,... In my colorful mapping.

Here Is my Shader Code:

Shader "Custom/Extrude" {
        Properties {
            _MainTex ("Base (RGB)", 2D) = "white" {}
            _ModTex ("Vertex Modify", 2D) = "white" {}
            _NoseLength ("NoseLength ", Range(-0.05,0.01)) = 1.0
            _LipSize ("LipSize ",  Range(-0.05,0.01)) = 1.0
            _CheekBones ("CheekBones ", Range(-0.05,0.01)) = 1.0
            _ForeHead ("ForeHead ", Range(-0.05,0.01)) = 1.0
            _EyeSize("EyeSize", Range(-0.05,0.01)) = 1.0

        }
        SubShader {
            Tags { "RenderType"="Opaque" "Queue" = "Transparent"}
            Cull off
            CGPROGRAM
            #pragma surface surf Lambert vertex:vert
            #pragma target 3.0

            sampler2D _MainTex;
            sampler2D _ModTex;

            uniform fixed _NoseLength;
            uniform fixed _LipSize;
            uniform fixed _CheekBones;
            uniform fixed _ForeHead;
            uniform fixed _EyeSize;

            struct Input {
                float2 uv_MainTex;
            };

            void vert(inout appdata_full v) {
                float4 lipSize = tex2Dlod(_ModTex, float4(v.texcoord.xy, 0, 0)).g;//Green
                float4 nose = tex2Dlod(_ModTex, float4(v.texcoord.xy, 0, 0)).b; //Blue
                float4 eye = tex2Dlod(_ModTex, float4(v.texcoord.xy, 0, 0)).r; // Red
                float2 cheek = tex2Dlod(_ModTex, float4(v.texcoord.xy, 0, 0)).rg; // Yellow
                float2 forehead = tex2Dlod(_ModTex, float4(v.texcoord.xy, 0, 0)).rb; // Purple
                v.vertex.y += _LipSize * lipSize;
                v.vertex.y += _NoseLength * nose;
                v.vertex.y += _EyeSize * eye;
                v.vertex.y += _CheekBones * cheek;
                v.vertex.y += _ForeHead * forehead ;

            }

            void surf (Input IN, inout SurfaceOutput o) {
                half4 c = tex2D (_MainTex, IN.uv_MainTex);
                o.Albedo = c.rgb;
                o.Alpha = c.a;
            }
            ENDCG
        }
        FallBack "Diffuse"
    }

sentences:
What is the best practice to move sprites using mouse order in Tile games? I am trying to make my first Tile-game using XNA. I have no problem drawing the map layers using TiledLib from codeplex, but, now I want to give sprite an (order) to move to a specific position on map, by selecting the sprite (left mouse click) and then right mouse click somewhere on the map to specify the target position. I don’t know what is the best practice to move sprite this way, considering that there may be collision objects in the direct path.

What is the best practice to do this? Is there any demo covering this issue?

BTW: I couldn’t upload snapshot because of my low score :(

sentences:
What can I do to avoid one-off flags and checks throughout my code? Consider a card game, such as Hearthstone.

There are hundreds of cards that do a wide variety of things, some of which are unique even to a single card! For instance, there is a card (called Nozdormu) that reduces player turns to only 15 seconds!

When you have such a wide variety of potential effects, how do you avoid magic numbers and one-off checks all over your code? How does one avoid a "Check_Nozdormu_In_Play" method in the PlayerTurnTime class? And how can one organize the code such that when you add even more effects, you don't need to refactor core systems to support stuff they've never had to support before?

sentences:
Changing orientation by applying torques Suppose you've got an object floating freely in space. You have a vector you want this object to point towards, and a vector representing the direction it's currently facing. From these two, you can get the rotation (matrix, quaternion, whatever) that represents the change in orientation to bring the two vectors into alignment.

If you only have the ability to apply torque (derivative of angular velocity) to your object, what's a good algorithm for applying torque over time that won't over/undershoot the destination?

(In this case, it's a space ship that wants to automatically orient itself in the direction of travel using thrusters. Roll is irrelevant.)

sentences: XNA C# Making the game scaleable for different resolutions I am currently developing a game in C# and XNA, and I want it to look right at all resolutions. How would I get started with doing that?

sentences:
How does unity size graphics? I'm working on a 2D game. It has tiles. each tile is 50x50 px. I attached script to camera which sets the camera size to screenHeight/2/PixelsPerUnit.

Now in the player, as an example i selected 480x320 size. I expected it to show approx 9x6 tiles.
However it shows 6tiles horizontally and 4 tiles vertically.

Similarly for other sizes, it shows lesser than calculated number of tiles.

How does this corelate?

Edit i created the tiles in photoshop with 300 dpi. Not sure if that affects anything though.

sentences:
Endless runner character stops moving unexpectedly I've been trying to make an endless runner game in Unity in which a player moves forward automatically and can move from x to y axis while still moving forward. I do not know how to program so I used a Template.
Since then, my player stops moving forward when there is no box collider in front of it. it stops when there is a box collider by the sides and even when it's at the front. It's really frustrating.
Below is the script I used:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewPlayerScript : MonoBehaviour
{
    private CharacterController controller;
    private Vector3 direction;
    public float forwardSpeed;
    public float maxSpeed;

    private int desiredLane = 1;
    public float laneDistance = 4;
    public float jumpForce;
    public float Gravity = -20;
    void Start()
    {
        controller = GetComponent<CharacterController>();
    }

    // Update is called once per frame
    void Update()
    {
        direction.z = forwardSpeed;

        if (controller.isGrounded)
        {
            if(forwardSpeed < maxSpeed)
            forwardSpeed += 0.1f * Time.deltaTime;
            direction.y = -1;
            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                Jump();
            }
        }
        else
        {
            direction.y += Gravity * Time.deltaTime;
        }
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            desiredLane++;
            if (desiredLane == 3)
                desiredLane = 2;
        }
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            desiredLane--;
            if (desiredLane == -1)
                desiredLane = 0;
        }
        Vector3 targetPosition = transform.position.z * transform.forward + transform.position.y * transform.up;
        if (desiredLane == 0)
        {
            targetPosition += Vector3.left * laneDistance;
        }else if(desiredLane == 2)
        {
            targetPosition += Vector3.right * laneDistance;
        }
        transform.position = Vector3.Lerp(transform.position, targetPosition, 80 * Time.deltaTime);
    }
    private void FixedUpdate()
    {
        controller.Move(direction * Time.fixedDeltaTime);
    }
    private void Jump()
    {
        direction.y = jumpForce;
    }
}

I really dont know what the problem is. I have the character controller and the sphere collider enabled in my inspector for my character and I have only the box collider enabled for my prefabs.

sentences:
Pointer to member function of another class I have two classes, CEffect and CEffectPool. A third class CLevel, is doing most of the stuff in my code.

In every frame, it checks each CEffect in CEffectPool, and if it is currently inactive, it disables it.

What I would like to do is to give CEffect the pointer to the CEffectPool member function called Destroy(), so I don't have to check every single CEffect by another class whether it shall be destroyed or not.

With this function pointer, CEffect would simply call a function, which would destroy it.

Also, I am not talking about destroying in the C++ way (I don't want memory to be freed or to call the destructor).

Here is some code, that i have, but it unfortunately don't work and I am not sure why:

CEffect.h

class CEffectPool;
class CEffect {
    public:
        CEffect();
        CEffect(const CEffect& eff);
        CEffect& operator=(const CEffect& eff);
        void Initialize(CEffectPool* pool,
                        ushort id,
                        real x,
                        real y,
                        ushort timer);
        void Frame();
        void Draw();
        bool IsActive() const;
    private:
        CEffectPool* _pool;
        ushort _id;
        CSprite _sprite;
        ushort _anmfrm;
        ushort _timer;
};
void DestroyEffect(CEffectPool* pool,
                   ushort id);

CEffect.cpp

void CEffect::Frame() {
    if(_timer) {
        --_timer;
        return;
    }
    ++_anmfrm;
    if(_anmfrm == 24) {
        DestroyEffect(_pool,_id);
    }
}

CEffectPool.cpp

void CEffectPool::Destroy(ushort index) {
    if(index >= _size) {
        return;
    }
    CEffect temporary = _pool[index];
    _pool[index] = _pool[_size-1];
    _pool[_size-1] = temporary;
    --_size;
}
void DestroyEffect(CEffectPool* pool,
                   ushort id) {
    pool->Destroy(id);
}

Could you help me with this? What is the best approach to do this?

sentences:
How do I handle collision response between many different types of game objects? I am looking for a way to avoid the dreaded switch or if/else scenarios between numerous game object types when a collision takes place in a game. For example:

You have a list of game objects which inherit from a common class such as GameObject. You check the list for any collisions and call a method for each colliding object to respond to the collision, but this situation develops:

public void handleCollision(GameObject other) {
    switch(other.getType()) {
    case Alien:
    //Perform some logic
    break;

    case Ogre:
    //Perform some logic
    break;

    case Wall:
    //Perform some logic
    break;

    case Door:
    //Perform some logic
    break;

    //and so on

    }
}

This would become unwieldy with hundreds of different game object types. What I was attempting to do was this:

Map<CollisionKey, Method> collisionCallbackMap = new HashMap<CollisionKey, Method>();

collisionCallbackMap.put(new CollisionKey(gameObjectType, gameObjectType), //add a reference to a method here);

CollisionKey is a class I created for handling game object pairs such as Player-Alien, Player-Ogre, Player-Wall, etc. The idea was to look up a pair of game objects in the map, cast the game object in the collision list to the appropriate class types, and pass them into the method stored in the value slot of the map for that game object pairing. So it would look something like this:

for(GameObject a : collisionListA) {
    for(GameObject b : collisionListB) {
        if(a.collidesWith(b)) {
            collisionCallbackMap.get(new CollisionKey(a.getType(), b.getType(), //cast GameObjects to appropriate types such as Player and Alien and pass it into a method here);
        }
    }
}

The method called from the map would look something like this if the game objects colliding were a Player and an Alien:

public void playerToAlienCollision(Player p, Alien a) {
    //Perform some logic here such as...

    p.reduceHealth();
    a.reduceHealth();

    a.knockBack();
}

This wouldn't be a problem if I were working in, say, C++ with function pointers, but I'm working in Java with Android. Android's Java only supports Java 6, and if I'm not mistaken I believe it now has support for Java 7, but it does not currently support the recently released Java 8. With the addition of lambdas and method references in Java 8 I feel this would be a viable approach, but I don't have access to that so I need another solution. The workaround or Java's version of function pointers before Java 8 seems to involve interfaces with a single method and I believe I would need one for each collision method. It just looks convoluted and not very polished. The accepted answer of this question displays an example of it:

https://stackoverflow.com/questions/4480334/how-to-call-a-method-stored-in-a-hashmap-java

I'm not looking for how collision detection is done, I'm ok with that, its what comes right after I'm seeking a solution for. What is an efficient way to handle collision response and callbacks without the dreaded and bloated switch or if/else scenarios? I think of a large game like Runescape with tons of objects and its written in Java and wonder how they set up their collision response/callbacks.

sentences:
Why does Unity think my RectTransform has changed? I am working with UI.  I want to know when my RectTransform changes its position.  I am using transform.hasChanged:

void Update()
{
    if (transform.hasChanged)
    {
        Debug.Log("Updated Position");
        transform.hasChanged = false;
    }
}

However, it thinks it has always changed.  "Updated Position" is constantly printing out.  If I remove and then readd the component while in play mode, the issue resolves itself.  However, I don't want to have to do this, as it is very hacky.

I could just throw a bunch of if statements in there to check, but I'd prefer to make use of the build in transform.hasChanged property.

How can I check to see if my RectTransform has changed its position efficiently and elegantly?

sentences:
How can I make it so that my player object doesn't penetrate world collision when I'm holding down movement keys in that direction? Right now I have a player object and an obstacle, both with bounding box rectangles around them. The issue is that when my player runs into this obstacle, as long as I'm holding down the movement key, my player goes slightly inside the obstacle, then when I let go of the key my player is placed outside of it.

The movement code in the update function of my player class is as follows:

if (Input.isKeyDown(Keys.Left))
{
    velocityX += 5;
}
_position.X += velocityX;

The collision code in my SpriteManager game component is:

if(player.collisionRect.Intersects(platform.CollisionRect))
{
    if(player.position.X >= (platform.position.x - player.width))
    {
        player.velocityX = 0;
        player.position.X = platform.position.X - player.width;
    }
}

I have searched online for the past two days and have been unable to find any solution to this problem and I have been unable to figure out what I have been doing wrong. Even though this seems like a fairly simple problem.  Any help would be greatly appreciated!

Edit: I can tell that my issue is that when I collide, my player is still moving into my object by the amount of velocityX. So what I need to do is check if there is about the be a collision with the box, however I am still unsure of how to do this.

sentences:
Managing shared dll correctly in Unity I'm developing a dll that is to be used in two Unity projects.

I've read that the way to reference a dll is to drag it into a 'plugins' folder so that it is added to the Unity project's dependencies, as their is no "add reference" available for this project in Visual Studio.

But doing that the Unity project does not take into account that the dll evolves (as it is still in development).

What I'd like (if possible) is to set up an automatic way so that the Unity projects update their dependencies when the shared dll is updated.

I've try the reimport option (right click on the dll in Unity) but it seems that it is not working.

What is the best way to manage this situation?

sentences:
How to give and remove authority of an object between multiple clients (Or how to let the client controller push a rigidbody) I'm doing a cooperation FPS game in which players can push big rigidbody cubes with their rigidbody characters (the one from the standard assets).

The problem is that the player hosting the game has authority on these cubes positions and so when the client tries to push them, he really struggles and the result is 100% disappointing.

So i'm searching a way to pass authority from the server to client and vice versa when the cube is touched by a player.

I'm using Unity 2018.2

Have a nice day.

sentences:
Unity - Get list of gameobjects close to object clicked? I have a stack of balls of 4 colors some touching some not. When you click on one color ball I want to destroy that ball and any other balls of that color that are close. They may not be touching so collision wont work.

How do I detect gameobjects close but not touching that are the same color? Say half a radius away from the edge of the ball clicked.

Here are the two scripts I'm working with to create and touch the game objects.

public class SpawnBalls : MonoBehaviour {
public Rigidbody ball;
public float waittime = 0.5f;

// Use this for initialization
void Start () {
    spawn ();
}

// Update is called once per frame
void Update () {
    //Instantiate (ball);

}
public void spawn(){
    //yield WaitForSeconds(waittime);

        for (var i = 0; i < 10; i++) {
            Instantiate (ball);
        }
}

}

Selecting the balls

public class Ball : MonoBehaviour {

public Color[] colors;
private Color ballpicked;

// Use this for initialization
void Start () {
    GetComponent<Renderer>().material.color = colors[Random.Range (0, 4)];
}

// Update is called once per frame
void Update () {

}
 void OnMouseDown(){
    if (Input.GetKey("mouse 0")){

        ballpicked = GetComponent<Renderer> ().material.color;

        //if (ballpicked == "Any other balls within a half a ball width") {

        //}

        Destroy (gameObject);
    }
}

sentences:
Unity (UNET) Pass custom data when creating and joining a match in multiplayer I've written some simple stuff to make a lobby for matchmaking. Now I want to pass some extra info besides the match name to the lobby. Something like Player's avatar and a number of players connected and what not.
Thereto, I also want to pass information to the game from the players.
For example, two players connect to a match and the character pick starts. For this I want to have the player's info regarding the characters they've picked and the character's weapons info (e.g. customized weapons info). I store all that in a json file and load from it to a class object. Is it ok to add these classes to, say, the player connection prefab that holds Network Identity or is it done somehow differently?

Can someone maybe help me with that in the context of Unity 2018 (i.e. give some advice or referrences to some relevant information)?

Appreciate all the help and thanks in advance.

sentences:
Algorithm to select all cells inside rooms/regions I have a 2d game map consisting of several 'rooms'

For example, here is a 2D map grid: (Brown cells = wall tiles)

If I click on a tile (that isn't brown), I would like to obtain an array of all the cells in the region that I clicked. (If the region is bounded by brown tiles, otherwise do nothing)

For example, there are two regions in the image above, both colored in grey. If I clicked cell (4,4) I would get a 4x5 array of cells starting at (3,3).

Does anyone know a good performance efficient algorithm for this? I need to account for non-square rooms ideally.

sentences: How do I detect when the Xbox home button is pressed XNA? How do I detect when the big Xbox button in the middle of the gamepad is pressed in XNA?

sentences:
Why do my pyramids fade black and then back to colour again I have the following vertecies and norms
GLfloat verts[36] = {

-0.5, 0, 0.5,
 0, 0, -0.5,
0.5, 0, 0.5,

0, 0, -0.5,
0.5, 0, 0.5,
0, 1, 0,

-0.5, 0, 0.5,
0, 0, -0.5,
0, 1, 0,

0.5, 0, 0.5,
-0.5, 0, 0.5,
0, 1, 0

};

GLfloat norms[36] = {

0, -1, 0,
0, -1, 0,
0, -1, 0,

-1, 0.25, 0.5,
-1, 0.25, 0.5,
-1, 0.25, 0.5,

1, 0.25, -0.5,
1, 0.25, -0.5,
1, 0.25, -0.5,

0, -0.5, -1,
0, -0.5, -1,
0, -0.5, -1
};

I am writing my fists Open GL game, But I need to know for sure if my Normals are correct as the colours aren't rendering correctly. my Pyramids are coloured then fade to black every half rotation then back again.

My app so far is based on the boiler plate code provided by apple. heres my modified setUp Method
 [EAGLContext setCurrentContext:self.context];

[self loadShaders];

self.effect = [[GLKBaseEffect alloc] init];
self.effect.light0.enabled = GL_TRUE;
self.effect.light0.diffuseColor = GLKVector4Make(1.0f, 0.4f, 0.4f, 1.0f);

glEnable(GL_DEPTH_TEST);

glGenVertexArraysOES(1, &_vertexArray); //create vertex array
glBindVertexArrayOES(_vertexArray);

glGenBuffers(1, &_vertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(verts) + sizeof(norms), NULL, GL_STATIC_DRAW); //create vertex buffer big enough for both verts and norms and pass NULL as data..
uint8_t *ptr = (uint8_t *)glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES); //map buffer to pass data to it
memcpy(ptr, verts, sizeof(verts)); //copy verts
memcpy(ptr+sizeof(verts), norms, sizeof(norms)); //copy norms to position after verts
glUnmapBufferOES(GL_ARRAY_BUFFER);
glEnableVertexAttribArray(GLKVertexAttribPosition);
glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0)); //tell GL where verts are in buffer
glEnableVertexAttribArray(GLKVertexAttribNormal);
glVertexAttribPointer(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(sizeof(verts))); //tell GL where norms are in buffer
glBindVertexArrayOES(0);

And the update method.
- (void)update
{

float aspect = fabsf(self.view.bounds.size.width / self.view.bounds.size.height);
GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(65.0f), aspect, 0.1f, 100.0f);

self.effect.transform.projectionMatrix = projectionMatrix;

GLKMatrix4 baseModelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -4.0f);
baseModelViewMatrix = GLKMatrix4Rotate(baseModelViewMatrix, _rotation, 0.0f, 1.0f, 0.0f);

// Compute the model view matrix for the object rendered with GLKit
GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -1.5f);
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f);
modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix);

self.effect.transform.modelviewMatrix = modelViewMatrix;

// Compute the model view matrix for the object rendered with ES2
modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, 1.5f);
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f);
modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix);

_normalMatrix = GLKMatrix3InvertAndTranspose(GLKMatrix4GetMatrix3(modelViewMatrix), NULL);

_modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, modelViewMatrix);

_rotation += self.timeSinceLastUpdate * 0.5f;
}

But providing I understand this correct one pyramid is using the GLKit base effect shaders and the other the shaders which are included in the project. So for both of them to have the same error, I thought it would be the Norms?

sentences:
How do I calculate how an object will move from one point to another? Here's the problem: A player starts the game in the 0 coordinate (x=0,y=0).
When the user clicks on the screen, it returns the coordinates of the destination.
Now the player has to move from its current position A(0.0) to B(x,y).
Take into account that B is in the first Quadrant so x>0 and y>0.

How will the player move?
I know that I will have to use this:
atan2(positionY-destinationY, positionX-destinationX)
to get the angle.

Now what? How will the player move with a fixed velocity (which by the way will be a variable, so a player may move faster while using some "items")?

Whose answer is better? What is more accurate? Trigonometry or Linear Algebra?

sentences:
How do i put random velocity in a Vector2? I'm very new to C# scripting.
I want to use a random velocity for my Enemies using Vector2. Here's the code that I have done at the moment:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy1 : MonoBehaviour
{
    [SerializeField]
    Rigidbody2D rb2d;

    [SerializeField]
    Vector2 vectorEnemysVelocity;

    [SerializeField]
    gameManager gameManager;

    [SerializeField]
    AudioSource source;

    [SerializeField]
    AudioClip deathSound;

    private void Awake()
    {
        gameManager = FindObjectOfType<gameManager>();
    }

    void Start()
    {
        MoveEnemy();
    }

    void MoveEnemy()
    {
        rb2d.velocity = vectorEnemysVelocity;
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if(collision.gameObject.layer == 8)
        {
            gameManager.GenerateGameOver();
            source.PlayOneShot(deathSound, 1f);
        }

        if (collision.gameObject.layer == 9)
        {
            Destroy(gameObject);
        }
    }
}

With this I can choose the velocity but as I said earlier I want it to be random. How can I do this?

sentences:
How to create fallout intensity on a generated mesh in Unity? So I was able to generate a circle mesh in Unity to basically see the other characters when they are inside of it, and hide the characters when they are outside of it, and partially hide and show the character if they are partially in or outside of it. Below is an image of what I was able to generate, but the thing is, the edges are very sharp and I would like to have some Fallout Intensity on the mesh. Just like with Lights in Unity, where they have a fallout intensity at the edge of the lights.
Image of Generated Mesh

As you can see, the edges of the mesh are very sharp and thats not the kind of effect am after, I would like to add some fallout to that, and adjust it.
Here is The Code That Generates The Mesh
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class FieldOfView : MonoBehaviour {

    public float fieldOfView = 360f;
    public int numberEdges = 360;
    public float initalAngle = 0;
    public float visionDistance = 8f;
    public LayerMask layerMask;

    private Mesh mesh;
    private Vector3 origin;

    private void Start()
    {
        mesh = new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;
        origin = Vector3.zero;
    }

    private void LateUpdate()
    {
        GenerateUpdateMesh();
    }

    private void GenerateUpdateMesh()
    {
        float actualAngle = initalAngle;
        float incrementAngle = fieldOfView / numberEdges;

        Vector3[] vertices = new Vector3[numberEdges + 1];
        int[] triangles = new int[numberEdges * 3];

        vertices[0] = origin;

        int verticeIndex = 1;
        int triangleIndex = 0;

        for (int i = 0; i < numberEdges; i++)
        {
            Vector3 actualVertices;
            RaycastHit2D raycastHit2D = Physics2D.Raycast(origin, GetVectorFromAngle(actualAngle), visionDistance, layerMask);
            if (raycastHit2D.collider == null)
            {
                // No hit
                actualVertices = origin + GetVectorFromAngle(actualAngle) * visionDistance;
            }
            else
            {
                // Hit object
                actualVertices = raycastHit2D.point;
            }

            vertices[verticeIndex] = actualVertices;

            if (i > 0)
            {
                triangles[triangleIndex + 0] = 0;
                triangles[triangleIndex + 1] = verticeIndex - 1;
                triangles[triangleIndex + 2] = verticeIndex;

                triangleIndex += 3;
            }

            verticeIndex++;
            actualAngle -= incrementAngle;
        }

        // We form the last triangle
        triangles[triangleIndex + 0] = 0;
        triangles[triangleIndex + 1] = verticeIndex - 1;
        triangles[triangleIndex + 2] = 1;

        mesh.vertices = vertices;
        mesh.triangles = triangles;
    }

    Vector3 GetVectorFromAngle(float angle)
    {
        float angleRad = angle * (Mathf.PI / 180f);
        return new Vector3(Mathf.Cos(angleRad), Mathf.Sin(angleRad));
    }

    public void SetOrigin(Vector3 newOrigin)
    {
        origin = newOrigin;
    }
}

What do I do here to add some Fallout Intensity? All the help is really appreciated. And Thank you in advance.

sentences:
What are the free 3d OOP game engines? Could you please list a few free 3d OOP game engines, along with the pros and cons?
Embeddable in VB.net would be great.

sentences:
Get Unity to read in objects name without the need to hard code I'm trying to get away from having to hard code in the names of objects I want my code to use.

For example, I'm use to do it this way:

    TextAsset test = new TextAsset();
    test = (TextAsset)Resources.Load("test.txt", typeof(TextAsset));

What I want to know, is there a way to have so that when I drag my test.txt file onto my object in Unity, my code automatically gets the name of that object?

I'm wanting to do this so once I write the code, I don't need to back in and change it should I wish re-use it.

sentences:
Specify Vertex Quality in OBJ File I've got a program that prints OBJ files in the format

# x y z r g b format opens with MeshLab only (http://meshlab.sourceforge.net/)
v xVal yVal zVal rVal gVal bVal
v xVal yVal zVal rVal gVal bVal
v xVal yVal zVal rVal gVal bVal
v xVal yVal zVal rVal gVal bVal
.....

And I'd like to start including "quality" data as well.  I'm having a hard time finding an example that shows the correct way to format an OBJ file with quality data, does anyone have one they can share with me?

Thank you

sentences:
Why does my Unity animator state "finish" before the visible motion does? Example:

The TopAppearing motion -  boost the alpha of the sprite from 0 to 1 for total of 2 seconds:

After TopAppearing state has been finished:

The TopAppearing's transition settings:

Question:

Why is the Top's sprite alpha 235 after the TopAppearing animatior state has been finished?

sentences:
Game Mechanics for character development in an RPG I recently asked a question here on a different stack about how to write strong characters given the limitations of the RPG genre. After all, even in an RPG, which is somewhat story friendly, many gamers just want to get on with the game. I understand the impulse and have no desire to punish the players of my game for just wanting to play my game.
The Goal:
I want to create a character driven ensemble cast jRPG/cRPG with strong characters that the player begins to know and love.
The Problem:
I don't want to shove story or backstory or dialogue down peoples throats when they just want to fight battles and level up and complete quests. Especially when this can get very repetitive when a player is 'stuck'.
Current Solutions:

Skippable Dialogue and cutscenes: This feature will often be used by players and can cause problems of its own. Many people will skip the important parts. Then you need to make the important bits unskippable or keep a quest log to hold their hand.
Characters make predetermined choices: This is the thing I can use the most. But I need to also allow the player to make some decisions too. Need might be a strong word; I want. I also don't want to define my characters by a string of choices they made throughout an adventure story.
Blank Canvas: This is where the character is just a representation of what the player makes of them. Their dialogue, their actions, their appearance and personality are all given to them by the player, not the game designer. This doesn't work for me. I have multiple characters. Plus I don't feel strongly that I can develop a game that facilitates the player projecting themselves onto the character, and that is a different skill and style.

The Question:
What are some game mechanics that can facilitate character development. My Writing question was how do I write within the above constraints. My question here is: What other game mechanics are available to seamlessly integrate character development into my game?

My question is not a dupe of How can I make my players interested in the game lore of my MMORPG?. While we have similar problems, I am working on a single player jRPG which allows for different approaches to story and character than an MMO. I am also not looking for just back-story to develop character. For instance, one of the answerers to my linked writing question mentioned a characters battle-cry as an opportunity to develop their personality, which is decidedly not story.

sentences:
Create an 2d Isometric map with tiles? I'm creating a 2D Tower Defense game and I want it to be isometric. I'm creating it on the XZ plane in Unity(3D mode). I need the map to be based on tiles so I can seperate the monsters' path and the tiles where the player will build the towers on because they will have different scripts attached to 'em. My game will just need one map so I dont need any functionalty like randomizing tiles etc. I've tried using Tiled however, the Tiled2Unity converter doesn't support Isometric maps.

With that said, how do I create a isometric map? Is there any program other than Tiled? Is there any guides or scripts that explain how to create one with different tiles etc, so I can create a path. I've tried looking for something that works but with no results/I dont understand what do do.

This is basicly the look(the angle/path) I want to achieve:

sentences:
Setting up speedtests in Actionscript 3 for an entire game I'm very new to this so please forgive the questions possibly ill-stated nature.

Firstly is this even a valid way to speedtest:

public function L1() {

        tree.x = 200;
        tree.y = 200;
        tree.healthPoints = 0;
        addChild(tree);
        var myTimer:Timer = new Timer(100,60);
        myTimer.addEventListener(TimerEvent.TIMER,someFunction);
        myTimer.start();
        addEventListener(Event.ENTER_FRAME, speedTest)

    }
    function someFunction(event:TimerEvent) {
        t++
    }
    public function speedTest (e:Event) {
        if (tree != null) {
            do { tree.healthPoints += 1; }
            while (tree.healthPoints < 10000) ;
            tree.healthPoints = 0;
                trace (t);

        }
    }

Secondly:
I want to actually speed-test the entire game somehow to check if adding new features or rewriting current features actually optimizes the game or not.

What are some ways to do this?

sentences:
Geometry problem for area of sight My player have a line of sight and all objects between the white lines, turns red.
To compute this, the following conditions are met: if the angle between the yellow line and the red line are small or equal to the angle between the yellow line and the white line above, then the object is considered to be inside the line of sight. It also works if the object are below the white line. Here is the code:

def _getTeta(obj_1, obj_2):
    deltaX = (obj_1.centerx - obj_2.right)
    deltaY = (obj_2.top - obj_1.centery)
    return math.acos(deltaX / math.sqrt(deltaX**2 + deltaY**2))

  Obs.: centerx and right are X values and centery and top are Y value; all of them representing values encountered under certain points of each object's rectangle.

Then, I do:

if _getTeta(platform.rect, self.rect) <= _getTeta(abovePoint, self.rect):
    return True

where above point is the point in which forms the white line on the top, and platform is the object to be checked.

However, as the second image shows, it doesn't work if the line of sight are inverted in the X axis. The problem is that I don't know how to set values right so it could also work when the player is looking to the left.

Let me know if I'm not being clear in my question! Thanks!

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:
Why do I see this "ghosting" effect with my sprite in SDL? I'm using SDL to create a 2D side-scrolling platformer, but I'm getting ghosting from the sprite. I'm not used to programming with graphics or SDL so excuse any stupid remarks I make.

Here's the issue:

The tutorial I'm following:
http://gamedevgeek.com/tutorials/moving-sprites-with-sdl/

int main(int argc, char* argv[])
{
    SDL_Surface *screen, *temp, *sprite;
    int colorkey;

    SDL_Init(SDL_INIT_VIDEO); //Initialize SDL

    SDL_WM_SetCaption(WINDOW_TITLE, 0); //Window title

    screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, 0, 0); //Create window frame

    SDL_EnableKeyRepeat(70, 70); //Keyboard Repeat

    temp   = SDL_LoadBMP("sprite.bmp"); //Load the actual sprite
    sprite = SDL_DisplayFormat(temp);
    SDL_FreeSurface(temp);

    /* setup sprite colorkey and turn on RLE */
    colorkey = SDL_MapRGB(screen->format, 160, 136, 128); //Make this RGB color transparent, so sprite isn't surrounded by a colored box
    SDL_SetColorKey(sprite, SDL_SRCCOLORKEY | SDL_RLEACCEL, colorkey);

    spriteRect.x = 150; //Initial X Position
    spriteRect.y = 150; //Initial Y Position

    /* set animation frame */
    srcRect.x = 0;
    srcRect.y = 0;
    srcRect.w = SPRITE_SIZE;
    srcRect.h = SPRITE_SIZE;

    gameover = 0;

    /* message pump */
    while (!gameover)
    {
        SDL_Event event;

        /* look for an event */
        if (SDL_PollEvent(&event)) {
            HandleEvent(event);
        }

        /* collide with edges of screen */
        if (spriteRect.x <= 0)
            spriteRect.x = 0;
        if (spriteRect.x >= WINDOW_WIDTH - SPRITE_SIZE)
            spriteRect.x = WINDOW_WIDTH - SPRITE_SIZE;

        if (spriteRect.y <= 0)
            spriteRect.y = 0;
        if (spriteRect.y >= WINDOW_HEIGHT - SPRITE_SIZE)
            spriteRect.y = WINDOW_HEIGHT - SPRITE_SIZE;

        SDL_BlitSurface(sprite, &srcRect, screen, &spriteRect);
        SDL_UpdateRect(screen, 0, 0, 0, 0);
    }

    /* clean up */
    SDL_FreeSurface(sprite);
    SDL_Quit();

    return 0;
}

sentences:
What kind of performance issues does multiple instances of the exact same object have on a game? I'm fairly new to programming, and I've pretty much learned all the things I know on the go, while working on projects. The problem is that there some things that I just don't know where to begin searching.

My question is about performance, and how can multiple instances of the same object affect it -- Specifically, I'm talking about XNA's "GraphicsDevice" class. I have it instanced on four different parts of my game, and in three of those, the object has the exact same values for all the attributes. So, in that case, should I be using the same instance of GraphicsDevice, passing it as a parameter, even if I use it in different classes?

I apologize if the question seems redundant, but like I said, I've taught myself most of what I know, so there are quite a few "holes" in my learning process.

sentences:
Moving a dynamically spawned object I would like to create an object dynamically when the player presses Q and use this object in Instantiate and in transform.Translate.

The problem is that the translation must be outside the if that checks for the Q press, but it applies to the cube that I created inside the if.

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

public class instancier_new_object : MonoBehaviour {

    public float moveSpeed=5f;

    void Update () {
        if (Input.GetKeyDown (KeyCode.Q)) {
            GameObject objet = new GameObject ("objet");
            GameObject cube = new GameObject ("cube");

            cube = Instantiate(
                       objet,
                       new Vector3(1, 2, 3),
                       Quaternion.identity
            );
        }

        cube.transform.Translate(
                 Time.deltaTime*moveSpeed,
                 0,
                -Time.deltaTime*moveSpeed,
                 Space.Self
        );
    }
}

sentences:
Calculating stopping distance while turning I need to calculate the movement of an object that is slowing down to approach its destination while turning. Calculating the linear stopping distance and deceleration is straightforward. However if the object is not pointing at the destination, and has a limited rotation speed, makes this more complicated. For example imagine it starts pointing 90 degrees off the target: its rotation will increase the distance to the target.

The turning circle increases the distance to the target, but decelerating makes the subsequent turning circle tighter, and I'm not sure how to take in to account both factors.

Basically I have the following information:

starting position, angle, and speed
target position
deceleration
rotation speed

and I need to calculate the distance (or time) to the target. What is the calculation for that?

I can also see that if the starting speed is too high, it may not be solvable - in which case it would be useful to also calculate the maximum possible speed.

sentences:
How to make a PROPER main menu (or any other UI windows/modals) in Unity? So, I'm currently learning both about Unity for the first time as well as the 'new' 2D UI system, but I'm having a hard time figuring out how to make windows, modals/dialogs, main menus etc. which are not only functioning, but also modular, reusable and written following proper coding standards. Most how to's, blogs, Q&As or tutorials I find only cover the most basic parts of UI development (e.g. how to drag a button from the toolbar to the scene window in 2 hours).

So basically, I'd like to have a main menu which meets those (very common) requirements:

A button which 'starts' the game (e.g. by simply loading another scene)
A button which 'quits' the game, but also opens up a confirmation dialog before
A button which opens up an options dialog, which again is composed of multiple parts (audio, video...)
and finally, it should be possible to go back to the previous screen using a 'back key/button', for example Escape

What I started with is a canvas which I called GameMenu. This canvas has several nested canvases, such as

MainMenu
OptionsMenu

OptionsMenuAudioPart
OptionsMenuVideoPart

CancelMenuModal

Then I created a menu script which works as some sort of state machine:

public class MenuScript : MonoBehavior {

    private GameObject _currentStateObject;
    private GameObject _previousStateObject;

    public void SetState(GameObject newStateObject) {
        if(newStateObject == null || newStateObject)
            return;

        if(CurrentStateObject != null)
            CurrentStateObject.SetActive(false);
        _previousStateObject = _currentStateObject;
        CurrentStateObject = newStateObject;
        CurrentStateObject.SetActive(true);
    }
}

Every button has now an event trigger attached which calls the SetState(...) method on MenuScript.

However, I've got the following problems:

How do I pass multiple parameters to methods invoked by event triggers? As soon as I add another parameter to SetState(...), for example bool isModal = false to tell the method that it shouldn't disable the previous state, then it disappears from the event trigger action selection menu.
How to I register key press events within the event triggers? It's easy by script (Input.GetKey(...) etc.), but I didn't find one on the event type selection.
How do I make e.g. event triggers conditionally? So that certain events cannot be called when certain states are active?

I know I can solve all those problems within the script and make a fully functional main menu which does exactly what I want, but then...

I cannot use it for something else
I don't use the new Unity UI system, which makes me wonder what's the purpose of it
I got to reference all involed game objects (the canvases, buttons etc.) in script, which makes it not really 'extendable' anymore as this means for every changed requirement, I have to alter the script (e.g. a new state, menu, button etc)

The main goal in the end is a script which I can use for all kinds of UIs without writing the same logic over and over again just because it's another scene, game state etc.

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 use A star pathfinding algorithm How would i implement an A star algorithm for a game that i'm making on the android in java? i'm looking for a pre-made A star API in java with classes and methods to call. i don't want to have to code from scratch.

sentences:
Box collider/rigid body eventually moves through static collider I found this question, but I'm not sure if it applies to my problem.

I'm hacking together a Pong-style game, and my problem is with the walls (box collider, no rigid body) not completely stopping movement of the player paddle (box collider, yes rigid body.) Sufficiently fast mouse movement eventually moves the paddle through the wall. There is initial resistance, but I would expect Player Paddle to stop moving abruptly at the wall. How can I make this happen? I'm new to Unity/colliders/game dev.

My player paddle simply moves up and down (Z-axis) with up/down mouse movement:

public class MouseMovement : MonoBehaviour {
    public float speed = 10f;
    // Update is called once per frame
    void Update () {
        var translation = Input.GetAxis("Mouse Y") * speed;
        translation *= Time.deltaTime;
        transform.Translate(0, 0, translation);
    }
}

I exported an asset package that reproduces the problem. My problem objects are Player Paddle, Upper, and Lower https://www.dropbox.com/s/yx9svb51nywdvgg/pong-export.unitypackage?dl=0

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:
Use of NetworkHash128 assetId in Custom Spawn Handler I was learning Custom spawn handler on Unity Manual. It says before spawning we need to Register Spawn handler using ClientScene.RegisterSpawnHandler(coinAssetId, SpawnCoin, UnSpawnCoin);
 I understood SpawnCoin and UnSpawnCoin is Handler function that will be invoked on clients but what is the use of coinAssetId?

sentences:
What techniques could I use to give players the ability to control certain features, e.g. fatness? I'm working on a tool for character customization (e.g. starting from a base model, a player can control his fatness), so I'm looking for ideas, techniques or other regarding this topic.

After some research I thought to this technique: starting from two models (one standard human and one fat human, both with the same data, like vertices and triangles), then creating a new model by storing data about the two original mesh (e.g. store vertex data of the second mesh as color data), and controlling their interpolation with a shader.

What do you think about this idea? Suggestions?

sentences:
Frame rate slowing down after publishing XNA game in VB.NET I will get to the main question later but I just want to give the backstory here first.
I program a game in XNA using VB.NET. As I'm testing the game in debug it works at a certain speed (spritemovement, animations etc.). After I publish the game and install it on my other computer (which is newer), the game slows down considerably.
To investigate that problem I used FPS code. It showed 75 on debug and 60 after installed. I have thus programmed the entire game for running at 75. To try to solve that problem I incorporated this:

TargetElapsedTime = TimeSpan.FromSeconds(1.0F / 75.0F)
IsFixedTimeStep = True

Now after trying to publish again the game actually ran smoothly at 75fps on the newer computer, but there was a catch: when I turn to fullscreen the game again slows down. However now without showing the lower fps. So the fps is still showing 75 but the game apparently runs at 60.

I've looked around for answers and find that I can possibly maximize the window (borderless) without making it fullscreen, and could perhaps solve the problem that way. However all the code suggested are in C# and I can't get it to work.

How can I either get a borderless maximized window to work with VB.NET, or in any other way solve my FPS issue?

Thank's for any help on this issue!

sentences: 3ds Max Rigs to Cinema 4D I exported the rig from 3ds Max as a FBX file and opened it with Cinema 4D. Everything works great, but the model and a different look to it. Also the mask on her head has a different texture, but it was imported with only 1 object. Just wondering if it can be fixed, if not its ok.

sentences:
What's next to learn? I am self-learning programming for video games. I have learned:

Basics (variables, loops, branching, etc.)
Object Oriented (classes, objects)
Functions
Dynamic Memory Allocation
Operator Overloading
Aggregation
Inheritance and Polymorphism
Swallow Copy And Deep Copy
STL Libraries

and I am learning I/O Files. What is next? Thanks for the help.

sentences:
Ways to persist entities and components in an ECS? I am working on a small multiplayer game with rpg elements using java and "Artemis ODB". Most of the logic is already done but one important thing is missing. The persistence.
So i am searching for different ways to persist my game. One thing is important, the world is huge and i cant load in the whole world at once. I already stumbled upon two different ways on my own. Using a relational database or a nosql database. But one thing scares me... entity references.
In my game i have an player entity and item entities. The player entity owns a inventory component which stores a reference to some item entities. In my ecs, each entity reference is an simple integer. So this looks like this...
/**
 * Represents the Inventory of our game, contains references to entities acting as items.
 */
public class Inventory extends HibernateComponent {
    public Set<Integer> itemEntities = new LinkedHashSet<>();
}

Why does this scare me ? Well... Entity references are Integers in my case. They are no real ID and i cant set or change this "ID" of an entity because my framework permits it. This brings us straight to the problem. When i serialize this component or the whole player entity it would look like this.
Inventory{
   itemEntities: [40,2,5,50]
}

So when we save this and load it later on we have no entity with the id 40... and even if we recreate that entity we cant set it to an id of 40, because the frameworks permits it. So how the heck do we save references between entities ? ^^
So all in all... what are common ways to save, load entities from an ecs ? How do you do it ? And what would you recommend ?

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 to generate a navmesh from a set of 3D meshes from scratch I've found a great article on how to build a constrained delaunay triangulation that can be used to create a simple navmesh from cutout geometry. However, this does not seem sufficient to generate a high quality navmesh from any arbitrary set of level geometry from scratch.
One of the problems is that it only deals with triangles in XZ space. But how should I handle situations where an arbitrary 3D mesh is intersecting another arbitrary 3D mesh? Within their intersection, each triangle would need to retriangulated in some way.

sentences:
Can I sample audio sources from others without asking? As the title says, would it be considered legal if I take a part of an audio source (any media like music, dialog, video, etc.) to use in a project, whether it is for commercial or non-commercial purposes, without contacting the owner/creator of the asset?

As an example, Earthbound used this technique to create unique and memorable soundtracks.

sentences:
Multiplace instances of an object in Game Maker with a variable changing I want to do a level selection menu in GameMaker. There's one button for each level. Clicking on the button 1 take you to level 1, button 2 take you to level 2 and so on.

But if I duplicate the first button, all of the buttons will get you to level 1. Is it possible for multiple instances of the same object to have different variables?

sentences:
Game Editor plugin architecture I'm creating 3D Game Editor for my own use. As rendering i took Ogre3D and MFC as UI.

I faced with architecture problem.

I am using Document/View architecture and for each Doc. i create new SceneManager and for each View i create own viewport, camera, my own local Input manager which send input data to local camera. Also it's sending input data and pointer to SceneManager to global ToolManager which contains some base tools like Move, Select etc. and the pointer to active tool, if it's NULL he is sending input to SelectTool by default.

I'm only at start but i'm thinking of the future.
I think that this strategy of passing some data to the global manager is not so good how it looks now. Can you give me some design advices or articles and share with me your experience.

Thank you for your time.

Edit:

I think that plugin architecture would give a lot flexibility and it`s like all editors do. But i never before faced with that. So i will try to tell u what i think about it.
Host App contain

PLuginManager:

load/unload plugins
base interface to add frame/window and other UI
base interface to communicate with other plugins

EventListener

collect all events and EventListeners
send specific events to it listener

It's all what host app contains.
But, how to implement it? I mean all communication. How to load and save files. Edit object with different plugins. I'm thinking to use QT, is it better than MFC or wxWigets.

Can you give me some advices please.

sentences:
Debugging .FX files in Visual Studio not working So I have been learning how to use DirectX 11 for a while now and I have chosen to use the .FX framework rather than seperate .vs & .ps files. (I know it's deprecated but I found it a little easier to use for learning, I will use in seperate .vs and .ps files in the near future).

In order to get my engine to compile I have to keep the effects.fx file in the same file directory as the engine project but I cannot include it in the VS2015 project directly (This works fine). At the moment whenever I am writing some code in my .FX file and it creates an error I get an error from the C++ side of things and nothing from my shader. Which leaves me clueless on what is causing the issue.

How can I get the HLSL compiler error/warning output to the debug window?

sentences:
What should I name the keybinding menu? Here's a pretty basic question:

My game supports custom keybindings. What label should I put on the button the player clicks to get to the menu that lets him customize them?

Specifically, this game is targeted at nerdy high-schoolers to nerdy middle-aged adults, and any given player may or may not be an experienced gamer, or even if they are they may or may not be familiar with first person shooters, where I imagine the idea of custom key bindings is usually first encountered.

I need a name that doesn't feel out of place in my menu (which consists of short two-word labels: "Start Game," "Load Game," "Level Select, "Save & Quit," etc...) but conveys the idea of "this is where you go to alter which buttons do what" without using semi-advanced gamer jargon like "bind" or "mapping."

Any suggestions?

sentences:
Deciding Which Platforms to Support -- Silveright (+Android?) My "usual" stack for game dev is to create (in-browser) Silverlight games. I've decided I want to branch into iPhone or Android, and decided to go droid because it's cheaper (considering I don't have a Mac).

Having now all the requisite software and hardware, how do I decide which games to code on both platforms and which to not?

In an ideal world, it would only cost me 5-10% more (time/effort) to port it to Android having developed it for SL. But I know the worst case is 100%+ (i.e. rewrite), and that it'll be somewhere in the middle.

Considering everything will likely be free (although it might be worth it to release the SL one free and offer a $5 paid one on Android, not sure), what are factors to look at?

sentences: Using coroutines and texture array for talking animation? I was thinking of having random textures from a texture array being chosen every 0.5 seconds through a coroutine to imitate talking if something like talking=true. Not sure how I could set this up and such so I appreciate any help!

sentences: I would really like to write a script for a game, but do I have a chance? I'm 18 and am very good a reading writing and storytelling. I would like to write out the concept script and scenes for a vdeogame. I have a High School diploma but at the moment no other formal schooling. I would like my dream to become a reality, a game I wrote that gets created by a big name developer and published for everyone to enjoy. Before I start writing though I want to know is this achievable from the position I stand in now?

sentences:
Rotate an object on itself, from one random Quaternion to another I have a situation:
I have a 3D object in the world. let's say a sphere.
I have 2 random directionnal vector: vector A, and vectorB:

My question is: How to I rotate over time my object, from A to B ?
The vector A is important: I don't want to simply rotate the forward of the object from current forward to B.

I know I can use the function vector3 C = Vector3.SmoothDamp(...) in unity to lerp between my 2 vectors A & B.

but then ok, I have vector3 C, how do I apply the rotationof my object to C ?
if don't want to do:
gameObject.transform.forward = C;

I want something like:
gameObject.transform.rotation = SomeQuaternion(C, initial rotation A).
or something.

Thank you for help !

PS: I don't want to parent / unparent gameObject or something like that, i want the math answer, using Quaternion.

sentences:
Giving values to uniform in OpenGL First thing is that I know how to give values to uniforms in OpenGL. Second thing is that it is a question related to optimization and performance.

The habit for changing the uniforms, we preferred is like this:

//Consider that we have shaders having 'aValue' as uniform

//During initialization
GLint loc = glGetUniformLocation(program, "aValue");

//During a loop or when required to change uniform's value
if (loc != -1)
{
   glUniform1f(loc, 0.75);
}

But what if it is like this:

//'program' is a global variable

//Can be anywhere but not after destructing 'program'
void updateUniformf( const char* name, float value )
{
    glUniform1f(glGetUniformLocation(program, name), value);
}

//During a loop or when required to change uniform's value
updateUniformf("aValue", 0.75);

How much would such approach decreases the performance? Or would this approach even affects the performance? It will be appreciable to have some measurements or practical example rather than all theories. Of course, I need to know reasons as well.

Thanks for answering this question!

sentences:
Need help with rotating sword around player (Unity 2D) I'm having an issue with rotating an object around another object in my top-down roguelike in Unity 2D. My goal is to rotate a sword around a player based on joystick input from a controller (as shown in this image).

I have looked around online for any answers, but nothing has helped. All I have so far that is remotely close to what I want is code that keeps the sword attached to the box even when the box moves.
void Update()
{
    transform.localPosition = new Vector3(0, 1.5f, 0);
}

It might be necessary to note that the sword object is a child of the box object. I would appreciate it if anyone could point me in the right direction. Thanks!

sentences:
Make a plane to display material from both sides I know there is a setting in Cry Engine, which allows you to be able to read materials of the plane from both sides, so I am wondering if there is such a setting in Unity5.

Thanks in advance

sentences:
How do I make the 3rd person camera follow the space ship in my Space Shooter game? https://youtu.be/13HgaeZWlIA

I am making a 3D space shooter game using OpenGL and Bullet Physics. I am having a hard time with the 3rd person Camera though. If you take a look at the video above you can see that the camera follows the spaceship rotating on the X axis without a problem and rotating on Z axis also without a problem when the spaceship is is oriented towards the horizon and parallel to the ground. When I roll to the right and move the spaceship up I am totally losing it from the camera. The code for my camera is as follows:
float CalculateHorizontalDistance() {
    if (!mpPlayer) return 0.f;

    return distanceFromPlayer * glm::cos(glm::radians(-UpAngle));
}

float CalculateVerticalDistance() {
    if (!mpPlayer) return 0.f;

    return distanceFromPlayer * glm::sin(glm::radians(-UpAngle));
}

void calculateCameraPosition(float horizDistance, float verticDistance)
{
    if (!mpPlayer) return;

    glm::vec3 playerFront = mpPlayer->GetFront();
    glm::vec3 playerPos = mpPlayer->GetPosition();

    Position = playerPos + ((-playerFront) * distanceFromPlayer);

    UpAngle = 180.f - mpPlayer->GetRoll();
    //RightAngle = -mpPlayer->GetPitch();
    RollAngle =  mpPlayer->GetYaw() - 180.f;

    //float theta = mpPlayer->GetRotationY() + angleAroundPlayer;
    //float offsetX = horizDistance * glm::sin(glm::radians(theta));
    //float offsetZ = horizDistance * glm::cos(glm::radians(theta));

    //Position.x = mpPlayer->GetPosition().x - offsetX;
    //Position.y = mpPlayer->GetPosition().y + verticDistance;
    //Position.z = mpPlayer->GetPosition().z - offsetZ;
}

The above code is used to calculate the position and rotation of the camera. The commented out code was used to calculate the position based on trigonometrical calculations for the x and z sides of the triangle created from the camera position to the player position. This didn't work right because I could never set the camera behind the spaceship, only the position worked well.
On the non-commented out code I use as a camera position the player position - back vector * offset. This works fine for the simple purpose that the camera is always on the back side of the spaceship. I also update pitch and roll which works almost fine and here is where I need help mostly to get this right. I also never update the yaw of the camera.
This is how I get yaw, pitch and roll from Bullet Physics rigid body of the player (spaceship):
btScalar yaw;
btScalar pitch;
btScalar roll;
body->getCenterOfMassTransform().getBasis().getEulerZYX(yaw, pitch, roll, 1);

The following code is how the orientation of the camera is calculated :
void updateCameraVectors()
{
    // Yaw
    glm::quat aroundY = glm::angleAxis(glm::radians(-RightAngle), glm::vec3(0, 1, 0));

    // Pitch
    glm::quat aroundX = glm::angleAxis(glm::radians(UpAngle), glm::vec3(1, 0, 0));

    // Roll
    glm::quat aroundZ = glm::angleAxis(glm::radians(RollAngle), glm::vec3(0, 0, 1));

    Orientation = aroundY * aroundX * aroundZ;

    glm::quat qF = Orientation * glm::quat(0, 0, 0, -1) * glm::conjugate(Orientation);
    Front = { qF.x, qF.y, qF.z };
    Right = glm::normalize(glm::cross(Front, WorldUp));
    Up = glm::normalize(glm::cross(Right, Front));
}

and lastly how the view matrix of the camera is calculated:
glm::mat4 GetViewMatrix()
{
    // You should know the camera move reversely relative to the user input.
    // That's the point of Graphics Camera

    glm::quat reverseOrient = glm::conjugate(Orientation);
    glm::mat4 rot = glm::mat4_cast(reverseOrient);
    glm::mat4 translation = glm::translate(glm::mat4(1.0), -Position);

    return rot * translation;
}

Can someone help me fix the rotational problems that I am facing? I am open to modify also the Camera Class to make it work better with Bullet's quaternions instead of the Euler's angles that I am trying to use. Any code or ideas are very welcomed. Thank you for reading through.

sentences:
How to figure out what's moving my GameObject? I have a GameObject as part of a complex scene with a handful of interconnected parts, that's moving when it shouldn't be.  I've tried running under the debugger and setting breakpoints on all of the script points that are supposed to move its Transform, and ensured that none of them are firing.  There seems to be some "spooky action at a distance" going on, some rogue script doing something I don't want it to be doing, but I can't for the life of me figure out where it is.

What I'd really like is some way to set a "breakpoint" on the object's Transform that will break me into the debugger when it gets moved by any script, but that doesn't appear to be supported.  Is there any way to figure out exactly what it is that's moving my object around when it shouldn't be?

(And before anyone says "trial and error, disable components and see when it stops moving," I already know exactly which component to disable to make it stop moving.  Unfortunately, that isn't helping track down the problem because the movement isn't coming directly from that component's MonoBehaviour script.)

sentences:
Server List for a game I'm making a c++ multiplayer game, and I'm trying to implement a server list, where everyone can host his own server. But I don't know how to start, I've google'd for a while and I didn't find anything about this. I tried to search for a master server specially designed to handle with the server list, so if I refresh it, it will ask the master how many servers it has, and tell the client the servers' informations, and I don't have any idea on how I could make it.

Could you just show me an example, or tell me how could I begin?

Any help is really appreciated.

sentences:
How to add a constant horizontal force just like gravity? I want to add a constant horizontal force, just like gravity to a projectile or a sphere moving in 3d space, which will make the projectile or ball or sphere or whatever be influenced by this force so that it will curl in the direction of the constant horizontal force.
I have this code which will add force to the object on swiping the screen, but it doesnt drift/curl or whatever you may call it:

var anglex : float;
var angley : float;
var elevationAngle : Vector3;

function FixedUpdate () {
    if(Input.touchCount>0 && Input.GetTouch(0).phase == TouchPhase.Ended)
               {
                    var touchdeltaposition: Vector2 = Input.GetTouch(0).deltaPosition;
                    anglex = touchdeltaposition.x * Time.deltaTime *2.0;
                    angley = touchdeltaposition.y * Time.deltaTime *5.0;
                    Debug.Log(angley);
                    elevationAngle = Vector3(anglex,angley,0);
                    rigidbody.velocity = transform.TransformDirection(Vector3(anglex,angley,angley ));
                    var elevation : Vector3 = Quaternion.Euler(elevationAngle) * transform.forward;
                    rigidbody.AddRelativeForce(elevation);
                  }
           }

I feel this is simple, but I'm just not able to turn the crank.

sentences:
how to put elements around circle with equal distance? I know circle formula and know how to draw it. but I want put 4 points on it with equal distance from each other. how can I do that?

I work with unity.

sentences:
What animation technique is used in 'Dont Starve'? While playing a few games in my personal time off development I've stumbled across a survival 2D/3D survival game. The game was apparently made in SDL and GLUT (Dont starve) but what really amazed me was the animations in the game.

The animations are extremely smooth and fluent. There is no distortion while animating, what usually happens in hand-made animations is that pixels get removed, animations are jaggy and they simply aren't as smooth. That got me thinking on how they managed to accomplish such a quality of animations. Were they really handmade (If they were, then it must've taken a very talented artist), is it bone animation or are they using another technique?

sentences:
Objects rendering only on editor, but not on build (they get invisible) Everything works fine in the editor, but when I build the game, none of the objects in the scene are rendered, and only the skybox and UI text is visible. But although they aren't appearing, they are working as normally (i.e. these objects' triggers work normally when the determined event occurs, like for example, colliding to a specified object, or in other words, they are invisible).

I searched for this issue but didn't found any answer.  Could it be my cheap computer's fault (Intel Celeron without an external graphics card)?

In editor game mode:

In buit game:

I ran both the editor and the built game in the same quality, and also tried to run it in Fastest quality, but no, it made no difference in the built game.

Also, there is no object tagged with "Editor only", only one have a custom tag and all the others are "Untagged". And the camera's culling mask is set to "Everything".

The result is the same either for web or Windows.

Edit:

OK, I built for Android and the objects render normally. So, I'm not completely sure, but probably it's my PC that can't render the objects, because both building for web plugin and desktop have this disappointing result, but for Android it works perfectly (even the shadows, which wasn't being cast in the editor), so...

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:
Estimate the time it takes for an object to travel from point A to point B I have an object with vec2 position, velocity, and destination with 2 variables maxspeed and acceleration. In each step, its position is calculated as follows:

vec2 desiredVel = destination - position;

var dist = desiredVel.length;
if (2 * dist * acceleration < currentSpeed*currentSpeed)
    desiredVel.zero();

vec2 steering = desiredVel - velocity;
steering.setLength(acceleration);

velocity += steering * dt;
velocity.truncate(maxspeed);
currentSpeed = velocity.length();

position += velocity * dt;

Basically the object will accelerate to its maxspeed towards destination, then maintains  speed until the a certain distance to destination. At that distance, the object will decelerate at the -max acceleration rate so that it stops approximately to the destination point.

My question is that if I have an object with an initial velocity and I set a destination point, how can I estimate the time it will take to reach the destination point? Assuming its maxspeed and max acceleration doesn't change and no other force/acceleration applies to the object in the path.

sentences:
using heightmap to simulate 3d in an isometric 2d game I saw a video of an 2.5d engine that used heightmaps to do zbuffering.
Is this hard to do? I have more or less no idea of Opengl(lwjgl) and that stuff.

I could imagine, that you compare each pixel and its depthmap to the depthmap of the already drawn background to determine if it gets drawn or not.

Are there any tutorials on how to do this, is this a common problem? It would already be awesome if somebody knows the names of the Opengl commands so that i can go through some general tutorials on that. greets!

Great 2.5d engine with the needed effect, pls go to the last 30 seconds

Edit, just realised, that my question wasn't quite clear expressed: How can i tell Opengl to compare the existing depthbuffer with an grayscale texure, to determine if a pixel should get drawn or not?

sentences:
Frustum culling takes ages c++ I have two ways of doing frustum culling taken from different web sources. First one takes 200ms to check 10k AABBs, second around 50ms for the same box count.
I read some forum answers, people say 0.5ms for 10k is ok but I'm totally far away from those numbers. So what am I doing wrong ?

Measuring time here:

        auto frustum = camera.getFrustum(); //frustum

        auto n = frustum.pNear;
        auto f = frustum.pFar;
        auto e = frustum.pExtra;

        ArrayList<Pair<vec3, vec3>> planes;
        ArrayList<vec3> v1;
        n.genVertices(v1);

        ArrayList<vec3> v2;
        f.genVertices(v2);

        planes << Pair<vec3,vec3>(v1[0], -n.genNormal());
        planes << Pair<vec3,vec3>(v2[0], n.genNormal());
        for(size_t i = 0; i < 4; i++)
        {
            planes << e[i];
        } //frustum planes array initialization done

        ArrayList<AABB> objs; //10k test aabbs
        for(size_t i = 0; i < 10000; i++)
        {
            objs << AABB(vec3(rand_float()/100,rand_float()/100,rand_float()/100),rand_float()/100);
        }

        auto t1 = timer.getTimeNanoSeconds(); //starting to measure
        for(size_t i = 0; i < 10000; i++)
        {
            rs::CollisionEngine::checkAABBAndFrustumFast(objs[i], planes);
        }
        auto t2 = timer.getTimeNanoSeconds() - t1; //getting time
        println("Collision check of 10k objs: "+ toString(t2/1000000) + " ms"); //printing time

Here is slow and fast collision checks:

 /**
    *
    * @param box
    * @return 0 - inside, 1 - intersects, 2 - outside
    */
    us checkAABBAndFrustumSlow(AABB box, ArrayList<Pair<vec3, vec3>>& planes)
    {
        ArrayList<vec3> vertices;
        box.genVertices(vertices);

        us totalIn = 0;

        for(int i = 0;i<6;i++){ //six planes for every frustum
            Pair<vec3, vec3> plane = planes[i];
            auto n = plane.v2;

            uint inCount = 8;
            uint pIn = 1;

            for(int j= 0;j<8;j++){
                vec3 v = vertices[j];
                vec3 toVertex = (v - plane.v1).normalize();
                float res = n * toVertex;
                if(res < 0){
                    inCount -=1;
                    pIn = 0;
                }
            }

            if(inCount == 0) return 2;
            totalIn += pIn;
        }

        if(totalIn == 6) return 0;

        return 1;
    }

    using namespace rs;
    vec3 getPosForFrustum(AABB b, vec3 n)
    {
            vec3 max = b.center + b.extent;
            vec3 p = b.center - b.extent;
            if (n.x() >= 0)
            p(1) = max.x();
            if (n.y() >=0)
            p(2) = max.y();
            if (n.z() >= 0)
            p(3) = max.z();

            return p;
    }

    vec3 getNegForFrustum(AABB b, vec3 n)
    {
        vec3 min = b.center - b.extent;
        vec3 p = b.center + b.extent;
        if (n.x() >= 0)
            p(1) = min.x();
        if (n.y() >=0)
            p(2) = min.y();
        if (n.z() >= 0)
            p(3) = min.z();

        return p;
    }

    uint checkAABBAndFrustumFast(AABB box, ArrayList<Pair<vec3, vec3>>& planes){

            uint result = 0;
            for(int i = 0;i<6;i++) {

                auto n = planes[i].v2;
                auto p = planes[i].v1;

                if (n * (getPosForFrustum(box, n) - p) < 0)
                    return 2;
                else if (n * (getNegForFrustum(box, n) - p) < 0)
                    result = 1;
            }

            return result;
    }

EDIT:
ArrayList is a custom vector like structure

Pair contains a copy of two objects it takes.

sentences:
How to do profiling and memory pooling per system? I have been interesting in profiling and keeping a managed memory pool for each subsystem, so I could get statistic on how much memory was being used in something such as sounds or graphics. However, what would be a design that works for doing this? I was thinking of using multiple allocators and just using one per subsystem, however, that would result in global variables for my allocators (or so it would seem to me). Another approach I have seen/been suggested is to just overload new and pass in an allocator for a parameter.

I had a similar question over on stackoverflow here with a bounty, however, it seems as if perhaps I was too vague or just there is not enough people with knowledge in the subject.

sentences:
What are the differences betwen Texture, TextureRegion, TextureAtlas, Sprite and Image in libgdx? I've searched around for tutorials. I've seen people using the above classes to load images.

As according to my understanding, all of the classes can read in a non-power of two images, TextureRegion/TextureAtlas are usually used to load sprite sheet, in which the sheet contains multiple images. While for Texture/Sprite/Image, they are used to load a sprite sheet with single image.

However, I'm not so sure in which situation I should use Texture/Sprite/Image and in which situation I should use TextureRegion/TextureAtals.

Please correct me if I'm wrong, as I'm a bit confused by the terminologies in the API after looking various tutorials.

sentences: Web site for XAML snippet sharing? I am making a game with WPF and C#, and I frequently am in need of artwork for it.  Some things could be easily shared, such as explosion animations, exhaust plumes, etc.  I was wondering if there are any good web sites for this?  All I can find are tutorials and the infrequent sample, but I imagine there is a site out there that I am missing.  I would also like to clarify that I am looking for pure vector based XAML snippets.  I know there are a lot of sites out there for sprites and textures, but I am looking for XAML components that I can tweak.

sentences:
Switch from left click to right click to make character walk in the Top Down Example, in UE4? When creating a new project in the Unreal Engine 4, you can choose to create a project already with some added features and things (Top Down Example):

This project has a character (which I changed its appearance) and it moves around the map when I click the left mouse button:

I looked at the blueprints of the project, but I did not identify where the command is that makes the character walk, so I'd like it to walk when I right-click.

Alls blueprints of project:

M_Cursor_Decal:

TopDownCharacter:

TopDownController:

TopDownGameMode:

The circled blocks of reds are the ones I suspected could be where I should make the modification, but no information on them gave me the certainty that that was where I was supposed to change.

I still do not create projects in C ++ programming mode, because I do not have Visual Studio 2017.

Some links from websites where I spent before coming here and that can help you to help me:

https://docs.unrealengine.com/en-us/Engine/Blueprints

https://www.youtube.com/watch?v=EFXMW_UEDco

The video is 2015, so although it's good, I did not take it so well, because I know that with all this time that has already happened, a lot is different.

Sorry for any translation errors, I'm not English speaker.

sentences:
Finding if 2 polygons intersect using clipper library After realising my code was pretty inefficient at checking for polygon overlaps, I've turned to a mentioned library Clipper but finding it difficult to know hot to use it for this operation.

I am using unity Vector2[] for my shape descriptions:

//Square
Vector2[] square = new Vector2[] {
    new Vector2(0,0),
    new Vector2(1,0),
    new Vector2(1,1),
    new Vector2(0,1)
};

I want to be able to do the above boolean comparison of 2 shapes. If anyone knows Clipper well, what methods can I use to do this check?

I've recently tried the following but the result is always true even when the test shapes are completely separate from each other:

public bool CheckForOverLaps(Vector2[] shape1, Vector2[] shape2) {

    List<IntPoint> shape1IntPoints = Vector2ArrayToListIntPoint (shape1);
    List<IntPoint> shape2IntPoints = Vector2ArrayToListIntPoint (shape2);

    List<List<IntPoint>> solution = new List<List<IntPoint>> ();

    c.AddPath (shape1IntPoints, PolyType.ptSubject, true);
    c.AddPath (shape2IntPoints, PolyType.ptClip, true);
    c.Execute (ClipType.ctIntersection, solution, PolyFillType.pftNonZero, PolyFillType.pftNonZero);
    return solution.Count != 0;

}

private List<IntPoint> Vector2ArrayToListIntPoint (Vector2[] shape) {

    List<IntPoint> list = new List<IntPoint> ();

    foreach (Vector2 v in shape) {

        list.Add (new IntPoint (v.x, v.y));

    }

    return list;

}

And the tests:

    //Square
    Vector2[] square = new Vector2[] {
        new Vector2(0,0),
        new Vector2(2,0),
        new Vector2(2,2),
        new Vector2(0,2)
    };

    //Square
    Vector2[] square2 = new Vector2[] {
        new Vector2 (1, 1),
        new Vector2 (3, 1),
        new Vector2 (3, 3),
        new Vector2 (1, 3)
    };

    //Square
    Vector2[] square3 = new Vector2[] {
        new Vector2 (2, 0),
        new Vector2 (4, 0),
        new Vector2 (4, 2),
        new Vector2 (2, 2)
    };

    //Square
    Vector2[] square4 = new Vector2[] {
        new Vector2 (4, 0),
        new Vector2 (6, 0),
        new Vector2 (6, 2),
        new Vector2 (4, 2)
    };

    Assert.IsTrue(tc.CheckForOverLaps(square,square2));
    Assert.IsFalse(tc.CheckForOverLaps(square,square3));
    Assert.IsFalse(tc.CheckForOverLaps(square,square4));

Many thanks.

sentences:
What are examples of games with "minimalist" models/art assets When teaching game development, my student's obsess about building realistic or complex art/models/animation. And spending wayyy to much time trying to get accurate collision detection between two 3D models [despite my best efforts]

However I would like them to spend more time thinking about developing the game mechanics, interaction and game play.

I'm looking for some games where the visuals are simple but have good game play.

Things I am thinking about are Cubes' vs Spheres or Impossible Game.

What are more examples of visually simple (preferably 3D) games to help inspire my students?

sentences:
Why would I want to set a minimal OpenGL version before creating the context? Typical GLFW applications have these lines after glfwInit():
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

And similarly:
glfwMakeContextCurrent(window);

I get that glfwMakeContextCurrent is needed before sending calls to the OpenGL API, but the doc says

You can require a minimum OpenGL version by setting the GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR hints before creation

But why would I want that? Why would I cut options for OpenGL versions? I did not understand that, if I am interpreting it correctly in the first place

sentences:
Taxes and Approximate revenue? I'm heading out from the prototype stage and towards my early/alpha stage.

In this transition period I've been interested in getting an estimate of what the revenue will be so I've come up with this in Excel.

I've considered taxes in general, VAT and fee transactions from Stripe and PayPal.

I'm from Europe.

This is my first game and I know no-one in the field so I don't really have an answer.

Is the following a reasonable assumption?

Itch.io Cut           10 %
VAT Transactions      25 %

With this as an example result:

Money Earned       +1,000 €
VAT Transactions   -  250 €
                   --------
SubTotal           +  750 €

Itch.io Cut        -   75 €
                   --------
My Final Revenue   +  675 €

Here is my question on itch.io, and here it is to my reddit question.

sentences:
ScreenToWorldPoint(Input.mousePosition) always returns 0 for X and Y coordinates I'm trying to convert the mouse position (Input.mousePosition) into world points, but for whatever reason the X and Y coordinates are always, always 0.
Here, I printed mousePosition and ScreenToWorldPoint()'s output:

The -10 in the Z is understandable, but why do I get 0s in X and Y regardless of the actual, varying mouse position?
This is inside a custom display I set inside Game View (1440x3040). I tried Free Aspect, but that didn't change anything.
I tried parenting the script to an empty game object centered on origin just in case, but that didn't do anything either.
The code:
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Debug.Log(mousePos);
Debug.Log(Input.mousePosition);

Or, more generally:
private bool hitProjectile() {
    bool hit = false;
    Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

    Debug.Log(mousePos);
    Debug.Log(Input.mousePosition);

    if ((mousePos.x >= (pt.position.x - radius) && mousePos.x <= (pt.position.x + radius)) &&
        (mousePos.y >= (pt.position.y - radius) && mousePos.y <= (pt.position.y + radius)))
        hit = true;

    return hit;
}

The game is in 2D, the camera is perspective, and I'm using URP. The script is trying to determine if the mouse clicked on a circle (/w a CircleCollider2D).
What the hell is going on? I hope this is not a URP thing. I've had nothing but bad experiences with it.

sentences:
just download first assetbundle In the Start of my scenes I call the method that downloads the assetBundles for that scene. The problem is that it only downloads the first assetBundle from the list, the second does not download it. My code is:

Note: The Debug that shows the url shows the correct url both times, first http://mihost.com/assetbundles/asset1 and then http://mihost.com/assetbundles/asset2.
However, in the Debug that shows the assets 'added' in both cases it shows the name only of those in asset1

public virtual IEnumerator LoadBundleFromServer()
{

var AssetPathOnServer = "http://mihost.com/assetbundles/"

var assetBundleNames = new List<string>();
assetBundleNames.Add("asset1");
assetBundleNames.Add("asset2");

    for (int i = 0; i < assetBundleNames.Count; i++)
    {
        var currentAssetBundleName = assetBundleNames[i];
        var url = AssetPathOnServer + currentAssetBundleName;
        Debug.Log("url: " + url);

        var request = UnityWebRequestAssetBundle.GetAssetBundle(url);
        yield return request.SendWebRequest();
        if (!request.isHttpError && !request.isNetworkError)
        {
            var asseBundle = DownloadHandlerAssetBundle.GetContent(request,);

            Debug.Log("count assets: " + AssetNames.Count);

            for (int j = 0; j < AssetNames.Count; j++)
            {
                string assetName = AssetNames[j];
                AssetBundleRequest asset = asseBundle.LoadAssetAsync<AudioClip>(assetName);
                yield return asset;
                AudioClip myClip = asset.asset as AudioClip;
                if (!assetDictionary.ContainsKey(assetName))
                {
                    assetDictionary.Add(assetName, myClip);
                }
                Debug.Log("added: " + assetName);
            }
            asseBundle.Unload(false);
        }
        else
        {
            //TODO: aqui hay que mostrar un error
            Debug.LogErrorFormat("error request [{0}, {1}]", url, request.error);
        }
    }
}

public abstract List<string> AssetNames
{
    get;
}

sentences:
Can't figure out projection transform I'm trying to fugure out all the spaces transformations, and currently have some inconsistency I can't understand. I'm working on a 2D game (so we assuming Z is always 0 for now), on a device with 960x544 resolution. So, as far as I understand my World Space is left-top (0, 0) to right-bottom (959, 543), with Y axis inverted (going down). Let w = 960, h = 544. To transform it to Eye Space we need to move (0, 0) to center of the screen, so it would be simple translation, viewT:

1, 0, 0, -w/2
0, 1, 0, -h/2
0, 0, 1, 0
0, 0, 0, 1

Next step is Clip Space. I want all world space to be rendered so it's just scaling. But we also need to invert Y axis and that's the part I'm unsure of. My assumption would be that we just add minus sign for the Y scale, and thus projT:

2/w, 0, 0, 0
0, -2/h, 0, 0
0, 0, 1, 0
0, 0, 0, 1

Then viewProjT = projT * viewT would give me:

2/w, 0, 0, -1
0, -2/h, 0, 1
0, 0, 1, 0
0, 0, 0, 1

But in samples I have, "reference" matrix is:

2/w, 0, 0, 0
0, -2/h, 0, 0
0, 0, 1, 0
-1, 1, 0, 1

i.e. it's my viewProjT, but transposed. And that's the part I don't understand. Can someone clarify why I need to transpose matrix to get correct matrix? Is this somehow related to inverting Y axis?

Note: I'm using this, as a basis for my calculations.
And image to illustrate my World and Clip spaces:

sentences:
MonoGame renders texture in an almost compressed looking way I was working on a game in MonoGame, which I have been doing for quite some time now. As I was implementing UI, I was noticing some sort of weird scanlines. Investigating further, to my surprise my whole scene was covered in it!

Notice how the texture when zoomed in has almost a JPEG squared compressed feel too it. I have no idea what is causing this.

We were using a RenderTargetTexture instead of the backbuffer, so figured I try it without, but the same happens. I checked if we were doing any weird Matrix transformations, we did not, in fact, I disabled them just to test it out. After that I thought "half pixel offset" (even though it should not really apply anymore post DX9), but also that did not solve a thing. Last but not least I thought maybe a MipMapping issue, but that would be weird since the exact same thing happens with the normal backbuffer.

My Question: Does anyone here recognize this "effect", and have any clue what might be causing it?

I'm basically just rendering a 1920x1080 image to a 1920x1080 backbuffer, but I can assure its not the image. When I for example draw a cursor and make it follow the mouse, the points where pixels "go missing", even the cursor texture deforms.

Might not be as clear in this picture, but notice how both the cursor and the orange curve basically "skip" a row of pixels, when I move the cursor to another location, it turns back to normal.

sentences:
How can I avoid the precision loss when recentering objects on open terrain? For a better context this question is related to this one:

What's the largest "relative" level I can make using float?

When the player is moving too far away from the center, all the scene and objects are moved in the opposite direction, in order to bring the center closer to the player and avoid float precision issues.

Recentering all objects makes me doubt a little, since it might still accumulate error since it's an addition. I also don't think I can tell a physics engine to just teleport all its object without causing weird behavior.

sentences:
Unity assets turned binary from text I'm working with unity and git, and for some reason, from some point - the assets started being Binary files, meaning that they're not visible as normal YAML files, and I cannot see textual git diff results on them.

Has anyone experiences it and knows how to revert to the textual format from the binary format?

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:
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:
Games that mix emulated old machine code with modern languages Is there any example of game development in a "modern" multi-purpose language (C++, Python, Java, Go) that loads game binaries of an old platform (e.g. 8-bit, 16-bit or 20-bit DOS) and emulates it partially until a given condition and then mixes it with code that runs natively on the host platform?

I am looking for games or extensions of games that use a hybrid approach of emulation and native programming to build newer versions of old games.
I am also not looking for software disassembled and ported to a new system, like SDLPoP.

sentences:
Add image to button in unity Sorry if this question has already an answer somewhere, but I've just started to play with Unity and now I'm stuck. :(

I've tried a few things ( from here , here and here and others ) but none of them work, I'm sure that I do something wrong but I don't know what.

I have this code:

public class SceneManager : MonoBehaviour {

    public Image myButtonImage;
    private Button switchBtn;

    // Use this for initialization
    void Start () {

        switchBtn = GameObject.Find("switchBtn").GetComponent<Button>();
        myButtonImage = Resources.Load<Image>("switchCameraImg");

        switchBtn.image = myButtonImage;
    }
}

and this are my objects:

where cameraSwitchObj is a GameObject and switchBtn is the button itself.

SceneManager is the script attached to MainCamera

I receive this error :

NullReferenceException: Object reference not set to an instance of an object SceneManager.Start ()

for this line : switchBtn.image = myButtonImage; but according to what i read from different posts this is all i must do. What I am missing?

sentences:
Bounding Box Collision Glitching Problem (Pygame) So far the "Bounding Box" method is the only one that I know. It's efficient enough to deal with simple games. Nevertheless, the game I'm developing is not that simple anymore and for that reason, I've made a simplified example of the problem. (It's worth noticing that I don't have rotating sprites on my game or anything like that. After showing the code, I'll explain better).

Here's the whole code:

from pygame import *

DONE = False
screen = display.set_mode((1024,768))
class Thing():
    def __init__(self,x,y,w,h,s,c):
        self.x = x
        self.y = y
        self.w = w
        self.h = h
        self.s = s
        self.sur = Surface((64,48))
        draw.rect(self.sur,c,(self.x,self.y,w,h),1)
        self.sur.fill(c)
    def draw(self):
        screen.blit(self.sur,(self.x,self.y))
    def move(self,x):
        if key.get_pressed()[K_w] or key.get_pressed()[K_UP]:
            if x == 1:
                self.y -= self.s
            else:
                self.y += self.s
        if key.get_pressed()[K_s] or key.get_pressed()[K_DOWN]:
            if x == 1:
                self.y += self.s
            else:
                self.y -= self.s
        if key.get_pressed()[K_a] or key.get_pressed()[K_LEFT]:
            if x == 1:
                self.x -= self.s
            else:
                self.x += self.s
        if key.get_pressed()[K_d] or key.get_pressed()[K_RIGHT]:
            if x == 1:
                self.x += self.s
            else:
                self.x -= self.s
    def warp(self):
        if self.y < -48:
             self.y = 768
        if self.y > 768 + 48:
             self.y = 0
        if self.x < -64:
             self.x = 1024 + 64
        if self.x > 1024 + 64:
             self.x = -64
r1 = Thing(0,0,64,48,1,(0,255,0))
r2 = Thing(6*64,6*48,64,48,1,(255,0,0))
while not DONE:
    screen.fill((0,0,0))
    r2.draw()
    r1.draw()
    # If not intersecting, then moves, else, it moves in the opposite direction.
    if not ((((r1.x + r1.w) > (r2.x - r1.s)) and (r1.x < ((r2.x + r2.w) + r1.s))) and (((r1.y + r1.h) > (r2.y - r1.s)) and (r1.y < ((r2.y + r2.h) + r1.s)))):
        r1.move(1)
    else:
        r1.move(0)
    r1.warp()
    if key.get_pressed()[K_ESCAPE]:
        DONE = True
    for ev in event.get():
        if ev.type == QUIT:
            DONE = True
    display.update()
quit()

The problem:

In my actual game, the grid is fixed and each tile has 64 by 48 pixels. I know how to deal with collision perfectly if I moved by that size. Nevertheless, obviously, the player moves really fast.

In the example, the collision is detected pretty well (Just as I see in many examples throughout the internet). The problem is that if I put the player to move WHEN IS NOT intersecting, then, when it touches the obstacle, it does not move anymore. Giving that problem, I began switching the directions, but then, when it touches and I press the opposite key, it "glitches through". My actual game has many walls, and the player will touch them many times, and I can't afford letting the player go through them.

The code-problem illustrated:

When the player goes towards the wall (Fine).

When the player goes towards the wall and press the opposite direction. (It glitches through).

Here is the logic I've designed before implementing it:

I don't know any other method, and I really just want to have walls fixed in a grid, but move by 1 or 2 or 3 pixels (Slowly) and have perfect collision without glitching-possibilities. What do you suggest?

sentences:
Simple Update loop to show questions one at a time I have two lists which work with an XML file which holds questions and answers. At the moment the project displays all the questions at the same time so they "flicker" on the screen and iterate between each item in the list.

Whats the easiest way (coding) to pause the random generated list on any particular questions?

Question class:

class question
{
    public string questionString;
    public string apple;
    public string pear;
    public string orange;

    //the ? indicate the int can be nullable so it can accept the string item
    int? correctAnswer;

    public question(string newquestionString)
    {
        parseQuestion(newquestionString);
    }

    public void parseQuestion(string newquestionString)
    {
        List<string> questionComponents = newquestionString.Split('|').ToList<string>();

        questionString = questionComponents[0];
        apple = questionComponents[1];
        pear = questionComponents[2];
        orange = questionComponents[3];

        correctAnswer = Int32.Parse(questionComponents[4]);

    }

In Game1:

    Random q = new Random();
    int i = q.Next(questions.Count);

    spriteBatch.Begin();
    spriteBatch.DrawString(myfont, questions[i], new Vector2(100 + 100 *i, 100), Color.Black);
    spriteBatch.DrawString(myfont, myQuestions[i].questionString, new Vector2(100 + 100, 100), Color.Black);
    spriteBatch.DrawString(myfont, myQuestions[i].apple, new Vector2(100 + 100, 200), Color.Black);
    spriteBatch.DrawString(myfont, myQuestions[i].orange, new Vector2(100 + 100, 300), Color.Black);
    spriteBatch.DrawString(myfont, myQuestions[i].pear, new Vector2(100 + 100, 400), Color.Black);
    spriteBatch.End();

sentences:
Problem with impulses in my physics engine I'm currently developing a small 3D impulse-based physic engine for a CS project.  It uses GJK for collision detection and is kind of stable at the moment.  Nevertheless, I'm not satisfied with my collision response as rigid bodies appear to gain more and more momentum with each bounce, although only under some configurations.

I use Newton’s Law of Restitution (pictured immediately below) for instantaneous collisions with no friction.  I checked this formula again and again, and I also checked if the magnitude of the contact normal is 1, and all seems fine.  The direction of the bounce and the induced rotation are convincing but the impulse is just sometimes too strong.

I think my problem may lie within the impulse application part; in my mind, the impulse is the force necessary to separate two touching points of two bodies plus a certain magnitude depending on the coefficient of restitution (0.7 in my tests).  I compute an impulse for each detected contact point and apply it at the contact position.

For example if a cube falls right to the floor, there will be 4 impulses, each one at a vertex of the bottom face of the cube.  For each of the four contacts, I do something like this:

J = computeImpulse(contact)
A.applyImpulse(J, contact.pos)
B.applyImpulse(-J, contact.pos)

I'm a bit confused.  Is this the correct approach, or should I apply half of the impulse to each body?  Or, should I rather apply a fraction of the impulse depending of the mass of the bodies?  Or, is the problem just somewhere else (e.g., in the formula)?

I don't know if someone has an easy answer for me, as it's a rather specific problem, but thank you for your help.  :)

sentences:
Instantiate objects that share same variable I'm just wondering how to instantiate the same objects that all share the same variables, except their positions.

I'm basically working on the scene of my HTML5 game, and I've build a streetlamp post that turns on and off. All the lamps will have the same variables, such as Image, Size, on/off function. The only thing that will be different will be the position x and y.

I've built my lamp within a variable function (I think they're called that var = {), and within my actual game DrawFunction, I'm calling LampPost.draw();.

Is it possible to do something like this?

LampPost(0,0);
LampPost(100, 0);
LampPost(200, 0);

etc ... and then possibly place each instantiate Lamp within an array?

This is a snippet code for the lamp:

var LampPost = {

    lamp_xsprite : 0,
    lamp_ysprite : 0,

    light_xsprite : 0,
    lightysprite : 0,

    x : 440,
    y : 320,

    //Flicker effects
    lightFlicker : 0,
    seconds_Off : 0,
    seconds_On : 0,

    randomLength_Off : 500,
    randomLength_On : 150,

    draw: function(x, y) {

        this.x = x;
        this.y = y;

        ctxPropsOver.setTransform(1, 0, 0, 1, -Map.x + gameWidth/2, -Map.y + gameHeight/2);
        ctxPropsOver.rotate(Math.PI / -25);
        ctxPropsOver.clearRect(0, 0, 1000, 1000);

        ctxPropsOver.globalAlpha = this.lightFlicker;
        ctxPropsOver.drawImage(imgLights, 0, 36, 500, 463, -60 + this.x, -190 + this.y, 500, 463);
        ctxPropsOver.globalAlpha = 1;
        ctxPropsOver.drawImage(imgLights, 0, 0, 210, 36, 0 + this.x, 0 + this.y, 210, 36);

----- UPDATE -----

Okay, So I've converted it into an instance of object, this is what I have so far:

LampPost = function(lx, ly, la){

    x = lx; //500;
    y = ly; //335;

    centrex = 12;
    centrey = 17;

    rotate = la; //-8;

}

LampPost.prototype.draw = function (){

    ctxPropsOver.setTransform(1, 0, 0, 1, (-Map.x + gameWidth/2), (-Map.y + gameHeight/2) );

    ctxPropsOver.clearRect(0, 0, 1000, 1000);

    ctxPropsOver.save();
        ctxPropsOver.translate(this.x, this.y);
        ctxPropsOver.rotate(this.rotate*Math.PI/180);
        ctxPropsOver.translate(-this.centrex, -this.centrey);
        ctxPropsOver.globalAlpha = this.lightFlicker;
        ctxPropsOver.drawImage(imgLights, 0, 36, 500, 463, -60, -190, 500, 463);
        ctxPropsOver.globalAlpha = 1;
        ctxPropsOver.drawImage(imgLights, 0, 0, 210, 36, 0, 0, 210, 36);
    ctxPropsOver.restore();
};

sentences:
What is the right way to implement a loading screen in cocos2d-js? We have two scenes that are loaded with heavy computation; a map screen and a puzzle screen. When we change the scene from A to B, the app gets stuck on scene A for a while before it renders scene B.

So to avoid confusion, we created a dummy scene with 'Loading...' written on it and then on it's onEnter function we change to scene B. The game now gets stuck on the dummy loading scene now instead. But the loading scene takes in touch inputs and the device's native button inputs and triggers it as soon as scene B enters. So the map scrolls if you swipe on the loading scene and puzzle takes input on tapping the loading screen.

Has anyone implemented a proper loading scene with cocos2d-js?

sentences: I have created character human in blender. How to use it in Java/Android Title says it all pretty much. I can't find anything online which explains it in details. I have created a character model in Blender and I want to use it in Android app. I want to make it move. What's my next step here?

sentences:
How can I generate Sudoku puzzles? I'm trying to make a Sudoku puzzle generator. It's a lot harder than I expected and the more I get into it, the harder it gets!

My current approach is to split the problem into 2 steps:

Generate a complete (solved) Sudoku puzzle.
Remove numbers until it's solveable and has only 1 solution.

In step 1, since I'm using a brute force methods, I'm facing some run time issues. Is there an optimal way of filling in a complete Sudoku puzzle?

In step 2, what kind of algorithm should I use to "puzzlize" a solved sudoku?

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:
How do I seperate my game and game engine into seprate projects? I am trying to separate my game from the game engine, both written in Java. Currently, they are in two separate packages, but I would like to separate them into different projects.

A main method in "Project B" starts a game loop in "Project A". This loop needs to call back to methods in "Project B". What is the best method to achieve this, without "Project A" being aware of the specific implementation of "Project B"?

"Project A" (Engine - Library):

public class Engine {

    public static void start() {
        init();
        // Call Game.getInstance().init() from Project B.

        while (true) {
            input();
            // Call Game.getInstance().input() from Project B.

            update();
            // Call Game.getInstance().update() from Project B.

            render();
            // Call Game.getInstance().render() from Project B.
        }

        cleanUp();
    }

}

"Project B" (Game - Executable)

public class Main {

    public static void main(String[] args) {
        Engine.start();
    }

}

public class Game {

    private static Game instance = new Game();

    private Game() {}

    public static Game getInstance()
        return instance;

    public void init()
        // Do Stuff

    public void input()
        // Do Stuff

    public void update()
        // Do Stuff

    public void render()
        // Do Stuff

}

sentences:
Opengl ES 2.0: Is there a way to use less resources to draw in-game background texture 1.Should my in-game background be drawn with my game loop renderer, or if

2.I don't want to draw my background image every frame in my main renderer since it could possibly be a heavy job while the game loop is running. Do I need to use a separate thread or some other method to achieve this?

FYI, the background should be able to scale and translate with zooming function, it should be flexible.

sentences: How do I get the touch event on a body in JBox2d I have various bodies rotated at some angle with the help of Box2d in LibGDX. What I want is to destroy the body when I click on it, but the problem is that I am not able to get the area definition of the body so that I can check whether my touch point lies inside the body. I tried using actor and its hit() method but it's working only if I don't rotate it. As far as I know, once I rotate the body, its bounds are not rotated.  How can I check the Touch event in a Body?

sentences:
What is a good format for a 3d topview map? I am building a 3d topview game like GTA2. In this game the ground is mostly one level (except for tunnels and highways). Most of the ground is also city so the ground is usually covered by either roads or buildings. The buildings are simple 3d models which the player can walk around on. Most of the gameplay is 2d.

How should I model the map? I have considered the following options:

Bitmaps, I think this gives problems when I want to add data smaller than a tile. Also the problem of bridges and tunnels seems hard to solve with this.
Polygons, define all roads, terrain types, buildings with polygons and save that along with physics and texture information.

What approach would you take or have you ever implemented this or know of an implementation?

sentences:
Redundant checks from spatial partitioning A simple 2D grid partition system for collision detection divides space into equal-sized tiles. Colliders then map themselves to tiles with their bounding box in O(1) time. Collision detection only has to be performed between objects that occupy the same tile(s).

Collision detection is expensive so the more culled, the better. With a grid partitioning system, how are collisions culled when colliders share multiple tiles?

For example, Circle_A and Circle_B both sit on the edge between Tile_1 and Tile_2. Iterating both tiles would make collision detection between Circle_A & Circle_B run twice.

A global pair hashtable seems performance expensive since it has to be cleared every frame. Tracking pairs inside colliders takes a lot of memory. How do you mitigate redundant pairs when iterating through partition grid tiles?

sentences:
How to determine the amount of experience needed for leveling up Related questions under this topic might include:

How should I base how much experience points it takes to get to the next level?
What factors are involved in this?
How do I keep the player not entertained long enough till he levels up?
How can I vary the way the player gets experience points?

sentences:
opengl matrix multiplication Can someone provide some type of example of multiplying a 4x4 matrix without using loops?

typedef struct matrix4
{
    data[16];
} m4;

can someone provide a sample of how you you'd multiply two of these in the opengl column major way?

sentences:
SDL2 Textures bleeding / 1px border around tile maps - SDL_RenderCopyEx taking integer arguments https://forums.libsdl.org/viewtopic.php?t=9486 This post gives a good indication of my question.

Basically if you set SDL2 logicalScale or otherwise and render textures at native window resolution they appear fine. However, with tile maps if you resize the window in anyway, you get a bleed where an integer rounding issue creates a 1px border around certain tiles.

Is my only option to create a 1px border around all my images to stop this bleed / rounding error? Or a semi-transparent border with the main color. What are my options? Is this solved in any of the latest SDL2.X.Y ?

EDIT: A simpler method I have used is reducing my images from 64x64px to 62x62px in SDL2 (not the actual sprite) and using it's own sprite as a 1px border, and using Render Scaling to scale up that 1px, which stops bleed. It reduces the quality on background images ever so slightly, but it requires no tweaking of any code or sprites... but again wondering if there's a more elegant solution.

sentences:
box2dlights confuses ScreenUtils for screenshots in libGDX I take screenshots as usual in libGDX via ScreenUtils.getFrameBufferPixmap(), which works fine. Hoever, when I call RayHandler.updateAndRender() during rendering, then the screenshot only contains those assets rendered after this call. All other pixels in the screenshot are transparent.

What is the best way to deal with this issue?

sentences:
Box2d: Is there a way to have collisions but ignore the accompanying forces? To begin, I know that you can use filtering or isSensor to remove physical collisions. However, I would like to retain the ability to, say for example, stop when trying to move past another player. Essentially, I don't want one player to be able to push another dynamic body with the force that normally accompanies a collision. I've tried static and kinematic bodies, but both obviously have their own problems with trying to have collisions.

An example might be a topdown game such as League of Legends of Starcraft, where units can impede on eachother's movements, but don't apply any force upon collision.

sentences:
Is having a master builder object a bad idea? I have wondered about using the following approach to creating Entity objects in a personal project. What I want is to be able to keep track of all Entity objects that get created, so whenever an instance is created, it should automatically get added to a bookkeeping list.

The approach I thought of using is to create a class that can hand out new Entity objects, rather than allowing them to be created directly. This class is called EntityFactory. It's not the factory pattern though. Basically, I define my Entity base class with a private constructor and made EntityFactory a friend class so that it could instantiate Entity objects and hand them out.

The only downside I can see is that I would have to pass around the EntityFactory object.

Will there be other problems? Is this a bad idea? If so, what alternatives are there to have automatic tracking of all Entity objects that get instantiated.

sentences:
Deploying GWT application / LibGDX and TextureAtlas problem I encountered with a little problem. After GWT (and LibGDX) deployment I got an error:

  GwtApplication: exception: Couldn't load image '/images/objects.png',
  file does not exist Couldn't load image '/images/objects.png', file
  does not exist

This error throws when TextureAtlas tries to load the image from settings.text file:

  images/objects.png
  format: RGBA8888
  filter: Nearest,Nearest
  repeat: none
  hills
  rotate: false
  xy: 0, 0
  size: 1024, 146
  orig: 1024, 146
  offset: 0, 0
  index: -1

I tried to use any type of path

"/assets/images/object.png"
"/clutchkick/assets/images/object.png"
"/public_html/clutchkick/assets/images/object.png"
and so on..

Any suggestions?

By the way there are no any problems on android or desktop deployment.

EDIT:
The same problem occurs when trying to load a Tmx map.

sentences:
Sending entities to connecting player When a player connects to a game, he needs to be sent all the entities currently on the map. This is done by creating entities one by one. Three ways of implementing this come into my mind. Which one them is the best?

1) Implement sending entities in the game engine: Game engine listens to "connected" event from a player object and send all the entities to the player when this happens.

2) Implement sending entities in the entity class: Entity listens to "player connected" event from the game engine and when this happens, it sends itself to the connecting player.

3) Implement sending entities in the player class: When a player connects, it gets list of entities from the game engine and sends each of them to itself.

sentences:
Help understanding Accidental Noise Gradient function Background:

I am trying to create a set of functions to manipulate noise, similar to Libnoise, Fastnoise and the Accidental Noise Library. The end goal is to produce terrain.

As recommended by this article (http://accidentalnoise.sourceforge.net/minecraftworlds.html) I am starting out with a 'Gradient' function.  Quoting the author:

  The Gradient function is given a line-segment in N-dimensional space
  (ie, in whatever coordinate space we are working in, be it 2D, 3D, or
  higher) and calculates a gradient field aligned along this segment.
  Input coordinates are projected on this line, and their gradient value
  is calculated depending where on the line they lie in relation to the
  endpoints of the defining segment.

Even after repeatedly reading the article and looking at these two other questions I found (2D Terra(ria)in generation - Accidental noise and Accidental noise - Gradient function) I'm still having problems understanding exactly what the function is doing.

Questions:

My test chunk is of size 32x32x32 and ranges from -16 to +16 on the x, y and z axis.  In this case, would the inputs to the function be x/32, y/32, z/32?
Does the function map points between 0 and 1 (as input) to a point between 1 and -1 (as output)? I.e if my x, y and z where -16, -16, -16, would I get 1, 1, 1 back?
Why in the extract below is the line segment (0,1)->(0,0) rather than (0,0)->(0,1)?  Given that the example line segment is defined as x1=0, x2=0, y1=0, y2=1.

  The Gradient function accepts a line segment in the form of (x1,x2,
  y1,y2) for the 2D case, extended to (x1,x2, y1,y2, z1,z2) for the 3D
  case. The point formed by (x1,y1) delineates the start of the line
  segment, which is mapped to 0. The point formed by (x2,y2) is the end
  of the line segment that maps to 1. So here we are mapping the line segment (0,1)->(0,0) to the gradient.

Any help on this would be greatly appreciated, thanks.

sentences:
Do empty Update() methods get executed and slow down the game while playing? From an optimization point of view, is it best practice to delete the predefined update() methods in all my C# scripts if there is no code inside them ?

On hundreds/thousands of GameObject(s) with Update() {} empty, does the game slow down ?
Can they be left empty or is it better to delete them ?

sentences:
Multiple lua scripts using newthread I'm trying to hook lua-scripts to my entities, where several entities of the same type want to use a separate instance of the same script. Problem is, when I run two or more scripts and use any C-api functionality, I get an access violation after some time. I'm guessing some kind of stack corruption occurs but I'm not sure. The application is single-threaded but uses lua_newthread for each entity, and I then use lua_resume on each new thread for when I want the scripts to run. The code looks like this.

Script 1

function Update(dt, owner)
   print("Script 1")
   pos = GetPosition(owner)
end

Script 2

function Update(dt, owner)
   print("Script 2")
end

GetPosition()

static int GetPosition(lua_State* L)
    {
        Core::Entity entity = lua_tonumber(L, 1);
        Core::TransformationComponent* tc = WGETC<Core::TransformationComponent>(entity);

        lua_newtable(L);

        for (int i = 0; i < 2; i++)
        {
            lua_pushnumber(L, tc->position[i]);
            lua_rawseti(L, -2, i);
        }

        return 1;
    }

How I create new lua threads (m_luaState is the global parent state to which I bind all my functions):

lua_State* LuaCore::CreateThread(std::string file)
    {
        lua_State* newState = lua_newthread(m_luaState);

        lua_newtable(newState); //new globals table
        lua_newtable(newState); //metatable

        lua_pushliteral(newState, "__index");
        lua_pushvalue(newState, LUA_GLOBALSINDEX); //original globals
        lua_settable(newState, -3);
        lua_setmetatable(newState, -2);
        lua_replace(newState, LUA_GLOBALSINDEX); //replace newState's globals

        luaL_dofile(newState, file.c_str());

        return newState;
    }

How each script is called:

            lua_State* ls = GetChildState(stateIndex)
            lua_pushstring(ls, functionName.c_str());
            lua_gettable(ls, LUA_GLOBALSINDEX);

            SimpleLuaCallData* slcd = (SimpleLuaCallData*)inData;

            lua_pushnumber(ls, slcd->dt);
            lua_pushnumber(ls, slcd->ownerID);

            lua_pcall(ls, 2, 0, 0);

            return nullptr;

If I remove the call to GetPosition from Script 1, the application runs without issue. Am I missing some kind of required clean-up or garbage collection problems? I'd like to try and avoid creating a new state for each entity, as that seems excessive and sharing globals via the core state is nice. lua_pcall doesn't produce any results. The application eventually stops running Script 1 and after a few more cycles it gets the access violation on

lua_gettable(ls, LUA_GLOBALSINDEX);

in the calling function.

sentences:
Dynamically creating astar node map by triangular polygonal map My game's map format uses a bunch of triangles to make up the platforms and terrain in 2d. Right now I can set up a 2d array of nodes for the A* (A star) algorithm that basically is a bunch of rectangles across the maps x and y that can be set to "wall" if the A* algorithm should try to go around it.

However I want a function in the map loader to create the node overlay if the nodes are not specified. I was thinking if more than n percent of the A* rectangle overlaid on map was filled by polygons I could mark that entry in the array as "wall". However I'm stuck on how to do this (or even start) where/when the triangles can be overlapping and also of variable size.

sentences:
perspective camera with libgdx I am trying to setup a viewport using perspective camera. I am trying to render a scene like this
   I read an official blog post about the cameras and found a few tests within gdx test suits. However, I am still kinda confused. I have no idea how to manipulate the test suits nor i have any idea what the code does other than just following the code given in the test.

I have a couple of sub-questions,

was the game in the screenshot rendered with perspective camera or just the grids?
Is it possible to work with Orthographic and Perspective Camera at the same time? so that i can render different elements with different camera?
Is there any detailed and easy to understand guide that explain perspective camera really well? I find libgdx severely lack of documentation regrading these.

sentences:
Move Animation in LibGdx I'm trying move animation within screen, here's the code

Animation<TextureRegion> animation_run = GifDecoder.loadGIFAnimation(Animation.PlayMode.LOOP,
    Gdx.files.internal("run.gif").read());
    float elapsedTime += (Gdx.graphics.getDeltaTime()) * 2;
    float playablePosition = (Gdx.graphics.getWidth()) / 2 - 200;
    float currentPosition = 0;
    for (int i = 0; currentPosition <= playablePosition; i++) {
    currentPosition += i;
    batch.begin();
    batch.draw(animation_run.getKeyFrame(elapsedTime), currentPosition, 0, 200, 300);
batch.end();
}

but I got not exactly what I want

Does anybody know how fix my code to make movement from left edge to the center properly?

sentences:
What is the proper strategy to manage vertex buffers? I have created a large variety of shaders for my game engine for different use cases. The vertex input for the shaders depend on what I want to do with them. For example, if I want to just render the wireframe of a mesh, I do not need texture coordinates, normals, etc. because I just need basic vertex information. However, when I render animated meshes (I use Skinned Animation), then I need additional information like joint link weights for each vertex.
My question is: What is the best way to manage Vertex Buffers? Do I create a Vertex Buffers for each use case when I create the model and store them for later use, i.e. I select at run-time which of the stored Vertex Buffers to use for rendering? Do I create the Vertex Buffer I need at run-time in each render cycle? What is the best way to do it?
I am using DirectX 11 and C# (using SharpDX as wrapper).

sentences:
How to add user created data to drop down menu options So I'm trying to make it that I can have a dropdown that will have user created info appear in it.

List<engines> engineList = new List<engines>();
public Dropdown engineSelect;

public class engines
{
    public string engineName;
    public int featureNumber;
    public int totalDevPoints;
    public string optimizedGenre;
    public engines(string name, int feature, int totalPoints, string opt)
    {
        engineName = name;
        featureNumber = feature;
        totalDevPoints = totalPoints;
        optimizedGenre = opt;

    }
}
engines playerEngine = new engines(engineName, numFeature, 0, whatGenre);

Pretend player set engineName, numFeature, and whatGenre with text fields.
I wanted to have it that the drop down would add in whatever new engines the player makes. How would I do that? I want to have it say select engine: and then the player would pick from dropdown from engines they made(only saying engine names).

sentences:
How do I make my offline socket.io server go online? I've made a simple multiplayer game using socket.io, and took a lot of help from YouTube and the Internet on how to do it. However, the tutorials only talk about how to run the server locally, and none of the ones that I followed ever talked about running the server online - and I looked through a lot!

I think that I only need to add my server IP to my Javascript file, and match the socket.io inspector property value with it.

How do I make my offline socket.io server go online?

sentences:
Physics for moving blocks I'm working on a 2D game for windows phone where the player moves blocks around to bounce a laser beams.

I need to create some simple physics for moving the blocks.

For the moment I have a simple collision class, telling me if two rectangles collide. But that's not enough because when I'm moving a block the rectangle/rectangle function doesn't work.

By Doesn't work i mean,I manage the collision but I don't how to stop the block mooving while the user sliding the block.

The collision response for the block I want is if the user tries to slide it on another object, the block should slide up against the other object and not overlap.

How would I go about implementing this functionality?

Some code about how i impletement mooving block

{
            Currentposition = Station.Position;

            TouchPanelCapabilities touchCap = TouchPanel.GetCapabilities();
            if (touchCap.IsConnected)
            {
                TouchCollection touches = TouchPanel.GetState();
                if (touches.Count >= 1)
                {
                    Vector2 PositionTouch = touches[0].Position;
                    for (int i = 0; i < ListDragObj.Count(); i++)
                    {
                        if (ListDragObj[i].Shape.Contains((int)PositionTouch.X, (int)PositionTouch.Y))
                        {
                            ListDragObj[i].selected = true;
                        }
                        else
                        {
                            ListDragObj[i].selected = false;
                        }
                        ListDragObj[i].Update(PositionTouch);
                    }
                }
            }
        }

sentences:
Calculating initial velocities given trajectory parabola I'm working on a volleyball game but my maths/physics knowledge isn't quite up to par. I need some help with the following problem:

The player can hit the ball from anywhere on the left of the court into one of three points on the right:

    P    | x  x  x

The ball travels in a parabola defined by the three points, all of which are known:

The players X coord and height (Xp, Yp)
The point just above the top of the net (0, Yn) (assume the left of the court is negative along the x axis)
The point where the ball impacts the ground on the other side of the net (Xi, 0)

I need to calculate the initial X/Y velocities when the player hits the ball so that the ball, affected only by gravity, follows that parabola. EDIT Alternatively, the velocity magnitude and angle from which the X/Y component velocities can be calculated.

I'm able to find the function of the parabola using pen and paper but since this involves "saving" equations with unknown variables I have no idea how to translate that to code (how could you have variable a = 2b for example if b is undefined?). I'm not even sure if finding the function is necessary for this problem.

Any help?

EDIT: I just came to the realisation that if I can calculate the flight time then I can divide the distance traveled each frame along the x axis and just plug that into the parabolic function to get the ball's y coordinate. I guess that's my next avenue of research.

sentences:
player movement variable is not being set to false i have a player with a basic movement. when i press W he just keep on going
this my code
private void fixedupdate
{
    rigid.AddForce(new Vector3(0, 0, 10) * speed, ForceMode.Impulse);

    moveup = false;
}

sentences:
Separation of game logic - extending game state to include location information? I'm currently making a conversion of a board game I have - I don't intend to release it, it's merely to sharpen up skills. I'm currently refactoring it to completely separate game logic from everything such as rendering, getting user input, etc. The game logic is now in a library independent of the project that is actually run.

However, I've come across the problem that, if I don't store piece positions in the game state (as the game logic does not need to know about these), I'm struggling to think of how to store this information in the project that deals with rendering/user input stuff, so that it may render pieces.

Game State

The game state looks like this within the game logic - each district used to have a Vector2 indicating where the trouble marker would be displayed, and each piece would also have a Vector2 indicating their position on the board. They do not at the moment, as I wish to only have such things in the game project, as opposed to the logic project

Environment
    City
        District
        District
            Trouble
            Piece(s)

I have thought of creating a clone of this structure but adding position information, or of trying to use inheritance. But both of these methods seem extremely painful to do in the situation, and I'd really prefer to keep the game logic completely unknowing of things like this.

How would I go about doing this cleanly? Is it possible, or do I need to do a complete rethink of things?

sentences: UI Bug After UI has interaction I am making a 3rd person game for pc. Space, of course, makes the player jump in game. For some reason if I interact with my menu at all and then press space it will open my menu back up. This doesn't happen if I don't interact with the UI first though. I don't know if this is a bug or what but my code does not contain anything that would take input from the keyboard in general so the space bar interacting with it doesn't make sense. Has anyone seen this issue before?

sentences:
MiniMax not working properly(for checkers game) I am creating a checkers game but My miniMax is not functioning properly,it is always switching between two positions for its move(index 20 and 17).Here is my code:

 public double MiniMax(int[] board, int depth, int turn, int red_best, int black_best)
 {

  int source;
  int dest;
  double MAX_SCORE=-INFINITY,newScore;
  int MAX_DEPTH=3;
  int[] newBoard=new int[32];
  generateMoves(board,turn);
  System.arraycopy(board, 0, newBoard, 0, 32);
  if(depth==MAX_DEPTH)
  { return Evaluation(turn,board);}
  for(int z=0;z<possibleMoves.size();z+=2){
        source=Integer.parseInt(possibleMoves.elementAt(z).toString());
        System.out.println("SOURCE= "+source);

        dest=Integer.parseInt(possibleMoves.elementAt(z+1).toString());//(int[])possibleMoves.elementAt(z+1);
        System.out.println("DEST = "+dest);
        applyMove(newBoard,source,dest);
        newScore=MiniMax(newBoard,depth+1,opponent(turn),red_best, black_best);
        if(newScore>MAX_SCORE)
        {MAX_SCORE=newScore;maxSource=source; maxDest=dest;}//maxSource and maxDest will be used to perform the move.

        if (MAX_SCORE > black_best)
        {
            if (MAX_SCORE >= red_best)
                break;  /*  alpha_beta cutoff  */
            else
                black_best = (int) MAX_SCORE;  //the_score
        }
        if (MAX_SCORE < red_best)
        {
            if (MAX_SCORE<= black_best)
                break;  /*  alpha_beta cutoff  */
            else
                red_best = (int) MAX_SCORE;  //the_score
        }

  }//for ends

  return MAX_SCORE;
 } //end minimax

I am unable to find out the logical mistake. Any idea what's going wrong?

sentences:
Why do 100 rect contain 400 tris? I am making a game targeted towards mobile, so I am experimenting around to know how I can boost performance.

Now I have a rectangle with a road texture on it. This I made in Blender. And as expected it has 2 tris.

I made a c# script to add these rectangles together to make a long road. So if I make a road 100 unit long, I have 100 such rectangles, and I expect that their total tris count becomes 200.

Now while running the game, Stats panel shows 8.2k tris for entire scene. And when I disable this 100 unit long road, Stats shows 7.8k tris. So why are there 400 tris for 100 rects?

For each rectangle object, I have already turned off the "cast shadows" property.

Link to blend file https://drive.google.com/file/d/0BztX2HefTk_wb1VuSUlONXVxaE0/view?usp=sharing

Link to texture file https://drive.google.com/file/d/0BztX2HefTk_wc3JvdTBJZmphRUU/view?usp=sharing

EDIT (adding code for builder script)

void createRoad() {
    Vector3 rotation = new Vector3(270, 0, 0);

    float z_size; // Value assigned in CreateWizard()
    Object road_item; // Assigned in CreateWizard()

    for (int i = 0; i < count; i++) {
        GameObject roadPiece = (GameObject)Instantiate (road_item);
        roadPiece.transform.parent = ((GameObject)Selection.objects[0]).transform;
        roadPiece.transform.localPosition = new Vector3 (0, 0, i * z_size);

        roadPiece.transform.localEulerAngles = rotation;
        roadPiece.name = BASE_NAME + (i+1);

        //Turn Off cast-shadows
        roadPiece.GetComponent<MeshRenderer>().shadowCastingMode =
            UnityEngine.Rendering.ShadowCastingMode.Off;
    }
}

sentences: What is the difference between an impulse and a force related to a physics engine? What is the difference between an application of an impulse and an application of a force in relation to a physics engine?

sentences:
AS3 hittest with a tweening movieclip, what is the best way? I'm making a simple game. The character is movable with the arrow keys.
The enemies are moving around the screen with a (classic) tween.

I want to detect collision between the character and the enemies. At first I thought it was working properly, but it also seems to detect a collision on the starting position from the enemies. So even if the enemies are already moving/tweening away from their start position, there's a collision detected between the character and these starting positions. (please ask questions if you don't quite get what I mean)

First method:

addEventListener(Event.ENTER_FRAME, checkIfHitTest);
function checkIfHitTest(Event)
{
      if(player.hitTestObject(enemies))
      {
        trace("yes");

      }
      else
      {
           trace("no");

      }
}

This didn't work properly because it seems to detect the collition even if the enemy moved away from the starting point. (Probably because the ENTER_FRAME but correct me if i'm wrong)

My question to you: What's causing the detection and what is the best way to detect collision between a tweening movieclip and a movieclip wich is movable with the arrowkeys?

sentences: How to stop rendering a gameObject that has no rendering component in unity I want to stop rendering this gameObject. But the all-available renderer.enabled = false is not working. Is it because it has no rendering component attached? If so, how can I see it when it is not rendered?!

sentences:
how to calculate initial Y velocity required to reach target? I am trying to calculate the y velocity necessary for my player character to jump up and reach a y position within 1 second.

Given that my game engine is at 60fps, I am doing:

velY = (targetY - playerY) / 60

..  However, I need to account for gravity which is being applied to the character on every update, so I am doing:

velY = ((targetY - playerY) / 60) - (gravity * 60)

This results in the player character always jumping significantly higher than expect.

UPDATE

Attempting to try the Equations of Motion approach, I am setting a timestamp when the player character should begin moving to the target position...  So then in my update loop, I am calling a function with currentTime - timestamp.

update: function(paceFactor) {
    // paceFactor in this game engine is how many nominal 60FPS game “ticks” have elapsed. So if the game is running at 30FPS, then paceFactor will be 2.0, if it's 60FPS, then 1.0 will be passed in.

  this.timer += paceFactor * (1 / 60);

  if (this.setVelocityAt) {
    this.setVelocityFor(this.timer - this.setVelocityAt, this.targetPoint);
  }

  this.position.x += this.vel.x * this.speed * paceFactor;
  this.position.y += this.vel.y * this.speed * paceFactor;
  this.position.y += (gravity * (paceFactor * paceFactor) * 0.5);
  this.vel.y += gravity * paceFactor;
},

setVelocityFor: function(time, target) {
  if (time > 1) {
    time = 1;
    this.setVelocityAt = undefined;
  }
  this.character.vel.x = (target.x - this.character.position.x) / time;
  this.character.vel.y = (target.y + (0.5 * GRAVITY * time * time) - this.character.position.y) / time;
},

Then later the position and gravity is applied to the character as described in the previous update.

However, the velocity being set is a huge number which is... wrong.

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:
UI Sprite in Unity3D is badly drawn? (Possibly anti-aliasing problem) I move a

28x42 Image,
in a 11x17 RectTransform
in Update,
with anti-aliasing on,
without compression,
with point filtering.

But sadly its visuals aren't smooth, it's flickery, even in a standalone build with 1440p resolution.

I move it like this:

Arrow.anchoredPosition = new Vector2(newX, Arrow.anchoredPosition.y);

I've already tried:

Changing the RectTransform's size to 28x42.
Turning off anti-aliasing.
Changing filtering modes.
Moving it in FixedUpdate.

I tried it with a 110x170 and 280x420 RectTransform, but it's still wrong: (110x170 shown below)

Why?

sentences:
simple 2d car AI unity I have a top down Car Game. how can I implement AI for the Cars? how the car follow the way points?
I want AI cars also rotate itself along the path.

I tried this solution

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

public class waypoint : MonoBehaviour {

    public List<Transform> waypoints;
    private Transform currentWaypoint;
    public float speed = 5f;
    private float closeEnouth = 0.5f;
    int point = 0;

    void Start()
    {
        currentWaypoint = waypoints[point];
    }
    // Update is called once per frame
    void Update()
    {

        Quaternion rotation = Quaternion.LookRotation(waypoints[point].position - transform.position, transform.TransformDirection(Vector3.forward));
        transform.rotation = new Quaternion(0, 0, rotation.z, rotation.w);
        float dist = Vector3.Distance(waypoints[point].position, transform.position);
        transform.position = Vector3.MoveTowards(transform.position, waypoints[point].position, Time.deltaTime * speed);
        if (Vector3.Distance(this.transform.position, waypoints[point].position) < closeEnouth)
        {
            if (point + 1 < waypoints.Count)
                point++;

        }
    }
}

and the car moved in the path but it moves reversed and if arrives the final node it stops and corrects its direction and console displays "Look rotation viewing vector is zero" error.

Thanks in advance

sentences:
STL for games, yea or nay? Every programming language has its standard library of containers, algorithms, and other helpful stuff. With languages like C#, Java, and Python, it's practically inconceivable to use the language without its standard lib.

Yet, on many C++ games I've worked on, we either didn't use the STL at all, used a tiny fraction of it, or used our own implementation. It's hard to tell if that was a sound decision for our games, or one simply made out of ignorance of the STL.

So... is the STL a good fit or not?

sentences:
Framebufferobject crashes when I do pop without resetting the framebuffer to the original glPushAttrib(GL_ALL_ATTRIB_BITS);
glBindTexture(GL_TEXTURE_2D, 0);

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);
gl::drawFilled(mesh_);
//glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

glAssert();
glPopAttrib();
glAssert(); // <= crashes here

If I uncomment the line //glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); it works, how come?

sentences:
Import a 3D animation into an android game I want to import a skinned and animated character model built with bender into an android game. The animations can be: idle, walk, run ...etc

I've seen a related question but it's only about importing a static model: https://stackoverflow.com/questions/204363/is-there-a-way-to-import-a-3d-model-into-android

But I don't see how to import a set of animation with tweened frames.

Any ideas, resources or tutorials about how this can be achieved ?

 Edit:
After some further searching I've found this library that claim to provide model loaders for md5 files.
http://code.google.com/p/libgdx/

Edit2 (2011 12 16):
I tested libgdx mentionned above And it actually works well for now, I can render a walking animation from md5 models with a good framerate, but the model loading time is quite long. For a large amount of models and frames, I think switching to binary formats will become necessary.

sentences:
Find the co-ordinates of collided objects in Python I have a group containing my aliens and another containing the bullets I have fired. When I detect their collisions, I want to pull the alien's x-y co-ordinates during it's deletion so I can put an explosion animation in that location. How do I achieve this? My attempts so far give an error saying group items cannot be indexed.

This is my first real coding project - so still new. I'm using Pygame to make the game.

Current collision detection code:

def check_bullet_alien_collisions(ai_settings,screen,stats,sb,ship,aliens,bullets,bombs):
"""Respond to bullet-alien collisions"""

collisions = pygame.sprite.groupcollide(bullets,aliens,True,True)

#Collect X-Y co-ordinates here

if collisions:
    for aliens in collisions.values():
        stats.score += ai_settings.alien_points * len(aliens)
        sb.prep_score()
        stats.aliens_hit += 1
        stats.calc_accuracy()
        sb.accuracy()
    check_high_score(stats,sb)

sentences: Unity: Restrict movement inside a gameobject (2D) I've been sort of trying my own thing but it's super buggy so I'd like to see what other people have done to create moveable spaces. In essence, I just want to restrict my character's movement to inside of a sprite. So one of my sprites is the character  and another one of my sprites is a box -- I want to make it so my character can't leave the box. I've been modifying transform.position on mouse click in order to move my character, but now I'm not sure if this was the smartest idea.

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:
Java create a Polygon for each island in tile game I am making a 2d top-down tile based game, which is randomly generated each new world.

What I want to do is create a Polygon (or other more appropriate shape I don't know of) for each landmass not disrupted by land, basically each unseparated landmass/island, I want to do this for where my player is to spawn in the world, I want to have it so it has a higher chance of spawning on the biggest landmass in the world, rather than spawning on a tiny several tile island. So, all I need to know is how would I create some sort of shape system to recognise different islands.

The reason I suggest a Polygon is because the player would randomly spawn in that area so it has to be accurate to the land, it can't start of by spawning in water nearby.

If a Polygon is obsolete for this idea, and another system would be better let me know.

sentences: How can I move objects pixel by pixel in the scene editor? I'm trying to find a way to move objects pixel-by-pixel(on my screen at least) in the scene editor. I tried a lot of different buttons but nothing seems to work, please tell me Unity has this functionality because doing it by mouse or by altering X and Y yourself is really tedious.

sentences:
Libgdx Scene2D second screen animating and accept input while still loading I'm currently developing an app Scene2D that involves a small number of screen switches.  I am having a problem that after calling set screen there appears to be a pause of a second or two (I think it's the non UI logic is being performed in the new screen constructor to aid setting up UI actors), which is fine.  But during that second pause.  It appears my second screen is already running in the background but not being rendered. I think this is happening because of two problems:

Animations and Actions that are supposed to begin when the second screen loads are already one or two seconds in progress by the time the second screen loads.
During the pause before the second screen loads, the first screen is still rendered in freeze frame, but any user input is queued and processed in the second screen after it renders! Meaning that the user is effectively clicking on things that are not yet rendered which can cause some problems for their experience.

I already am setting the input processor in the show method but it show appears to be called before the screen is actually visible and rendering frames.

Is there something I have misunderstood about the life cycle? Or common pitfalls I may have fallen into?  Only a problem on Android, Desktop is fine but possibly only because the loading times are too fast to notice either problem.

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:
Will this method of hashing player positions be effective in defeating FPS wall-hacks? For example using a class like below to Hold the player positions and only show the players to each other when their Distance is less than something, So the calculations are also used by the client's PC.

public struct SafeFloat {
private float offset;
private float value;

public SafeFloat (float value = 0) {
    offset = Random.Range(-1000, +1000);
    this.value = value + offset;
}

public float GetValue ()
{
    return value - offset;
}

public void Dispose ()
{
    offset = 0;
    value = 0;
}

public override string ToString()
{
    return GetValue().ToString();
}

public static SafeFloat operator +(SafeFloat f1, SafeFloat f2) {
    return new SafeFloat(f1.GetValue() + f2.GetValue());
}
// ...the same for the other operators
}

sentences:
How does an ECS work for a world subdivided into chunks (example)? I am trying to use an ECS for my 2d game at the moment. Up until now I had my world subdivided into chunks (as minecraft does) of size 64x64. They are loaded and drawn when they come onto screen. I did this to reduce the drawing calls.

How would something like this work in an ECS?
I would say my Chunks have the following properties at the moment: tile_is_water[64,64], humidity[64,64], sprite_batch (the thing that is drawn)

At some intervals I will need to call some kind of updatefunction which uses tile_is_water and humidity to generate a new sprite_batch (but not very often, these change rarely). On every frame I need to draw the sprite_batch. On every (or maybe every few) frame I need to check which areas are visible and set some kind of flag s.t. I only draw the visible ones.

It would help me a lot of someone could explain to me what the components, the entities and systems would be in this case.

Edit: To clarify. I don't have this modelled as an ECS yet and I have problems modelling this particular issue. What I have until now is just seperated everything into components:
Components: Is_Water_Area, HumidityArea, SpriteBatch
Is_Water_Area and HumidityArea just contain the corresponding 64x64 arrays and sprite_batch contains the drawable spritebatch.
I also have a BatchDrawer system that draws everything that has a SpriteBatch. But where do I do the updating of the SpriteBatch for example? Where do I check which areas are drawn?

For example I could just check this every frame or I could keep a list of drawable Areas and update that. But where would I keep such a list of the drawable areas?

sentences:
Camera LookAt position with fixed screen position I have a perspective "lookAt-type" camera. I'm trying to compute specific focus point of the camera, which should be placed in the middle of the screen: I also have a custom 3d point in world space, margin values in screen space and camera's tilt as inputs. I want to compute lookAt point, & camera distance with restriction, that input world space point has to be visible in the middle of the free screen space area (not affected by margin values) and it has to have a given tilt.

I'm able to compute this in 2D, but I'm lost in 3D. Any idea how to achieve this? Here's a sketch of the problem, red and blue area's are margin values of 0.5f in both x and y direction.

sentences:
Save game statistic in simple method? I wrote a script to save and load game statistic. It works fine. In this script, two levels have it own score and timer. So, I have to write level by level it own score and timer. The issue is if I have 100 or 200 levels in my game. I have to write for every level. Yes will work, but will take time. So, I was thinking if there any simple method to shift the number of lines like use List or anything else ?

public gameStatic dr;

void Awake()    {
    Load_game_end();
}

   public void Save_game_end()  {
    BinaryFormatter bf = new BinaryFormatter();
    FileStream data_file = File.Create(Application.persistentDataPath + "/WarWorld.datt");

    level_static data = new level_static();
    data.level1tv = dr.level1t; // level one
    data.level2tv = dr.level2t; // level two
    //
    data.timer1 = dr.finalTime1; // level one
    data.timer2 = dr.finalTime2; // level two
    //
    data.total_money = dr.total_money;

    bf.Serialize(data_file, data);
    data_file.Close();

    Debug.Log("Game full saved");

}

public void Load_game_end() {
    if (File.Exists (Application.persistentDataPath + "/WarWorld.datt"))
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream data_file = File.Open (Application.persistentDataPath + "/ballworlds.datt", FileMode.Open);
        level_static data = (level_static)bf.Deserialize(data_file);
        data_file.Close();

        dr.level1t= data.level1tv;
        dr.level2t = data.level2tv;
        //
        dr.finalTime1 = data.timer1;
        dr.finalTime2 = data.timer2;
        //
        dr.total_money = data.total_money;

        Debug.Log("Game full loaded");
    }

    else {
        Debug.Log("save not found");
    }

}

public void delete_save_file() {
    File.Delete(Application.persistentDataPath +"/WarWorld.datt");
    Debug.Log("delete save file");

}

[Serializable]
class level_static
{
    public float total_money;
    //
    public float level1tv; // height score level 1
    public float level2tv;

    //
    public float timer1; //  level 1 timer
    public float timer2;

}

sentences:
VS2013: Compiling Shaders with Shader Model 5.0 When I try to compile two HLSL files included in my project, the compilation fails with an error:

  Error error X4502: invalid vs_2_0 input semantic 'INSTANCE'

However, I notice it's trying to use shader model 2.0; when I'm trying to use 5.0:

Why is the shader compiler trying to use the 2.0 model when I've told VS to use 5.0? Or have I misunderstood?

sentences:
Looking to render video in game? I have recently been looking to add a feature which will allow me to render a movie\video into my game. I.e, something pre-rendered and played as the game starts.

I am using Java2D purely so I am curious if there are any frameworks out there that will allow me to do this in an active rendering environment.

Thanks.

sentences: Unity - Cube edges are jagged I am new to Unity. I have a basic setup following Brackeys tutorial. When in game mode, I see the red cube having jagged edges. I tried increasing the antialiasing in Unity to 8x but it did not work. I also tried turning on antialiasing in my Nvidia control panel. But the issue still persists.

sentences:
delaying enemy attacks I have an enemy attack script that when a raycast hits the player it deals damage to the player, however the enemy attacks at multiple times per second and I wish for the enemy to have to wait 1 second after it attacks the player before it can attack again. The script is here, the main focal point is the void update(). Any help is appreciated, let me know if I've missed out any needed details. :)
public class DamagePlayer : MonoBehaviour
{
    int attackDamage = 10;

    [SerializeField]
    float agroRange;

    [SerializeField]
    Transform castPoint;

    Rigidbody2D rb2d;

    bool isFacingLeft;

    // Start is called before the first frame update
    void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();

    }

    bool CanSeePlayer(float distance)
    {
        bool val = false;
        float castDist = distance;

        if (isFacingLeft == true)
        {
            castDist = -distance;
        }

        Vector2 endPos = castPoint.position + Vector3.right * castDist;
        RaycastHit2D hit = Physics2D.Linecast(castPoint.position, endPos, 1 << LayerMask.NameToLayer("Action"));

        if (hit.collider != null)
        {
            if (hit.collider.gameObject.CompareTag("Player"))
            {
                val = true;

            }
            else
            {
                val = false;
            }

            Debug.DrawLine(castPoint.position, endPos, Color.red);
        }
        else
        {
            Debug.DrawLine(castPoint.position, endPos, Color.green);
        }

        return val;
    }

    // Update is called once per frame
    void Update()
    {
        if (CanSeePlayer(agroRange))
        {
            PlayerHealth.currentHealth -= attackDamage;
            //Debug.Log("can see player");
        }
        else
        {

        }
    }
}

sentences:
Persisting unlocked characters in Player Prefs I am  working on a character selection menu in Unity.

If you have enough coins, you can buy your desired character. Once player buys one, that character must not be locked on game restart, the number of coins must not be changed again, and the lock image (a GameObject I defined under name "wood" and acts as a lock) must disappear.

Everything works fine when I buy one character, but when I buy another one, the previous one returns to locked mode, but its image (wood) has already disappeared (I mean, I should have enough coins to re-buy an already bought character).

I guess there must be something wrong with this code isPlanesold = PlayerPrefs.GetInt("isPlanesold"); because it changes as a character is bought.

Here is my script:

int isPlanesold;
public static int chnum; //character number that must be referenced on another scene
public Button WhitePlane;
public Button YellowPlane;
public GameObject wood1;
public GameObject wood2;

void Start () {

        PlayerPrefs.SetString ("BluePlane", "on");
        if (PlayerPrefs.GetString ("WhitePlane") == "on") {
            wood1.SetActive (false);
        }
        if (PlayerPrefs.GetString ("YellowPlane") == "on") {
            wood2.SetActive (false);
        }

                UIManager2.coin_score = PlayerPrefs.GetInt ("Score");
        isPlanesold = PlayerPrefs.GetInt ("isPlanesold");

}

            public void BuyWhitePlane () {

        if (isPlanesold == 1) {
            PlayerPrefs.SetInt ("isPlanesold", 1);
            chnum = 2;
            PlayerPrefs.Save ();
            SceneManager.LoadScene ("Menu2");
        } else if (UIManager2.coin_score >= 1) {
            PlayerPrefs.SetInt ("isPlanesold", 1);
            chnum = 2;
            PlayerPrefs.SetInt ("Score", UIManager2.coin_score--);
            PlayerPrefs.SetInt ("Score", UIManager2.coin_score);
            PlayerPrefs.Save ();
            PlayerPrefs.SetString ("WhitePlane", "on");
            SceneManager.LoadScene ("Menu2");

            }
        else
        {
            Debug.Log ("You Don't Have The Score");

        }

    }

    public void BuyYellowPlane () {

        if (isPlanesold == 2) {
            PlayerPrefs.SetInt ("isPlanesold", 2);
            chnum = 3;
            PlayerPrefs.Save ();
            SceneManager.LoadScene ("Menu2");
        } else if (UIManager2.coin_score >= 2) {
            PlayerPrefs.SetInt ("isPlanesold", 2);
            chnum = 3;
            PlayerPrefs.SetInt ("Score", UIManager2.coin_score -= 2);
            PlayerPrefs.SetInt ("Score", UIManager2.coin_score);
            PlayerPrefs.Save ();
            PlayerPrefs.SetString ("YellowPlane", "on");
            SceneManager.LoadScene ("Menu2");

        }
        else
        {
            Debug.Log ("You Don't Have The Score");

        }

    }

PlayerPrefs.SetString ("BluePlane", "on"); refers to a character that's unlocked by default.

sentences:
Custom Tile Collision Detection Has Trouble With Edges So, I'm writing my own game to expand on my abilities as a programmer. However, I have come to a writer's-block of sorts. The game I am building uses tile collision, but allows the player to be in an unaligned space (like at the edge of a tile rather than directly above it).

The code I have written to determine which tile the player is standing on is failing. On certain edges, when standing on top of the tile, the player will fall through the tile. Here is an example of this occurrence: http://i.imgur.com/CACfhIP.gifv

I have narrowed this down to this specific segment of code:
(Please note that SPRITE_WIDTH is 20, which also means 20 pixels)

BOOL changePos(Player* player, Level* level, int newX, int newY)
{
    int roundedY;
    int roundedX;

    if (newX <= player->pos.x)
        roundedX = roundDownTo(newX, SPRITE_WIDTH); //round down to a multiple of SPRITE_WIDTH
    else if (newX > player->pos.x)
        roundedX = roundUpTo(newX, SPRITE_WIDTH); //ditto but up

The problem seems to be that both parts of the if...else if... statement require the equality symbol to work correctly. Meaning that in the provided example, the fall-through glitch will happen to the tile on the left instead if I move the equality symbol to the else if portion.

I attempted to fix this issue by adding an else clause and removing the equality from the if...else if... parts. My method was to determine which half of the tile the player was on and determine if it required them to fall. So, my code became this:

BOOL changePos(Player* player, Level* level, int newX, int newY)
{
    int roundedY;
    int roundedX;

    if (newX < player->pos.x)
        roundedX = roundDownTo(newX, SPRITE_WIDTH);
    else if (newX > player->pos.x)
        roundedX = roundUpTo(newX, SPRITE_WIDTH);

    else
        if (newX%SPRITE_WIDTH >= SPRITE_WIDTH / 2)
            roundedX = roundDownTo(newX, SPRITE_WIDTH);
        else
            roundedX = roundUpTo(newX, SPRITE_WIDTH);

But this created an even stranger case where the middle part of the tile would cause a fall-through but the edges would work correctly on both the left and the right tile. This can be seen here: http://i.imgur.com/lTaUuzh.gifv

I've been at this all day (literally), I appreciate any help you can provide.

If I have not provided enough information, please let me know and I will do my best to provide it.

sentences:
How do I cap rendering of tiles in a 2D game with SDL? I have some boilerplate code working, I basically have a tile based map composed of just 3 colors, and some walls and render with SDL. The tiles are in a bmp file, but each tile inside it corresponds to an internal number of the type of tile(color, or wall).
I have pretty basic collision detection and it works, I can also detetc continuous presses, which allows me to move pretty much anywhere I want. I also have a moving camera, which follows the object.

The problem is that, the tile based map is bigger than the resolution, thus not all of the map can be displayed on the screen, but it's still rendered. I would like to cap it, but since this is new to me, I pretty much have no idea.

Although I cannot post all the code, as even though I am a newbie and the code pretty basic, it's already quite a few lines, I can post what I tried to do

void set_camera()
{
    //Center the camera over the dot
    camera.x = ( player.box.x + DOT_WIDTH / 2 ) - SCREEN_WIDTH / 2;
    camera.y = ( player.box.y + DOT_HEIGHT / 2 ) - SCREEN_HEIGHT / 2;

    //Keep the camera in bounds.
    if(camera.x < 0 )
    {
        camera.x = 0;
    }
    if(camera.y < 0 )
    {
        camera.y = 0;
    }
    if(camera.x > LEVEL_WIDTH - camera.w )
    {
        camera.x = LEVEL_WIDTH - camera.w;
    }
    if(camera.y > LEVEL_HEIGHT - camera.h )
    {
        camera.y = LEVEL_HEIGHT - camera.h;
    }
}

set_camera() is the function which calculates the camera position based on the player's positions. I won't pretend I know much about it.

Rectangle box = {0,0,0,0};

for(int t = 0; t < TOTAL_TILES; t++)
{
    if(box.x < (camera.x - TILE_WIDTH) || box.y > (camera.y - TILE_HEIGHT))
        apply_surface(box.x - camera.x, box.y - camera.y, surface, screen, &clips[tiles[t]]);

    box.x += TILE_WIDTH;

    //If we've gone too far
    if(box.x >= LEVEL_WIDTH)
    {
        //Move back
        box.x = 0;

        //Move to the next row
        box.y += TILE_HEIGHT;
    }
}

This is basically my render code. The for loop loops over 192 tiles stored in an int array, each with their own unique value describing the tile type(wall or one of three possible colored tiles).

box is an SDL_Rect containing the current position of the tile, which is calculated on render.

TILE_HEIGHT and TILE_WIDTH are of value 80.

So the cap is determined by

if(box.x < (camera.x - TILE_WIDTH) || box.y > (camera.y - TILE_HEIGHT))

However, this is just me playing with the values and see what doesn't break it. I pretty much have no idea how to calculate it.

My screen resolution is 1024/768, and the tile map is of size 1280/960.

sentences:
UE4.23 - Cast of child of GameUserSettings fails I've derived GameUserSettings to add a bunch of custom properties to it. I tried making accessible in blueprint by creating a static method that returns the current GameUserSettings cast to my Child Class.

 Custom_Settings * Custom_Settings::GetCustom_Settings() {
     return Cast<Custom_Settings>(GEngine->GameUserSettings);
 }

Unforunately, the cast fails and returns null, which leads to UE complaining about trying to access none in blueprint (naturally). There was a similar question here, but that led me nowhere, since I've already set DefaultEngine.ini to use my custom settings

 [/Script/Engine.Engine]
 GameUserSettingsClassName=/Script/MyGame.Custom_Settings

I've checked whether GEngine can fetch the Settings, and it appears it can. Does anybody have an idea why the cast might be failing?

sentences:
Linking Unreal Engine with OpenCV libraries built with RTTI on Linux Unreal Engine has a plugin for integrating with OpenCV. Currently that plugin works on Windows. I'm trying to modify this plugin to work on Linux. I've worked through many issues but I have one I can't resolve.
When I try to build the plugin without modification, I get this error:

cannot use typeid with -fno-rtti

The error is from a file any.h which is a part of the OpenCV FLANN feature set and appears to have been copied over from boost.
To address this, I enable RTTI for the module of the plugin I'm building. Unfortunately, this leads to load time errors like the following:

dlopen failed: /home/lvl-dev/Projects/TestOpenCVModules/Plugins/OpenCVLensDistortion/Binaries/Linux/libUE4Editor-OpenCVLensCalibration.so: undefined symbol: _ZTI7UObject
ModuleManager: Unable to load module '/home/lvl-dev/Projects/TestOpenCVModules/Plugins/OpenCVLensDistortion/Binaries/Linux/libUE4Editor-OpenCVLensCalibration.so' because the file couldn't be loaded by the OS.

As far as I can tell, this is because Unreal builds by default with '-fno-rtti'. And now the Unreal objects in my plugin expect RTTI information to be available for the Unreal objects when my libraries are loaded at runtime. I found you can pass RTLD_LAZY to dlopen(), which I thought would address this, but when I looked at the source it was already using it.
The next obvious thing is to just build everything with RTTI but I've been unable to accomplish this. I've seen on some forums that building Unreal with RTTI is possible after version 4.15 or so. However, when I've tried to build the engine with RTTI I get errors from attempting to link compiled third party dependencies that are now incompatible with Unreal (WebRTC for example). I'd really rather not work my way through building every Unreal dependency from source myself.
Strangely nothing is done to handle this issue on Windows. It seems the Microsoft linker and runtime handles both RTTI and non-RTTI definitions of the object without issue.
Is there a straight forward way to build and successfully run wtih C++ RTTI enabled?
Is there a way to mix RTTI and non-RTTI objects, as Microsoft seems to do, and suppress the link errors from the runtime?
Is there some solution I'm not considering?

sentences:
Random AI movement in Java I am making a maze game in Java, where you have to escape the maze without being caught by the randomly-moving AI.

The code I am using to decide which direction the enemy moves in causes the character to change direction way too fast. It currently chooses a random number, which corresponds to the direction in which the AI moves.

How can I edit this method so it only chooses a random number every 3 seconds?

if(new Random().nextInt(4) == 0){
    xMove = speed;
}
if(new Random().nextInt(4) == 1){
    xMove = -speed;
}
if(new Random().nextInt(4) == 2){
    yMove = speed;
}
if(new Random().nextInt(4) == 3){
    yMove = -speed;
}

sentences:
3D space indexing for nearest neighbor searching I am developing a CAD-like application where the user can draw (digitize) new geometries (points, polylines & polygons). While digitizing, I want the user to be able to (optionally) snap the points of the new shape onto points or lines of existing geometries. I have already written the snapping algorithm that computes a ray from the mouse position and finds a line segment between the ray and the closest geometry (point or line segment). My scene is totally static but may contain too many shapes, which makes brute force searching inefficient.

What would be a good way to index the existing geometries so that I could quickly filter most of them out and consider a smaller set (the ones roughly within distance X) in my snapping algorithm?

I was thinking of doing something similar to what OpenGL (I am using DirectX 9 in my app) provides with the GL_SELECT option, i.e. render my geometries on a bitmap, each one coded with a different color. However I am a bit worried since I will have to use a second device with a hidden window to achieve this.

Is there a 3D space partitioning data structure that I can use, which can efficiently compute the nearest neighbour to a ray?

sentences:
Composition and passing pointers to parent, or work inside namespaces My application right now has a Game class, which contains other classes that receive a Game pointer. Also these classes passes the Game* pointer to their subclasses. I do this to keep communication between objects. Is this a bad way to keep all communicated? This looks like a "god object" antipattern.

The only alternative I've found to avoid this is simply instanciate my objects globally, inside namespaces, like they did int his project https://github.com/thelaui/M.A.R.S. . But this also looks as an antipattern, where almost everything is global.

What is then the correct way to design a program where the objects keep communicated?

Or the objects shouldn't keep communicated? Which looks hard to make a game.

sentences:
DirectX11 - Color Interpolation Along Quad Diagonal Imagine that we have a vertex structure that looks like this:

struct Vertex
{
    XMFLOAT3 position;
    XMFLOAT4 color;
};

The vertex shader looks like this:

cbuffer MatrixBuffer
{
    matrix world;
    matrix view;
    matrix projection;
};

struct VertexInput
{
    float4 position : POSITION;
    float4 color    : COLOR;
};

struct PixelInput
{
    float4 position : SV_POSITION;
    float4 color    : COLOR;
};

PixelInput main(VertexInput input)
{
    PixelInput output;

    input.position.w = 1.0f;

    output.position = mul(input.position,  world);
    output.position = mul(output.position, view);
    output.position = mul(output.position, projection);

    output.color = input.color;

    return output;
}

And the pixel shader looks like this:

struct PixelInput
{
    float4 position : SV_POSITION;
    float4 color    : COLOR;
};

float4 main(PixelInput input) : SV_TARGET
{
    return input.color;
}

Now let's create a quad consisting of 2 triangles and the vertices A, B, C and D:

// Vertex A.
vertices[0].position = XMFLOAT3(-1.0f,  1.0f,  0.0f);
vertices[0].color    = XMFLOAT4( 0.5f,  0.5f,  0.5f,  1.0f);

// Vertex B.
vertices[1].position = XMFLOAT3( 1.0f,  1.0f,  0.0f);
vertices[1].color    = XMFLOAT4( 0.5f,  0.5f,  0.5f,  1.0f);

// Vertex C.
vertices[2].position = XMFLOAT3(-1.0f, -1.0f,  0.0f);
vertices[2].color    = XMFLOAT4( 0.5f,  0.5f,  0.5f,  1.0f);

// Vertex D.
vertices[3].position = XMFLOAT3( 1.0f, -1.0f,  0.0f);
vertices[3].color    = XMFLOAT4( 0.5f,  0.5f,  0.5f,  1.0f);

// 1st triangle.
indices[0] = 0; // Vertex A.
indices[1] = 3; // Vertex D.
indices[2] = 2; // Vertex C.

// 2nd triangle.
indices[3] = 0; // Vertex A.
indices[4] = 1; // Vertex B.
indices[5] = 3; // Vertex D.

This will result in a grey quad as shown in the image below. I've outlined the edges in red color to better illustrate the triangles:

Now imagine that we’d want our quad to have a different color in vertex A:

// Vertex A.
vertices[0].position = XMFLOAT3(-1.0f, 1.0f, 0.0f);
vertices[0].color    = XMFLOAT4( 0.0f, 0.0f, 0.0f, 1.0f);

That works as expected since there’s now an interpolation between the black color in vertex A and the grey color in vertices B, C and D. Let’s revert the previus changes and instead change the color of vertex C:

// Vertex C.
vertices[2].position = XMFLOAT3(-1.0f, -1.0f, 0.0f);
vertices[2].color    = XMFLOAT4( 0.0f,  0.0f, 0.0f, 1.0f);

As you can see, the interpolation is only done half of the way across the first triangle and not across the entire quad. This is because there's no edge between vertex C and vertex B.

Which brings us to my question:

I want the interpolation to go across the entire quad and not only across the triangle. So regardless of which vertex we decide to change the color of, the color interpolation should always go across the entire quad. Is there any efficient way of achieving this without adding more vertices and triangles?

An illustration of what I'm trying to achieve is shown in the image below:

Background

This is just a very brief explanation of the problems background in case that would make it easier for you to understand the problems roots and maybe help you with finding a better solution to the problem.

I'm trying to texture a terrain mesh in DirectX11. It's working, but I'm a bit unsatisfied with the result. When changing the terrain texture of a single vertex, the interpolation with the other vertices results in a hexagon shape instead of a squared shape:

As the red arrows illustrate, I'd like the texture to be interpolated all the way into the corners of the quads.

sentences:
SDL2 C++ How to make enemy move in random directions How do i make an Enemy move in random directions?
I tried this but it doesnt work how i want it to.. thats why im asking what i need to do, to achieve that? (Pseudo code would be cool)

 void Enemy::Update()
{
    Timer += Timer->GetTimeElapsed();
    int Random = (rand() % 4);
    if (Timer >= 2.0f)
    {
        switch (Random)
        {
        case(0):
            m_xPos += 10.0f * Timer->tElapsed();
        case(1):
            m_xPos -= 10.0f  * Timer->tElapsed();
        case(2):
            m_yPos -= 10.0f  * Timer->tElapsed();
        case(3):
            m_yPos += 10.0f  * Timer->tElapsed();
        }
    }
}

Thank you

Edit: This is the movement i get so far.

sentences:
What is inertia in a physics engine? Inertia seems to be useful in a physics engine, so useful that even in Box2DLite, a demo of Box2D it hasn't been omitted.

See this Body class from Box2DLite:

struct Body
{
    Body();
    void Set(const Vec2& w, float m);

    void AddForce(const Vec2& f)
    {
        force += f;
    }

    Vec2 position;
    float rotation;

    Vec2 velocity;
    float angularVelocity;

    Vec2 force;
    float torque;

    Vec2 width;

    float friction;
    float mass, invMass;
    float I, invI; //inertia and reverse inertia
};

In the implementation of the class, inertia is set as the mass multipled by something:

I = mass * (width.x * width.x + width.y * width.y) / 12.0f;
invI = 1.0f / I;

What does this formula means ? I understood from wikipedia that Inertia is how much something doesn't want to move but there's not much formulas in this article. Why is it useful in a physics engine ? How is it used in the context of a collision ? Is it compared to other bodies ?

sentences:
Glowing Effect and Blending I am using C++ and SDL and I am trying to get lines with a glowing effect as provided by the image of the game Defcon on the continental outlines.

How could I achieve this glow and blend of the color in 2D? What are some algorithms that I can implement or built in functions that some other graphical frame work has?

I attempted my own solution by rendering lines around the bright center line and reducing its hue but I believe that such method is too expensive in rendering. I need something more efficient.

sentences:
How do I get 'getchar()' to not block the input? I am working on designing a pong like game but converting a getchar() to getch() and getche(), respectively, but getchar() is blocking the input. I am using C++ code, and while there is the ncurses library, I heard that this is a better approach; I am only needing to update this one command.

How do I get getchar() to not block the input?

The code is as follows:

#include<iostream>
#include <termios.h>
#include <stdio.h>

//Prototypes
char inputReader();
void updateWorld();
void renderWorld();
void initTermios(int echo);
void resetTermios(void);
char getch_(int echo);
char getch(void);
char getche(void);

static struct termios oldChars, newChars;
int main()
{
   bool running = true;

   do
   {
      if(getche() == 'q')
      {
         running = false;
      }
      updateWorld();
      renderWorld();
   }

   while(running);
   std::cout << "I exited the loop";
   return 0;
}

char inputReader()
{
   return getch();
}

void updateWorld()
{
  std::cout << "I am updating the world" << std::endl;
}

void renderWorld() {}

void initTermios(int echo) //struct termios &oldChars, struct termios &newChars)
{
  tcgetattr(0, &oldChars); /* grab old terminal i/o settings */
  newChars = oldChars; /* make new settings same as old settings */
  newChars.c_lflag &= ~ICANON; /* disable buffered i/o */
  newChars.c_lflag &= echo ? ECHO : ~ECHO; /* set echo mode */
  tcsetattr(0, TCSANOW, &newChars); /* use these new terminal i/o settings now */
}

/* Restore old terminal i/o settings */
void resetTermios(void)//struct termios &oldChars)
{
  tcsetattr(0, TCSANOW, &oldChars);
}

/* Read 1 character - echo defines echo mode */
char getch_(int echo)
{
  char ch;
  initTermios(echo); //oldChars, newChars);
  ch = getchar();
  resetTermios();//oldChars);
  return ch;
}

/* Read 1 character without echo */
char getch(void)
{
  return getch_(0);
}

/* Read 1 character with echo */
char getche(void)
{
  return getch_(1);
}

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:
LibGDX - How to do more things asynchronously Most documentation only mentions how to load assets asynchronously, eg with code similar to

private void render(float delta){
  if (assetManager.update()){
     // ** HERE ** //
     game.setScreen(new MainGameScreen(game));
  } else {
    progress = assetManager.getProgress();
  }

  // draw progress bar or whatever
}

but what if, as part of game initialization, I have to do other things before switching to the main game screen (marked with ** HERE ** in the above code)? Sure, the user is still seeing the splash screen, but what if I wanted to do these things in background as well, and give some sign of progress (another progress bar, or whatever). I haven't found examples of similar things (or perhaps I haven't looked hard enough).

sentences:
What's wrong with this camera implementation? I'm using WebGL and glMatrix and I implemented a camera. When a move backward, no problem. But when I move to the side and particularly forward, the camera becomes all glitchy. I implemented almost exactly the same camera before in C++ and it worked perfectly. I put the whole code on jsFiddle (with glMatrix because it's not in the list and I didn't find a url, sry).

https://jsfiddle.net/ydx0Lr1v/14/

Click and move the mouse to move around.

Also, the more I decrease the speed of the camera movement, the more it works well. I put a high speed to dramatize the effect. I know I should make the speed of the camera depend on the time between each frame, but I haven't implemented an fps counter yet.

Thanks!

Edit: Hum, that's strange. In jsFiddle the camera seems to work better when moving forward.

sentences:
How to rotate actors around the actor like a satellite around the earth? I'm not a pro in LibGDX and physics but I know basics, vectors, actor's actions and so.

I'm trying to achieve a movement like on the gif below:

For now, let's say that I have a stage and a central actor that the moon and comet will rotate around.

The problem is here that I have no idea if this is achievable with 2D. Should I implement some sort of 3D in LibGDX?

Also, is there a way so these objects move in a 'random' path, not the straight line like the comet below? (Moon is a little bit randomized)

I know that this question is too broad, but I really didn't know where to ask about this. I'm here to learn cause I always wanted to build a thing like this. I personally think that this is achievable with LibGDX's actions cause I saw something similiar somewhere.

If someone could point me the way I would be grateful :) Thanks!

sentences:
HIGH energy consumption in Empty Scene Unity iOS I am struggling from quite long about this issue where I am having High Energy Impact in Unity 2019.2.16f1 on iOS platform and it doesn't matter which device I am using. It occurs on iPhone6 to iPhoneX also I tried in an empty scene and checked stats through xCode and still bar is in Very High. Can someone explain to me what is going on? because of this device gets heat up quickly.

Below are stats with empty scene.

I have tried following still Very High:

Framerate to 30
SetResolution to 720 x 1080
Compressing Textures
Multi-threaded Rendering enabled and disabled
Auto Graphics API turned on and off in player setting

Though I am making game and I don't want to set resolution too low or to compress textures, I want as much attractive graphics as unity can offer.

Also is this estimation of GPU Utilization calculated on based on total capacity of GPU vs how much the app is taking at the moment? I am totally blocked here and I need to improve energy impact of my app.

sentences:
Random Ghost Behavior in PacMan Clone Not Random? I'm currently programming a PacMan clone as my first ever game with the XNA Game Studio before eventually going to DirectX.

As a first ever game, lots of things have given me great headaches, especially collision detection with the walls.

The problem I have now is the "AI" I have implemented for the ghosts. It's wish-wash, really. The basic method is that, if the Ghost runs into a corner, it will change its speed vector, and ultimately its direction.

However, the seed seems to be giving me the same pattern. If I launch them from the same corner multiple times, they keep taking the same direction. They have only rarely ever not taken the same route before getting stuck.

I'm not sure how much code can be posted here, but this is my current algorithm. Beware, it's not very pretty at the moment. It was implemented just to see if it's viable. Now I just want it to work properly before refactoring it and making it more intelligent.

        // OMG! Is the ghost trying to hit a wall? Ha! No wall-hacking for you!
        if (!wall_.Collides(frameSize_, pos_, direction_))
            pos_ += direction_;
        else
        {
            // a and b will change speed.
            // if a and b are both 1 (diagonal vector), then c will determine
            // which value a or b shall be taken.
            // d negates the values for reversed direction.
            Random rand = new Random();
            int a, b, c, d;
            a = b = 0;
            while (0 == a && 0 == b)
            {
                a = rand.Next(2);
                b = rand.Next(2);
            }

            if (1 == a && 1 == b)
            {
                c = rand.Next(2);
                if (0 == c)
                    spd_ = new Vector2(a * 2, 0);
                else
                    spd_ = new Vector2(0, b * 2);
            }
            else
            {
                d = rand.Next(2);
                if (1 == d)
                {
                    if (1 == a)
                        spd_ = new Vector2(a * 2, 0);
                    else
                        spd_ = new Vector2(0, b * 2);
                }
                else
                {
                    if (1 == a)
                        spd_ = new Vector2(-a * 2, 0);
                    else
                        spd_ = new Vector2(-b * 2, 0);
                }
            }
        }

Addendum: What I also meant to add is that the ghosts get stuck eventually. They stop taking corner with a different direction. I've waited for about 20-40 tries, but they simply reversed direction. This happened repeatedly with several restarts of the game.

sentences:
3D rotation matrices deform object while rotating I'm writing a small 3D renderer (using an orthographic projection right now).

I've run into some trouble with my 3D rotation matrices. They seem to squeeze my 3D object (a box primitive) at certain angles.

Here's a live demo (only tested in Google Chrome):
http://dl.dropbox.com/u/109400107/3D/index.html

The box is viewed from the top along the Y axis and is rotating around the X and Z axis.

These are my 3 rotation matrices (Only rX and rZ are being used):

var rX = new Matrix([
        [1, 0, 0],
        [0, Math.cos(radiants), -Math.sin(radiants)],
        [0, Math.sin(radiants), Math.cos(radiants)]
    ]);

    var rY = new Matrix([
        [Math.cos(radiants), 0, Math.sin(radiants)],
        [0, 1, 0],
        [-Math.sin(radiants), 0, Math.cos(radiants)]
    ]);

    var rZ = new Matrix([
        [Math.cos(radiants), -Math.sin(radiants), 0],
        [Math.sin(radiants), Math.cos(radiants), 0],
        [0, 0, 1]
    ]);

Before projecting the verticies I multiply them by rZ and rX like so:

vert1.multiply(rZ);
vert1.multiply(rX);

vert2.multiply(rZ);
vert2.multiply(rX);

vert3.multiply(rZ);
vert3.multiply(rX);

The projection itself looks like this:

bX = (pos.x + (vert1.x*scale));
bY = (pos.y + (vert1.z*scale));

Where "pos.x" and "pos.y" is an offset for centering the box on the screen.

I just can't seem to find a solution to this and I'm still relativly new to working with Matricies.

You can view the source-code of the demo page if you want to see the whole thing.

sentences:
Making my characters modular I'm making a school-based sandbox adventure game in Unity. I need a lot of NPCs with different apperances. I dreaded this since I don't have fun doing art and it is usually the reason I end up becoming burnt out of projects.

My solution for this was to segregate parts of the characters by color. The skin being green, hair being blue, shirt being red and trousers/leg wear being yellow. Then, I would use a shader to change these colors to something else.

The result is this sprite sheet:

and the ability to easily change the apperance of my NPCs to make them look different from eachother but there's still an issue.

A lot of the characters have the same hair style etc. Not to mention when I make a new hair style for a female, I have to then draw that style 3-4 more times for the different combinations of clothes.

The solution for this that would work ideally would be a modular apporach. I would only need to draw the sprite once and just swap out different clothing combinations. I have attempted this before but the main issue that kept on coming up was the different sprites not lining up, especially when changing the different sprites.

The art style is pixel art so they have to line up perfectly to look nice. How should I go about doing this to ensure I can fit every sprite together perfectly, no matter the combinations I choose?

sentences:
Testing Multiplayer Browser Game on Single Computer I am writing a multiplay browser based game and am running into an issue with playtesting simple interactions. When a browser window loses focus is stops running requestAnimationFrame calls. This effectively pauses the state all visuals when focus is lost.

I would like to have two instances of the game running at the same time. I could playtest in one window and observe how a thirdparty would see those actions in another window.

Right now I am only able to toggle between the two windows and see teleportation like behavior as the client state catches up to the new server state.

I am not sure how, without setting up a second computer, I might test this. Anyone have any experience with this or any advice?

sentences:
Improving SpriteBatch performance for tiles I realize this is a variation on what has got to be a common question, but after reading several (good answers) I'm no closer to a solution here.  So here's my situation:

I'm making a 2D game which has (among some other things) a tiled world, and so, drawing this world implies drawing a jillion tiles each frame (depending on resolution: it's roughly a 64x32 tile with some transparency).

Now I want the user to be able to maximize the game (or fullscreen mode, actually, as its a bit more efficient) and instead of scaling textures (bleagh) this will just allow lots and lots of tiles to be shown at once.  Which is great!

But it turns out this makes upward of 2000 tiles on the screen each time, and this is framerate-limiting (I've commented out enough other parts of the game to make sure this is the bottleneck).  It gets worse if I use multiple source rectangles on the same texture (I use a tilesheet; I believe changing textures entirely makes things worse), or if you tint the tiles, or whatever.

So, the general question is this:

  What are some general methods for improving the drawing of thousands of repetitive sprites?

Answers pertaining to XNA's SpriteBatch would be helpful but I'm equally happy with general theory.  Also, any tricks pertaining to this situation in particular (drawing a tiled world efficiently) are also welcome.

I really do want to draw all of them, though, and I need the SpriteMode.BackToFront to be active, because I use the layering quite essentially.

I don't have any easily digested sample code since the method has become somewhat complicated, but no extra tiles are being "drawn," and all the drawing is inside one SpriteBatch.Begin / SpriteBatch.End call.

sentences:
C# Game Setting message Takes away first character So If you set it to like

  abcdefg

it will come out like

  bcdefg

Here's changing the message

Here's the result

Here's the code

//Set Welcome msg
else if (Type == 6)
{
    if (Character.Network.Stall.isOpened) return;
    short length = Reader.Int16();
    Character.Network.Stall.WelcomeMsg = Reader.Text3();
    Character.Network.Stall.Send(Packet.StallWelcome(Character.Network.Stall.WelcomeMsg));
}

Any help?

sentences:
How can I set up potentially dozens of cameras rendering to targets without killing performance? I'm thinking through how I'd do a particular trick for playing cards with animated 3D faces. Setting up a single card is pretty trivial. I would create another camera somewhere, maybe restrict some layers so it'll only show what I want it to show so I don't have to worry what's behind it, put an object in front of it that is the basis of the card, have the camera render to a texture, and put that texture on a quad (the card) with the same aspect ratio. Now whenever the main camera views the card, regardless of angle, the card displays what the other camera sees.

I don't believe this approach would scale well as I'd have to duplicate everything for every card. The way I imagine it, there could be dozens of cards visible at once so every frame would require rending all of them. Even at low qualities that sounds bad for performance. Also the main reason I want to animate cards is to have them respond to input and actions happening to the cards so two instances of the same card won't show exactly the same thing. Another thing is where would I place all these cameras and their models in the 3D space so that they won't see each other? I could put them on top of each other and use layers to only capture what I want but something doesn't feel right about having dozens of layers.

How would I begin to pull this off on a scale of dozens of cards?

sentences:
What are some good game development programs for kids? I know a very bright little boy who excels in math, but at home he's glued to his Nintendo DS.

When I asked him what he wanted to do when he grew up he said "Make video games!"

I remember a few years ago there was mention of a MIT software called Scratch and I thought maybe this kid can do want he wants to do.

Has anyone used any of the "game development" for kids softwares out there? Can you recommend any?

sentences:
Gamepad default trigger identification in Windows I'm currently writing an interface driver for my Moga Power Pro controller on Windows.  I'd like to release it for others to use, but first I have some questions on expected default mappings for the triggers.

Specifically, how do other gamepads map the triggers, as viewed from the Windows joy.cpl Game Controllers panel?  And which axis are they normally mapped to?  Some axes default to the center value, others can default to zero, and the different axes might be treated differently inside games.  Triggers are naturally zero-to-full, but I don't want someone to download my interface driver and suddenly find the triggers are always active because Windows thinks the axis ought to be centered and reads it always tilted to one side.

I realize every controller is different, so this may be a bit subjective, but the closer I can set it to some form of standard the better.  Or is this something I shouldn't even need to worry about, that games which expect a trigger input will handle on their own?

sentences:
Where to create the vertex buffers? Please note that this is purely an architectural/design question. And sorry for the long post, there are a lot of "thinking out loud" here.

I'm working on a simple graphics engine (as a universtiy research project) and I'm stuck with a decision. I'm trying to abstract every low level API call (so there is no direct gl/d3d call in the high level of code) making the "engine" basically graphics-API-independent.

Let's say I have a class that can represent the source of any geometry (eg. positions, normals, texcoords, etc). The attributes provided can vary from geometry to geometry, there is no guarantee that every geometry contains all of the possible attributes.

I also have the traditional Scene/GameObject/Component/etc classes: a GameObject can be added to the Scene and a GameObject can contain any number of Components.

Lastly, there are multiple Renderers that iterate over a certain set of "things" and use the RenderDevice to issue graphics commands (like setting states, creating resources, executing draw calls, etc).

I'm wondering where I should create/store the actual vertex buffer(s), etc. As far as I know, it is the best to have the least amount of different vertex layouts. Also, the vertex layout is tightly coupled to the shader (especially in DX11+) so it seems logical that the renderer specifies a vertex struct with a layout descriptor. And this was my initial idea.

However, this means that only the renderer knows how to align/store data interleaved from the individual components of the geometry source. And this means that the renderer should create the actual vertex buffers. (This would also help with static batching, since the batching logic depends on the actual rendering task).

However with this approach a "GeometrySource" might be stored in multiple vertex buffers. For example the ShadowMapRenderer requires only the position component of the geometry. Also it can batch every static geometry into a single vertex buffer since there will be no state/uniform/etc changes between the draw calls.

My very first approach (years ago) was that the GeometrySource self-contained a vertex buffer with a vertex layout descriptor. However there are multiple problems with this approach:

every (even the smallest one) geometry would be stored in separate buffers which would cause a big driver overhead
in the modern graphics APIs (eg. DX11+) the vertex layout is tightly coupled to the shader that will be used to render that geometry (see)
the vertex layout should be checked before rendering (does the buffer provide every necessary attribute with the right format?)

So I don't think that this approach would be beneficial. What is a sensible alternative?

Also, there are multiple stack*** posts, but unfortunately, I couldn't find my answer in these:

https://stackoverflow.com/questions/21347636/dx11-inputlayout-cannot-be-set-to-multiple-shaders
Creating Input layouts for different vertex types
How do commercial games engines organise the index/vertex buffers?

sentences:
How to set keys for emission on/off for a prefab? I am making a prototype for a Mario game and am having difficulty completing a canned animation for a prefab. There is an item box asset that has 3 materials and an "ItemGet" animation. One of these materials has an active emission property that is supposed to turn off during a specific frame of the "ItemGet" animation. These boxes will have an "Active" and "Inactive" state.

While "Active", the item box just bobs up and down and IF Mario hits the trigger, the "ItemGet" animation plays (and the player gets a unique item). The box then becomes "Inactive".
While "Inactive", no animations play, the emission effect is gone and the trigger cannot be reactivated.

Challenges:

finding the correct property to set a keyframe for in the Animations panel.
Making sure Active versions of the prefab remain Active after any ItemBox becomes Inactive and that all materials don't change when GetItem plays.

Ideas:

Instead of keying the emission on/off property (assuming that exists and does what I think it does; trouble finding it), swap the materials.
( . . . ), swap the mesh.

Can somebody please help me find a viable way to finish this animation that fits this object's intended use-case?

sentences:
How to make local keyboard input move only the local player, not everyone in networked multiplayer? I am working on Unity Networking and following this Tanks Networking tutorial:

https://www.youtube.com/watch?v=V6wEvT6G92M

Problem is that the keyboard inputs move all the tanks in the scene. It is not detecting the local tank. And when I run the game all tanks shows the same movement but it is not giving any error. I have followed all steps in the tutorial and searched all solutions on the google. This step in Tutorial is at 11:48.

Implemented Code is:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
using UnityEngine.Networking;

public class TankController : NetworkBehaviour {

// Use this for initialization

[Header("Movement Variables")]
[SerializeField] float movementSpeed = 5.0f;
[SerializeField] float turnSpeed = 45.0f;

[Header("Camera Position Variables")]
[SerializeField] float cameraDistance = 16f;
[SerializeField] float cameraHeight = 16f;

Rigidbody localRigidBody;
Transform mainCamera;
Vector3 cameraOffset;

void Start () {
    if (!isLocalPlayer)
    {
        Destroy(this);
        return;
    }
        localRigidBody = GetComponent<Rigidbody>();
        cameraOffset = new Vector3(0f, cameraHeight, -cameraDistance);
        mainCamera = Camera.main.transform;
        MoveCamera();

}

// Update is called once per frame
void FixedUpdate () {

        float turnAmount = CrossPlatformInputManager.GetAxis("HorizontalUI");
        float moveAmount = CrossPlatformInputManager.GetAxis("VerticalUI");

        Vector3 deltaTranslation = transform.position + transform.forward * movementSpeed * moveAmount * Time.deltaTime;
        localRigidBody.MovePosition(deltaTranslation);

        Quaternion deltaRotation = Quaternion.Euler(turnSpeed * new Vector3(0, turnAmount, 0) * Time.deltaTime);
        localRigidBody.MoveRotation(localRigidBody.rotation * deltaRotation);

        MoveCamera();

}

void MoveCamera() {
        mainCamera.position = transform.position;
        mainCamera.rotation = transform.rotation;
        mainCamera.Translate(cameraOffset);
        mainCamera.LookAt(transform);

}
}

I have also checked the auto create player in the spawn info as suggested in some solutions.

sentences:
How do I make my main character move towards an object? LibGDX/Java What I want to happen is for my player to bounce from spring to another. For example take the illustration below:

Here's my code (what I've tried to do so far). This gets called in an update()method

public void springCollision(Box containsSpring) {
        // player object
        Player player = ((Player) this.object);
        // first spring
        Spring boxSpring = containsSpring.getSpring();
        // second spring
        Spring platformSpring = containsSpring.getPartnerPlatform().getSpring();
        // if player collides with first spring
        if (player.getRect().overlaps(boxSpring.getRect())) {
            // distance in x between first & second spring
            float dx = platformSpring.getxPos()
                    + platformSpring.getSprite().getWidth()
                    - boxSpring.getxPos() - player.getSprite().getWidth();
            // distance in y between first & second spring
            float dy = platformSpring.getyPos() - boxSpring.getyPos();
            Vector2 directionToSpring = new Vector2(dx, dy);
            // normalise vector then set player speed
            player.setxSpeed(directionToSpring.nor().x);
            player.setySpeed(directionToSpring.nor().y + player.getGravity());
        }
    }

What currently happens is that when he jumps onto a spring his jump just continues but in slow motion for some reason. Can anyone see why my algorithm doesn't work? Let me know if the comments are unclear

sentences:
C++ and SDL Trouble Creating a STL Vector of a Game Object I am trying to create a Space Invaders clone using C++ and SDL. The problem I am having is in trying to create Waves of Enemies. I am trying to model this by making my Waves a vector of 8 Enemy objects.

My Enemy constructor takes two arguments, an x and y offset. My Wave constructor also takes two arguments, an x and y offset. What I am trying to do is have my Wave constructor initialize a vector of Enemies, and have each enemy given a different x offset so that they are spaced out appropriately.

Enemy::Enemy(int x, int y)
{
    box.x = x;
    box.y = y;
    box.w = ENEMY_WIDTH;
    box.h = ENEMY_HEIGHT;

    xVel = ENEMY_WIDTH / 2;
}

Wave::Wave(int x, int y)
{
    box.x = x;
    box.y = y;
    box.w = WAVE_WIDTH;
    box.y = WAVE_HEIGHT;

    xVel = (-1)*ENEMY_WIDTH;
    yVel = 0;

    std::vector<Enemy> enemyWave;
    for (int i = 0; i < enemyWave.size(); i++)
    {
        Enemy temp(box.x + ((ENEMY_WIDTH + 16) * i), box.y);
        enemyWave.push_back(temp);
    }
}

I guess what I am asking is if there is a cleaner, more elegant way to do this sort of initialization with vectors, or if this is right at all. Any help is greatly appreciated.

sentences:
How can one create "network effects" in a game as it scales? Is it possible to create network effects in a game? How?

Usually a product with network effects present gets more valuable to a user as more people have the same product. Examples can be Skype or Facebook. The more people are using them, the more it's important to a single user.

Does it even matter in games?

sentences: Java LWJGL - How can I click to interact with objects? I want to be able to click on a monster to walk to him and start attacking him. The part that doesnt make sense to me is the conversion between the mouse position, and the actual terrain position. There are camera angles to worry about, heights, seperate terrains, how is this done???? I am using Java LWJGL and rendering with OpenGL 4.4

sentences:
How do I detect collision between movie clips? I know there are some methods you can use, like hittestPoint and so on, but I want to see where my movie clip collides with another another movie clip. Are there any other methods I can use?

I have had trouble finding a good introduction to game physics, and I would like to know how to something like this, properly.

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:
Developing internet sweepstake games I have absolutely no idea about game developing but want to know following things about internet sweepstake games: Click on demo and play any of the game.

What technology (programming language) is used to develop these games. e.g. Flash, Silverlight, etc.
If I wish to develop such game(s) what is the best technology to use, how much time it might take to learn and develop a simple commercial product.
Is the algorithm/code behind the scene re-usable while changing the front graphics. I mean a scalable/adjustible game.
In case I wish to hire a game programmer what would be the approximate cost or per/hr charge for such developer.
Any good books or online tutorial/videos to learn/see this in action?

Or any other ideas or suggestions?
Sorry if these are lot of questions but this is the only good place I see asking such questions. I will more than happy to post them as separate questions if that is necessary.

sentences:
2D Rotation Transform Matrix Issues I'm stuck on my computer graphics class homework. I'm sorry if this is not right place to ask. I think this is closest thing to computer graphics.

My assignment is to create basic 2D colored polygons at original position and another same polygon transformed to new location.

I am required to implement translation, rotation, scale using transform matrix. I believe I wrote my translation and scale correctly but I think rotation is having issues and I can't seem to figure what's wrong. Can you point out what's wrong?

This is what image is supposed to look like.

Here's how I did it, I stored 3x3 transform matrix for each polygon. The Driver code provided by my professor, will call transformation functions, translate(x,y), rotate(deg), scale(x,y), and clearTransform(), to modify the matrix of each polygon. It does not modify polygon's vertices until it's the time to render the whole image. When it is time to render, I multiplied the transform matrix with each vertex of the polygon. After the multiplication, I fed the new vertices to drawPoly() function and we get an image.

Here are two functions that I believe works correctly.
Translation code:

transform[0][2] = x + transform[0][2];
transform[1][2] = y + transform[1][2];

Scale code:

transform[0][0] = x * transform[0][0];
transform[1][1] = y * transform[1][1];

Now, here's my rotation code.

float radian = 0.0174532925;
transform[0][0] = std::cos(degrees*radian) * transform[0][0];
if(transform[0][1] == 0){
    transform[0][1] = -(std::sin(degrees*radian));
}else{
    transform[0][1] = -(std::sin(degrees*radian)) * transform[0][1];
}
if(transform[1][0] == 0){
    transform[1][0] = std::sin(degrees*radian);
}else{
    transform[1][0] = std::sin(degrees*radian) * transform[1][0];
}
transform[1][1] = std::cos(degrees*radian) * transform[1][1];

So far how I understand it, those 'if' statements are necessary for rotation because the identity(original) transform matrix is supposed to only have ones on middle diagonal and zeros everywhere. If I tried to apply sine functions on that zero, it will remain zero and image will scale instead of rotate.

What's the error in the code that is causing my image to show up incorrectly?

sentences:
How do I draw text once a countdown ends? I created a countdown in Game Maker using a variable of time. The countdown works properly and is displayed at the proper coordinates. However, when the countdown reaches zero, I want to make the countdown disappear and display "GO" instead.

How can I do that?

sentences:
Midpoint Displacement 1D - How to properly reduce my random number range? So I'm trying to implement this http://www.gameprogrammer.com/fractal.html#midpoint algorithm, to generate myself a terrain.
In the tutorial is said:

OK, before we go into 2D fractal surfaces, you need to know about the roughness constant. This is the value which will determine how much the random number range is reduced each time through the loop and, therefore, will determine the roughness of the resulting fractal. The sample code uses a floating-point number in the range 0.0 to 1.0 and calls it H. 2(-H) is therefore a number in the range 1.0 (for small H) to 0.5 (for large H). The random number range can be multiplied by this amount each time through the loop. With H set to 1.0, the random number range will be halved each time through the loop, resulting in a very smooth fractal. With H set to 0.0, the range will not be reduced at all, resulting in something quite jagged.

Let's say rand_start and rand_end are the starting and ending values that a random number can be generated by using for example random.uniform(rand_start, rand_end) or random.uniform(-1.0, 1.0)

Then I must reduce the number range so I do:

rand_start *= H * (pow(2, -H))

rand_end *= H * (pow(2, -H))

With H set to 1.0 for example.Both rand_start and rand_end will be lowered by half and in the next iteration the random value will be between -0.5 and 0.5.
All clear, just like the tutorial said it.

Here is the problem:

My x coordinate starts at 0 in the left side of the window, and y coordinate in the top of the window, in Pygame

I draw my line at this coordinates:

line_start = (0, 300)

line_end = (WINDOWWIDTH, 300)

How to reduce my random range if start and end values are initialized like that:

rand_start = 400

rand_end = 200

Again, my line starts at y coordinate 300 and the highest the midpoint can be displaced is 200, the lowest - 400.

Any code required will be provided asap.

sentences:
Design Pattern for card game objects In my game, I will have more than 100 types of cards,
and before the actual game, player can select 6 of them and will be shown as 6 buttons on the scene.
The card have its own ID, card name, and a 3D game Object prefab, and have a function call perfromCardAction which performs different actions.

public class cardA:cardInterface {
     private int ID;
     private string cardName;
     private Texture2D cardImage;
     private GameObject card3DObject;

     ...Constructor...

     private override void prefromCardAction(){
     ...do Card A action...
     }
}

A script cardManager should get the 6 object player selected and stored in an array.
And set the button's Image as card's 2D image.
when the button is click, that card's prefromCardAction should be called.

So my main quesstions are:
What pattern should I used so that easier manage my cards objects?
I believe I should use Factory so that I can do something like:

selectedCardArray[0]=CardFactory.createCard("CardA");

If yes, I would like to ask:
How should I code all my card class (cardA, cardB, cardC...)?
separate into different c# script and implement cardInterface and override the perfromCardAction?

sentences:
How would you generate details like trees, water or caves in a 2D terrain? Yesterday I made a post about generating a 2D planet, which resulted in this:

I did it by subtracting a radial gradient from simplex noise (explained in my other post).

Now of course thats a bit boring, what technique should I use to add details like trees, lakes or caves? Would be able to do something like this (but of course across the whole planet):

I know doing it on a planet would make it a bit harder, because you would have to know if f.E. the tree is on the north of the planet or the south. To make it easier, if you want, just assume a flat 2D surface like this:

sentences:
2015 android multiplayer server based Implementation There are a lot of old posts about multiplayer implementations on SE, so i'm looking for an up-to-date answer. What is the best server-client implementation of real-time multiplayer now? I have an Amazon MYSQL Server hosted by digitalOcean, I've made a REST web service that communicates with the Server and Android app, and I have my Android app running receiving and sending data.

I want to add a multiplayer minigame to what I have right now where 2 players would see the same screen and one user would receive location data (which i'm already storing in the server and sending to all devices with the app) from the other and would have an interface to interact with the data they're receiving (like building towers around the location and deploying units). The computer AI would need to be synced between both devices.

The matches would last maybe 3 minutes tops and the location data would have to be streamed constantly as well as the interaction from the other user. The computer AI would be streamed to both.

I've done a lot of research on the topic, and most of my experience was from a bluetooth P2P game I created in 2011 using sockets. So what are the most common implementations today? What are the most common libraries? I'm currently using Android Studio for the app and Notepad++ for the PHP webservice.

EDIT:
I'm fine with answers promoting their own products, but explain how your product is better than Google's Game Services (which appears to be the best choice right now). I'm really looking for a way to implement the multiplayer with the server I'm already using.

sentences:
How can I render text using the new(ish) JOGL GPU curve rendering classes? I'm fairly new to OpenGL/JOGL, working through various tutorials and books and making steady progress. Text, however, is an area where I'm stuck. I figured out one way using BufferedImage and Graphics2D to draw strings and then swizzle the pixels and copy to an OpenGL texture, but the quality is low, it is resolution dependent, and it's not efficient.

I found this: http://forum.jogamp.org/GPU-based-Resolution-Independent-Curve-Rendering-td2764277.html. Unfortunately while there are some demos in the GitHub repo I can't quite get my head around them. The code I've tried to use is below:

In the init() method:

    InputStream fontFile = getClass().getResourceAsStream("media/futura.ttf");
    try {
        font = FontFactory.get(fontFile, true);
    } catch (IOException e) {
        System.err.println("Couldn't open font!");
        e.printStackTrace();
    }

    RenderState renderState = RenderState.createRenderState(SVertex.factory());
    renderState.setColorStatic(1, 1, 1, 1);
    renderState.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);

    renderer = RegionRenderer.create(renderState, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
    renderer.init(gl, Region.VBAA_RENDERING_BIT);

    util = new TextRegionUtil(Region.VBAA_RENDERING_BIT);

In the display() method:

    PMVMatrix pmv = renderer.getMatrix();
    pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
    pmv.glLoadIdentity();
    pmv.glTranslatef(0, 0, -300);
    float pixelSize = font.getPixelSize(32, 96);
    util.drawString3D(gl, renderer, font, pixelSize, "Test", null, samples);

I've searched and searched for a tutorial on this stuff or a simple, commented code example explaining how it works but to no avail. If anyone can help me I'd be extremely grateful!

sentences:
Right click a location and move towards it (C# Monogame) I would like the player to move towards the mouse when the player right clicks. The player does move, but doesn't stop when the player reaches the point.
Here is the code.

void playerUpdate(GameTime gameTime)
    {
        float dT = (float)gameTime.ElapsedGameTime.TotalSeconds;
        player.pos.X += player.vel.X * dT;
        player.pos.Y += player.vel.Y * dT;

        player.checkDest(x2y2, player.pos);

        if ((mouse.RightButton == ButtonState.Pressed) && (player.moving == false))
        {
            x2y2.X = mouse.X;
            x2y2.Y = mouse.Y;

            player.move(x2y2, player.pos);

        }
    }

The player's file,

        public void move(Vector2 dest, Vector2 pos)
    {
        dist.X = pos.X - dest.X;
        dist.Y = pos.Y - dest.Y;

        vel.X -= dist.X;
        vel.Y -= dist.Y;

        moving = true;
    }

    public void checkDest(Vector2 dest, Vector2 pos)
    {
        if (pos == dest)
        {
            vel.X = 0;
            vel.Y = 0;
            moving = false;
        }
    }

I assume it is because of the player's position and its use of decimals and the mouse position being integers. How could I work around that?

sentences:
Unity3D Get object size in order to be used in Vector3 coordinates I have a plane in Unity in 3D project, and I want to get its boundaries so I can use them in random function for getting Vector3 coordinates. Currently I am trying like this

GameObject ground;

void Start () {
        ground = GameObject.Find("Ground");
        moveAreaX = ground.GetComponent<Renderer>().bounds.size.x;
        moveAreaZ = ground.GetComponent<Renderer>().bounds.size.z;
        Debug.Log ("X Area: " + moveAreaX + ", Z Area: " + moveAreaZ);
        GetRandomTargetCoords();
    }

void GetRandomTargetCoords() {
        targetCoordsX = Random.Range(0f, moveAreaX);
        targetCoordsZ = Random.Range(0f, moveAreaZ);
        targetCoords = new Vector3(targetCoordsX, 1.1f, targetCoordsZ);

    }

And in the console I am getting this:

X Area: 108.5801, Z Area: 108.5801

The problem is the units provided by this bounds.size are not equal to the game object's Transform position's units, and so the game object gets out of the Plane's boundaries.

How can I make it have the same units for measurements?

sentences:
Physics from other games I'm making a platform engine with XNA Game Studio, and I've solved almost everything about colliding stuff. But now, I'm searching for good physics for the player, I'm trying to emulate characters from other games like Mario from Super Mario World, or MegaMan X... do you know a website or something, where the physics from that games are revealed? I remember seen a page with something like that.

Or what's the process you think is the best to emulate physics from other games? Just trial and error?

Thank you.

sentences:
Why does this variable keep returning to its original value? In my 2D platformer game, I'm trying to create a button that, when the player or a box is on top of it, opens a door of the same color. Here is the code for the button:
extends StaticBody2D

onready var is_object_on_button = false

func _on_Green_Button_Area_body_entered(body):
    is_object_on_button = true
    print("button is down")

func _on_Green_Button_Area_body_exited(body):
    is_object_on_button = false
    print("button is up")

Code for the door:
extends StaticBody2D

onready var is_object_on_button = Green_Button.is_object_on_button
onready var door_collision = $CollisionPolygon2D

func _process(delta):
    if is_object_on_button:
        door_collision.set_disabled(true)
        print("unlocked")
    else:
        door_collision.set_disabled(false)
        print("locked")

The button prints the right things at the right time, so I assume the button is working properly, but the door constantly stays (and prints) locked. How do I fix this?
Edit: After a bit of experimentation, I think that the problem is that is_object_on_button keeps returning to whatever value its assigned at the start: If I set it to true at the onready, it stays true. I do not know how to fix this, either.

sentences:
Help figuring out how to build for the iOS Unit3D So currently I'm exporting my game strictly for testing to the iOS (iPad.)

I don't own a Mac, so I'm having my client make a build from his Mac, but that means I need very specific instructions for him as he isn't very tech-savvy. I've looked online and can't find much at all about what all you need to export from Unity and make a file for the iOS, then sync it to your iPad. Could anyone provide a video or and help at all for this?

Thanks,

Tim.

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:
Chunking/caching large levels in a singleplayer game Does it make sense to try to offload a large nonlinear level into file-based chunks, and load those on demand? We've implemented level chunking to improve rendering performance, but still all level objects are persistent in RAM.

If yes, then how do we keep the illusion of a living/changing world? Since the level is not linear, but rather like a world in itself, we cannot just pretend that whatever one's gone through is gone forever.

Is it a better idea to make the levels complex enough, but also optimized enough to be always persistent in memory, but implement micro/macro jump points which allow one to jump to a totally distant point (i.e. a whole new level), thus forgetting about the world consistency, and the illusion of a changing world. Also, this would allow us to follow a slightly linear story in a seemingly non-linear world. It would be possible to just apply a new state to the existing state of a "distant" level, if we are to bring the player back to it.

sentences:
Windows 7/8 imcompatibility via XNA? I have MS Visual Studio 2010 installed on my machine (a Windows 7 Pro 64-bit), and im developing a game in XNA 4.0 with it. I can run the program just fine from the .exe file in the bin directory, and it appears to have no bugs.

But when trying it on Windows 8 64-bit, it just doesn't run. Am I doing something wrong or is XNA suddenly incompatible in this case?

BTW this game has no 3d graphics at all, just 2D stuff, but iirc every texture2D is rendered through the GPU thing as some sort of flat 3D surface, so idk.

sentences:
Unity Third Person Controller Camera-Relative Script I'm an newbie in game developing. So i have a script for a camera that i attach to the player. I was wondering how to make a Third Person Controller with WASD controls that moves in the direction that the camera is facing.
If you need it here's the camera script that i use

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

public class ThirdPersonCamera : MonoBehaviour {
    //define some constants
    private const float LOW_LIMIT = 0.0f;
    private const float HIGH_LIMIT = 85.0f;

    //these will be available in the editor
    public GameObject theCamera;
    public float followDistance = 5.0f;
    public float mouseSensitivityX = 4.0f;
    public float mouseSensitivityY = 2.0f;
    public float heightOffset = 0.5f;

    //private variables are hidden in editor
    private bool isPaused = false;

    // Use this for initialization
    void Start () {
        //place the camera and set the forward vector to match player
        theCamera.transform.forward = gameObject.transform.forward;
        //hide the cursor and lock the cursor to center
        Cursor.visible = false;
        Cursor.lockState = CursorLockMode.Locked;
    }

    // Update is called once per frame
    void Update () {
        //if escape key (default) is pressed, pause the game (feel free to change this)
        if (Input.GetButton("Cancel"))
        {
            //flip the isPaused state, hide/unhide the cursor, flip the lock state
            isPaused = !isPaused;
            Cursor.visible = !Cursor.visible;
            Cursor.lockState = Cursor.lockState == CursorLockMode.Locked ?
            CursorLockMode.None : CursorLockMode.Locked;
            System.Threading.Thread.Sleep(200);
        }

        if(!isPaused)
        {
            //if we are not paused, get the mouse movement and adjust the camera
            //position and rotation to reflect this movement around player
            Vector2 cameraMovement = new Vector2(Input.GetAxis("Mouse X"),Input.GetAxis("Mouse Y"));

            //first we place the camera at the position of the player + height offset
            theCamera.transform.position = gameObject.transform.position + new Vector3(0,heightOffset,0);

            //next we adjust the rotation based on the captured mouse movement
            //we clamp the pitch (X angle) of the camera to avoid flipping
            //we also adjust the values to account for mouse sensitivity settings
            theCamera.transform.eulerAngles = new Vector3(
                Mathf.Clamp(theCamera.transform.eulerAngles.x + cameraMovement.y * mouseSensitivityY, LOW_LIMIT, HIGH_LIMIT),
                theCamera.transform.eulerAngles.y + cameraMovement.x * mouseSensitivityX, 0);

            //then we move out to the desired follow distance
            theCamera.transform.position -= theCamera.transform.forward * followDistance;
        }
    }
}

sentences:
More efficient in range checking I am going to use a specific example in my question, but overall it is pretty general. I use java and libgdx.

I have a ship that moves through space. In space there is debris that the ship can tractor beam in and and harvest. Debris is stored in a list, and the object contains it own x and y values. So currently there is no way to to find the debris's location without first looking at the debris object. Now at any given time there can be a huge (1000+) amount of debris in space, and I figure that calculating the distance between the ship and every single piece of debris and comparing it to maximum tractor beam length is rather inefficient.

I have thought of dividing space into sectors, and have each sector contain a list of every object in it. This way I could only check nearby sectors. However this essentially doubles memory for the list. (I would reference the same object so it wouldn't double overall. I am not CS major, but I doubt this would be hugely significant.) This also means anytime an object moves it has to calculate which sector it is in, again not a huge problem.

I also don't know if I can use some sort of 2D MAP that uses x and y values as keys. But since I am using float locations this sounds more trouble than its worth.

I am kind of new to programming games, and I imagined there would be some eloquent solution to this issue.

sentences:
My camera does not rotate around player in 3d open world I want my camera to following behind the player at all times.  When the player turns to the left, I would expect the camera would move behind the player while remaining focused on the player.

My camera stays focused on the player.  However, it does not rotate to stay behind the player.

I tried following the directions from here, and here.  Neither of which seems to help.

Here's my code:

public class CameraFollow : MonoBehaviour
{

    private GameObject player;
    private GameObject mainCamera;
    private Vector3 offset;
    private float distance;
    private Vector3 playerPrevPos;
    private Vector3 playerMoveDir;

    // Use this for initialization
    private void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        mainCamera = GameObject.FindGameObjectWithTag("MainCamera");

        //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;

        distance = offset.magnitude;
        playerPrevPos = player.transform.position;
    }

    // Update is called once per frame
    private void Update() { }

    private void LateUpdate()
    {
        playerMoveDir = player.transform.position - playerPrevPos;

        if (playerMoveDir != Vector3.zero)
        {
            playerMoveDir.Normalize();
            transform.position = player.transform.position + offset;
            transform.LookAt(player.transform.position);
            transform.rotation = Quaternion.Lerp(transform.rotation, player.transform.rotation, Time.deltaTime * 1);

            mainCamera.transform.position = player.transform.position + offset;
            mainCamera.transform.LookAt(player.transform.position);
            mainCamera.transform.rotation = Quaternion.Lerp(transform.rotation, player.transform.rotation, Time.deltaTime * 1);

            playerPrevPos = player.transform.position;
        }
    }
}

I have done something a little different, per instructions from a online unity class.  My main camera is a subobject of a rootobject, as shown in this picture.

I have attached image of the game with the yellow line showing which way the player is facing.  The camera is facing in a different direction.

Any help would be appreciated.
Thnx
Matt

Follow-up from answers:
I cannot get either solution to work.  @alejandrodlsp solution doesn't compile (I've added a comment to the answer explaining why).  If I do not set offset on Start (aka its always 0), then the camera rotates.  The problem is that is at the feet the player and not behind like I wanted.   Once I compute offset, then the camera never rotates behind the player.

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:
Intersystem communication in a ECS game Apologies if this question has been answered before, but after relentless searching I couldn't find anything.

As many, I've recently jumped on the ECS-bandwagon, and I am currently killing some time by making a modest ECS-game. The game is a somewhat simple 2D-platform game. It is programmed in plain JS.

The layout of the game is essentially as following:

The core of the game is the Engine, the Engine runs the game-loop and holds an EventManager, responsible for raising events, and an EntityManager, responsible for containing all components of all entities.

All logic is done by systems. The systems registers event-handlers (i.e. member-functions) with the EventHandler for specific EventTypes, which gets called when an event of that type is raised.

For example:

this.eventManager.registerHandler(EventType.EVENT_RENDER, this.render, null, this);

I recently switched from calling all systems relevant functions explicitly in the Engine to this pattern.

But over to my problem and question.

For rendering I have a RenderSystem. This system contains references to several type of drawable/animatable-components which it, you guessed it, renders.

Until recently, this system also contained a reference to another system, MapSystem, which spatially indexes all entities. The reason for this reference was to be able to call a function along the lines of

mapSystem.search(frame_bound);

effectively pruning away all entities not needing to be rendered.

So I have a couple of questions regarding this:

Is it very bad practice for systems to communicate directly? Something about it just doesn't smell right to me.

I see how it might severely complicate your code if you have say 100 systems, and each system holds references to many of the other systems. Hello O(n^2).
If I am not to hold inter-system references, how do I perform communication like described above?

My initial thoughts was to create an entity whose primary purpose were to hold the necessary information (i.e. all entities currently in the frame). Then let MapSystem write to and RenderSystem read from this entity.

But this also seems to be rather unclean to me. Especially as MapSystems search function might be useful to call in many different contexts. Creating an entity per calling-context doesn't really seem like a good way to go about it either.

TL;DR: Is it bad for systems in a ECS-game to communicate directly and hold references to each other?

sentences:
How can I make terrain texturing look detailed both close-up and far away? I attempting to make my game have very detailed textures, and in general look pretty. However, I'm having some issues with that.

Let's take a look at a rock texture close up:
Picture.

As you can see, this looks perfectly adequate for a 3D game up-close. However, I'm struggling to get this working at a distance: Picture

At a distance, the texturing looks obviously uniform, and looks very tiled and very bland. Picture

How can I solve this issue to make my textures look more detailed at all distances? I obviously have mipmapping enabled, but I don't understand why the texture looks so badly detailed and what I can do to improve it.

sentences:
Fixed distance between character and ground whatever slope value I am working on character moving on any ground meaning whatever slope degree ,the result i got is the character does not moving on just shake in his place
the following the code i wrote

public float speed = 1;
bool isMoving;
Transform childPosition;
Rigidbody rb;

private void Start ( )
{
    rb = GetComponent<Rigidbody>();
}

// Update is called once per frame
void FixedUpdate () {

    if (Input.GetAxis("Horizontal") > 0)
    {
        rb.velocity = new Vector3(1f, rb.velocity.y, rb.velocity.z);
    }
    else
    if (Input.GetAxis("Horizontal") < 0)
    {
        rb.velocity = new Vector3(-1f, rb.velocity.y, rb.velocity.z);
    }
    else
    transform.position += transform.forward * Time.deltaTime * speed;

    detectRoad();
}
private void detectRoad()
{
    Ray ray = new Ray(transform.position, -transform.up);
    RaycastHit hit;

    if (Physics.Raycast(ray, out hit))
    {
        transform.rotation = Quaternion.FromToRotation(transform.up, hit.normal) * transform.rotation;
    }
    if (hit.distance < 0.6f)
    {
        transform.position += transform.up * Time.deltaTime;
    }
    else
    if (hit.distance > 2f)
    {
        transform.position += -transform.up * Time.deltaTime;
    }
}
   `

This animated gif is about what I want:

sentences:
Creating a gradient for a texture - Why is the color becoming dark on one side? Updated
While debugging I looked at the lerp and it was calculating into a negative number at the start. So I added in checks for to low or high a value, and that seems to have fixed it. I'll answer the question myself unless someone can find a way to fix the formula that calculates the lerp, since that seems to be the culprit. My fix was this:

double lerp = (start - here) / (start - end);

if (lerp < 0d)
    lerp = 0d;
if (lerp > 1d)
    lerp = 1d;

Original Question
I'm applying a gradient to a texture per the answer in this topic: Code to generate a color gradient within a texture using a diagonal line

My code is referenced below. The code was seeming to work fine. I was using a two-color gradient: green to purple. However, when I changed it to two colors that blended well into a 3rd color, I could instantly see that something was wrong.

For example, blue to purple was producing a red element outside of the gradient area. If you also look closely, the blue itself is also enhanced on the outer edges. It's almost as if the two colors are mixing outside of the gradient area, when they should be the original colors.

Calling Code

This is applying to the center of an area 80x25.

Color[] colors = new Color[] { Color.Blue, Color.Purple };
float[] colorStops = new float[] { 0f, 1f };

Algorithms.GradientFill(new Point(40, 12), 3, 33, new Rectangle(0, 0, CellData.Width, CellData.Height), colors, colorStops);

Gradient Calculation Code

public static void GradientFill(Point position, int strength, int angle, Rectangle area, Color[] colors, float[] colorStops)
{
    double radians = angle * Math.PI / 180; // = Math.Atan2(x1 - x2, y1 - y2);

    Vector2 angleVector = new Vector2((float)(Math.Sin(radians) * strength), (float)(Math.Cos(radians) * strength)) / 2;
    Vector2 location = new Vector2(position.X, position.Y);

    Vector2 endingPoint = location + angleVector;
    Vector2 startingPoint = location - angleVector;

    double x1 = (startingPoint.X / (double)area.Width) * 2.0f - 1.0f;
    double y1 = (startingPoint.Y / (double)area.Height) * 2.0f - 1.0f;
    double x2 = (endingPoint.X / (double)area.Width) * 2.0f - 1.0f;
    double y2 = (endingPoint.Y / (double)area.Height) * 2.0f - 1.0f;

    double start = x1 * angleVector.X + y1 * angleVector.Y;
    double end = x2 * angleVector.X + y2 * angleVector.Y;

    for (int x = area.X; x < area.Width; x++)
    {
        for (int y = area.Y; y < area.Height; y++)
        {
            // but we need vectors from (-1, -1) to (1, 1)
            // instead of pixels from (0, 0) to (width, height)
            double u = (x / (double)area.Width) * 2.0f - 1.0f;
            double v = (y / (double)area.Height) * 2.0f - 1.0f;

            double here = u * angleVector.X + v * angleVector.Y;

            double lerp = (start - here) / (start - end);

            float newLerp;
            int counter;
            for (counter = 0; counter < colorStops.Length && colorStops[counter] < (float)lerp; counter++) ;

            counter--;
            counter = Math.Max(counter, 0);
            counter = Math.Min(counter, colorStops.Length - 2);

            newLerp = (colorStops[counter] - (float)lerp) / (colorStops[counter] - colorStops[counter + 1]);

            SetPixel(x, y, color);
        }
    }
}

sentences:
algorithm advice for game background ambiance - animals living in forest In the game, there is a forest and animals living in it.
The interaction of the animals is just a background ambiance.

When googling I found Goal-Oriented Action Planning pattern.

And this pattern seems to solve the issue. If we give goals to the animals while achieving their goals they can behave realistically for the ambiance.

After more research, I found a paper which is advising extending GOAP with smart ambiance objects to make agents behave context aware.
"Feeling the Ambiance: Using Smart Ambiance to Increase Contextual Awareness in Game Agents"

For example, think of an adventure game, the player is searching for clues/items in the forest.

Meanwhile, a bird (non-player character) is looking for a fruit on the tree to eat.
Bird sees a fruit on the tree but also saws a snake danger close to the fruit.
So bird afraid and do not decide to eat that fruit...

Are there other algorithms/patterns that you can remind to solve this need?

sentences:
How do I generate solar systems for a 2d universe map, but still look random I need to generate 64 systems separated into 16 sectors, each with 4 systems.  Each system must have another system within 10 units in it's own sector, but no closer than 3.  One system in a sector must have a non-sector system within 20 units, but no closer than 8.  When I made a formula that satisfies these requirements, I end up with a very visible grouping of 16 sectors in a box formation with very little variety.  Probably because I want it output into an array so I can track distances, etc.

I'd do a random generation, where it just places a system on a grid and then makes sure it doesn't conflict with a rule, and then find a way to group them, but it just seems beyond me right now.  I wouldn't be sure how to check for inability to place another system... I'm probably looking at the problem from the wrong angle.

Any help?

Each dot is a system, the grey background is just a box to make it temporarily easier to see.

sentences:
How can I display triangle faces (not quads) in Cinema4D? I started to learn Cinema 4D. I've noticed it's really easy to use for motion graphics, but I want to use it for modeling for games/realtime 3d engines.

Before I used 3dsmax and it was easy to estimate how a model would look/behave in a 3d engine. The two main things I did was displaying Polygon triangles and displaying the Polygon Count.

I've found the Total Polygons tick in HUD settings in Cinema 4D, but I can't find any display mode that will show triangles.

Is there there a way to display triangle faces/not quads in Cinema4D ? If so how ?

There is a Triangulate function, but I'd rather not Triangulate/Untriangulate all the time, especially since it's converting back and forth between the two doesn't always produce the same result.

I imagine I'm asking for old school techniques, but I plan to use these to make low poly models for web(canvas/webGL) and mobile.

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:
2D SAT How to find collision center or point or area? I've just implemented collision detection using SAT and this article as reference to my implementation. The detection is working as expected but I need to know where both rectangles are colliding.

I need to find the center of the intersection, the black point on the image above. I've found some articles about this but they all involve avoiding the overlap or some kind of velocity, I don't need this.

I just need to put a image on top of it. Like two cars crashed so I put an image on top of the collision. Any ideas?

## Update

The information I've about the rectangles are the four points that represents them, the upper right, upper left, lower right and lower left coordinates. I'm trying to find an algorithm that can give me the intersection of these points.

sentences:
What is the most efficient way to trigger an action based on proximity? I am developing a 3rd person platformer that entails a grapple hook system.

This grapple hook system relies on a series of 'grapple-able' points.

I would like these points to shine every so often.

These points will shine when:

Within the player's view cone AND
Within a certain distance of the player.

This Grapple object class will contain the method Shine() to trigger the effect.

Initial research

My initial research was based upon using a cone trace from the player for these Grapple objects, then in each one found, calling the Shine method.

I could then tweak the cone's angle and height to better represent the view cone.

Problems

Unreal by default does not have a cone trace, and I'm not sure if using a multibox trace followed by an angle check is the most efficient solution.

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:
Multiple buffering in OpenGL on Windows What is the most common way modern games perform triple buffering ?
What does the SwapBuffers exactly do in terms of OpenGL states ?
Is it possible to perform double and triple buffering independently of window system (for example, by manipulating with glDrawBuffer or by using FBO/PBO) ? If so, any hints ?
Does 3. even make sense in terms of performance and flexibility ?

sentences:
How can I toggle between single shots when clicking the mouse left button and automatic none stop shooting when clicking the mouse right button? I'm talking in build not in editor !

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

public class Shooting : MonoBehaviour
{
    [SerializeField]
    private Transform[] firePoints;
    [SerializeField]
    private Rigidbody projectilePrefab;
    [SerializeField]
    private float launchForce = 700f;
    [SerializeField]
    private Animator anim;
    [SerializeField]
    private bool automaticFire = false;
    [SerializeField]
    private bool slowDownEffect = false;

    private void Start()
    {
        anim.SetBool("Shooting", true);
    }

    public void Update()
    {
        if (isAnimationStatePlaying(anim, 0, "AIMING") == true)
        {
            if (Input.GetButtonDown("Fire1")/*automaticFire == false*/)
            {
                automaticFire = false;

                if (anim.GetBool("Shooting") == true)
                {
                    anim.Play("SHOOTING");
                    LaunchProjectile();
                }
            }
            else
            {
                if (/*automaticFire == true &&*/Input.GetButtonDown("Fire2"))
                {
                    automaticFire = true;
                }
            }
        }

        if(automaticFire == true)
        {
            anim.Play("SHOOTING");
            LaunchProjectile();
        }
    }

    private void LaunchProjectile()
    {
        foreach (var firePoint in firePoints)
        {
            Rigidbody projectileInstance = Instantiate(
                projectilePrefab,
                firePoint.position,
                firePoint.rotation);

            projectileInstance.AddForce(new Vector3(0, 0, 1) * launchForce);

            projectileInstance.gameObject.AddComponent<BulletDestruction>().Init();
        }
    }

    bool isAnimationStatePlaying(Animator anim, int animLayer, string stateName)
    {
        if (anim.GetCurrentAnimatorStateInfo(animLayer).IsName(stateName))
            return true;
        else
            return false;
    }
}

I tried to do it in the Update using the automaticFire variable but it's not working fine.

When clicking first the left mouse button it's shooting singles but then when clicking the mouse right button it's shooting automatic but then when clicking the left mouse button again it's not back to single shots again it's staying on automatic.

The idea is right click mouse button automatic fire left button each time clicking the left mouse button the automatic should stop and then single shots with the left mouse button. And this way to toggle between the Fire1 and Fire2.

Fire1 = left mouse button click Fire2 = right mouse button.

sentences:
Can I have a fixed-angle sprite with a non-fixed-angle CircleCollider2D? In Unity2D, can I have a fixed-angle sprite with a non-fixed-angle CircleCollider2D?

I would like to move my character using the circle physics (without fixed-angle), but display him always as if he wasn't rotated (as if he had fixed-angle).

I thought I could just let the collider rotate, and then rotate-back the sprite in the LateUpdate, however since the collider's center isn't 0,0, it "rotates sideway" and doesn't end up in the "original" position.

My knowledge on matrices and quaterions is null, and trigonometry is only slightly above zero, so I'm a bit at a loss... how can I achieve the desired effect?

In order to prevent a X/Y problem, I want to do that since with box colliders sometimes the characters got stuck: if a platform had even just 1 pixel step, the character couldn't walk over it. Also, slopes were a big problem. Changing the collider to a Circle was the obvious consequence; I also tried to detect and add a small vertical speed but it didn't work very well and was becoming a mess.

sentences:
Trouble loading sprite from spritesheet with Phaser I am working on re-creating a breakout clone to help me learn Phaser (following the overall design of jsbreakouts.org). Anyway, I have the start screen set up. From the start screen, I can transition to the game state without any problems. In my game state, I can load the background and the paddle without issues. The paddle responds to mouse input as it is supposed to.

But the ball does not load for some reason. The ball is coming from a spritesheet. Each ball in the sheet is 16x16 and there are 5 of them. I can't even get one of them to load, let alone animate them.

The balls spritesheet is in the same directory as the paddle. I have looked at other code online and as far as I can tell, I'm doing it right. Yet, it is not working.

What am I doing wrong?

Here's my game state code:

var paddle;
var ball;

var Game = {

preload : function() {
        // Here we load all the needed resources for the level.
        game.load.image('background', './assets/bg_prerendered.png');
        game.load.image('paddle',     './assets/paddle2.png');
        game.load.spritesheet('ballsheet', './assets/balls.png', 16, 16, 5);
        game.load.spritesheet('tiles', './assets/tile_spritesheet.png', 32, 16);
    },

create : function() {
    //enable physics
    game.physics.startSystem(Phaser.Physics.ARCADE);
    game.physics.arcade.checkCollision.down = false;

    //add the background
    background = game.add.sprite(0, 0, 'background');

    //add score text placeholder
    game.add.text(50, 390, "Lives: 3    Score: 700   Level: 1", { font: "12px sans-serif", fill: "#000000"});

    //add the paddle and set it up
    paddle = game.add.sprite(136, 384, 'paddle');

    //set the anchor to be the lower center of the paddle
    paddle.anchor.set(0.5,1);

    //enable paddle physics
    game.physics.enable(paddle, Phaser.Physics.Arcade);
    paddle.body.immovable = true;
    paddle.body.collideWorldBounds = true;

    ball = game.add.sprite(100,100, 'ballsheet');
    ball.frame = 0;
    //ball.animations.add('rotate',[0,1,2,3,4], 10, true);
    //game.physics.enable(ball, Phaser.Physics.Arcade);
    //ball.body.collideWorldBounds = true;
    //ball.play('rotate');

},
    update: function() {
        paddle.x = game.input.x;

    },
};

sentences:
How to convert pixel coordinates to GL coordinates in 2D space? I know that if you want to display a sprite on screen (in 2D) you can use glOrtho and essentially make 1 gl unit equal to 1 pixel, so when I plot out the vertices for say a 128x128 image (on a quad), I can define the vertices as -64/64, -64-64, etc and then when I map my texture coords to that quad, the image is displayed at a 1:1 ratio.

However, lets say I wanted to not use glOrtho and wanted to have a perspective view, so I can combine 2D sprites with 3D models and whatnot? I'm at a loss on how to convert/set up the coordinates for the planes/quads I want to draw images to, in a way that will match the resolution of the image. That is, define coordinates or convert them in such a way so that when a 2D sprite is right at the near plane, that sprite is mapped as 128x128 pixels on the screen.

sentences:
Connecting to external computer with lidgren I'm new to networking and thought i'd muck around a bit with lidgren before i start implementing it in my games, so i made a little client/server chat program that works fine on localhost and lan. I can connect other computers on my subnet and chat, but when it comes to connecting a friends computer not connected on my home network it becomes a bit tricky. I set up UPnP and port forwarding on the server application and i connect the client directly using my external IP address, but the problem seems to come from connecting my client with my external IP address as they never actually connect.

        Network.config = new NetPeerConfiguration("SKGCHAT");
        Network.config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse);
        Network.client = new NetClient(Network.config);
        Network.client.Start();
        Network.outMsg = Network.client.CreateMessage();
        Network.outMsg.Write("password");
        Network.client.Connect("121.217.195.105", 14242, Network.outMsg); //doesnt work
        //Network.client.Connect("192.168.0.14", 14242, Network.outMsg); works
        //Network.client.DiscoverLocalPeers(14242); works

This is the client initialisation

        Network.config = new NetPeerConfiguration("SKGCHAT");
        Network.config.Port = 14242;
        Network.config.EnableUPnP = true;
        Network.config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest);
        Network.config.EnableMessageType(NetIncomingMessageType.ConnectionApproval);
        Network.server = new NetServer(Network.config);
        Network.server.Start();
        Network.server.UPnP.ForwardPort(14242, "SKG Chat bb");

and this is the server initialisation

This following code should display a message to the server if it even receives the clients connection attempt but when run, no connection attempts are received.

 case NetIncomingMessageType.ConnectionApproval: //wan
                    string message = incMsg.ReadString();
                    outMsg = server.CreateMessage();
                    outMsg.Write("You've been received");
                    server.SendUnconnectedMessage(outMsg, incMsg.SenderEndPoint);
                    if (message == "password")
                    {
                        incMsg.SenderConnection.Approve();
                        finalMsg = "New Connection";
                        readDiag = true;
                    }
                    else
                    {
                        incMsg.SenderConnection.Deny();
                        finalMsg = "Connection denied";
                        readDiag = true;
                    }
                    break;

I honestly am lost when it comes to networking and have no clue why it isnt connecting. Any help would be greatly appreciated.

sentences:
libgdx game process dies on loading texture atlases I try to load a lot of texture atlases (10) with approximately 5 (~2048x~2048)(not using PoT) .pngs each. I'm using AssetManager and there is no trouble with it on my pc but when I try it on my tablet the app just dies without any error messages or crash reports and there aren't any outOfMemoryExceptions.

Here's my log:

DropBox link

the max memory: 67 is

Runtime().getRuntime().maxMemory() / 1000000

I'm running out of ideas of what to do. Maybe I don't fully understand the way mobile games work: is that a lot of atlases (I have other textures not atlases apart from these atlases)? because everything looks quite fine in the memory segment as much as I know. Anyway I'm open to suggestions and maybe some tips. And I'd really like to keep these atlases in my game.

EDIT: the game loads on my tablet but not phone when I use 1 png per atlas (8192x8192) but my tablet doesn't show images larger than 2048x2048 for some reason oh and the images in the atlas aren't even 1024x1024 so idk why it doesn't show them must be because the atlas is 8192x8192.

EDIT #2: I load only atlases now, no separate .png files and I am now using PoT (2048x2048). 17 atlases some have 2 pngs some even have 1 png but there are some that have 5+ and that's my level plus player animations plus I'm using a gradient for my whole level that is ~10000px in width combined and I use FBO to do a Lighten shader on the level and my level has animations. Is that too much? Anyway this time the game died @ 94% on my phone(Galaxy S2) and @ 58% on my tablet(Lenovo IdeaTab A2109) and here's my new log but this time from my phone:

DropBox link log_new

I'm confused because there aren't any outOfMemory exceptions and I'm disposing every possible thing there is to dispose. btw my app in the logs is com.comraz.slashem
Is theree something I can do? f.e. downscale textures or use mipmaps or something? my level textures are 1024x768 when zoomed in and 1024x1536 when zoomed out. If you have any ideas or any questions please do ask or tell me. Oh and my camera size is 1280x768

sentences:
Can I create custom framebuffer and render to it in cocos2dx? I want to do post processing effects so I was thinking If I could just make custom framebuffer in cocos2dx like OpenGL and render the ALL SCENES objects in it. I want a single frame buffer for all scenes. Is there any
 way? Thanks.

sentences:
Not So Beginner Tutorial Request So my game is done for now but every time it flashes on the screen and my game loop is awful. So crowded with logic.

I need to learn more about games and how they are running. My idea now is that at the heart of the game you have a while loop. Inside that you are checking for events to happen. Each time an event happens, you spawn a thread that accomplishes a task.

You then have a layer that draws on the screen the "map". Also a layer that says where objects collide. And finally the logic of how objects interact.

I am using C++ and SDL and I need a complete tutorial that takes me through a complex example to get started. I am a good programmer but have no experience with games. Any suggested tutorials would help.

All tutorials I have found so far are too easy and don't do anything worth while.

sentences:
Support of multiple 3d formats in engine What is the best practice to add support of loading models from multiple file formats (.obj, .3ds ...)?
What class hierarchy should I use (now I have Mesh class( containing vertex, data ) and MeshLoader class ( doing nothing right now ))?
I do not want to write loaders by myself, so than I have to copy loaded data into my structure.
Possibly you can show some articles explaining it especially Mesh class organization. Thanks in advance.

sentences:
In OpenGL what's quicker, lots of smaller VAOs, or one large one updated each frame? In my game engine, a mesh can be made of many submeshes. These submeshes may or may not share vertex data with the rest of the mesh, if they don't they have their own vertex data array.

I've noticed that rendering a mesh with many submeshes that don't share vertices is incredibly slow. This is because each submesh has it's own VAO (and vertex/index VBO pair).

The alternative is to gather the vertices and indices into one pair of VBOs and update them every frame. But will this be much faster?

Is it faster to create one large VAO and update it every frame, or to render many small ones which don't need updating each frame?

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:
Unity 3D mirror, sync player spawn name I am using Mirror for doing my little multi-player car racing project which I want to rename the game object automatically after the NetworkManager auto create the game object.
Here is my NetworkManager code:
using System.Collections.Generic;
using UnityEngine;
using Mirror;
public class MyNetworkManager : NetworkManager
{
    public List<GameObject> spawnPos;

    public override void OnServerAddPlayer(NetworkConnection conn)
    {
        Transform start = spawnPos[numPlayers].transform;
        GameObject player = Instantiate(playerPrefab, start.position, start.rotation);
        player.name = "car_" + (numPlayers + 1).ToString();
        NetworkServer.AddPlayerForConnection(conn, player);
    }

}

This NetworkManager works good in the Host PC. However, when the client connecting to the host, the name showing in the inspector on client PC is still like car(Clone).
Does anyone know how to deal with this problem?
Thank you for your help.

sentences:
What is the cause of this lighting artifact on my dynamic terrain mesh? I am generating my own terrain mesh in Unity, using pseudo-random noise to determine the height. I construct the mesh using quads, each quad is composed of two triangles.

All seems to be going well, except the terrain does not look right - the quads are very visible. You can see the outline of them on the surface, but I haven't seen this effect before elsewhere. I feel that something is wrong with either my normals or my UV's. I am using just one white directional light.

Dynamic Terrain http://www.spannerworx.com/images/terrain.png

I thought the issue was with the normals, so I stopped calling RecalculateNormals and manually calculated the normal for every vertex using the averaged normal of the sum of each triangle touching that vertex. This was a lot of effort, but made no effect and ended up looking just the same.

Has anyone else seen this dynamic mesh effect before and maybe make some suggestions as to how I could try resolve this?

Just to clarify, I am already generating the triangles myself, two per quad. I do it like this:

for (int t = 0; t < quadCount; t++)
{
    int x = t / (Samples - 1);
    int z = t % (Samples - 1);

    // Calculate quad corner indexes
    int indexBR = CalculateIndex(x + 1, z);
    int indexBL = CalculateIndex(x, z);
    int indexTL = CalculateIndex(x, z + 1);
    int indexTR = CalculateIndex(x + 1, z + 1);

    // Assign indexes for triangles
    // Triangle 1
    triangles[6 * t + 0] = indexBR;
    triangles[6 * t + 1] = indexBL;
    triangles[6 * t + 2] = indexTL;

    // Triangle 2
    triangles[6 * t + 3] = indexBR;
    triangles[6 * t + 4] = indexTL;
    triangles[6 * t + 5] = indexTR;

    // Normals stuff...

}

sentences:
Stuck at tile seams using 2D collision I'm making a little top down 2D dungeon crawler, and have pretty much fallen over at collision detection with my dungeon walls. I have figured out how to stop my player sprite at the walls, but I'm having trouble with the seams of the vertical walls. Horizontal walls, for some reason, are giving me absolutely no issue.

I store a bunch of rectangles representing the dungeon walls, and for each entity that is of the type RigidBody.Type.Moving, I collision check using a projection of where the entity will be based on its current X & Y velocity (against all rectangles, at the moment).

Here is my collision detection code:

var dt = (float) gameTime.ElapsedGameTime.TotalSeconds;
var rb = entity.GetComponent<RigidBody>();
var body = rb.Body;

// We only want to do collision checks for bodies that are moving.
if (rb.Type != RigidBody.Type.Moving) return;

// Don't collision check against itself!
var rectangles = CollisionWorld.Instance.Bodies.Where(b => b != body);
foreach (var rectangle in rectangles)
{
    // Work out where the entity is going to be next with its current velocity
    // and store it as a rectangle to collision check on.
    var projectedBody = new Rectangle(
        (int)(rb.Position.X + rb.Velocity.X * dt),
        (int)(rb.Position.Y + rb.Velocity.Y * dt),
        body.Width, body.Height);

    // If we have a collision, continue. Otherwise move on.
    if (!Collision.DoesCollide(projectedBody, rectangle)) continue;
    var side = Collision.CalulateCollisionSide(projectedBody, rectangle);

    if (side == Collision.Side.Top || side == Collision.Side.Bottom)
    {
        rb.Velocity.Y = 0;
    }
    if (side == Collision.Side.Left || side == Collision.Side.Right)
    {
        rb.Velocity.X = 0;
    }
}

I have tried finding the collision intersection, and using it to offset the player's position. by that and that kinda works, but then the sprite is all jittery whenever it collides. I've been bashing my head against this for a couple of days, now.

Why would the seams between each vertical tile be causing my sprite to get stuck?

sentences:
Does Google Play allow an account to log in to the same game on 2 devices? I'm developing an online Android game with Unity. I want all Google Play accounts to have only one session logged in at a time.

Do I need to write my own code to disconnect an existing session on new login attempts, or does Google Play already handle this?

Edit:

An idea popped to my mind. I can save the logged in device's state to a a file on Google's Saved Games cloud, and write an instance-specific identifier to that file that indicates who has logged on last. And checking file constantly on all instances will allow me to disconnect instances whose identifier doesn't match the one on the file on the cloud.

Do you think this is a good idea? I mean, fetching file from cloud every second or so?

sentences:
Any good books on graphics programming? I've been looking for a book that takes a bottom-up approach for graphics programming. So something that starts with 2d filtering, maybe moving into normal mapping, then ambient occlusion, etc.

I ask because I've been lazy for the last few years in game development and always used an engine that handles this. I want to start writing some shaders for my games instead of relying on the cryptic ones that I've borrowed in the past. I think a very strong knowledge in this will help and I'm a bottom-up kind of learner so please help me out!

I know the GPU Gems series is great, but they seem to be more like a cookbook than a bottom-up approach that I want. You tend to get more scattered theory from cookbooks instead of building on theory from previous chapters.

EDIT: Preferably something you've read! I can search amazon for this, but it's hard to get a unbiased review that way.

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:
XNA Video Playback on XBOX "Invalid operation exception" I am able to play a video in windows in my project, but the same code fails on the XBOX at the _player.Play(_logo) line. The error message is:

"An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll"

Relevant code:

    public LogoScreen()
    {
        TransitionOnTime = TimeSpan.Zero;
        TransitionOffTime = TimeSpan.Zero;

        _content = new ContentManager(Game3.Instance.Services, "Content");

        _player = new VideoPlayer();
        _player.IsLooped = false;

        _sb = new SpriteBatch(Game3.GDM.GraphicsDevice);
    }

    public override void LoadContent()
    {
        _logo = _content.Load<Video>("Video/intro_logo");
    }

    private bool _started = false;
    public override void Update(bool otherScreenHasFocus,
        bool coveredByOtherScreen, bool coveredByPopup)
    {
        if(_started == false)
        {
            _player.Play(_logo);
            _started = true;
        }

        if (_player.State == MediaState.Stopped)
        {
            Exit();
        }
    }

Here is the random test video that I'm using:
http://olhovsky.com/xna/intro_logo.wmv

Any ideas why this might be failing?

sentences:
Should I use select() for networking in my gameloop? I'm writing a simple networked game in C/C++. To keep things simple I'm using TCP.

In my server's game loop I'm using a POSIX select() with a zero second timeout for two things:

Discover incoming data from connected clients
Discover new incoming connections

Is this a reasonable way to do it? Instead of using select() I could just loop through all connected socket descriptors and call recv() (or something like it) for each, to see if there is any new data. Would that be better?

The same question goes for the client. Note that on the client there's only one socket descriptor. Should I here use select() and a zero second timeout to find out if there's any new data incoming, or should I just call recv() on each game tick?

Or perhaps it would be even better if I pushed networking to a separate thread?

sentences:
Speech recognition and AI in language learning platform I work for a publishing company that is looking to create an online virtual environment for English Language Learners.

We are keen to create something immersive (virtual 3D world) through which the learners can experience 'real' interactions.  Part of this is that we really want them to be able to speak in the environment (and for the game NPCs to be able to respond/register the learner's utterances). Is there tech out there that could help us achieve this? Is there currently anything like this out there?

sentences:
Unity - How to don't ignore a layer when Raycasting? For example: Physics.Raycast(ray, out hit, range, layerMask), let's say layerMask = groundMask. What I want to do is only return true if it didn't hit a ground mask. Like what I mean is like "Ignore raycast except groundMask". Is there anyway to do this?
Some example:
origin ------------ (groundmask) -------- (other mask) --- // return false;
because there is a ground mask in a range
origin ---------------------------------- (other mask) --- // return true;
because there is no ground mask in a range

sentences:
When does the memory transfer from CPU to GPU happen when creating a buffer? I just finished my first DirectX 11 program. But I have several questions on memory transfer between CPU and GPU.

In my program, I create a vertex buffer first:

bool InitializeGeometry() {
    VertexType vertices[] = {
        XMFLOAT3(0.0f, 0.0f, 0.5f),
        XMFLOAT3(0.5f, 0.0f, 0.5f),
        XMFLOAT3(0.0f, 0.5f, 0.5f)
    };

    D3D11_BUFFER_DESC vbDesc;
    ZeroMemory(&vbDesc, sizeof(vbDesc));
    vbDesc.Usage = D3D11_USAGE_IMMUTABLE;
    vbDesc.ByteWidth = sizeof(vertices);
    vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    vbDesc.CPUAccessFlags = 0;

    D3D11_SUBRESOURCE_DATA vbData;
    ZeroMemory(&vbData, sizeof(vbData));
    vbData.pSysMem = vertices;

    if (FAILED(gDevice->CreateBuffer(&vbDesc, &vbData, &gVB)))
        return false;

    // ...
}

Later I will use this vertex buffer for rendering.
Note that the vertices array is a stack variable and it will be destroyed on after the return of InitializeGeometry.

Does actual memory transfer from CPU to GPU happen in CreateBuffer?
Or CreateBuffer just takes a reference to the vertices so I should give a longer lifetime to the vertices?

If the transfer does starts in CreateBuffer(or Unmap for dynamic buffers),
can I expect the GPU driver save a copy of my vertices?
I am afraid that the transfer takes so much time that InitializeGeometry function returns early, hence leaves transferring data incomplete.

sentences:
Is it legal to imitate a game without publishing it If you're developing a game that's very similar to a game that's already published, both the game mechanics and the graphics but you're not publishing it, instead you're keeping it in your own computer.
Is it legal to do so?

sentences:
Simple square vertex lifting shader I am trying to rebuild the fur effect in Viva Pinata.

Here each square becomes a pattern of fur

I imagine the process to be like this...

U lift one end of the triangles.

Now I need to achieve "lifting one end of square". I can do either vertex, fragment, geometry shader. However I am clueless when it comes to determining which vertex is "end of square", so that I know which vertex to lift up.

sentences:
How to create a trail like this in Unity? I want to create a trail like this game...

When the plane flies it creates this trail...

It's possible because the game itself was made in Unity...

But I can't find any options to do so...

Any help would be much appreciated...

sentences:
How do I tackle top down RPG movement? I have a game that I am writing in Java. It is a top down RPG and I am trying to handle movement in the world. The world is largely procedural and I am having a difficult time tackling how to handle character movement around the world and render the changes to the screen. I have the world loaded in blocks which contains all the tiles.

How do I tackle the character movement?

I am stumped and can't figure out where I should go with it.

EDIT:
Well I was abstract with the issue at hand.

Right now I can only think of rigidly sticking everything into a 2D array and saving the block ID and the player offset in the Block or I could just "float" everything and move about between tiles so to speak.

sentences:
Multiple Render Targets, Multiple Fragment Shaders I render a normal and a depth image of a scene. Then I want to reuse these two images to do further texture/image processing in a second fragment shader. I use a framebuffer with 3 textures attached to it. 2 for the normal and the depth textures and one is supposed to contain the final processed image. The problem is, that I can't get the first two images to the second fragment shader to use them as texture samplers.

Here is my code:
First I create a fbo and attach 3 textures to it.

    // create FBO
glGenFramebuffers(1, &Framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, Framebuffer);

glGenTextures(1, &renderedNormalTexture);
//glBindTexture, glTexImage2D, glTexParameteri ... left out for clarity
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, renderedNormalTexture, 0);

glGenTextures(1, &renderedDepthTexture);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, renderedDepthTexture, 0);

glGenTextures(1, &edgeTexture);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, edgeTexture, 0);

ndbuffers[0] = GL_COLOR_ATTACHMENT0;
ndbuffers[1] = GL_COLOR_ATTACHMENT1;
ndbuffers[2] = GL_COLOR_ATTACHMENT2;
glDrawBuffers(3, ndbuffers);

Fragment shader 1:
This is the first fragment shader which outputs 2 textures to position 0 and 1

in vec3 position_worldspace;
in vec3 normal_cameraspace;
in vec4 vpos_to_fragment;
uniform float zmin;
uniform float zmax;
layout(location = 0) out vec3 normalcolor;
layout(location = 1) out vec3 depthcolor;
void main() {
normalcolor = normalize( normal_cameraspace ) * 0.5 + 0.5;  // normal out
  vec4 v = vec4(vpos_to_fragment);
v /= v.w;
float gray = (-v.z - zmin) / (zmax - zmin);
depthcolor = vec3(gray);  // depth out
 }

fragment shader 2:
And the second fragment shader which is supposed to receive two texture samplers from position 0 and 1 and do sth. with them:

uniform sampler2D normalImage;
uniform sampler2D depthImage;
uniform float width;
uniform float height;
in vec2 UV;
layout(location = 2) out vec3 color;

void main() {
vec3 irgb = texture2D(normalImage, UV).rgb;
// do sth here...
color = irgb ;
}

And finally the rendering step:
Maybe I am mistaken here. I render the geometry/scene (once?!) and apply two fragment shaders.

glUseProgram(FragmentShader1);
SetMVPUniforms();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
RenderScene(); // render geometry

glUseProgram(FragmentShader2);

GLuint nID = glGetUniformLocation(FragmentShader2, "normalImage");
GLuint dID = glGetUniformLocation(FragmentShader2, "depthImage");

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, renderedNormalTexture);
glProgramUniform1i(FragmentShader2, nID, 0);

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, renderedDepthTexture);
glProgramUniform1i(FragmentShader2, dID, 1);

Now what I get is either nothing or a wrong colored image.

sentences:
VBO Performance issues I'm making a 2D Tile based game in OpenTK at the moment. Performance was really bad (laggy and slow) with direct drawing, so I switched to VBOs. The performance hasn't changed, it might even be slower than it was.

I render the tiles from a list, but use a single VBO.

public void DrawTiles()
        {
            foreach(Tile t in Tiles)
            {
                if(t != null)
                {
                    GL.Color4(System.Drawing.Color.White);
                    GL.BindTexture(TextureTarget.Texture2D, Global.LoadTexture(t.TileTexture.Path, 1));
                    var i = (CellNum * CellSize) / 2;
                    GL.PushMatrix();
                    GL.Translate((t.Position.X * CellSize) - i, 0, (t.Position.Z * CellSize) - i);
                    var x = CellSize;
                    verts = new Vector3[8]
                    {
                        new Vector3(0, 0, 0), new Vector3(0, 0, 0),
                        new Vector3(x, 0, 0), new Vector3(1, 0, 0),
                        new Vector3(x, 0, x), new Vector3(1, 1, 0),
                        new Vector3(0, 0, x), new Vector3(0, 1, 0)
                    };

                    GL.EnableClientState(ArrayCap.VertexArray);

                    GL.EnableClientState(ArrayCap.TextureCoordArray);

                    GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
                    GL.BufferData<Vector3>(BufferTarget.ArrayBuffer, (IntPtr)(Vector3.SizeInBytes * CellNum), verts, BufferUsageHint.StaticDraw);
                    GL.BindBuffer(BufferTarget.ArrayBuffer, 0);

                    GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
                    GL.VertexPointer(3, VertexPointerType.Float, Vector3.SizeInBytes * 2, 0);
                    GL.TexCoordPointer(3, TexCoordPointerType.Float, Vector3.SizeInBytes * 2, Vector3.SizeInBytes);
                    GL.DrawArrays(PrimitiveType.Quads, 0, verts.Length / 2);
                    GL.Flush();
                    GL.PopMatrix();
                }
            }
        }

That method is called in OnRenderFrame, CellSize and CellNum tell me how big the tiles are supposed to be and how many there are each side of the grid. Even if I run say a 20 tile grid, my program is incredibly laggy.

Does any one know a more efficient way to render these tiles, or better yet, speed up my current method?

sentences:
How should I access frame buttons from a controller in an MVC approach? I'm developing an italian card game using the mvc pattern. I have the class GameFrame that contains the view. The user's card are buttons (JButton objects). I have 3 controllers:

GameController: to control the game in general. Contains the game loop.
HumanPlayerController: to control the user input
ComputerPlayerController: contains the AI of the computer
PlayerController: is an interface with the makeTurn() method. It's implemented by HumanP.C. and ComputerP.C.

HumanPlayerController implements ActionListener too. But what is the right way to access to the GameFrame buttons? I need it for understand which card was chosen.

GameFrame and HumanPlayerController are in different packages. Should i make the JButtons public?

sentences: Grow first, Ads later for mobile games? Facebook's strategy has been to Grow First, include Ads Later. For mobile games, is there any evidence that ads hinder popularity, or that people are more likely to share games without ads?  Or as mentioned by angarg12, is there evidence that introducing ads part-way through a game's life cycle affects how people feel toward your game?

sentences:
Isometric drawing "Not Tile Stuff" on isometric map? So I got my isometric renderer working, it can draw diamond or jagged maps...Then I want to move on...How do I draw characters/objects on it in a optimal way?

What Im doing now, as one can imagine, is traversing my grid(map) and drawing the tiles in a order so alpha blending works correctly.

So, anything I draw in this map must be drawed at the same time the map is being drawn, with sucks a lot, screws your very modular map drawer, because now everything on the game (but the HUD) must be included on the drawer..

I was thinking whats the best approach to do this, comparing the position of all objects(not tile stuff) on the grid against the current tile being draw seems stupid, would it be better to add an id ON the grid(map)? this also seems terrible, because objects can move freely, not per tile steps (it can occupies 2 tiles if its between them, etc.)

Dont know if matters, but my grid is 3D, so its not a plane with objects poping out, its a bunch of pilled cubes.

sentences:
Why loading ~250mb of compressed texture data spills Out of memory error on Windows I am making SDL2/OpenGL 2D game for Windows with a lot of pre-rendered sprites. When testing on my laptop I got SDL_Surface creation failed: out of memory error during loading assets.

Windows' Application Manager on other machine shows that my game in stress uses less then 170 mb of ram memory and MSI Afterburner shows that vram usage for entire system is below 800 mb.

My laptop has 8 gb of RAM and 2048 mb of vram (GeForce 840 M).

I am obviously doing something terribly wrong, but I don't know wheres my ram usage counting technique is wrong, or maybe for some reasons I have less memory then available on system, or something completely else is happening. But I don't know where to search for.

I will gladly post some code if I need to, but I don't know which parts will be useful in diagnosing the problem.

One more thing, I am using GL_COMPRESSED_RGBA_ARB for all textures

Edited

It's not exactly the same situation as what's described here. I've already measured vram usage, and numbers are way below available count, yet still I get out of memory error. So, the question is: "How measure properly vram usage", not "How measure vram usage", as in other question. I am not a native English speaker, so maybe there is some cloud in my title - I will gladly accept correction for title

Edited

I reckon the image load procedure might be useful here, since it is heavily related to issue.

Game::Texture * Game::Asset::GetTex(const UString & path)
{
    Texture * ret = _assetsTex[path];
    if (ret)
        return ret;

    const UString & absolutePath = GetAbsolutePath(path);
    SDL_Surface * surface = IMG_Load(absolutePath.GetCStr());

    if (!surface)
        ERR(_U("Failed to load surface: #1#"), UString::FromA(IMG_GetError())); // Here's my problem!

    int bpp = surface->format->BytesPerPixel;
    UInt8 * pixels = (UInt8 *)surface->pixels;

    if (bpp != 3 && bpp != 4)
    {
        WARN(_U("Texture '#1#' is not 24 bpp or 32 bpp! Aborting load..."), path);
        SDL_FreeSurface(surface);
        return nullptr;
    }

    GLuint tex;
    glGenTextures(1, &tex);
    glBindTexture(GL_TEXTURE_2D, tex);

    if (bpp == 3)
        glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ARB, surface->w, surface->h, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
    else if (bpp == 4)
        glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ARB, surface->w, surface->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

    ret = new Texture(tex, surface->w, surface->h);

    SDL_FreeSurface(surface);

    _assetsTex[path] = ret;

    return ret;
}

Edited

I moved from SDL_Image to stb_image for image load, but I still got out of memory error message

Edited

I've installed VS Studio 2015 on my laptop and found out:

Task Manager shows application eats up 650 mb in the moment of Out of memory casted
GetProcessMemoryInfo returns PeakWorkingSetSize ~720 mb and WorkingSetSize 650 mb as well
But Visual 2015 UI (Debug Diagnostic, memory usage) shows that application actually consumed 1.7 gb. Even if this is true and both former are not, there is still plenty of room for allocations (application is 32 bit, there are 8 gb of on-board memory, not counting page file)
I tried to convert png -> tga and load them up, to check if png uncompressing is eating memory, but the result was exactly the same, the same Out of memory error
Out of memory is spit in png load function which has nothing to do with OpenGL and GPU at all. I am retagging and retitleing the post

sentences:
How attach a model with another model on a specific bone? I meet a difficulty attached to a model to another model on a "bone" accurate.
I searched several forums but no result. I saw that many people have asked the same question but no real result see no response.
Thread found :

How to attach two XNA models together?

How can I attach a model to the bone of another model?

https://stackoverflow.com/questions/11391852/attach-model-xna

But I think it is possible.

Here is my code example attached a "object" of the hand of my player

private void draw_itemActionAttached(Model modelInUse)
    {
        Matrix[] Model1TransfoMatrix = new Matrix[this.player.Model.Bones.Count];
        this.player.Model.CopyAbsoluteBoneTransformsTo(Model1TransfoMatrix);
        foreach (ModelMesh mesh in modelInUse.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                Matrix model2Transform = Matrix.CreateScale(1f) * Matrix.CreateFromYawPitchRoll(0, 0, 0);

                effect.World = model2Transform * Model1TransfoMatrix[0]; //root bone index
                effect.View = arcadia.camera.View;
                effect.Projection = arcadia.camera.Projection;
            }
            mesh.Draw();
        }
    }

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: how to prevent a ball from bouncing only vertically I am trying to make a ball bounce off (and also sideways) when it gets into contact with another object. I am having an issue shown in the image below, where the ball rests on the triangle instead of falling off sideways. I tried playing round values for the bounciness and friction, but that didn't solve my issue. How can I solve this issue. I've added the inspector settings on the ball.

sentences:
LWJGL - Mixing 2D and 3D I'm trying to mix 2D and 3D using LWJGL.

I have wrote 2D little method that allow me to easily switch between 2D and 3D.

protected static void make2D() {
    glEnable(GL_BLEND);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    glOrtho(0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
}

protected static void make3D() {
    glDisable(GL_BLEND);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity(); // Reset The Projection Matrix
    GLU.gluPerspective(45.0f, ((float) SCREEN_WIDTH / (float) SCREEN_HEIGHT), 0.1f, 100.0f); // Calculate The Aspect Ratio Of The Window

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    glLoadIdentity();
}

The in my rendering code i would do something like:

make2D();
//draw 2D stuffs here

make3D();
//draw 3D stuffs here

What i'm trying to do is to draw a 3D shape (in my case a quad) and i 2D image. I found this example and i took the code from TextureLoader, Texture and Sprite to load and render a 2D image.

Here is how i load the image.

TextureLoader loader = new TextureLoader();
Sprite s = new Sprite(loader, "player.png")

And how i render it:

make2D();
s.draw(0, 0);

It works great.

Here is how i render my quad:

glTranslatef(0.0f, 0.0f, 30.0f);
glScalef(12.0f, 9.0f, 1.0f);
DrawUtils.drawQuad();

Once again, no problem, the quad is properly rendered.

DrawUtils is a simple class i wrote containing utility method to draw primitives shapes.

Now my problem is when i want to mix both of the above, loading/rendering the 2D image, rendering the quad. When i try to load my 2D image with the following:

s = new Sprite(loader, "player.png);

My quad is not rendered anymore (i'm not even trying to render the 2D image at this point). Only the fact of creating the texture create the issue. After looking a bit at the code of Sprite and TextureLoader i found that the problem appears after the call of the glTexImage2d. In the TextureLoader class:

glTexImage2D(target,
        0,
        dstPixelFormat,
        get2Fold(bufferedImage.getWidth()),
        get2Fold(bufferedImage.getHeight()),
        0,
        srcPixelFormat,
        GL_UNSIGNED_BYTE,
        textureBuffer);

Commenting this like make the problem disappear. My question is then why? Is there anything special to do after calling this function to do 3D? Does this function alter the render part, the projection matrix?

sentences:
is it possible to use dynamic types in c# generic methods? for example i need something like this:

 SQLITE._instance.ds.GetItems<armour>();

armour is a class. but i need to get type of object to send to it in order to avoid rewriting this function.

for example it need:

SQLITE._instance.ds.GetItems<"classType">();

or

 SQLITE._instance.ds.GetItems<obj.getType()>();

to send the type to generic function. but i always receive that you send a variable not a type to generic function.

what should i really do?

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:
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:
Left-Hand and Right-Hand Coordinate Systems In Blender and other 3D modeling tools, the coordinate system is right-handed, while in Unity 3D and Orbiter Space Flight Simulator, they are left-handed, why this could happen? Why they don't simply use the right-hand coordinate system all the time to make things easier? Why don't all programs that deal with 3D graphics use Z+ as up?

 Y         |  Z
 ZX        |  YX
RIGHT-HAND | LEFT-HAND
TOP VIEW   | TOP VIEW

(fortunately, Unity3D converts from Blender coordinate system to Unity3D coordinate system)

sentences:
Disabling, overriding or hooking a VS warning to Unity's Vector's ToString()? I've just spent 2 hours debugging a misbehaviour because ToString() truncates to 1 digit by default.

I want to disable the parameterless version so I won't use it by accident and I will always have to define how much truncation I want.

Or if this isn't possible I want to redefine it, so it will truncate to 3 digits for example.

Or somehow hook a custom warning to it, so Visual Studio will tell me that I'm using it?

Is this possible?

sentences:
Java multiple player objects/enemy objects? NOTE: I'm a beginner and learning :D

Alright, so in my game I have a class for the player (with the parameters of x, y, color, width, height, and health, same parameters with the enemy). But I have a problem. So, in my player class, I have a draw method which sets the color and fills a rectangle with the variables specified in the parameters. In my main class, I create an instance of that player, and call the draw method from there, too. However, when I try to create more than 1 player object, it just renders the second one, rather than both, even if the x, y, color, and pretty much everything is different.

Basically, I can't draw more than 1 player to my screen. Same thing with the enemy.

sentences: What to use as a Box2D renderer in a release version? I'm creating a game with libgdx. For testing physics I use a Box2DDebugRenderer, which is not fast. When I want to release my full game, what should I use as a renderer?

sentences:
What needs to be done to port a Windows Flash game to Android? My team has developed a game using Flash (with Lua embeded) that targets Windows. And we want to port that game to Android (also iOS in the future).

It's acceptable to rewrite the Flash part of client. And some other team in our company recommended Unity3D to replace the Flash part.

Since we have no experience in Android/iOS development, we would need to learn some new tool/language anyway. So we would like that learning still be useful after the porting and when we starting a new game.

Any thoughts?

Edits:

I think it is worth noticing the background of the game : the project is started by a tester and developer, both without knowing much about flex and actionscript. They built the game while learning, so most of the code is hard to maintain. I and other two developers joined the project after a year or so when one has leave (and the other be our manager). The other two developers are just graduates with little experience and little knowledge of flex. I am good at the server part and the c# language.

Based on the fact that the code is hard to maintain (and we do need to change a lot of code to make the game easier to playe in a mobile device), and I am good at c# (and learning). I still tend to do the porting with Unity, which could get better performance and possibly save time.

sentences:
How to create a material that blends textures in Blender to Unity workflow I'm new to Blender and Unity and trying to figure out the best way to create a material that will use either vertex colors or a texture map to interpolate between other textures on a single mesh.  This is the sort of effect you might use when you want to have a big grassy terrain mesh with a dirt path running down the middle of it and patches of rock here and there - and instead of modeling each of those as separate pieces, you create a single shader that takes a grass, dirt and rock texture map and uses a fourth blending map to decide which to sample from.

I come from a Maya background which provides an HLSL material shader that makes this straight forward.  It's not as clear to me how to do this in Blender, and in particular the best way to set it up so that it imports into Unity cleanly.  I suspect that setting up the shader using Blender's cycles shading network won't create anything Unity can recognize.  Blender also has the Open Shading language, but again I'm unsure how well this will work with Unity.

I could also bake all my textures, but this strikes me as wasteful of memory and bandwidth.

I have experience with both HLSL and GLSL.  Is trying to do this with custom shaders the best way to do about things?  What's the best way to set things up so that both Blender and Unity are happy?

sentences:
Multiplatform GLSL shader validator? Im working on a multiplatform (Pc,Mac,Linux) game that uses shaders quite extensively. Since we do not have any funding, it is pretty hard to test our game on all possible hardware configurations.

While our engine seems to run fine on different platforms, its usually the slight differences in GLSL compiling that gives us headaches. We have things set up such that we can test the shaders on Ati/Nvidia cards, but since the new Macbooks have Intel graphics, I'm really looking for a tool that can simply validate my GLSL shaders for different hardware without the need of yet another system.

Does anyone know such a tool?

sentences:
Implementing simple proportional navigation for a homing missile I'm trying to implement the simplest possible form of proportional navigation, i.e, the missile turns in the direction that its bearing-to-target is changing, and once its bearing-to-target is unchanging, it's on an intercept course.

So, I have a 2d missile moving at a constant speed in the direction it is facing, which can turn at a constant rate, and every interval I update the missile with something like:

Position += VectorProduct (Direction * Speed * TimePassed)

PreviousTargetBearing = TargetBearing
TargetBearing = AngleBetween(TargetPosition, Position)
TargetBearingDelta = TargetBearing - PreviousTargetBearing

If TargetBearingDelta > 0: MissileDirection += TurnRate * TimePassed
If TargetBearingDelta < 0: MissileDirection -= TurnRate * TimePassed

Problem is, the missile always oscillates around its launch direction, because as soon as the missile turns the first time, this reverses the sign of TargetBearingDelta, making it then turn in the opposite direction, and so on...

What is the simplest way I can resolve this problem? I'm sure I'm missing something simple.

Related StackOverflow question: How to create an “intercept missile” for a game?

To reiterate, I am interested specifically in implementing the proportional navigation algorithm, not in homing algorithms in general.

Update: I guess the obvious answer is to not check bearing and adjust heading every turn, but to alternate between the two. I'll try that.

sentences:
Is there a repository of game logic algorithms? I'm writing my first 2D game, and I'm writing some tracking logic for the computer enemies. Basic follow-the-player tracking was easy, but ineffectual. Too easy to escape. So I'm trying to implement some more sophisticated flanking and other tactics, and (as expected) it's pretty tricky. This is a topic I know nothing about.

I'm going to keep trying, but it'd be awesome to have some examples or tips to work off of.

Is there any place that has a decent set of pseudocode AI algorithms, or tips or advice on the subject, e.g. for 2D tracking?

sentences:
Using DirectX9 within Visual Studio 2012 in Windows 8? Asking the question here simply because my PC is down for the count for a while and wasn't able to stave a curiosity before that happened.

I picked up a few books about programming Games in DirectX, specifically 9.0c.

I have a Windows 8 machine, and have Visual Studio 2012, and remember a massive headache about following some of the more simple DirectX tutorials on the web as everything I could find was prior to Windows 8 when all headers and such we're available, and DirectX wasn't merged into the WindowsSDK. (I think specifically it was the absence of a commonly used DX UTILITY that was causing issues).

Before my PC went down, I wasn't able to try simply installing previous SDK's.

.. Does this work? Can one, under a Windows 8 environment with Visual 2012, install the previous DX9 SDK's and it'd work out alright? Are there going to be conflicts? How can I set this up correctly?
I'm just interested in getting going with the basics of what can be followed by the majority of the resources available today, and not so much "bleeding edge" at the moment...

Thank you in advance!

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 some great papers/publications relating to game programming? What are some of your favorite papers and publications that closely relate to game programming? I'm particularly looking for examples that are well-written and illustrated, and/or have had a profound influence on the industry. (Here's one example: in this GDC talk, Bungie's David Aldridge mentions that a paper called "The TRIBES Engine Networking Model" was the starting point for Halo's network code.)

sentences:
How to Call a function from another script? I just learned in a C# tutorial that we can declare var name = new ClassNameOfOtherScript(); to create a new class object, then use the object to call the function in that class, but it doesn't seem to be working in Unity.
Am I understanding it wrong or does it work differently in Unity?
I have a class Cube1 this is attached to an object with SpriteRenderer enabled. Then I have another script ClockController which is not attach to any object. When I run it, the color of cube does not change to red?
public class Cube1 : MonoBehaviour
{

    public void Rectangle()
    {
        GetComponent<SpriteRenderer>().color = Color.red;
    }

}

public class ClockController : MonoBehaviour
{

    void Start()
    {
        var cube1 = new Cube1();
        cube1.Rectangle();
    }
}

sentences:
How to expose a child node’s texture from the parent in Godot I built a simple scene that I instanciate at will.  Simply a KinematicBody2D as root, containing a Sprite and a CollisionShape2D.  There is a script linked to the root node that basically expose a few properties to describe an orbit and make it move in orbit around its parent.  The point being to make a very basic solar system simulation or anything that requires a node to move around another in a circular fashion.

The movement work fine and I’ve been playing around my scene tree, instancing a bunch and watching them move around as moons of planets, etc.  But the texture is all the same.  If I make children editable, I can go change the texture of the sprite, but I’d like to expose that property from the root node so I can access it directly from the editor.

I tried adding an exposed property with a setter and a getter to assign and retrieve the texture, but it seems to crash Godot completely with this code:

export(Texture) onready var texture setget texture_set, texture_get

func texture_set(newtexture):
    $"Sprite".texture = newtexture

func texture_get():
    return $"Sprite".texture

Is there a solution for that?  Or simply another way?

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:
Should collision detection be done server-side or cooperatively between client/server? I am working on an online game that will have very heavy collision detection processing. Player models will collide with other players, mobs, structures, terrain, and solid objects that only exist server side (not stored in client data files).

For security purposes, should I do all collision detection server-side? Or should I have the client do the detection and have the server follow up on it somehow? I feel like it will be too much for the server to do by itself (I am designing the engine for hundreds of players on one server).

Does anyone know how mainstream MMOs do it? I know that almost all MMOs right now are susceptible to physics hacks and usually deal with them by detecting hacks and banning people. I would rather the hacks did not work at all, at least for the physics component.

sentences: Reason for white lines in tile-based game My game is tile-based. I am getting this lines between two tiles. They don't look nice. How can i resolve this issue?

sentences:
Will Geolocations for IPs ever change? I'm making a game where the geographic location of a user is used to give them a little flag icon next to their user name. To do this, I've been using the ipstack API. However, the API only allows up to 10,000 requests per month, and since I make a request every time a user connects, this could easily lead to overuse.

Would it make sense to just store geolocation data on my server and only make a request when an unknown IP connects? Or will the geolocation data ever change for an IP?

sentences: How to adjust position relative to resolutions? I have a lot of objects on the screen and would like at different resolutions, object's positions rendered correctly on the screen irrespective of the resolution. Is it correct to multiply the position by aspect ratio ?

sentences:
Supercover line algorithm from corners instead of the square's center? I need to check whether a cell in a 2D grid is visible to the starting cell. I'm currently using amit's supercover line algorithm, this one https://www.redblobgames.com/grids/line-drawing.html#supercover
The algorithm works but I need  the cells that are intersected by the top-left corner-to-corner line instead of the center-to-center.
This shows what I mean:

The green square is the start point and red is the end point
The white dots represents the cells that are visited by the line drawing algorithm I'm using
I want to get the cells that are intersected by the blue line. It's drew from the top-left corner of the start cell to the top-left corner of the end cell.

This is my implementation of the amit's algorithm in gdscript
func _line_of_sight(p0, p1):
    var dx = p1.x - p0.x
    var dy = p1.y - p0.y

    var sx = 1 if dx > 0 else -1
    var sy = 1 if dy > 0 else -1

    var p = Vector2(p0.x, p0.y)
    _points.append(p)

    var x = 0
    var y = 0
    var nx = abs(dx)
    var ny = abs(dy)

    var result = true
    var blocked_cells = _tilemap.get_used_cells()

    while x < nx or y < ny:
        var px = (1+2*x) * ny
        var py = (1+2*y) * nx

        if px == py:
            p.x += sx
            p.y += sy
            x += 1
            y += 1

        elif px < py:
            p.x += sx
            x += 1
        else:
            p.y += sy
            y += 1

        if blocked_cells.has(p):
            result = false

        _points.append(p)

    return result

I've also tried Bresenham's line algorithm and the Bresenham supercover modification, this and this, as well as this, but none did the trick
Any insight would be appreciated - thanks in advance!

sentences:
Data structure for objects in a galaxy of star systems I'm having some difficulty coming up with the appropriate data structure to use for a game.
I'm aiming for a galaxy view with tens of thousands of visitable star systems.

Structure
Hierarchically, each star system can contain one or more of the following:

Planets [and their moons]
Asteroid Belts
Megastructures [and their moons/sub-structures]

All of the above can have "points of interest" [POI] eg a station in low orbit, a surface resource node, a docking bay.
Usage
I don't particularly care about physical location within a system beyond knowing its order in the hierarchy (I'll be showing a list of locations, rather than trying to render them in 3D space). So I can treat all objects within a system as located at the star for the pursposes of calculation.
I do, however, need a way to specify routes from any Planet/AsteroidBelt/Moon/Megastructure/POI to any other. I also need to be able to search for other locations meeting certain criteria [both to offer as destinations in the UI and to handle rendering].
Each type of location will have some unique properties (Asteroid belts have resource distributions, for example whereas planets ave atmospheres) but they also have lots of common properties (inventory, owner, comms network node id, etc).
Ideas so far
Obviously, with the numbers I'm considering I need to take a sparse/lazy generated approach. Currently the galaxy is built entirely in the GPU and stars are only presented to the CPU when the user first clicks on them.
That lends itself nicely to a hierarchical data structure with a load-on-first-access approach. Click on a star and it's added to the list, so the name is saved. Scan/visit it and I'll generate the system contents.
Unfortunately, I also need to be able to search across all generated locations efficiently (given an ID, find the star system coordinates, find planets with an atmosphere like X, find any location with X in its inventory) in a potentially huge search space.
That doesn't align with recursively walking up/down trees.
I considered using a heirarchy and manually maintaining a number of separate indices to speed up searching. It's doable but a pain and error-prone. It also feels like one of those solutions where I'm going to keep finding one more type of query I need to support and before long I'm trying to implement a minimal database.
Speaking of which I also need to persist this data at some point. Currently I'm serializing to a densely packed binary blob.
So... I took a step back and wondered whether I should actually use a database. I can see the benefits of using something like SQLite which I could bundle with the game and would handle persistence, indices, and the rest.
Db?
After spending a couple of days implementing the basics, I can see this is going to be quite a long and involved process.
None of the friendly tooling works well in Unity, so I can't take advantage of entity framework w/ code first, nor nice Linq-To-Sqlite predicate handling. Even worse, most of the libraries to work with EF are tightly coupled to windows. EF Core seems like an option but I haven't been able to get it working in Unity (I need to do some assembly version mapping but as Unity overwrites the project file regularly and doesn't seem to support this itself, I think it's a losing battle).
So I've headed down the route of implementing a data layer that generates SQL as needed.
I can do that, but it opens up a huge can of worms in terms of manually maintaining the DB schema. I'm going to have to start tracking a DB version and bundling migration scripts with any update/patch. It's a whole new maintenance burden.
Question
So... What am I missing? What's the elegant way to store a sparse hierarchy of data whilst still supporting flexible search across disparate object types that just happen to have a lot of common properties?

sentences:
How to give a certain scene different preference settings then other scenes unity In my unity game that I am creating there are 4 scenes. 3 of those scenes rely on a backdrop because they are the main menu, death screen and the escape screen(for when you escape the place). Therefore they need a high resolution image. However, the other scene (the main game scene) is incredibly laggy when the quality setting for the texture quality isn't "eighth res". How can I make it so that the texture quality for only my game scene is eighth res and the rest is normal res? This might help: my build order value is the main menu is 0, my game is 1, my death scene is 2 and my escape scene is 3.
thanks in advance

sentences: How to make 4 way walking animation in game maker studio 2? So I am trying to make a 4 way movement for my character, and I cant seem to get the walking animations to work for it. The character moves fine, but whenever he moves, the walking animation doesn't play. I figured it was because I made it so when the button was held down, it put it as the sprite for that direction constantly, so it could never get to the next frame. does anyone know how to bypass this? (btw I am using D&D)

sentences:
Moving Rect with KEYDOWN I tried to move my obstacle with the event type KEYDOWN, but it seems it is not working.
This is my code.
import pygame
import time

pygame.init()
res=(500,500)
blue_color=(0,0,255)
black_color=(0,0,0)
red_color=(255,0,0)
title=pygame.display.set_caption("Pygame Game")
screen=pygame.display.set_mode(res,pygame.RESIZABLE)

coord_rec=pygame.Rect(250,2,20,20)
coord_obs=pygame.Rect(150,450,200,20)
rectangle=pygame.draw.rect(screen,blue_color,coord_rec)
obstacle= pygame.draw.rect(screen,red_color,coord_obs)

pygame.display.flip()
launched= True
while launched:
    for event in pygame.event.get():
        if event.type== pygame.QUIT:
            launched=False
        elif event.type==pygame.KEYDOWN:
            if event.key==pygame.K_LEFT:
                    coord_obs.x+=10
            elif  event.key==pygame.K_RIGHT:
                    coord_obs.x +=-10

    while not coord_rec.colliderect(coord_obs):
              time.sleep(0.0500)
              screen.fill(black_color)
              coord_rec.y+=10
              rectangle=pygame.draw.rect(screen, blue_color, coord_rec)
              obstacle=pygame.draw.rect(screen, red_color, coord_obs)
              pygame.display.flip()

sentences:
How do I determine my games minimum hardware/software requirements? With me going it alone in development I only have limited resources at my disposal i.e one pc with which I develop and test the game. so I only know for certain my game works with that setup.

What options have I got in testing the game on the many different hardware/operating system combinations? Its a windows desktop game.

sentences:
Stuck trying to decompress sections in Minecraft Anvil files (.mca) I've been trying to write some Java code to read .mca files, based on the information at http://wiki.vg/Map_Format and http://wiki.vg/User:Sprenger120 . I am at the point where I can read in the header correctly, and read the header for each section, telling me its compression mode and size. I am now trying to inflate the NBT blob that is the actual section, but it's not working at all. I just get "java.io.IOException: Not in GZIP format".

I'm starting the deflation stream five bytes into the memory segment specified by the header, and given that I am consistently getting sane section sizes and compression types, it seems like I'm managing to parse correctly up to this point, but now I'm stuck.

The code is at: https://github.com/Zarkonnen/Ager/tree/master/src/ager

I don't know if this is the correct forum to ask this kind of question - if it isn't, I apologise and would be very thankful if someone could direct me to a good place to ask it.

sentences:
Animation package from Assert Store not working probably with Unity Model/Custom Model? I downloaded the animation pack from here:
https://www.assetstore.unity3d.com/en/#!/content/25794
The assert contains a fbx file, which contains a bunch of animations.

Then in Animator window I added a State and transitions between states and have set the Motion in the inspector of the state.
Then I look at the preview in Animator's inspector with it original Model, the animation works properly:

If I apply Unity Model or my custom Model in the preview, its became:

Why is that?  How can I fix it?
Or did I use it incorrectly?

sentences:
Create button in NGUI I try to create a button with the help of the NGUI. Here are screenshots of me doing that:

So the problem here is the next. When clicking play button in game mode I hope to get the following line in the console:

play.

But actually nothing happens. What am I doing wrong?

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:
How can I send different contoller input to the different player avatars? My apologies in advance for the vague question, since I don't understand the problem well enough to ask in finer detail.

I want to create a multi-player Unity application using the Oculus SDK. Let's say there are two players in the scene, A and B. The problem is this: When player A presses a button using his index finger, the hand avatar for player B also displays a moving index finger. In short, hand movements for one player are also observed for the other. Controller inputs are also read without any ability to distinguish whether they originate from player A or B.

What are the possible approaches for eliminating this problem, if it is mandatory that I continue using Oculus SDK?

sentences:
User extendable content with Contentmanager I developed a towerdefense game that uses xml-Files for almost everything, (creeps, levels, towers, upgrades). Those Xml-files define properties like textures, sounds and values like hitpoints.

My goal is to give the user the power to add and modify those things, which will be some kind of editor in the future probably.
For now it shall be notepad...

So this makes using the ContentManager impossible i guess, since it needs to compile the data into those xnb Files.

I dont have a problem to use XmlSerializer, but how does it work for textures or sounds? Do i need to write my own code for loading the texture into vram etc?

Do i need to reinvent the wheel here and write my own ContentManger or can I make use of an existing feature?

I found a few "similiar" questions but none really gave me an answer.

sentences:
Why are there weird texture artifacts in baked light which don't appear with realtime light? This is the comparison of the same scene, realtime light vs baked light.

What's am I wrong ?

EDIT: In particular, also texture are low quality (see image 2). Why ?

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:
Issue with 2d Angular Car Collision Response I am having trouble getting the angular collision response to work properly in my 2d car simulation. I have gotten the linear collision response to work between the vehicles, however, the angular collision response does not seem to be working. The problem seems to arise from my slip angle calculation for the car, and it seems to override the angular impulse. The slip angle is necessary to make the vehicle move realistically.
Here's the code to calculate the slip angle:
// Calculate slip angle for front/back wheel
this.wheels.front.slipAngle = -Math.atan2(this.localVelocity.y + yawSpeedFront, Math.abs(this.localVelocity.x));
this.wheels.back.slipAngle = -Math.atan2(this.localVelocity.y + yawSpeedRear,  Math.abs(this.localVelocity.x));

As can be seen in the following pictures, the car rotation response is correctly simulated when it hits the top of the car and rotates clockwise. On the other hand, when the car hits the bottom of the other car, the rotation should be clockwise, but actually still goes clockwise. It seems to me that the problem arises because the slipAngle overrides the angular rotation of the collision.

My project can be seen here: https://victorwei.com/projects/car-sim/ Feel free to take play around with the simulation and view the code to figure out the issue. If there are any suggestions on how to mitigate this problem, that would be greatly appreciated.

sentences:
OpenGL 4.5 Primitive Restart vs. Base Index From how I understand the two techniques (Primitive Restart and Base Index) explained on https://www.opengl.org/wiki/Vertex_Rendering , they both do the very same thing. Simply spoken, they allow me to put many meshes into the same buffer and then render them as multiple meshes again. Is my understanding right?

If my understanding is indeed right, then my next question would be how well either of them works together with indirect rendering and multi-rendering.
Let's just use the following example: I have multiple meshes, which are put together to one entity. Multiple entities are put together to one scene. In a scene, entity attributes, like location, textures,... might change. What would be the most optimized way to render them performance vise? By using glMultiDrawElementsBaseVertex() (is there an indirect version?) or by setting glPrimitiveRestartIndex() and then using glMultiDrawElementsIndirect()?
If there is no indirect variant for the former, shouldn't the latter be the better choice?

Of course, there might be a better way of doing things. If so, I would really like to hear it :)

sentences:
glsl wrong light direction I'm practicing the Phong lighting model with glsl, and here's my shaders:
vertex shader:

#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord;
layout (location = 2) in vec3 aNormal;

out vec2 TexCoord;
out vec3 LightColor;
uniform mat4 model;
layout (std140) uniform coord_mats {
    mat4 view;
    mat4 projection;
    vec3 lightPos;
    vec3 lightColor;
};

void main()
{
    vec3 vertex_position = vec3(model * vec4(aPos, 1.0));
//    vec3 vertex_position = vec3(view * model * vec4(aPos, 1.0));
    vec3 vertex_normal = normalize(vec3(model * vec4 (aNormal, 1.0)));
//    vec3 vertex_normal = normalize(vec3(view * model * vec4 (aNormal, 1.0)));
    vec3 light_position = vec3(vec4(lightPos, 1.0));
//    vec3 light_position = vec3(view * vec4(lightPos, 1.0));
    vec3 light_dir = normalize(light_position - vertex_position);
    float diff = max(dot( light_dir,vertex_normal), 0.0);
    vec3 diffuse = diff * lightColor;
    vec3 ambient = 0.1 * lightColor;
    LightColor = diffuse + ambient;

    gl_Position = projection * view * model * vec4(aPos, 1.0);
    TexCoord = vec2(aTexCoord.x, aTexCoord.y);
}

fragment shader:

#version 330 core
out vec4 FragColor;

in vec2 TexCoord;
in vec3 LightColor;
// texture sampler
uniform sampler2D texture1;

void main()
{
    FragColor = vec4(LightColor,1.0) * texture(texture1, TexCoord);
}

The diffuse light works right, that is, faces which are facing to the light source, are bright, when backing the light source, they are dark(basically ambient color).

Now I want to calculate the specular light, in order to get the camera position for free, I changes the coordinate to camera view coordinate(using the commented code, just multiply the view matrix to the vertex position, normal and light position), but weird things happened: all faces which are facing the light is dark, all faces which are backing to the light is bright.

How could this happened?

sentences:
Is it must to use 3rd party framework to use to develop adobe stage3d game I was searching for tutorials to develop games using stage3d. Every where I came across the articles/tutorials using the frameworks.

Is it compulsory to use the frameworks? or its very difficult to do it without frame works?

sentences:
Creating your own vertex element in XNA I needed to create my own VertexElement with the follow - Position, Color & Normal. I found a tutorial explaining how to do this here (http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/Terrain_lighting.php).

I created a struct similar to the tutorial and then replaced all the declarations with the new one, but I get this error:

  There is no boxing conversion from 'VertexPositionColorNormal' to
  'Microsoft.Xna.Framework.Graphics.IVertexType'.

and I get it under the rendering line here:

graphicsDevice.DrawUserIndexedPrimitives<VertexPositionColorNormal>
(PrimitiveType.LineList, currentPlayer.LLObject.Vertices, 0,
    currentPlayer.LLObject.TotalVertices, currentPlayer.LLObject.LinelistIndexes, 0,
    currentPlayer.LLObject.TotalLinelistIndexes / 2);

I had a look on Google to see if there was any obvious answers but it's hard to search for. Could someone spread some light on what is going wrong?

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:
How to use This Keyword and using iterators to call class methods? I've been over this for a long time, I can't seem to understand what is wrong, is the use of the this keyword right? I want to add the instance of the class that is being created to the vector 'allEntities' in the constructor, or am I not using the iterators right? I'm very new to c++ and programming in general so all help is appreciated.

GameObject.h

class GameObject {

public:
    GameObject(const char* texturesheet, SDL_Renderer* ren, int x, int y, int _maxHp, int _currentHp, int _strength);
    ~GameObject();

    static std::vector<GameObject> allEntities;

    void update();
    void Render();
    void movement(const char* coord, bool positive);
    int getMaxHp();
    void addMaxHp(int change);
    int getCurrentHp();
    void setCurrentHp(int change);
    int getStrength();
    void changeStrength(int change);
    void attack(GameObject &other);
    int getX() { return x; };
    int getY() { return y; };
    void setDirectionFacing(char direction) { directionFacing = direction; };
    char getDirectionFacing() { return directionFacing; };
private:

    int x;
    int y;
    int strength;
    int maxHp;
    int currentHp;
    char directionFacing;

    SDL_Texture* objectTexture;
    SDL_Rect srcRect, destRect;
    SDL_Renderer* renderer;

};

GameObject.cpp

GameObject::GameObject(const char* texturesheet, SDL_Renderer* ren, int xx, int yy, int _maxHp, int _currentHp, int _strength)
{
    allEntities.push_back(*this);
    renderer = ren;
    objectTexture = textureCreator::loadTexture(texturesheet, ren);
    GameObject::maxHp = _maxHp;
    GameObject::currentHp = _currentHp;
    changeStrength(_strength);
    x = xx;
    y = yy;
}
GameObject::~GameObject()
{

}

void GameObject::update()
{

    srcRect.h = 48;
    srcRect.w = 48;
    srcRect.x = 0;
    srcRect.y = 0;

    destRect.x = x;
    destRect.y = y;
    destRect.w = srcRect.w * 1.5;
    destRect.h = srcRect.h * 1.5;
}

void GameObject::movement(const char* coord, bool positive)
{

    if (coord == "x" && positive == true)
    {
        y -= 4;
        setDirectionFacing('w');
        std::cout << 'w' << std::endl;
    };
    if (coord == "x" && positive == false)
    {
        y += 4;
        setDirectionFacing('s');
        std::cout << 's' << std::endl;
    };
    if (coord == "y" && positive == true)
    {
        x += 4;
        setDirectionFacing('d');
        std::cout << 'd' << std::endl;
    };
    if (coord == "y" && positive == false)
    {
        x -= 4;
        setDirectionFacing('a');
        std::cout << 'a' << std::endl;

    };

}

void GameObject::Render()
{
    SDL_RenderCopy(renderer, objectTexture, &srcRect, &destRect);
}

int GameObject::getCurrentHp() { return currentHp; };

int GameObject::getMaxHp() { return maxHp; };

void GameObject::setCurrentHp(int change) { currentHp += change; };

void GameObject::addMaxHp(int change) { maxHp += change; };

int GameObject::getStrength() { return strength; }

void GameObject::changeStrength(int change) { strength += change; }

void GameObject::attack(GameObject &other)
{

}

game.cpp

GameObject* player;
player = new GameObject("player.png", renderer, 10 , 10, 10,  10, 2);
    for (std::vector<GameObject>::iterator it = GameObject::allEntities.begin(); it != GameObject::allEntities.end(); it++) {
        int hp = it->getCurrentHp();
        std::cout << hp << std::endl;
    }

I expect to print out the hp value which is 10, but instead it prints 0 instead.

Also I need this vector so when the player attacks, it checks every entity and sees if it is in the area of the attack in a for loop, is there any better way to do this?

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:
organizing animation in Flash CS6 for sprite sheets Can I make a sprite sheet of a character which contains animated movies inside the main movie-symbol?
I tried to export it, but those movies inside the main one are not animated.
Thanks

sentences:
Client side prediction buffer size considerations for jitter I am currently having a FPS game with client side prediction. Every 20ms, the client sends it's input to the server. The server buffers 5 ticks worth of input (100ms) and starts consuming the inputs each tick and sends a world snapshot to the client. The client then validates the predictions and corrects the simulations if there is a misprediction. The setup works fine under ideal network conditions. However when the latency suddenly spikes from say 50ms to 400ms, the client's tick packet is delayed which causes the server to eat through all of the available inputs in the buffer and resort to using the previous tick values to perform server simulation. When the client input finally arrives at the server late, the server discards the input because it has already processed the input for that particular tick (using old input values).
How do I handle this edge case of latency increasing and decreasing? Sure I could use a larger buffer size for the inputs, but that will cause delays between client state and server state. Using a smaller buffer will cause the server to stall from inputs if there is a jitter that is more than the duration required by the server to process the inputs. I was under an impression that I would need some kind of dynamic buffer size that expands and contracts. However, I am out of ideas to implement something like this.
Does anyone have a solution?

sentences:
Lib-GDX GWT build will not load without Flash on some browsers I am trying to load my LibGDX application. Using Firefox without Flash on a  freshly installed Ubuntu system, it does not load.

I get this printed in the console:

SoundManager: No Flash detected. Trying HTML5-only mode. soundmanager2-jsmin.js:32:357
SoundManager V2.97a.20130512 (AS3/Flash 9) + HTML5 audio soundmanager2-jsmin.js:32:357<br/> SoundManager 2: soundManager: Fatal error: Flash is needed to play some required formats, but is not available. soundmanager2-jsmin.js:32:357
SoundManager 2 HTML5 support: mp3 = false (using flash), mp4 = false (using flash), ogg = true, opus = true, wav = true soundmanager2-jsmin.js:32:357
soundManager: No Flash response within expected time. Likely causes: Flash blocked or JS-Flash security error. soundmanager2-jsmin.js:32:357
soundManager: Waiting indefinitely for Flash (will recover if unblocked)...

And this on my screen:

I am assuming this is because of the lack of Flash and the fact that these audio formats are not supported in this version of Firefox. However, I am not using any audio in my game at all.

In my LibGDX HtmlLauncher, I have:

public GwtApplicationConfiguration getConfig () {
    GwtApplicationConfiguration config
        = new GwtApplicationConfiguration(getWindowInnerWidth(), getWindowInnerHeight());
    config.preferFlash = false;
    return config;
}

This did not fix anything. I am on the latest version of LibGDX, and the latest GWT SDK version. How do I fix this?

sentences:
How to Trigger OnSelect on a Button? I'm new to Unity and C# and have been struggling to figure out how to solve this.  What I'm looking for is a way to make text display whenever a button is selected. (ex. Player selects a difficulty option, and text pops up describing what mechanics the difficulty will affect)  I can get this to work with mouse input with no issue, with the following code attached to the button.
void Update()    {
        if (this.IsHighlighted() == true)
        {
            gameObject.transform.GetChild(1).gameObject.SetActive(true);
        }
        else
        {
            gameObject.transform.GetChild(1).gameObject.SetActive(false);
        }
}

The aforementioned description text is set up as a child to the button, and will appear/disappear depending on whether it's highlighted or not.  The problem is that isHighlighted only occurs when the mouse is hovered over the button, and does not take effect when selected via directional inputs from a keyboard/controller, which is what I'm looking for.  I've done some research and noticed there is an OnSelect method, but I can't figure out how to implement it.  Any advice would be greatly appreciated.

sentences:
I already have a GameManager script, but need to have a 2nd one I'm making a Unity game, and I want to use the Unity Distribution Portal.
My problem is that you have to make a script named GameManager for this, but I already have another script called GameManager, so every time I try to rename the first GameManager script, the game stops working.
I don't want to rewrite every script I've used GameManager variables in. So the way I've been trying to rename this is by right-clicking on the GameManager.cs file in the Unity project window and renaming it there, then typing a 2 in the name inside Visual Studio.
If I call the script for UDP for example something like GameManager2, UDP doesn't seem to understand that this is the script it needs for Sandbox Testing.
Can anyone help me with this?
Here is the UDP script I want to add (which is currently called GameManager2, but needs to be called GameManager):
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UDP;

public class InitListener : MonoBehaviour, IInitListener
{
    public IInitListener listener;
    public void Start()
    {
        StoreService.Initialize(listener);
    }

    public void OnInitialized(UserInfo userInfo)
    {
        Debug.Log("Initialization succeeded");
    }

    public void OnInitializeFailed(string message)
    {
        Debug.Log("Initialization failed: " + message);
    }
}

sentences:
How can I create background images in OpenSceneGraph? I'm trying my hand at using OpenSceneGraph for graphics in my game. I'm having a hard time trying to figure out how to get a background image up. The relevant piece of code that I have can be found in this gist. Does anyone here have an idea of what I'm doing wrong/missing?

BTW:

I know that the image is getting loaded because the logs says so
The log says that it managed to add the camera as slave to the viewer

sentences:
Low coupling and tight cohesion Of course it depends on the situation. But when a lower lever object or system communicate with an higher level system, should callbacks or events be preferred to keeping a pointer to higher level object?

For example, we have a world class that has a member variable vector<monster> monsters. When the monster class communicates with the world, should I prefer using a callback function then or should I have a pointer to the world class inside the monster class?

sentences:
Color spaces: Should colors be converted to linear color before applying premultiplied alpha? For instance, when loading an image that is SRGB, which of these is correct?

Simple premultiply:

Take SRGB color from file and multiply RGB by alpha

or

Convert to linear before premultiply:

Take SRGB color from and convert RGB to Linear
Multiply Linear RGB by alpha
Take Linear RGB and convert back to SRGB

sentences:
Simplistic level system (Math reliant question) So I've been checking some games to get ideas for my own. Some designs I've reviewed rely on a few variables like:

Current level
Current exp
Exp to next level

I aim for a simplistic design where there is only an exp variable.

Example:

  Level 1

  Current exp: 0

  Exp to next level: 100

  Level 2

  Current exp: 100

  Exp to next level: 200

  Level 3

  Current exp: 200

  Exp to next level: 400

  Level 4

  Current exp: 400

  Exp to next level: 800

Every level, the exp required for next level doubles.

That's okay. Since I use only an exp variable, I need two formulas:

Formula to calculate the current level
Formula to calculate the exp required for next level

My progress so far:

  Level = floor((exp + 100)/100)

This works for 0 exp (level 1) because floor(0 + 100)/100 equals 1, with 50 exp works fine too:

50 + 100 = 150
150/100
1.5
flooring 1,5 gets us to 1

If we hit 100 exp, we should be now at level 2.

floor((100+100)/100) = 2

Let's see level three.

floor((100 + 200)/100) = 3

Since level 3 is at least 200 exp, this thing keeps working.

Level 4 begins with 400 exp.

Let's see what happens if we have 399 exp.
399 + 100
499/100 = 4.9
floor(4.9)
4

No way. 399 should still be level 3.

So let's take into account the doubling factor.

Level = floor((exp + 100)/100)/2

399 + 100 = 499... / 100 = 4.99 .. floored -> 4 / 2 = 2

Level 2? No way , it should be level 3

Another try:

Level = floor((exp/100))

floor(399/100) = 3
floor(400/100) = 4

But if we apply the formula to level 2(starting at 100, ending at 200 which would be level 3)

floor(100/100) = 1

I can't seem to achieve this on my own. Any suggestions?

sentences:
Can I render 3D objects in Ray Casting engines? I was gathering some information on the glorious Ray Casting technique. As far as I've understood it's not a complete 3D rendering, and that's why objects and NPC's are often displayed as simple sprites (I might be wrong here, of course).

Then I've stumbled upon the Dark Forces' engine by Lucas Arts, called Jedi Game Engine and back in the days they were able to include fully 3D objects. Then a question arises: how did they do it? Do the objects "simply" boil down to a complex mixture of walls and floors?

sentences:
How far back should I move my camera to fit a given GameObject in frame? In Unity with C#, I want to calculate the minimum distance that my perspective camera has to be from a given GameObject (a procedurally generated mesh), so that the object is fully framed by the camera and leaving the least space possible around it in the screen. In other words, fully framed means that there is no part of the object outside the view area.

To make things easier, my camera does not need to rotate or move - it's fully static, with the exception of one axis to zoom in or out in order to frame the target object. So, in fact, we could summarize my problem as a zoom problem (not using FOV to zoom) where I need to frame a procedurally generated mesh whose size varies considerably.

Would anyone be kind enough to point me in the right direction with code snippets, suggestions, etc?

sentences:
Are there ways to limit players other than a conventional currency system or a resource system? I'm making a 2D strategy game. I want to create something unlike the current resource management type games I regularly see tagged as strategy.
My goals are:

To force the player to think about their decisions
To allow for experimentation easily and without sacrificing previous progress
To allow for multiple ways of solving problems presented in the game
To eliminate grinding simply because it won't work in whatever system I use

In effect, I want some way to limit the player and force them to make hard decisions, without using a commonly used currency or resource/crafting system, to cut down on grinding.
However, I'm actually having a little trouble implementing this sort of idea alongside the idea of progression.
My original idea was to introduce a cap on how many of each type of item a player could have at any one time. In effect, this introduces some elements of an open-ended puzzle game. However, this limits progression:

If the number of items the player can have increases over time, this means that each individual item's significance decreases over time. This has the effect of making decisions easier over the course of the game. Not what I want.
If the items get more powerful over time, then items acquired near the start of the game have no viability later on. I would like items to be at least partially viable at any stage of the game, to increase variety and make the game less linear. It turns the game into replacing old with new.
Only increasing the variety of items over the course of the game is a sure-fire way to lose players early if they believe they are not making progress.

My implementation is workable, but simply not good enough for my personal standards and goals.
Is there a better way to let limits, choice and progression go hand in hand?
I use the word "item" here not just to refer to items in game, but other things such as spells, moves, buildings, etc. that a player could acquire  and use in the game.

sentences:
For loop only checking the last object Hi I am using a for loop to check and see if my players character is colliding with a collision object in the game. But for some reason it only checks the last Rectangle of the list.

private void collisionDetection()
{
    for(Rectangle rectangle : colrect) {
        Rectangle rect2 = new Rectangle(posX, posY, 64, 64);
        if (rectangle.overlaps(rect2))
        {
            m.setTileCollision(true);
        }
        else
        {
            m.setTileCollision(false);
        }
    }
}

Why and how is this happening? I gave up on looking for an answer so I'm here. I want to check all of the Rectangles in the list not the last... I even for looped text through Bitmap font to see the positions and set text at all Rectangles and that works properly, but this doesn't.  Another solution perhaps is in order?

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:
In RecastNavigation, how can I make an agent idle after reaching its destination? This question is specifically about dealing with the Recast Navigation library.

I have added an agent with addAgent and set its target with requestMoveTarget.
When agent reaches its destination, it stops, but when being pushed out of the way (by another agent) it will try to return back to its target. Instead,  want it to stop and become idle, so that when other agent walking by push it aside and it wont return back.

I have tried calling resetMoveTarget upon agent.npos being close to agent.targetPos (as if agent has reached its destination), but that seems to break the inner logic of the crowd simulation - the agent would just keep walking in old direction, never stopping.

How do I properly tell an agent to stop and become idle (yet pushable) in RecastNavigation?

sentences:
Tangent space - Lengyel vs ShaderX5 - difference I have been studiing tangent space calculations and came across two solutions

E. Lengyel - http://www.terathon.com/code/tangent.html

ShaderX5 solution - (solution is also desribed here http://www.thetenthplanet.de/archives/1180)

What is the difference between tangent computed one or another way? Lengyel solution seems "easier" but I am no quite sure of its orthogonality to the normal vector of the tangent plane.

sentences:
Raycast algorithm fails to collide with diagonal walls in specific locations I'm having a problem with my ray-cast algorithm in a 2D tile-based universe. I feel the situation would be best explained with a picture, so here it is:

The ray, represented by the blue line, is passing "through" the wall to hit its target when the wall passes through a point where the quantized line moves diagonally and the wall is perpendicular to it. The raycast function is as such:

def raycast(pos, direction, level):
    dx, dy = direction
    t=0
    x, y = pos
    obj=None
    while not obj and t < 5000:
        t+=1
        x+=dx
        y+=dy
        obj=level.get_at((round(x),round(y)),True)
        pass
    return obj

Is there a simple, efficient way to eliminate this kind of edge case?

sentences:
Adding biome support to procedural landmass generation tutorials I've spent the past week studying the procedural landmass generation tutorial series and have been toying around with the source code.

The following is an example of the core Noise module he wrote. Essentially, it accepts some noise settings (seed, octaves, lacunarity, etc) for every "chunk".

I've been trying to figure out on my own how best to implement "biomes" but this is too different than noise systems I've used in the past (they handled octaves/etc internally didn't build those with chunk coordinates, etc).

I know I need different noise settings based on the biome, but I just can't figure out the best way to implement here.

My biggest dilemma is that this logic calculates the octaves/frequency/etc for the entire chunk but those values would be different for different biomes.

Since I need biomes to blend a bit (aka I don't want biomes limited to entire chunks), I need to either:

Use different noise settings for every "coordinate" (which won't work since this code uses one noise settings for the entire chunk)
Calculate the entire chunk once for each biome in it and then somehow "sum" biomes
Ditch this noise entirely with something I'm more familiar with (FastNoise, LibNoise.Unity). I've tried this, but absolutely will not work with the mesh generation he built, so I'd need to rewrite that too.

public static CoordinateProfile[,] GenerateCoordinateProfiles(int mapWidth, int mapHeight, NoiseSettings settings, Vector2 sampleCentre) {
    var profiles = new CoordinateProfile[mapWidth, mapHeight];

    System.Random prng = new System.Random(settings.seed);
    Vector2[] octaveOffsets = new Vector2[settings.octaves];

    float maxPossibleHeight = 0;
    float amplitude = 1;
    float frequency = 1;

    for (int i = 0; i < settings.octaves; i++) {
        float offsetX = prng.Next(-100000, 100000) + sampleCentre.x;
        float offsetY = prng.Next(-100000, 100000) - sampleCentre.y;
        octaveOffsets [i] = new Vector2(offsetX, offsetY);

        maxPossibleHeight += amplitude;
        amplitude *= settings.persistance;
    }

    float maxLocalNoiseHeight = float.MinValue;
    float minLocalNoiseHeight = float.MaxValue;

    float halfWidth = mapWidth / 2f;
    float halfHeight = mapHeight / 2f;

    for (int y = 0; y < mapHeight; y++) {
        for (int x = 0; x < mapWidth; x++) {
            amplitude = 1;
            frequency = 1;
            float noiseHeight = 0;

            for (int i = 0; i < settings.octaves; i++) {
                float sampleX = (x - halfWidth + octaveOffsets[i].x) / settings.scale * frequency;
                float sampleY = (y - halfHeight + octaveOffsets[i].y) / settings.scale * frequency;

                float perlinValue = Mathf.PerlinNoise(sampleX, sampleY) * 2 - 1;
                noiseHeight += perlinValue * amplitude;

                amplitude *= settings.persistance;
                frequency *= settings.lacunarity;
            }

            if (noiseHeight > maxLocalNoiseHeight) {
                maxLocalNoiseHeight = noiseHeight;
            }
            if (noiseHeight < minLocalNoiseHeight) {
                minLocalNoiseHeight = noiseHeight;
            }

            float normalizedHeight = (noiseHeight + 1) / (maxPossibleHeight / 0.9f);
            noiseHeight = Mathf.Clamp(normalizedHeight, 0, int.MaxValue);

            profiles[x, y] = new CoordinateProfile(noiseHeight);
        }
    }

    return profiles;
}

sentences:
Help with a Fast 2D Grid-Based world rendering technique First I'm going to give you my current situation and explain what I'm attempting. I will then pose my question below. I will attempt to include a "TL;DR" for those of you who prefer things to be concise.
OVERVIEW OF CURRENT SETUP:

The current representation of my game world is one where ' Pieces ' of a larger world are represented by three layers of IDs as follows.

//This is being done in C++
struct WorldPiece {
   ivec2 pieceLocation;         //Where ivec2 is a vector containing ints
   short backLayer[PIECE_SIZE]; //Where PIECE_SIZE is the size of the grid this piece contains, ie. for a 32x32 grid, this is 1024
   short middleLayer[PIECE_SIZE];
   short frontLayer[PIECE_SIZE];
};

The world as a whole is then composed of these pieces, which are loaded (and cached as needed) as the player traverses from piece to piece.
I currently have the data side of this all working. I may change the active data set and move around the camera (zoom in and out as well) and watch it all function.
I have also written a tool to support the loading and saving of pieces, and the painting of IDs across the world.
I HAVE THIS DATA:

Each ID within a piece maps to a texture that will be used when that ' cell ' of the piece must be rendered.

QUESTION:

How might I go about rendering each piece in such a way as to do this in as few passes as possible? I could render each cell at a time, but that would be slow. I could generate a list of vertices and indices and create massive VBOs, or sets of quads. Or perhaps there is a better way?
I would prefer to keep the data separate from the rendering and to keep the size of the data as small as possible (so as to have a small as possible load time while the game is running).
If possible, I would like this to be fast enough to render large swaths of tiles, (for example a 3x3 area of 1024 tiles apiece, or more). Since zooming in and out is possible it would be nice to provide this functionality to the player while still maintaining the detail of rendering the world.

If there would be a better setup for the world data to accommodate these requirements, I'm open to suggestions.
SIDE NOTES:

Please do not bring collision/physics, or other game-map-related things into this. I have that worked out and it will not be a bottleneck. I am merely concerned with a best approach to a rendering pipeline where speed is the top concern.
Please do not suggest API X or ENGINE Y. I have looked around quite thoroughly and nothing available would properly provide what I need or integrate with my current codebase.
I will be using a texture atlas.

tl;dr version-  I have a grid based world that streams pieces in as needed, I would like suggestions on a fast way to render these pieces and nothing I have found anywhere has a suitable solution for my current situation.

sentences:
Game Opens then Stops Responding Python Sorry for the bad title, if you think of a better one please tell me.

So I was asked to make a button that says a line from a video game. I attempted to have the while loop add 1 to a variable every time it looped through, then display the variable in the caption of the window. I did this so that I could see if it was looping, and really, what was going on. It showed a rapidly increasing number, then froze the computer (I had to restart the computer). I tried putting a short wait in the loop, still would not respond. I am also having this exact same problem in a much longer and more complex program that I'm working on, so if I figure it out, it will solve both issues. Don't just give me code, please tell me why I need to use it or what it does. Here's the program:

from pygame import *
import pygame
pygame.init()

pygame.display.set_caption('Potato')
screen = pygame.display.set_mode((224, 224))
button = pygame.image.load("C:/Python34/redbutton.jpg")
screen.blit(button,(0,0))
pygame.display.flip()

potato = pygame.mixer.Sound("C:/Python34/potato.wav")

test = 0
pressed = False

while pressed == False:
    if pygame.mouse.get_pressed()[1]:
        pressed = True

    if pygame.mouse.get_pressed()[0]:
        potato.play()

sys.exit()

sentences:
How to change Texture2D type to Sprite during runtime (Unity) How can we convert the Texture2D type to "Sprite" using the script (not in Editor)?
It seems that the Texture2D retrieved from file is by default Normal Map.
I need to convert the TextureType to "Sprite".

Texture2D texture = LoadPNG("D:/download.jpg");
testPlaneRenderer.material.SetTexture("_source",texture);

LoadPNG method code:

 public static Texture2D LoadPNG(string filePath)
{

    Texture2D tex = null;
    byte[] fileData;

    if (File.Exists(filePath))
    {
        fileData = File.ReadAllBytes(filePath);
        tex = new Texture2D(2, 2);
        tex.LoadImage(fileData); //..this will auto-resize the texture dimensions.
        Debug.Log("File Exists!");
    }
    else
    {
        Debug.LogError("File not exists!");
    }
    return tex;
}

It seems that this texture is set as "Default" or "Normal" Type when imported from file and then assigned to Material dynamically. As the particular shader I'm using, works best if the Texture Type is set to Sprite (I tested it by manually placing the texture file in Project and then assigning the texture to Material).

I need to change Type of Texture to Sprite before assigning it to the material.
I've seen options like "AssetImporter" but it only works in Editor.

The effect of the shader (which takes two texture types

a) Inverted & Blurred Texture

b) GrayScale Texture

And then returns a Sketch Effect to the object. I convert the original image to inverted & blurred, grayscale texture using some image processing code (C#, Unity -> working around with GetPixels and SetPixels)...

Output with Defualt Texture Type

Output with Sprite Texture Type

sentences:
Texture mapping a complex object on openGL ES I dont have much experience with openGL ES (or openGL), but i do get the general idea of texture mapping, which is each vertex should be mapped for the relevant UV coordinates of the texture we choose to map. but what happens when i have complex objects?

Lets say i have the known Stanford bunny:

and i want to map this texture:

It is not very simple to calculate all vertices locations on the image at all.
Are there any known methods or best practices for doing that?

Where should i begin regarding this kind of mappings?

Thanks!

sentences:
Faster way to do multi texture blending(HLSL, triplanar texturing and overhang mapping) Right now I'm doing a lot of lerping to blend my textures based on height(under water, mid ground and height ground), normal.y >= 0.0 for the under side of the terrain, fractal blend map for a marble effect and then triplanar mapping for the slopes.

It looks good and runs ok and I'm getting just the right blending effect where I need but I'm just thinking that all the lerping could be bad?

I end up with this in my terrain shader:

//Find the blend value for the blend zones
float IsLowGround = saturate(max(distance(min(input.WSPosition.y, 350), 350) / 300, 0));
float IsHeighGround = saturate(max(distance(min(input.WSPosition.y, 1500), 1500) / 1250, 0));

//Find the flip value
float3 flip = saturate(float3(normal.x < 0.0, normal.y >= 0.0, normal.z < 0.0));

//triplanar
float3 blend_weights = max((abs(normal) - 0.2) * 0.5f, 0.0f);
blend_weights = pow(blend_weights,2.0f);
float total = (blend_weights.x + blend_weights.y + blend_weights.z);
blend_weights /= total;
float2 coord1 = float2(input.WSPosition.zy / 750);
float2 coord2 = float2(input.WSPosition.zx / 150);
float2 coord3 = float2(input.WSPosition.xy /700);

//Marble blend maps
float Blend = BlendMap.Sample(colorSampler, input.WSPosition.xz / 2500).r; // flat blend
float Blend2 = BlendMap.Sample(colorSampler, input.WSPosition.zy / 6000).r;   //slope blend

//Color and Normal blending

//Slope Color With Marble
Color += lerp(ColorMap.Sample(colorSampler, coord1) * blend_weights.x, ColorMap6.Sample(colorSampler, coord1 * 3) * blend_weights.x,Blend2);
Color += lerp(ColorMap2.Sample(colorSampler, coord3) * blend_weights.z, ColorMap6.Sample(colorSampler, coord3 * 3) * blend_weights.z, Blend2);

//Slope Normal with marble
NormalM += lerp(NormalMap.Sample(colorSampler, coord1).rgb * blend_weights.x, NormalMap6.Sample(colorSampler, coord1 * 3).rgb * blend_weights.x, Blend2);
NormalM += lerp(NormalMap2.Sample(colorSampler, coord3).rgb * blend_weights.z, NormalMap6.Sample(colorSampler, coord3 * 3).rgb * blend_weights.z, Blend2);

//Height based Color Blending with marble eg. (mid -> height) -> marble
float4 GroundColor = lerp(lerp(ColorMap5.Sample(colorSampler, coord2 / 1.5) * blend_weights.y, ColorMap1.Sample(colorSampler, coord2) * blend_weights.y, IsHeighGround), ColorMap7.Sample(colorSampler, coord2) * blend_weights.y, Blend);

 //Height based Normal Blending with marble eg. (mid -> height) -> marble
float3 GroundNormal = lerp(lerp(NormalMap5.Sample(colorSampler, coord2 / 1.5).rgb * blend_weights.y, NormalMap1.Sample(colorSampler, coord2).rgb * blend_weights.y, IsHeighGround), NormalMap7.Sample(colorSampler, coord2).rgb * blend_weights.y, Blend);

 //Last Color Blending with underside flip eg. (underwater -> Ground) -> flip
Color += lerp(ColorMap4.Sample(colorSampler, coord2 / 2) * blend_weights.y, lerp(GroundColor, ColorMap3.Sample(colorSampler, coord2 * 1.2) * blend_weights.y, IsLowGround), flip.y);

 //Last Normal Blending with underside flip eg. (underwater -> Ground) -> flip
NormalM += lerp(NormalMap4.Sample(colorSampler, coord2 / 2).rgb * blend_weights.y, lerp(GroundNormal, NormalMap3.Sample(colorSampler, coord2 * 1.2).rgb * blend_weights.y, IsLowGround), flip.y);

Here is what it looks like when rendered:

sentences:
Need to produce an animated texture of Water where each image tiles in all directions I need to produce a 2D 'animated' texture of "water" for a game in which each image tiles in 'all' directions, much like those produced by the Caustics Generator, but with the power and flexibility of something the likes of Blender.

The final result from Caustics Generator is 32 images that are actually animated such that when the full 32 images are played in a loop they will seamlessly loop forever. They will not only loop in time, but each image also tile in all directions. This is nice, but it comes in only one flavor so to speak.

I'd like to accomplish the same thing with a Blender type tool, and I have actually gotten to the point where I generate the X number of images, but they do not tile in 'all' directions, nor are they slightly animated. I've tried Blender texture animations using offsets but with only limited success.

Does anyone know of how to (or of a tool) which will animate textures such that they tile in all (4) directions?

Many thanks in advance ....

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 render decoded video that is on GPU memory without copying to CPU I'm reading this example of ffmpeg hardware decoding: https://github.com/FFmpeg/FFmpeg/blob/release/4.2/doc/examples/hw_decode.c

At line 109 it does this:

/* retrieve data from GPU to CPU */
            if ((ret = av_hwframe_transfer_data(sw_frame, frame, 0)) < 0) {

which means that decoded video is in GPU. Since I want to render this video using Open GL, I guess it's much more efficient to not get this back to CPU but to actually render directly from GPU memory.

Is it possible to render directly from GPU memory?

What I know is that, in order to render from CPU memory, we usually send data from CPU using gltextImage2D function and the shaders will render it. If I want to pass data that is already on GPU, how do I do?

sentences:
Why players who join late can't see other people data? I want to show the name of the players above their head but I have a problem where people joining late doesn't get other players' name.
For example:

Player 1 joins to the server with the name Peter.
Player 2 joins to the server with the name Josh.
Peter (Player 1) sees Josh's name perfectly, but when Josh joins Peter's name is not synchronized correctly.

My sync code looks something like this:
[SyncVar] private string NAME;
public override void OnStartClient(){
    if(networkPlayerData is null)
    {
        networkPlayerData = BTNetworkController.Controller.playerData;
        NAME = BTNetworkController.Controller.playerData.Name;
    }
    SendPlayerNameToServer(NAME);
}
[Command]
private void SendPlayerNameToServer(string name)
{
    RpcSetPlayerName(name);
}

[ClientRpc]
void RpcSetPlayerName(string name)
{

    gameObject.GetComponentInChildren<TMP_Text>().text = name;
}

So my question is how can I sync data to newly joined players and refresh player names accordingly.

sentences:
Shooting the bullet out of the gun instead of the camera, yet keeping it accurate with respect to the reticle I'm working on a first person game, and I've ran into a problem. In my game, there's the player's gun being rendered, as well as a reticle in the center of the screen - like this:

First, Let's imagine there was no gun model being rendered. Then firing the bullet is easy - you just spawn the bullet exactly where the player's "eyes" are, and then use trig to calculate the velocity based on whatever direction the player is looking.

But now, when we add the gun model... we can't just spawn the bullet where the players eyes are, we have to spawn it at the tip of the gun (right?). So you do that, but then... how do you move the bullet in a way that it will hit wherever the reticle was pointing?

Keep in mind that the bullet in my game (it's actually a rocket, in this case) will be moving slow enough that its movement can be seen, so some workaround that would usually work if the bullet is too fast to be observed will not work. For example, if you didn't spawn it so it looks like it's coming out of the tip of the gun, the player would definitely notice that.

sentences:
How to create a Update function in Java I have recently started using Java, but have been programming in javascript, and actionscript 3 for a while.

I am used to the language giving me the ability to simply do something like:

private function Update(){
//stuff
}

or something similar to that.

I am looking for something similar in Java, and I want to make sure I am doing it correctly.

I started following a tutorial, and they said to do something like this:

 long lastTime = System.nanoTime();
        double amountOfTicks = 60.0;
        double ns = 1000000000;
        double delta = 0;
        long timer = System.currentTimeMillis();
        int frames = 0;
        while(running){
            long now = System.nanoTime();
            delta += (now - lastTime) / ns;
            lastTime = now;
            while(delta >= 1){
                tick();
                delta--;
            }

            if(running)
                render();
            frames++;

            if(System.currentTimeMillis() - timer > 1000){
                timer += 1000;
                System.out.println("FPS: " + frames);
                frames = 0;
            }
        }

This seems to be every second calling the tick() function, not the same as every frame though, and while things tend to happen in less time than a second, I would much rather use the same old frame by frame method i was using. (Unless someone can give me a reason not to, always up for an opinion)

So I am wondering, why not just do something like:

while(running){
Update();
}

I believe this would call every frame. Am I doing something completely crazy here? is there a much better method?

Thanks in advance

sentences:
Can I save a score as highscore, if it's a float? So I have this infinite runner type of game, subway surfers style. I chose a method where the player doesn't move, and instead the obstacles move towards him.
My score is a float and it increases as time passes.
However, I'm unable to figure out how can you save this as a highscore.
I tried a few methods but most of them were for int so it didn't work out.
Here is what I have for the score counting. It's currently missing the save score part completely.
    public class GameManagerC : MonoBehaviour
{
    float score = 0;
    public float scoreMulti = 5;

    void Update()
    {
        if (isPlayerAlive == true)
        {
            score += Time.deltaTime * scoreMulti;
            scoreText.text = score.ToString("Score: 0");
        }
    }

EDIT: Many of you asked how I tried to implement the code I've found so here it is:
public float score;
public float highScore;

void Start()
    {
        score = PlayerPrefs.GetFloat("score");
        highScore = PlayerPrefs.GetFloat("highScore");
        if (score > highScore)
            highScore = score;
        StartGame();
    }

    // Update is called once per frame
    void Update()
    {
        if (isPlayerAlive == true)
        {
            score += Time.deltaTime * scoreMulti;
            scoreText.text = score.ToString("Score: 0");
        }
    }

sentences:
How do I understand a big c++ gaming project in SFML? Currently I am doing SFML- c++ as a basement in game development before starting out Unreal

When I see a game project in  SFML,  the codebase is huge, like above 30 classes, 100 functions, how can I get an idea of the code project, any suggestions about the usual standard class names in SFML projects and their purpose would be helpful.

sentences:
How can this method to make a text mesh always face the camera be simplified? (Unity c#) Despite a fairly heafty new years I am back trying to learn a bit more coding :D

This latest feature I am trying to add is a TextMesh that floats above a gameobject when the player is looking at it.

I does all work fine (except it kinda shakes a little but I'll look into that another time). But as I wrote the method to make the textMeshObject look at my camera, I just had a niggling feeling it could be written in less lines of code.

I actually get this a lot where I write several lines and think it must be able to be simplified, and after the code having several parts like this it can look pretty messed up.

Anyways, I thought i'd ask you experts on here if it was possible to do this an simpler (NOTE: I only want it to rotate on Y Axis):

  void FaceTextMeshToCamera(){
            Vector3 origRot = textMeshObject.transform.eulerAngles;
        textMeshObject.transform.LookAt(textLookTargetTransform);
        Vector3 desiredRot = textMeshObject.transform.eulerAngles;
        desiredRot.x = origRot.x;
        desiredRot.z = origRot.z;
        textMeshObject.transform.eulerAngles = desiredRot;
  }

sentences:
Tool for creating complex paths? I want to create some fairly complex 2d predefined paths for my AI sprites to follow.

I'll need to use curves, splines etc to get the effect I want.

Is there a drawing tool out there that will allow me to draw such curves, "mesh" them by placing lots of points along them at some defined density and then output the coordinates of all of those points for me?

I could write this tool myself but hopefully one of the drawing packages can do this?

Cheers!

sentences:
how do I instantiate a prefab that adds to the score text in c#? Hello I'm working on a game with random generation, a dungeon crawler of sorts. i need to be able to have an object that when instantiated, adds to the score(the goal is to find all of them as the dungeon is created around you)this is the script for the orb/cube.`

public Text score;
public int scores;

// Use this for initialization
void Start () {
    scores ++ ;

    score.text = scores.ToString();
}
public void Update()
{
    score.text = scores.ToString();
}

public void OnMouseDown()
{
    Destroy(gameObject);

    scores--;
}

`

when an object is added it won't add to the score.

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:
Minecraft modding 1.12 draw image I want to draw an image that I created but the image is too big. Now I want the Gui to scale the image to a reasonable size, but when I change the width and height it doesn't make the image scale down/up but only the texture.

Code where I draw the image on screen:

@Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks)
    {
        this.drawDefaultBackground();
        super.drawScreen(mouseX, mouseY, partialTicks);
        this.renderHoveredToolTip(mouseX, mouseY);
        Slot slot = getSlotAtPosition(mouseX, mouseY);

        if(slot != null) {
            if(slot.getStack().getItem() instanceof MonsterCard) {
                this.mc.getTextureManager().bindTexture(new ResourceLocation(Reference.MODID + ":textures/items/" + ((MonsterCard) slot.getStack().getItem()).getName() + ".png"));
                int i = (this.width - this.xSize) / 4;
                int j = (this.height - this.ySize) / 2;
                this.drawTexturedModalRect(0, 0, 0, 0, 154, 226);
            }
        }
    }

Image I want to draw which is 154px x 226px:

Output:

sentences:
How do I know what button was clicked? (Unity) I have a prefabbed button (UI.Button) which I'm instantiating ten times:

public void LayoutButtons() {

    GameObject newCanvas = Instantiate (canvas) as GameObject;

    for (int i = 0; i < 10; i++) {
        buttons[i] = Instantiate(button, new Vector2((i * 100.0F)-500, -100), Quaternion.identity) as GameObject;
        buttons[i].transform.SetParent(newCanvas.transform, false);
        buttons[i].GetComponentInChildren<Text>().text = "Button " + i;
    }
}

However, I'm now stuck when trying to figure out which button was clicked. The Unity onClick seems to only allow zero or one parameters. I've tried using public void onClick(Button button) with button.getComponentInChildren<Text>().text but I get ArgumentException: failed to convert parameters

All I want to do is print out the clicked button's text. How can I do this?

sentences:
Storing game objects with generic object information In a simple game object class, you might have something like this:

public abstract class GameObject {

    protected String name;
    // other properties
    protected double x, y;

    public GameObject(String name, double x, double y) {

        // etc
    }

    // setters, getters
}

I was thinking, since a lot of game objects (ex. generic monsters) will share the same name, movement speed, attack power, etc, it would be better to have all that information shared between all monsters of the same type.

So I decided to have an abstract class "ObjectData" to hold all this shared information. So whenever I create a generic monster, I would use the same pre-created "ObjectData" for it. Now the above class becomes more like this:

public abstract class GameObject {

    protected ObjectData data;
    protected double x, y;

    public GameObject(ObjectData data, double x, double y) {

        // etc
    }

    // setters, getters

    public String getName() {

        return data.getName();
    }
}

So to tailor this specifically for a Monster (could be done in a very similar way for Npcs, etc), I would add 2 classes. Monster which extends GameObject, and MonsterData which extends ObjectData. Now I'll have something like this:

public class Monster extends GameObject {

    public Monster(MonsterData data, double x, double y) {

        super(data, x, y);
    }
}

This is where my design question comes in. Since MonsterData would hold data specific to a generic monster (and would vary with what say NpcData holds), what would be the best way to access this extra information in a system like this? At the moment, since the data variable is of type ObjectData, I'll have to cast data to MonsterData whenever I use it inside the Monster class.

One solution I thought of is this, but this might be bad practice:

public class Monster extends GameObject {

    private MonsterData data; // <- this part here

    public Monster(MonsterData data, double x, double y) {

        super(data, x, y);

        this.data = data; // <- this part here
    }
}

I've read that for one I should generically avoid overwriting the underlying classes variables.

What do you guys think of this solution? Is it bad practice? Do you have any better solutions? Is the design in general bad? How should I redesign this if it is?

Thanks in advanced for any replies, and sorry about the long question. Hopefully it all makes sense!

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:
How to calculate texture coordinates for a cube? I was reading about texture mapping on 3D shapes in javafx where I came across this code,

static TriangleMesh createMesh(float w, float h, float d) {
if (w * h * d == 0) {
return null;
}
float hw = w / 2f;
float hh = h / 2f;
float hd = d / 2f;
float x0 = 0f;
float x1 = 1f / 4f;
float x2 = 2f / 4f;
float x3 = 3f / 4f;
float x4 = 1f;
float y0 = 0f;
float y1 = 1f / 3f;
float y2 = 2f / 3f;
float y3 = 1f;
TriangleMesh mesh = new TriangleMesh();
mesh.getPoints().addAll(
hw, hh, hd, //point A
hw, hh, -hd, //point B
hw, -hh, hd, //point C
hw, -hh, -hd, //point D
-hw, hh, hd, //point E
-hw, hh, -hd, //point F
-hw, -hh, hd, //point G
-hw, -hh, -hd //point H
);

mesh.getTexCoords().addAll(
x1, y0,
x2, y0,
x0, y1,
x1, y1,
x2, y1,
x3, y1,
x4, y1,
x0, y2,
x1, y2,
x2, y2,
x3, y2,
x4, y2,
x1, y3,
x2, y3
);
mesh.getFaces().addAll(
0, 10, 2, 5, 1, 9, //triangle A-C-B
2, 5, 3, 4, 1, 9, //triangle C-D-B
4, 7, 5, 8, 6, 2, //triangle E-F-G
6, 2, 5, 8, 7, 3, //triangle G-F-H
0, 13, 1, 9, 4, 12, //triangle A-B-E
4, 12, 1, 9, 5, 8, //triangle E-B-F
2, 1, 6, 0, 3, 4, //triangle C-G-D
3, 4, 6, 0, 7, 3, //triangle D-G-H
0, 10, 4, 11, 2, 5, //triangle A-E-C
2, 5, 4, 11, 6, 6, //triangle C-E-G
1, 9, 3, 4, 5, 8, //triangle B-D-F
5, 8, 3, 4, 7, 3 //triangle F-D-H
);
mesh.getFaceSmoothingGroups().addAll(
0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5
);
return mesh;
}

How did the calculate and set up the texture coordinates for the cube?

sentences:
Server to client update rate I am building a game that uses client-server architecture and have the following question regarding server to client updates.

Currently the server is doing 60 ticks per second and is sending updates to the connected clients after every step, this means information about every entity that is in the world. Since my game is rather slow and rts based, a lot of the entities do not change state after every step and do not need to be updated. So to reduced server load I added an update queue. Only entities that require an update are added to this queue and it is executed after each step.

Looking at this approach I wonder if there are any significant disadvantages to it. One I could think of is that maybe as the time goes by and the game gets more complicated all the entities will need to be updated on every step anyway and that might be just a waste of time to implement.

sentences: Handle game flow in turn-based game on server or client side? Im building a turn-based game using websockets and nodejs. At the end of each turn I want to show some scores before starting the next turn. Should that be controlled by the server using a timer? Or should the client start a timer and tell the server when it's ready for next turn? Just to keep the load of the server. What is the pros/cons?

sentences: How to make objects collisions act differently I am making an arkanoid type game and have it mostly working.  I can destroy the bricks when hit by the ball, but I am adding a twist.  I want to have a object on top of the bricks that will interact with the bricks but not destroy them.  It needs to still be affected by gravity and collisions because when you collect them all you win the game(you collect them by getting rid of the bricks below them.  Everything is pretty much working except for when this object collides with the bricks it triggers the destroy function within the brick script.  I am using C# and unity 4.6.9.  Thanks in advance!  I can give pictures and scripts if people want, IDK what would be exactly relevant here though because I'm not sure if this is something done in unity, in the brick script, or in the falling object script.

sentences:
How to detect if players alter game files and stop them from entering the game server as the question says.

how can i check if a player modifies a file such as maps or spells in my rpg games that will be located as "/cache/spells", "/cache/maps" or "/cache/entities" and you get the point.

all the files are going to be written in .xml if that matters and the game will be an online game made in java. not a browser game btw

sentences:
Is it possible to create a homemade depth buffer? Studying the case of isometric rendering, I'm facing a big and well-known problem : depth sorting.

After many researches it seems that without tile mapping or 'height-leveling' it's impossible to solve this problem in a 2D game.
So I imagined a depth buffer that I could use with sdl_textures . The process : each sprite would contain pixels , with rgba AND a depth variable . When it comes to blit, I would check in a backbuffer the pixels that are nearer than the current pixels and replace them. Then I would convert the buffer to a texture with only four channels  (rgba without depth) in order to SDL_Rendercopy it .

My questions are:

Is it possible to do so ?
Isn't it too slow to check each pixel of a 1024×768 screen in this kind of scheme ?
How do I create a sdl_texture from an simple array of int ?

sentences:
Does the linear attenuation component in lighting models have a physical counterpart? In OpenGL (and other systems) the distance attenuation factor for point lights is something like 1/(c+kd+sd^2), where d is the distance from the light and c, k and s are constants.

I understand the sd^2 component which models the well known physically accurate "inverse square law" attenuation expected in reality.

I guess the constant c, usually one, is there to deal with very small values of d (and divide-by-zero defense perhaps?).

What role does the linear kd component have in the model, (by default k is zero in OpenGL). When would you use other values for k? I know that this is called the "linear attenuation" component, but what behavior does it simulate in the lighting model? It doesn't seem appear in any physical model of light that I'm aware of.

[EDIT]

It has been pointed out by David Gouveia that the linear factor might be used to help make the scene 'look' closer to what the developer/artist intended, or to better control the rate at which the light falls off.
In which case my question becomes "does the linear attenuation factor have a physics counterpart or is it just used as a fudge factor to help control the quality of light in the scene?"

sentences:
What is a good method for coloring textures based on a palette in XNA? I've been trying to work on a game with the look of an 8-bit game using XNA, specifically using the NES as a guide.

The NES has a very specific palette and each sprite can use up to 4 colors from that palette. How could I emulate this? The current way I accomplish this is I have a texture with defined values which act as indexes to an array of colors I pass to the GPU. I imagine there must be a better way than this, but maybe this is the best way?

I don't want to simply make sure I draw every sprite with the right colors because I want to be able to dynamically alter the palette. I'd also prefer not to alter the texture directly using the CPU.

sentences:
Making various shapes equally difficult to tap I'm developing a game where the player quickly has to tap/click on various shapes such as squares, circles, triangles, stars and so on. I'm now struggling with the following task: I'm searching for a normalized size for each shape, so that every shape is equally difficult to hit. E.g. given a circle with a radius r, how do I find the length l of the corresponding square?

At first glance I thought: Easy. Just make all shapes share the same area A. So, in the example above, l = sqrt(pi). http://en.wikipedia.org/wiki/Squaring_the_circle

But on second thought, this does not seem to be the best metric. Imagine a star with many long, thin, pointy arms or a very long but thin line. Even if they have the same area as a circle or square, they are still more difficult to hit.

So, what might be a better approach? Maybe something involving the "form factor" (circumference squared divided by area C²/A)?

sentences:
Publish to folder equivalent for a desktop GL project with visual studio Mac 2019 I'm not home so the only computer I have access to is a Macbook, and now I would like to see how I could pack up projects to export for various platforms. But when I build my project it only produce a windows executable. Since the project is DesktopGL I can execute it via the command
mono-sgen64 DesktopGL.exe

but this requires to include as redistributable the mono runtime. can't I publish the project in order to target Mac OS specific output and then get a fully packed .app executable like I can with the publish to folder thingy on windows?
I'll appreciate any help and really thank you for your attention.
Also if I could have access to linux executables I would be highly thankful.
Here is a recap of what I've found already:

the publish to folder is only available for Mac with a .asp.net or core console project
https://docs.microsoft.com/en-us/visualstudio/mac/publish-folder?view=vsmac-2019
We can use appify.sh script but I don't know how it would read the content files etc. and this won't be compatible with linux
I've allready used this script to create a packed php executable but I never included ressources
https://mathiasbynens.be/notes/shell-script-mac-apps
as I mentioned earlier I can execute the game properly using the mono executable so if I go that way I could create a run.sh script but this won't be the thing I'm looking into
i figured it by looking where was located the actual executable of the game once I've run the project
I've also found this nugget package which seems to add publishing parameters but I don't know if I can trust it
https://www.nuget.org/packages/InfinitespaceStudios.MonoGame.Packaging/0.1.4-alpha

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:
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:
Blueprint For Switching Between Cameras In The Unreal Engine So basically I have a scene in the Unreal Engine which has multiple cameras within it, the cameras are intentionally static as the application should behave more like a viewing gallery than a game. As the application is intended for mobile devices, the idea is that when a person touches the screen of their device, the rendering switches from the present camera to another one to show a different image. I have attempted to implement this action in the level blueprint with the following blueprint design:

Closer up:

Obviously in the scene there are three camera actors which must be switched between with the first camera viewed through being the 1st CameraActor hence the connection of the EventBeginPlay variable to the Set View Target With Blend variable that the 1st camera actor is connected to. When the Play button is pressed, the scene viewed from the first camera is rendered to the screen as desired however when the left mouse button is clicked equating to touch input on mobile devices, the scene does not switch to the second camera and the question is why?

sentences:
Collision Detection Code Structure with Sloped Tiles Im making a 2D tile based game with slopes, and I need help on the collision detection. This question is not about determining the vertical position of the player given the horizontal position when on a slope, but rather the structure of the code.

Here is my pseudocode for the collision detection:

void Player::handleTileCollisions()
    {
        int left = //find tile that's left of player
        int right = //find tile that's right of player
        int top = //find tile that's above player
        int bottom = //find tile that's below player

        for(int x = left; x <= right; x++)
        {
            for(int y = top; y <= bottom; y++)
            {
                switch(getTileType(x, y))
                {
                    case 1: //solid tile
                    {
                        //resolve collisions
                        break;
                    }
                    case 2: //sloped tile
                    {
                        //resolve collisions
                        break;
                    }
                    default: //air tile or whatever else
                        break;
                }
            }
        }
    }

When the player is on a sloped tile, he is actually inside the tile itself horizontally, that way the player doesn't look like he is floating. This creates a problem because when there is a sloped tile next to a solid square tile, the player can't move passed it because this algorithm resolves any collisions with the solid tile. Here is a gif showing this problem:

So what is a good way to structure my code so that when the player is inside a sloped tile, solid tiles get ignored?

sentences:
How do I raycast for a spherical harmonic shader using the iOS GPU? I am beginning an Spherical Harmonics shader project for an iOS app I am writing. I have begun by reading this excellent in-depth paper on the subject.

The paper describes a scene pre-processing step that involves ray-casting (one bounce, shadow feeler). Can someone describe how ray-casting can be performed using GLSL on iOS?

sentences:
openGL textures in bitmap mode For reasons detailed
here
I need to texture a quad using a bitmap (as in, 1 bit per pixel, not an 8-bit pixmap).

Right now I have a bitmap stored in an on-device buffer, and am mounting it like so:

glBindBuffer(GL_PIXEL_UNPACK_BUFFER, BFR.G[(T+1)%2]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, W, H, 0, GL_COLOR_INDEX, GL_BITMAP, 0);

The OpenGL spec has this to say about glTexImage2D:
"If type is GL_BITMAP, the data is considered as a string of unsigned bytes (and format must be GL_COLOR_INDEX). Each data byte is treated as eight 1-bit elements..."

Judging by the spec, each bit in my buffer should correspond to a single pixel. However, the following experiments show that, for whatever reason, it doesn't work as advertised:

1) When I build my texture, I write to the buffer in 32-bit chunks. From the wording of the spec, it is reasonable to assume that writing 0x00000001 for each value would result in a texture with 1-px-wide vertical bars with 31-wide spaces between them. However, it appears blank.

2) Next, I write with 0x000000FF. By my apparently flawed understanding of the bitmap mode, I would expect that this should produce 8-wide bars with 24-wide spaces between them. Instead, it produces a white 1-px-wide bar.

3) 0x55555555 = 1010101010101010101010101010101, therefore writing this value ought to create 1-wide vertical stripes with 1 pixel spacing. However, it creates a solid gray color.

4) Using my original 8-bit pixmap in GL_BITMAP mode produces the correct animation.

I have reached the conclusion that, even in GL_BITMAP mode, the texturer is still interpreting 8-bits as 1 element, despite what the spec seems to suggest. The fact that I can generate a gray color (while I was expecting that I was working in two-tone), as well as the fact that my original 8-bit pixmap generates the correct picture, support this conclusion.

Questions:

1) Am I missing some kind of prerequisite call (perhaps for setting a stride length or pack alignment or something) that will signal to the texturer to treat each byte as 8-elements, as it suggests in the spec?

2) Or does it simply not work  because modern hardware does not support it? (I have read that GL_BITMAP mode was deprecated in 3.3, I am however forcing a 3.0 context.)

3) Am I better off unpacking the bitmap into a pixmap using a shader? This is a far more roundabout solution than I was hoping for but I suppose there is no such thing as a free lunch.

sentences:
How to open .xml files in Cryengine 5.6.2? I am new at this engine and I am trying to understad its stuff before developing a game(I have good prior experience with unity and UE4) and this got me lots of headaches trying to understand it. My main problem is opening a .xml file, first of all I created a new project using third person shooter template and I started to study C# code and how character was animated using .xml files.

I know that cryengine V uses a thing called flow graph that makes the logic of an object by displaying a graph reading xml text.

What I have tried:

Clicking 1000 billion times the .xml file.

Trying to open it by importing into the flow chart thing.

How do I open this .xml file in a flow graph? There is poor documentation about this in docs.cryengine and makes hard for us to understand the logic.

sentences:
2D Rendering in DX11. Texture Storage and Reference I'm trying to think of the best way to manage textures in my 2D game.

First, I am using DX11, so right now my "textures" are just pointers to a ID3D11ShaderResourceView created by D3DX11CreateShaderResourceViewFromFile. Is this how I should be loading content?

Right now my basic idea is to create a hashmap of textures with string references.

When an object is created that uses a texture it passes the reference of the texture to the hashmap and gets back a pointer to the texture. If the texture isn't loaded it will use the string to find the correct texture to load, add it to the map and pass back the pointer, so it automatically loads new textures as required (my game is turn based, and many small pauses would have no real effect).

But here are my issues:

Is the above method the best method I could be using (without it becoming overly complex)
ID3D11ShaderResourceView. Is this how I should be storing texture data in DX11?
Ideally I want to have all my texture data compressed in a file. Right now I am simply loading jpgs and so on. But I have no idea how to compress these images and selectively re-load them as required. Ideally I would want to compress them to be locatable in the file using the reference string used when searching the hashmap too.

sentences:
How should I manage multiple entities? Before I start making a game, I'm trying to figure out how I will manage things.  One of the first things I'm not sure about is how to manage entities (enemy, player, projectile...)

I'm going to be using either C, C++, Java, or C#

One of the ideas I have is to use one array for projectiles and one for enemies.  Each time I have a new entity, I grow my array. Here is the problem: If player/enemy is firing, that creates a new entity which means the projectile array is growing.

Suppose its projectile #2053, when it hit something, I free it, then in my loop to check which projectiles are to do something, like getting closer to there target, I check if every # of my array to see if its null, if not, check is trajectory. But the problem is that the array will grow each time a new projectile is fired, and I will get a memory problem at the end.

So how should I manage my entities?

I need an awnser that covers both object oriented and procedural, since I mainly do things in C.

sentences: Multiple If Operations at Once In my game, I want to have it so that if a chess piece tries to move farther away than a certain distance it won't work. To do this, I need it to have an if statement that works between two numbers, but I can only seem to do above or below a number, not between. Is there a way to do this, or am I going to have to use to if statements?

sentences:
How can I separate component functionality from networking logic? Is it possible to make network independent components that allow networking details to be specified externally?

For example, if I have a "Follow" script that follows a game object, it would need to do certain actions on the server and certain actions on the client. However, these things can change based on the network architecture. Single player games would not even need to consider what runs where. That makes perfect sense, except why should a component as general as "Follow" need to be different across different types of game?

I've tried creating a base component class that figures out how to call each method based on options set in the editor, but that failed due to RPC names needing to be different across all components attached to one game object. Not to mention it was messy. I've tried abstracting method calls to figure out how they should be called, but that doesn't solve the problem of WHICH methods should be network invoked.

I really don't want to build this into the components themselves, even though it might be the easiest / most obvious solution. That would destroy their portability across projects.

sentences:
How to pause and resume a game in XNA using the same key? I'm attempting to implement a really simple game state system, this is my first game - trying to make a Tetris clone.  I'd consider myself a novice programmer at best. I've been testing it out by drawing different textures to the screen depending on the current state.

The 'Not Playing' state seems to work fine, I press Space and it changes to 'Playing', but when I press 'P' to pause or resume the game nothing happens. I tried checking current and previous keyboard states thinking it was happening to fast for me to see, but again nothing seemed to happen. If I change either the pause or resume, so they're both different, it works as intended.

I'm clearly missing something obvious, or completely lacking some know-how in regards to how update and/or the keyboard states work.

Here's what I have in my Update method at the moment:

    protected override void Update(GameTime gameTime)
    {
        KeyboardState CurrentKeyboardState = Keyboard.GetState();

        // Allows the game to exit
        if (CurrentKeyboardState.IsKeyDown(Keys.Escape))
            this.Exit();

        // TODO: Add your update logic here

        if (CurrentGameState == GameStates.NotPlaying)
        {
            if (CurrentKeyboardState.IsKeyDown(Keys.Space))
                CurrentGameState = GameStates.Playing;
        }

        if (CurrentGameState == GameStates.Playing)
        {
            if (CurrentKeyboardState.IsKeyDown(Keys.P))
                CurrentGameState = GameStates.Paused;
        }

        if (CurrentGameState == GameStates.Paused)
        {
            if (CurrentKeyboardState.IsKeyDown(Keys.P))
                CurrentGameState = GameStates.Playing;
        }

        base.Update(gameTime);
    }

sentences:
How can I start the race from a checkpoint with GTA 5 Map Editor? When I use the official Map Editor from GTA V then it seems that you are only able to test the Map from the Start Point all the time. This is very annoying when you build a hardcore difficult Map and you don´t want to start all the time again from the Start Point.

Is there a way to start the Race from as example Checkpoint #3 instead of always from the Start Point? I think there must be a way because I can´t imagine that hardcore difficult Map Builders always restart the Map from the Start Point..

Btw I can't ask the question at rockstar forum because you need to be 1 month online with your account before you can ask questions.

sentences: Implementing audio for a game made using JMonkey? Is it possible to implement music/SFX in game made using JMonkey?  If yes, how did you do it?  What did you use?

sentences: Game industry layoffs? I want to be a game programmer and it's come to my attention that people who work in this industry are laid off/fired every few years. Can someone please tell me how to deal with this? Thanks

sentences:
DirectXTK: SpriteBatch::Begin and Draw methods give LNK2019: unresolved external Right now, im using DirectXTK (version 2020.2.24.4) and Visual Studio 2019.

My declarations look like this:

    std::unique_ptr<SpriteFont> m_font;
    std::unique_ptr<SpriteBatch> m_spriteBatch;

and my code look like this:

    m_font = std::make_unique<SpriteFont>(m_device.Get(), L"myfile.spritefont");
    m_spriteBatch = std::make_unique<SpriteBatch>(m_deviceContext.Get());

    m_fontPos.x = 1080 / 2.f;
    m_fontPos.y = 720 / 2.f;

    const wchar_t* output = L"Hello World";
    DirectX::SimpleMath::Vector2 origin = m_font->MeasureString(output) / 2.f;

    m_spriteBatch.get()->Begin();
    m_font.get()->DrawString(m_spriteBatch.get(), output, m_fontPos);
    m_spriteBatch.get()->End();

The functions SpriteBatch::Begin(), SpriteBatch::Draw() and SpriteFont::MeasureString() give me a LNK2019 error.

I found this thread DirectXTK: Only SpriteBatch::Begin and Draw methods give LNK2019: unresolved external. But the answer didnt solve my errors

Thanks in advance!

sentences:
Java - Trouble with recursion and rectangle placement I am using Android API's and using the RectF class for rectangles. I have a list of blocks that are on the screen at one time. Each block is given a random position, and then I go through all of the tiles previous, to check if there is an intersection. If there is, it recursively calls the method again to get a new random position and check it against all the other tiles.

I feel like this should work perfectly, except for one thing that may be affecting it. Since recursion opens up so many instances of a method, it needs to finish them off, so I don't know if the rectangle is just being drawn at the initial position, and the rest of the calls are doing nothing?

I have tried quite a few different methods and this seems to be the closest, but something weird is happening and I cant figure it out.

Start method:

    private void start() {

    timerTask = new TimerTask() {
        @Override
        public void run() {

            if(Game.STATE == Game.State.Playing) {
                removeFailedTiles();

                Random deathRate = new Random();
                int i = deathRate.nextInt(100);
                if(i % 10 == 0) {
                    System.out.println("Death tile");
                    activeDeathTiles.add(new DeathTile(getRandomPosition()));
                    //System.out.println(activeDeathTiles.toString());
                } else {
                    System.out.println("Normal Tile");
                    activeTiles.add(new Tile(tileLifetime, getRandomPosition()));
                }

            }

            if(Game.STATE == Game.State.Lost) {
                timerTask.cancel();
                timer.cancel();
            }
        }
    };

    timer.schedule(timerTask, 1000, tileDelay);

}

Get Random Position method:

private RectF getRandomPosition() {
    int screenWidth = (int) Game.SCREEN_WIDTH;
    int screenHeight = (int) Game.SCREEN_HEIGHT;

    RectF pos = new RectF();

    Random random = new Random();
    int maxX = (int) (screenWidth - (Tile.TILE_WIDTH * 1.5f)), minX = (int) (Tile.TILE_WIDTH / 1.5f);
    int maxY = (int) (screenHeight - (Tile.TILE_HEIGHT * 1.5f)), minY = (int) (Tile.TILE_HEIGHT / 1.5f);

    pos.top = random.nextInt(maxY - minY) + minY;
    pos.left = random.nextInt(maxX - minX) + minX;
    pos.bottom = pos.top + Tile.TILE_HEIGHT;
    pos.right = pos.left + Tile.TILE_HEIGHT;

    if(isOverlap(pos)) {
        return getRandomPosition();
    } else {
        return pos;
    }
}

Helper methods:

private List<RectF> getAllTiles() {
    List<RectF> allTiles = new ArrayList<RectF>();

    for(RectF t : activeDeathTiles)
        allTiles.add(t);
    for(RectF t : activeTiles)
        allTiles.add(t);

    return allTiles;
}

private boolean isOverlap(RectF position) {

    for(RectF r : getAllTiles()) {
        if(RectF.intersects(position, r)) {
            return true;
        }
    }

    return false;
}

If someone could please help me figure out what is going wrong here that would be stellar!

sentences: How can we modify all of the human bone items in Skyrim? I have the models, but I am wondering which object_id I need to modify. Is there a single object_id for every skeleton part, or each parts have several variants and several object_id? Is there a list with all of the skeleton parts in the game thereby allowing me to modify all of the vanilla models without having to worry about not having changed all of the skeleton models in the game?

sentences:
How can I make the player(transform) to rotate once each time the player exist the collider and to rotate him slowly smooth? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerSpaceshipAreaColliding : MonoBehaviour
{
    private float timeElapsed = 0;
    private float lerpDuration = 3;
    private float startValue = 1;
    private float endValue = 0;
    private float valueToLerp = 0;
    private Animator playerAnimator;
    private bool exitSpaceShipSurroundingArea = false;

    // Start is called before the first frame update
    void Start()
    {
        playerAnimator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        if (exitSpaceShipSurroundingArea)
        {
            SlowDown();

            if (playerAnimator.GetFloat("Forward") == 0)
            {
                transform.rotation = Quaternion.Inverse(transform.rotation);
            }
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.name == "CrashLandedShipUpDown")
        {
            exitSpaceShipSurroundingArea = false;
            Debug.Log("Entered Spaceship Area !");
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.name == "CrashLandedShipUpDown")
        {
            exitSpaceShipSurroundingArea = true;
            Debug.Log("Exited Spaceship Area !");
        }
    }

    private void SlowDown()
    {
        if (timeElapsed < lerpDuration)
        {
            valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);
            playerAnimator.SetFloat("Forward", valueToLerp);
            timeElapsed += Time.deltaTime;
        }
        playerAnimator.SetFloat("Forward", valueToLerp);

        valueToLerp = 0;
    }
}

When the player exit the collider area he slow down then stop. at this point I want the player to start rotating and start moving back inside the colliding area.
The exit and the slow down are working but the rotation is not working and not sure how to make him start moving again slowly to max speed when entering back.
The main goal is to prevent the player to leave the marked colliding area with some slow down and rotation.
For the rotation I did :
transform.rotation = Quaternion.Inverse(transform.rotation);

but it keep rotating non stop and not slowly smooth like using Lerp.

sentences:
How to convert screen space to world space? I have a shader that should do raymarching.
But I have problems converting the fragment's position to a worldspace coordinate.
This is my vertex shader:
VertexShaderOutput VS(VertexShaderInput input)
{
    VertexShaderOutput output;
    output.Position = float4(input.Position.xy*2,0.0, 1.0);
    float4 worldPos = output.Position;
    output.WorldPos = mul(worldPos, InverseViewProjection);
    output.UV = input.UV;
    return output;
}

input.Position in this case is a quad from -0.5 to 0.5, hence why I multiply it by 2.
In my pixel shader, I want to get the ray start position from output.WorldPos.
However, the shader outputs WorldPos as this:
x = -118.943700000, y = -25.704420000, z = 23.763410000

This is wrong, because the camera is at around
x = -3846 y = -810 z = 734

What am I doing wrong? I expected a world position, but it seems to be a screen space position?
Here is how I create my matrices (DirectX SimpleMath):
View = Matrix::CreateLookAt(WorldPosition, target, up);
Projection = Matrix::CreatePerspectiveFieldOfView(fov, w / (float)h, n, f);
ViewProjection = View * Projection;
ViewProjection.Invert(InverseViewProjection);
Projection.Invert(InverseProjection);
View.Invert(InverseView);

The game renders perfectly fine, So I am certain The View/Projection Matrices are not wrong.

sentences:
Questions about property-centric game object runtime I was reading Game Engine Architecture by Jason Gregory

So according to him, I should use an array of entities, and arrays for each property, such as an array gameObjectsPosition, gameObjectsHealth... But in my case, the world is divided in a chunk grid. Each chunk have its own array (or for the moment vector but I plane to change that) of entities (game objects). Then, what should I do? Create a single array containing all entities positions wherever there are (and so one for health, level, orientations, dimensions...), or create the property specific arrays in each chunk?
Then how to process these property arrays? I mean, for each dynamic entity, I could update dimensions, sizes and health or I could for each property update each entity. Example:

 UpdateWorld() {
     for each entity in dynamicEntities
          entity.updatePosition()
          entity.updateHealth()
          entity.updateDimensions()
          entity.updateMesh()
 }

 UpdateWorld() {
     for each entity in dynamicEntities
          entity.updatePosition()
     for each entity in dynamicEntities
          entity.updateHealth()
     for each entity in dynamicEntities
          entity.updateDimensions()
     for each entity in dynamicEntities
          entity.updateMesh()
 }

How to handle sizes for each chunk? That'd mean each chunk have an array with MAX_ENT_PER_CHUNK (say in my example 1024), and then if a chunk have 24 entities there would be 1000 entities useless. Also, I can't use more than 1024 entities. I could use pointers, but then the CPU cache would hit a lot of misses.
How to handle IDs? If I have an array of entities I need to use IDs. I can use macro SID has specified in the book, but the IDs are not ordinals (they may not begin at 0)

sentences:
Culling mask don't work I have the following setup:
MainCamera render everything except ImageTurret layer.
TurretCamera render only ImageTurret layer on a RawImage

My problem is:
MainCamera render everything and TurretCamera render nothing
TurretCamera render only if set to default layer.

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:
CubeRealm OpenGL rotation problems, need help. :\ I'm totally new to OpenGL and I'm working on a Sandbox game called CubeRealm. My problem you see is rotation. I've got it in my head that to rotate the 'camera' I just rotate all the scene by the negative value of the camera's rotational values. However so far it seems to not be working.

Here's the code snippets:

glPushMatrix();

lighting();
/*
 (640^2)/(64^2)=amount of cubes on one 640x640 plane(409,600,4,096)
 */
//TODO: fix z axis problem for translating
glRotatef(-player.camera.rotation.x,1.0,0.0,0.0);
glRotatef(-player.camera.rotation.y,0.0,1.0,0.0);
glRotatef(-player.camera.rotation.z,0.0,0.0,1.0);
renderGrid();

glPopMatrix();

glutSwapBuffers();

//SNIPPET2...

case LOOK_UP:
    if(player.camera.rotation.y!=-90.0){ //if they are not looking up
        //make them look up
        player.camera.rotation.y-=90.0;
        //TODO: set direction the camera is facing in
    }
    break;
case ROTATE_LEFT:
    if(player.camera.rotation.x!=0.0){
        player.camera.rotation.x-=90.0;
        //TODO: set direction the camera is facing in
    }else{
        player.camera.rotation.x=360.0;
        player.camera.rotation.x-=90.0;
        //TODO: set direction the camera is facing in
    }
    break;
case LOOK_DOWN:
    if(player.camera.rotation.y!=90.0){ //if they are not looking down
        //make them look down
        player.camera.rotation.y+=90.0;
        //TODO: set direction the camera is facing in
    }
    break;
case ROTATE_RIGHT:
    if(player.camera.rotation.x!=360.0){
        player.camera.rotation.x+=90.0;
        //TODO: set direction the camera is facing in
    }else{
        player.camera.rotation.x=0;
        player.camera.rotation.x+=90.0;
        //TODO: set direction the camera is facing in
    }
    break;

When I press the right arrow key(rotate to the right) it doesn't rotate also when I rotate up(up arrow) it goes weird instead of allowing me to see the top of the skybox it still shows me my test cubes.

So guys how do I fix the rotation, what am I doing wrong?

Note the 'TODO: set direction' stuff is for my local axis system. Those TODOs are irrelevant to the question.

sentences: Can I use multiple OpenGL version together I want to use GLSL but keep my current OpenGL 1.1 setup. The thing is that can I use OpenGL 2.0 shaders on OpenGL 1.1 renders?

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:
Unity 2D Cinemachine weird behavior for non rectangular confiner I have been trying to emulate a sort of Megaman X4 way of following the player around platforming levels, where the camera is confined to certain boundaries of such levels.

However, all the tutorials and guides out there only show rectangular or square-shaped confiners for the virtual cameras, and not odd shapes like an L shaped confiner, when using a weirdly shaped confiner the camera just tends to snap from one position to another and the game ends up feeling bad when that happens.

I have tried solving this problem by using dolly tracks, which work nicely... But I end up having tons of virtual cameras to change to on sections that are weirdly shaped since the camera ends up also suddenly snapping on to weird positions on sharp turns and it also tends to get way off track, even when the settings of the virtual camera are configured to have very little damping and if there's no damping the camera just stutters all the time.

Is there a way to have this kind of behavior to confine a virtual camera to oddly shaped level boundaries?

sentences:
Connecting two arbitrary points with 2 lines DEFINITIONS:

Any "Point (x, y)" mentioned below is really the bottom left coordinates of a 1 unit by 1 unit rectangle. A "Line" is a defined as a rectangle that is either 1 unit tall and 1 unit or greater wide, or 1 unit wide and 1 unit or greater tall. These rectangles are constructed given a Rectangle(bottomLeftX, bottomLeftY, width, height). The height and/or width can be negative. If either are it will shift the start x or y accordingly as so:

public Rectangle(int x1, int y1, int width, int height) {
  _left = x1;
  _right = x1;
  if(width < 0)
    _left += width;
  else
    _right += width;

  _bottom = y1;
  _top = y1;
  if(height < 0)
    _bottom += height;
  else
    _top += height;
}

THE GOAL:

Given two arbitrary points, define two lines (as rectangles) connecting the two points. The two lines need to randomly 'bend' at one of the two possible connections (see below). The two points aren't in any specific order. Point A's X and/or Y can be above, below or even the same as Point B's X and/or Y.

THE PROBLEM:

I have made a solution that only partially works. There is a bug in my method below where sometimes the two lines do not connect at the bend/junction. It seems to only be when the bend/junction is in the bottom right of the points' bounds.

WHAT I HAVE NOW:

A little background: I'm working on a random dungeon generator. I create rooms randomly, and then I am going to connect them using the described point and line system above. Here's what I have now. "graph" is a Map>, technically it's directional, but the reason was so that I wouldn't draw the same lines twice.

int x, y, dx, dy;
Rectangle a, b;
// loop through each edge of the graph
for(Rectangle outer:graph.keySet()) {
  for(Rectangle inner:graph.get(outer)) {
    // randomly set a and b
    if(random.nextBoolean()) {
      a = outer;
      b = inner;
    } else {
      a = inner;
      b = outer;
    }

    // generate the origin points based on a
    x = (int) a.getCenterX();
    y = (int) a.getCenterY();
    // and the delta of b to a
    dx = (int) b.getCenterX()-x;
    dy = (int) b.getCenterY()-y;

    // create line starting at a, then
    // create line starting at end of above line
    lines.add(new Rectangle(x, y, dx, 1));
    lines.add(new Rectangle(x+dx, y+dy, 1, -dy));
  }
}

Here's what it produces. Most of the time it works, however there are cases where the corners do not line up. I'm not sure how to fix this.

Any input is much appreciated.

sentences:
How to create a legally valid timestamp of unpublished game artwork Before publishing promotional material of my first indie game I wanted to mark all my artwork with a legally valid timestamp.

There are two ways I know to do this:

 1 go to a sollecitor/lawyer and pay for them to certify the document
 2 use an online webservice to mark any given file/folder readable to the service

Anyone has already done this and if yes how (e.g. which website have you used? which type of solecitor have you contacted? etc..)?

I am doing all this because I have prepared a kickstarter video that I wanted to publish in these days to ask for some additional funds to complete my game and, as it contains sequences of the game, I am at the same time worried about publishing it (somebody might copy the characters as I say in the video that I would like to do also a comic book series based on those characters). I guess that "eCO" (or something similar) becomes a must in this case right?

Kind Regards

PS: I know that there is always the good old "send yourself a mail with a stamp and a date" but is not very strong as proof.

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:
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:
Displaying a Scratch Project (.SB2) file within a Delphi EXE FIle I would like to Display a Scratch Project (.SB2) file within my Delphi EXE file. I would like to know if it is possible to display and build the Scratch Project into your Delphi Project.

I wish to make a small game in Scratch and then use the game within my Delphi Application without the need of the Scratch 2 IDE. Perhaps a 3rd party delphi tool or component or something that can help me achieve this would also be very nice. So basically I want to host the Scratch game within my Delphi app.

Is this possible? How can this be done? (I am using Delphi 10.3.2 Rio and Scratch 2 Offline Editor)

sentences:
OpenGL Black rectangle in rendering texture I create textures (for example, I just fill the texture color), and render their. But, for some reason, to the upper edge added black rectangle.

Screenshot:

var
Textures: array of GLuint;

procedure LoadTexture(const TextureID: Byte; var Texture: GLuint);
var
//
w, h: Cardinal;
//
Data: PByteArray;
begin
//
if TextureID = 0 then
//
  begin
//
w:=512; h:=512;
  end
                 else
//
  begin
//
w:=128; h:=64;
  end;

//
GetMem(Data, w * h * 3);

//
if TextureID = 0 then
//
FillChar(Data^, w * h * 3, 204)
                 else
//
FillChar(Data^, w * h * 3, 102);

//
glBindTexture(GL_TEXTURE_2D, Texture);

//
glTexParameteri(GL_TEXTURE_2D,
//
GL_TEXTURE_MAG_FILTER, GL_NEAREST);

//
glTexParameteri(GL_TEXTURE_2D,
//
GL_TEXTURE_MIN_FILTER, GL_LINEAR);

//
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8,
//
w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, Data);

//
FreeMem(Data, w * h * 3);
//
Data:=nil;
end;

procedure glInit;
begin
//
glEnable(GL_TEXTURE_2D);

//
SetLength(Textures, 2);
//
glGenTextures(1, @Textures[0]);
//
LoadTexture(0, Textures[0]);
//
glGenTextures(1, @Textures[1]);
//
LoadTexture(1, Textures[1]);

//
glClearColor(1, 1, 1, 0);
//
glShadeModel(GL_SMOOTH);
//
glClearDepth(1);
//
glDisable(GL_DEPTH_TEST);
//
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

//
glViewport(0, 0, 800, 600);
//
glMatrixMode(GL_PROJECTION);
//
glLoadIdentity;
//
glOrtho(0, 800, 600, 0, 0, 1);
//
glMatrixMode(GL_MODELVIEW);
//
glLoadIdentity;
end;

procedure glDraw;
begin
//
glClearColor(1, 1, 1, 0);
//
glClear(GL_COLOR_BUFFER_BIT or
  GL_DEPTH_BUFFER_BIT);

//
glBindTexture(GL_TEXTURE_2D, Textures[0]);
//
glBegin(GL_QUADS);
//
glTexCoord2f(0, 0);
//
glVertex2f(0,   0);
//
glTexCoord2f(1, 0);
//
glVertex2f(512, 0);
//
glTexCoord2f(1, 1);
//
glVertex2f(512, 512);
//
glTexCoord2f(0, 1);
//
glVertex2f(0,   512);
//
glEnd;

//
glBindTexture(GL_TEXTURE_2D, Textures[1]);
//
glBegin(GL_QUADS);
//
glTexCoord2f(0, 0);
//
glVertex2f(128,   64);
//
glTexCoord2f(1, 0);
//
glVertex2f(256, 64);
//
glTexCoord2f(1, 1);
//
glVertex2f(256, 128);
//
glTexCoord2f(0, 1);
//
glVertex2f(128, 128);
//
glEnd;
end;

sentences: Keeping camera at player's back I'm developing a 3D game similar to the Roller Ball game from Unity's tutorials mixed with a runner type game like Subway Surfers.  The game uses the arrow keys for control.  When the player hits the left or right arrow key, I want the player to do a 90 degree turn and have the camera stay behind the player.  My questions are, how would I do this?  Would I need to do this in my player controller script and just change the rotation?  Or would I need to add some controls to the camera and change the rotation of the camera every time the player hits the right or left key?

sentences:
Rotate object always at same speed on screen, no matter camera distance? I am rotating a globe like XCOM's hologlobe,

I rotate it using Quaternion.RotateTowards(Quaternion from, Quaternion to, float maxDegreesDelta).

I found a good value for maxDegreesDelta, in my case it is 5.0f.

There is a limit on how close or far the camera can be, let's assume clos is 1.0f and far is 2.0f.

I want to be able to zoom into the globe, but obviously when I do, it rotates a bit too fast then.

When zoomed out, rotation speed is satisfying:

When zoomed in, rotation is too fast, making it more difficult to manipulate:

And the problem is even more evident as game view size gets bigger, i.e. fullscreen.

Using Mathf.Lerp and Mathf.InverseLerp, I've tried to make maxDegreesDelta and mouse delta proportional to the distance the camera is but it's hardly convincing.

Note: I rotate the globe, not the camera.

Question:

How can I ensure object rotates at same speed on screen, no matter how close or far camera is ?

Code:

(assumes there is a sphere of radius 0.5 at Vector3.zero and camera is positioned at Vector3.back)

using UnityEngine;
using UnityEngine.InputSystem;

namespace Test2
{
    public class GeoScapeController : MonoBehaviour
    {
        #region Public

        public Transform TargetObject;

        public Camera TargetCamera;

        [Range(0.01f, 1.0f)]
        public float Sensitivity;

        public bool Smooth;

        public float ZoomDistanceMin;

        public float ZoomDistanceMax;

        #endregion

        #region Private

        [SerializeField]
        [HideInInspector]
        private Quaternion TargetRotation;

        [SerializeField]
        [HideInInspector]
        private int ZoomLevel;

        [SerializeField]
        [HideInInspector]
        private int ZoomLevels;

        [SerializeField]
        [HideInInspector]
        private Vector3 ZoomVector;

        [SerializeField]
        [HideInInspector]
        private Vector3 ZoomVelocity;

        private void Reset()
        {
            Sensitivity = 0.05f;
            Smooth = true;

            ZoomDistanceMin = 0.625F;
            ZoomDistanceMax = 1.25F;
            ZoomLevels = 10;
        }

        private void Start()
        {
            TargetRotation = Quaternion.LookRotation(TargetObject.forward, TargetObject.up);
            ZoomVector = TargetCamera.transform.position;
        }

        private void Update()
        {
            var mouse = Mouse.current;
            var delta = mouse.delta.ReadValue();
            var scale = new Vector4(-1.0f, +1.0f, +1.0f);

            var x = mouse.leftButton.isPressed ? delta.y * scale.y * Sensitivity : 0.0f;
            var y = mouse.leftButton.isPressed ? delta.x * scale.x * Sensitivity : 0.0f;
            var z = mouse.middleButton.isPressed ? delta.x * scale.z * Sensitivity : 0.0f;
            var r = Quaternion.AngleAxis(x, Vector3.right) *
                    Quaternion.AngleAxis(y, Vector3.up) *
                    Quaternion.AngleAxis(z, Vector3.forward);

            if (Smooth) // hopefully, quaternion limits won't be crossed !
            {
                TargetRotation = Quaternion.RotateTowards(TargetRotation, r * TargetRotation, 2.5f);

                TargetObject.rotation = Quaternion.Slerp(TargetObject.rotation, TargetRotation, Time.deltaTime * 5.0f);
            }
            else
            {
                TargetObject.rotation = TargetRotation = r * TargetRotation;
            }

            var wheel = (int) mouse.scroll.ReadValue().y / 120;
            if (wheel != 0)
            {
                ZoomLevel = Mathf.Clamp(ZoomLevel + wheel, 0, ZoomLevels);
                var lerp1 = Mathf.InverseLerp(ZoomLevels, 0, ZoomLevel);
                var lerp2 = Mathf.Lerp(ZoomDistanceMin, ZoomDistanceMax, lerp1);
                ZoomVector = Vector3.back * lerp2;
            }

            TargetCamera.transform.position = Smooth
                ? Vector3.SmoothDamp(TargetCamera.transform.position, ZoomVector, ref ZoomVelocity, 0.3f)
                : ZoomVector;
        }

        #endregion
    }
}

sentences:
FBX UV Coordinates is strange i want correct UV Coordinates model
likes this model

but Model load and render at my importer result is likes this

My fbx uv coordinates extract code is here

     FbxLayerElementUV* layerUVs = pMesh->GetLayer(0)->GetUVs();
                if (NULL != layerUVs)
                {
                    int uvIndex = 0;
                    FbxLayerElement::EReferenceMode referenceMode = layerUVs->GetReferenceMode();
                    FbxLayerElement::EMappingMode mappingMode = layerUVs->GetMappingMode();

                    if (FbxLayerElement::eByPolygonVertex == mappingMode)
                    {
                        int id = pMesh->GetTextureUVIndex(j, k);
                        if (FbxLayerElement::eDirect == referenceMode ||
                            FbxLayerElement::eIndexToDirect == referenceMode)
                            uvIndex = id;
                    }
                    else if (FbxLayerElement::eByControlPoint == mappingMode)
                    {
                        if (FbxLayerElement::eDirect == referenceMode) uvIndex = iControlPointIndex;
                        else if (FbxLayerElement::eIndexToDirect == referenceMode)
                            uvIndex = layerUVs->GetIndexArray().GetAt(iControlPointIndex);
                    }
        FbxVector2 uv = layerUVs->GetDirectArray()[uvIndex];

        vtx.u = (float)uv[0]; vtx.v = (float)uv[1];
        vtx.u = 1 - vtx.u; vtx.v = 1 - vtx.v;

What I do, can we solve this problem??
Please Answer to me

sentences:
Why doesn't my Pygame game scroll properly? When I am clicking the arrow keys, in order to scroll my ground and my lucky block, I cant just press the key and it keeps on going scroll. So I need to press the key every second to get a kinda smooth scroll.

from os import environ
environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import pygame
import config
import spriteSheetLoader as sSL

# Some standard setup variables
scr = config.SCREEN_SIZES[:]
capt = config.CAPTION
clock = pygame.time.Clock()

# load image
sheet = pygame.image.load('img/tiles.png')
sheet = pygame.transform.scale2x(sheet)
tiles = {
    "brown-broken-wall": sSL.loadTileInfo(0, 0),
    "brown-wall": sSL.loadTileInfo(0, 1),
    "lucky-block": sSL.loadTileInfo(0, 24)
}
ground = []
tiles_pos = []
setted = False

pygame.init()

# Setting up our window
win = pygame.display.set_mode((scr[0], scr[1]))
pygame.display.set_caption(capt)

def setup_ground():
    for i in range(15, 22):
        for j in range(0, 50):
            ground.append([j * 32, i * 32, tiles["brown-broken-wall"]])
    tiles_pos.append([14*32, 10*32, tiles["lucky-block"]])
    tiles_pos.extend(ground)

def draw():
    global setted

    win.fill((62, 152, 255))
    if not setted:
        setup_ground()
        setted = True
    for i in tiles_pos:
        win.blit(sheet, (i[0], i[1]), (i[2][0], i[2][1], 32, 32))

    pygame.display.update()

while True:
    clock.tick(40)
    keys = pygame.key.get_pressed()

    draw()

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            quit()
        elif keys[pygame.K_RIGHT]:
            for i in tiles_pos:
                i[0] -= 15
        elif keys[pygame.K_LEFT]:
            for i in tiles_pos:
                i[0] += 15

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: Are there any games that contain a machine learning AI? Can anybody here give a reference to commercial AAA games that implement a machine learning AI?

sentences:
Rotating a row of Rubik cube in response to mouse position and drag I made this cube in ue4..now I am able to rotate cubes separately without any problem.

But how do I move a row of cubes in response to mouse drag..

How do I detect what row is selected when my mouse is clicked and dragged on only one cube

sentences:
What popular real world XNA games are out there? Possible Duplicate:
  Famous Games Written in .Net and XNA

Im learning XNA hoping to create a real world game out if one day, i.e. not just learning it to learn game programming.

But are there any successful real world XNA games out there?

(Maybe this question could be turned into a community wiki to a list can be maintained.)

sentences:
Android performance/issues with Corona SDK? I know this is a fairly broad question. We are looking to develop a mobile game and want to use a multi-platform engine/SDK. We like what we see with Corona but in doing some reading, we are seeing a lot of references to poor performance on the 'droid platforms. I am unsure how much of this is still relevant? Many of the articles/posts/references/discussions vary in date from 18 months ago to earlier this year.

Is there a reason we should not pursue Corona if Android support is important to us?

The game is going to be 2D isometric view. Thanks!

sentences: Is it possible to make a text based game and filter bad stuff? I was thinking of a text based game where the users type in various "things."  But I know it will quickly degenerate into filth.  Is there any way to stop something like this?

sentences:
Text rendering techniques for games I'm researching text rendering techniques for 3D applications, and I'm having a hard time finding information on the topic. Do you know of any other methods of text rendering that are actually used in current games or have a historical significance?

So far I have:

Using prerendered bitmaps of glyphs / strings as textures,
converting the glyph vectors to triangle meshes and rendering it as such,
signed distance fields (popularized by Valve's paper),
GLyphy.

I haven't managed to find anything else though.

Does anyone know what large engines, such as Source, Unreal, Unity, etc. use?

Sources would also be greatly appreciated.

Thanks.

sentences:
GameObject's scale gets 0 after being parented in editor 1) Before

2) After being parented.

I found a pattern. When adding the child, if the parent's scale.z = 0 the child scale.xyz becomes 0 on parenting. If the parent's scale.z != 0 it works. Another experiment that I tried was, after successfully adding the child(without getting scaled down to 0) and then to make the parent's scale.z = 0, the children's scales don't get affected at all.

Why?

sentences:
OpenGL RayCasting and Intersection with plane I have been trying for a couple of days to raycast. I have a Renderable/Texture/Primitive/Whatever placed in the WORLD at 0.0f,0.0f,0.0f, and when I click the mouse I want to know at what X,Y coordinates was the Primitive "clicked". We can safely assume that the primitive will always be at Z=0;

Basically, I should do raycasting. But it does not work. I tried finding the 3D position of the ends of the ray(near/far plane), and then compute the intersection, but it does not work. I tried getting Z from the DEPTH BUFFER,  but I always get 0 and it still does not work.

Does anyone have any fast, simple method for this?

sentences:
How do I modify textures in SDL with direct pixel access? I'm trying to use SDL_LockTexture and SDL_UnlockTexture for directly editing pixels in a texture. I'm using SDL 2.0. Setting the pixel value using the following code doesn't modify the texture:

void *pixels;
int pitch;

SDL_LockTexture(mytexture, NULL, &pixels, &pitch);

// Set pixel 100,100 to blue
((uint32_t *)pixels)[100 * 100] = 255;

SDL_UnlockTexture(mytexture);

sentences:
100 points between 0-1000 on an increasing scale Basically, it's for roleplay, I need to generate 100 points along a scale. Level 1 is the starting amount, and is at point 0 on the scale. Level 100 is the highest amount planned at this point, and it needs to be at 1,000 on the scale.

My problem is generating points 2-99 between those two. I could do it cheaply and just go with one level at every 10 points. But that's not how I want it to function.

Ideally, I'd like a sloping curve, so that in the early stages, levels might be only a number or two apart. Such as:

Level 1 - 0
Level 2 - 2
Level 3 - 4

But then as the level increases, the number also goes up.

Level 98 - 960
Level 99 - 980
Level 100 - 1000

Can someone help me figure this out?

sentences:
Rotation ascending into infinity? I'm creating a rotation for my sun to move, however it quickly extends to Infinity before going into NaN. I thought that taking advantage of the Matrix4f would make this much easier but it does as previously stated. Ideally should have the sun rotate around the sunCenter. Why is it doing this and how would I fix it?

private Vector3f getSunPosition() {
    double rotation = (time / DAY_LENGTH) * 360;
    Matrix4f matrix = new Matrix4f();

    Vector3f pos = sun.getPosition();
    matrix.m03 = pos.x;
    matrix.m13 = pos.y;
    matrix.m23 = pos.z;

    Matrix4f.rotate((float) Math.toRadians(rotation), sunCenter, matrix, matrix);

    return new Vector3f(matrix.m03, matrix.m13, matrix.m23);
}

I had it print out the Vector3f and rotation. The rotation looks a bit odd at first, however I can fix that another time.

Vector3f[1.0, 1.0, 1.0] 0.0
Vector3f[288375.56, 0.18377686, 287549.88] 79.41000366210938
Vector3f[1.96323607E11, -125296.0, 1.96323607E11] 158.82000732421875
Vector3f[1.05730567E17, 0.0, 1.05730567E17] 238.23001098632812
Vector3f[5.5935644E22, 0.0, 5.5935644E22] 240.02999877929688
Vector3f[2.9050322E28, 0.0, 2.9050322E28] 241.8300018310547
Vector3f[1.4801178E34, 0.0, 1.4801178E34] 243.6300048828125
Vector3f[Infinity, 0.0, Infinity] 243.8400115966797
Vector3f[Infinity, NaN, Infinity] 244.04998779296875
Vector3f[NaN, NaN, NaN] 244.25999450683594
Vector3f[NaN, NaN, NaN] 244.41000366210938
Vector3f[NaN, NaN, NaN] 244.55999755859375

sentences:
In a shader, why does substituting a variable with the expression producing it cause different behaviour? I have this correctly-working OpenGL shader producing Perlin noise:

 float left = lerp(fade(v),  downleft,  topleft);
 float right = lerp(fade(v), downright, topright);
 float result = lerp(fade(u), left, right);

Then I tried plugging the definitions of right and left into result:

float result = lerp(fade(u),
                    lerp(fade(v), downleft,  topleft),
                    lerp(fade(v), downright, topright));

Surprisingly, this behaves completely differently, giving visible edges in my Perlin noise. Below are both results:

My whole 30-line shader is here.

What is the difference between those?

sentences:
How does time-dependent camera rotation with a mouse work? The commonly used equation for camera rotation with a mouse does not involve time. This make sense since higher frame rates have smaller changes in mouse position and vise-versa so it all evens out. If time slows down or speeds up, however, camera rotation from the mouse does not adjust accordingly. Just as you move slower when time is slowed, logically I also want rotating to be slower.
One option is to multiply the change-in-position of the mouse with the same multiplier I'm using on time, but shouldn't it be possible to have change-in-rotation and change-in-time in the same equation, independent from framerate?

sentences:
Code Logic's execution with respect to time Events I have to show complete 24 hours cycle in Unity3d Scene. Where different kind of task will be executed in different Times.

Suppose

at 2pm I have to move a car,
at 6pm An Aeroplane will land on airport
at 07:07pm I have to open the door of Market's Buildings
and so on different task/works execution at different timing.

Now, I have some basic animation e.g., car, Aeroplane and door etc.,. Now I am confuse that how to play and stop my animation according to the time. And time can also be
changed manually using GUI. If currently 6pm (animation working) then user can switch to 8am to view 8am time's animation (or code execution). And User can also fast the timing to view complete hours in a single minutes or in an hour.

I can use if/else in Update Events but I guess this is not the right way to do and will be very difficult if I require to show significant number of works
in different time duration (which means significant number of if/else statements).  Just like below

void Update(){
if(time =1){
//logic
}
if(time =2){
//logic
}
if(time =3){
//logic
}
...//so on, tedious way
...//and also not possible if time require between the hours, suppose 06:06pm
}

What to do ? How to handle this?

sentences:
Non-object-oriented game tutorials I've been tasked with writing an essay extolling the virtues of object oriented programming and creating an accompanying game to demonstrate them.

My initial idea is to find a tutorial for a simple game written in a programming language which does not follow the OOP paradigm (or written in an OOP language but not in an OOP way) and recreate it in an OOP way using either C# or Java (haven't yet decided). This would then allow me to make concrete comparisons between the two.

The game doesn't have to be anything complex; Tetris, Pong, etc. that sort of thing. The problem I've had so far is finding a suitable tutorial, any suggestions?

sentences:
Best approach to 2D racing game AI? I have no experience in AI at all, but I would like to know how I could do this?
Even if the AI just followed a path how could I do this?

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:
Distinguish between HTC Vive controller grip buttons in Unity In Unity, I can check for grip button presses via the SteamVR API like so:

if(controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip)) { ... }

This results in either true or false so I can only check if any grip button was pressed but not specifically which one.

For Unity's Input API the documentation states [1]:

  The grip trigger differs between platforms:

  The HTC Vive controllers each have two grip buttons but both map to
  the same axis. The value for these buttons is 0.0 when not pressed and
  1.0 when pressed (intermediate values between 0.0 and 1.0 are not possible).

Source: https://docs.unity3d.com/Manual/OpenVRControllers.html

In this case it is again not possible to differ between the two grip buttons.

Is there any way in Unity to check which one of the grip buttons of a HTC Vive controller is pressed?

sentences:
How to control jump strength by how long the player presses the jump button? In a platformer game I am working on, I want my character to have controlled jumps. If I simply tap the jump key it will jump a just a little or if I hold it for a time it will jump higher.

What do I need to do?

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:
Unity Loading Scene with player data I have a empty scene, which loads another scene which is loading player data onStart. When the empty scene transition to the loading player scene. A loading bar is created on the empty scene and it shows me 100% and stuck for couple seconds. I've used Debug.Log and i only see is 0-9. Nothing between like 0.20, 0.40 and etc...

I can see on the hierarchy that loading player data scene, is loading while it's stuck on the 100%

Update:
I've made some futher tests, it seems my problem is that loading player data through awake or start. Does not get executed while loading a scene async. How can i load the player data aswell with the progress bar. Since the player data is stored as a file. This is purely because when i open my game, after the unity splash logo. It's a black screen, due to it's loading the player data.

    private IEnumerator LoadSceneProgress(Scene scene)
    {
        AsyncOperation operation = SceneManager.LoadSceneAsync(Tools.TitleCase(scene.ToString()));
        while (!operation.isDone)
        {
            float progress = Mathf.Clamp01(operation.progress / .9f);
            loadingSlider.value = progress;
            loadingSliderText.text = progress * 100 + "%";
            Debug.Log(operation.progress);
            yield return null;
        }
    }

public static bool LoadPlayer(PlayerObject player)
{
    SaveData loadData = LoadFile();
    player.Level = loadData.Level;

    // Load items inventory
    List<Item> itemList = loadData.ItemsInventory;
    if (itemList != null)
    {
        for (int a = 0; a < itemList.Count; a++)
        {
            Item item = itemList[a];
            Item newItem = player.GetInventory.AddItem(new Item(item.Id, item.Amount));
        }
    }
}

private static SaveData LoadFile()
{
    string path = Application.persistentDataPath + "/save.dat";
    SaveData data = null;
    using (FileStream fileStream = File.OpenRead(path))
    {
        data = ZeroFormatterSerializer.Deserialize<SaveData>(fileStream);
    }

    return data;
}

sentences:
Is it bad practice to store inventory and scores in PlayerPrefs? I'm building a mobile game for a client in Unity. To save time, we started with a template game from the Asset Store that had some of the features that the client wants.

The game includes a progression system and shop, so we save the user's scores,  progress, in-game currency, inventory, etc. We currently have no plans to export the save data.

The template game uses PlayerPrefs to store all save data. Is this bad practice? Assuming we don't include a button that calls PlayerPrefs.DeleteAll(), is there any extra risk associated with using PlayerPrefs instead of external files to store the player's data?

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 modify multiples BoxCollider on a same game object? I have an game object with multiples BoxCollider attached to it, is there a way to get all the BoxCollider to an array so that I could modify their value individually ?

sentences:
Finding cubes in frustum Working with an infinite set of cubes, is there a way of detecting which cubes exist within a frustum?

Most frustum culling seems to work along the lines of running through all objects and seeing if they intersect - this is ok with a finite set of objects, or something like Octrees.

I'm currently finding all cubes within the frustum's bounding box - but that's far more than I really need.

I could then test these all against it, but I was wondering if I could skip a step.

sentences:
Sound not playing on Windows XP - SoundEffect or Song: Monogame *Solution:* I have a RealTek ALC888. I solved this (OpenAL) by disabling hardware acceleration on my sound (Control Panel > Sound > Advanced, disable acceleration).

I'm trying to integrate sound into my Monogame game. I don't have the content pipeline hack -- just straight Monogame (Beta 3) at this point.

(I tried adding the content pipeline, but ran into some issues.)

I added a .wav file to my /Content directory, and I can create and instantiate both SoundEffect and Song classes. However, both show durations of 00:00:00 (on a ten-second long file), and neither plays.

I can call LoadContent without any issue. But when I call Play, nothing plays.

I've tried a couple of different sounds, and different formats (MP3 and WAV) to rule that out. Only WAV seems to even load without crashing out, but it doesn't play.

This issue only occurs on Windows XP. I tested it on a Windows 7 laptop, and the sound plays fine.

Edit: I opened a MonoGame issue to track this, and it includes several more details.

sentences:
I need to move an entity to the mouse location after i rightclick Well I've read the related questions-answers but still cant find a way to move my champion to the mouse position after a right-button mouse-click.
I use this code at the top:

float speed = (float)1/3;

And this is in my void Update:

  //check if right mouse button is clicked
        if (mouse.RightButton == ButtonState.Released && previousButtonState == ButtonState.Pressed)
        {
            // gets the position of the mouse in mousePosition
            mousePosition = new Vector2(mouse.X, mouse.Y);

            //gets the current position of champion (the drawRectangle)
            currentChampionPosition = new Vector2(drawRectangle.X, drawRectangle.Y);

            // move champion to mouse position:
            //handles the case when the mouse position is really close to current position
            if (Math.Abs(currentChampionPosition.X - mousePosition.X) <= speed &&
                Math.Abs(currentChampionPosition.Y - mousePosition.Y) <= speed)
            {
                drawRectangle.X = (int)mousePosition.X;
                drawRectangle.Y = (int)mousePosition.Y;
            }
            else if (currentChampionPosition != mousePosition)
            {
                drawRectangle.X += (int)((mousePosition.X - currentChampionPosition.X) * speed);
                drawRectangle.Y += (int)((mousePosition.Y - currentChampionPosition.Y) * speed);
            }
        }
        previousButtonState = mouse.RightButton;

What that code does at the moment is on a click it brings the sprite 1/3 of the distance to the mouse but only once. How do I make it move consistently all the time? It seems I am not updating the sprite at all.

EDIT
I added the Vector2 as Nick said and with speed changed to 50 it should be OK. I tried it with if ButtonState.Pressed and it works while pressing the button. Thanks.
However I wanted it to start moving when single mouse clicked. It should be moving until reaches the mousePosition.

The Edit of Nick's post says to create another Vector2, But I already have the one called mousePosition. Not sure how to use another one.

            //gets a Vector2 direction to move *by Nick Wilson
            Vector2 direction = mousePosition - currentChampionPosition;

            //make the direction vector a unit vector
            direction.Normalize();

            //multiply with speed (number of pixels)
            direction *= speed;

            // move champion to mouse position
            if (currentChampionPosition != mousePosition)
            {
                drawRectangle.X += (int)(direction.X);
                drawRectangle.Y += (int)(direction.Y);
            }
        }
        previousButtonState = mouse.RightButton;

sentences:
Is it normal in skeletal animation to NOT consider the translation component in bone transform matrices? I'm using assimp to load a model, and DirectX11 and DirectX ToolKit to render it.

In the document of DirectXTK's IEffectSkinning, it says:

  As an optimization, SkinnedEffect and DGSLEffect assume that all the
  matrices are affine transformations, and that the final column is (0 0
  0 1). This means that the value of the last column is effectively
  ignored when set into the constant buffer containing the bone
  transformations (i.e. the shaders use float4x3)

Is this the convention when implementing skeletal animation ?

Does it have negative repercussions ? If it does, what are they ?
Do some animated models require the translation components to be considered?

sentences:
Can I use fictional city/country names from public domain/fiction etc. in a potentially monetized browser game? I'm currently developing a browser game with a focus on economy, trading and industry. For that I'm building a fictional world with countries and cities. To avoid political drama within the games player interactions, I'd like to avoid using real countries that currently exist/are recognized. I tried to come up with several fictional country names, but I'm reaching the limitations of my creativity where they are still OK-sounding...
My questions are now...

Can I use fictional countries e.g. from movies/comics etc (e.g. Sokovia from the Marvel universe)? Maybe with slight adjustments?
Can I use older country or empire names (e.g. Babylonia)? Maybe also with slight adjustments.
Can I use city names from the real world? I need a lot of them, so coming up with thousands brings me to my limit and there may probably be overlaps without me knowing. Based on the following question that should be fine, also since they have nothing to do with the real-life equivalents. Do I need licensing to use real city names in my game?
What about using planet or galaxy names which are public domain (or how are they protected, if at all)?

I found some generators in the internet which are helpful to a certain degree, but I'd rather write my own to be honest.
Since the game might be monetized, are there any licensing issues involved? I'm pretty new to this from a legal perspective.

Another thing are the fictional company names the users can choose. I guess I can set certain restrictions there to exclude real world companies and provide a "report" button for real companies to request the removal/change to be on the safe side.

Thanks in advance

PS: Since I also needed flags, I already found a nice generator, in case someone is interested:
https://www.reddit.com/r/vexillology/comments/4ha19q/flagmaker_20/?st=jb6e4qyk&sh=c1544079

sentences: Using IPAD's as controllers for a Unity game We are making a Multiplayer game using Unity. The actual game would be run from a PC projected on a screen and the players would be using their respective Ipad as a controller to play the game. I am not sure how difficult this would be to achieve inside Unity but I am assuming that all the game data inside Unity would need to be fed and retrieved from some kind of a server. How would this be possible with Unity because each Ipad would have a separate Unity build and also a separate build for the PC from where the actual game would be running.

sentences: When trying to render a texture in opengl after including the stb_image.h file in the project i get a linker error Initially i gave the path of the stb_image.h & stb_image.c file location C/C++ include directories as adding the header file directly to the project was not working.

sentences:
Dealing with more complex entities in an ECS architecture Preamble: I'm working on a level editor for my engine, which uses an ECS architecture. I have around a dozen component types so far, mostly dealing with graphics, like lighting components, model, and other mesh related things like skeleton and collider components.

My engine only supports 1 of each component type per entity, and systems can deal with optional components as well.

Today I realized I was uncertain on how I should tie-together the building block components used for basic entities into a more complex one.

For example, let's say I want to make a torch / flaming stick, using the components found in a model entity and a lighting entity.
If the model's origin is in the center of the shaft, then the light and fire would appear at the center of the model.
Further, if I wanted a weird torch with fire on one end of the stick and smoke on the other, they would both need different offsets before rendering.

Do I need to create a system just for torch's, adjusting all the components to fit the model? This doesn't sound like it scales well to different models needing 'decorations'.

Should I instead be creating an attachment component, with its own offset variables? What dictates which components of an entity use the offset? Should I be making attachment types for every component type that could need an offset?
Or rather should most components just have a spatial offset as another parameter the user can control?

Anyone know any commonly used solutions?

sentences:
Estimating costs in a GOAP system I'm currently developing a GOAP system in Java. An explanation of GOAP can be found at http://web.media.mit.edu/~jorkin/goap.html. Essentially, it's using A* to plot between Actions that mutate the world state.

To provide a fair chance for all Actions and Goals to execute, I'm using a heuristic function to estimate the cost of doing something. What is the best way to estimate this cost so that it is comparable to all the other costs?

As an example, estimating the cost of running away from an enemy versus attacking it - how should the cost be calculated to be comparable?

sentences:
iOS: OpenGL ES 2.0 render texture with glScissor performance I have drawn image with OpenGL and will redraw tile of its texture (non filled area).

Which case will work faster?

Set glViewport with full texture's rect, draw full texture and use glScissor with updated area's rect.
Set glViewport with updated area's rect and draw tile of texture with calculating its texture coordinates.

I've found in Apple's documentation, that scissor test is called after fragment shader. Does this mean, that fragment shader will work with pixels of full texture? How slower will it be rendered than case 2?

SOLVED:
I've viewed pipeline scheme of OpenGL ES 2.0 here. Scissor test is done before fragment shading and allow to optimise rendering.

sentences:
Can adversarial agents flip coins? I was thinking about peer-to-peer games by considering a simple coin tossing game.

  You open up your version of P2PCoinFlipping Beta 2.3 and it displays a
  list of player name servers. After choosing the closest server a
  scoreboard of the luckiest players appears. You choose the highest
  ranking player and the game begins. Since you started the battle the opposing player
  chooses the coin side, heads, and you are assigned tails.
  A nice little graphic appears displaying a tumbling coin eventually landing on heads.
  Too bad, you lose.

But how do you know the outcome is fair?

If the outcome is chosen on your computer you can edit the program to choose to win and the same applies to the opponent. The game isn't deterministic so you can't seem to validate the outcome.

Is it possible to have multiple independent adversarial agents agree on a non deterministic event?

sentences: Feasibility of nested voxels Out of curiosity, does anyone know how feasible it would be to have a voxel engine that allowed for voxels within other voxels? For example, you would have the usual chunks filled with voxels, but instead of stopping there each voxel could become a chunk of it's own to store more, smaller voxels. The first use case that comes to mind would be for showing damage to voxels, but there could be others, such as smoother terrain. Thoughts?

sentences:
How can I reproduce the physics that we can see in Dawn of Titans? I'm working on a hobby RTS project and I want to implement collision physics between soldiers like in the mobile game Dawn of Titans.

Here is a video reference https://youtu.be/Fnpot2NeJl8?t=341

How can I achieve this?

sentences:
Event type and SDL_QUIT are incompatible I'm following the Lazy Foo SDL2 tutorials, and I've run into a problem when trying to poll for events. While I'm polling for the events, the event type and SDL_QUIT throw an error saying the operand types are incompatible when trying to see if they're equal.
SDL_Event e;

while (!quit)
{
    // Handle vents on queue
    while (SDL_PollEvent(&e) > 0)
    {
        // User requests quit
        if (e.type == SDL_Quit)
        {
            quit = true;
        }
    }
}

I double-checked and everything is linked correctly, and I've tried other scenarios and it always says the same thing. Does anyone have any ideas about what could be going wrong?

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:
Problem with Rotation clamping in Unity I'm trying to get a simple cannon to rotate to point at the mouse, but I only want it to follow the mouse for 180 degrees and then stop following the mouse, and pick up again when the player re-enters the 180-degree area.
I got the cannon to follow the user's mouse but when I tried to camp it to the 180-degree area I found it worked for one side, but when I went to the other it "teleported" to the other side.

I video to explain my issue: https://imgur.com/a/DZYA305
Sorry about the crude graphics, frame rate, and the software doesn't show my mouse making things more difficult, but as you can see, the clamp works fine when I move my mouse to the right, but when I move it to the left it "teleports" or instantly moves to teh right no matter where my mouse is.

Here is my code:

public int rotationOffset = -90;

    // Update is called once per frame
    void Update()
    {
        var mouse = Input.mousePosition;
        var screenPoint = Camera.main.WorldToScreenPoint(transform.localPosition);
        var offset = new Vector2(mouse.x - screenPoint.x, mouse.y - screenPoint.y);
        var angle = Mathf.Atan2(offset.y, offset.x) * Mathf.Rad2Deg;
        float finalRotation = angle + rotationOffset;

        // I have tried both the normal Mathf.Clamp and the if statments below and I get the exact same result.
        //finalRotation = Mathf.Clamp(180, 0, finalRotation);

        if (finalRotation >= 89f)
        {
            finalRotation = 89f;
            Debug.Log("Left");
        }

        else if(finalRotation <= -89f)
        {
            finalRotation = -89f;
            Debug.Log("Right");
        }

        transform.rotation = Quaternion.Euler(0, 0, finalRotation);

    }

I don't know if this might be a bug in Unity, But I've spent days trying to fix it, I'm tired, I'm stressed, I don't know how to fix it.

sentences:
class diagrams / design for an adventure game (rooms, objects, inventory)? Any links to existing design (e.g. class diagrams, database ER diagrams) for a basic adventure game - i.e. that has the aspects of:

rooms/locations (which you move between)
objects which you collect / use (which may have behaviours)
inventory (i.e. items which you carry)
rules (e.g. if you to want to open Door X, then you need Key Y)

sentences: Draw cube in glsl shader I am working on a voxel engine. Currently my cubes are rendered as vbos. I thought, it may be better to load only the cooridinates of voxels to the shader and make it draw a cube itself. Can someone tell me, if thats possible, and if so, how?

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:
ANDEngine : 3d rotation in Particle System Im using ANDEngine and wants to create confetti particle system.

But im unable to make flipping and rotation of confetti particle around z-axis
Since andengine is 2d engine, it doesnot support that.

However like in the following example , 3d rotation has been implemented for a single sprite:

http://code.google.com/p/andengineexamples/source/browse/src/org/anddev/andengine/examples/Rotation3DExample.java

I want to do this for the particles.
Am i missing something ? or do i hv to modify the particle system code.

sentences:
Are there any guidelines/articles/tutorials for creating a network protocol for games? I am currently developing a little 2D sandbox game with multiplayer functionality in XNA 4.0 and the latest lidgren-lib for networking.

I found myself quickly at a point where sending a players position to the server and broadcasting the position of all players to the connected clients isn't enough anymore. So I started to make up a protocol for the game.

I haven't done this before, so I'm wondering weather there're any guidelines/tutorials/articles which guide one through this process. A good starting point for me was the protocol of Minecraft, but this isn't a guide or something but rather a well example which I can adopt at some points.

So, are there any guidelines/articles/tutorials for creating a network protocol for games?

sentences:
Why is my render engine only rendering one frame? Just for background, I'm designing a soft engine in C# using the SharpDX DirectX wrapper library. I've gotten around to implementing the render engine, and I can render a texture to a face, except it only renders exactly one frame. It renders a triangle once, but on the next draw call, the screen is cleared. Even though I've made sure the render call is still firing every frame, the rendered item goes away, and does not get re-drawn in the next or any subsequent frame.

I think it has something to do with the way I initialize my resources; to minimize shader switching and boost performance, I have my render engine hold a set of pre-defined shader classes. Then, only when it is necessary will the shader access the device context and set the vertex, constant, index, etc. buffers one time when the method Shader.SetActive() is called. When the shader needs to render something, it can write directly to the buffers that have been created and set in the Shader.SetActive() method, using a method called UpdateShader().

Here's the source for SetActive():

public override void SetActive(D3D11.Device device, D3D11.DeviceContext context)
{
    /*========================== Set Pointers to GPU Buffers ==========================*/
    // write Matrix data first to constant buffer
    matrixBuffer = new D3D11.Buffer(device, matrixBufferDesc);
    vertexBuffer = new D3D11.Buffer(device, vertexBufferDesc);
    indexBuffer = new D3D11.Buffer(device, indexBufferDesc);

    context.InputAssembler.SetVertexBuffers(0, new D3D11.VertexBufferBinding(vertexBuffer,
    Utilities.SizeOf<VertexPositionTexture>(), 0));
    context.InputAssembler.SetIndexBuffer(indexBuffer, Format.R32_UInt, 0);
    context.VertexShader.SetConstantBuffer(matrixBufferPos, matrixBuffer);
    context.PixelShader.SetShaderResource(0, shaderTexture);

    context.InputAssembler.InputLayout = inputLayout;

    /*========================== set context shaders ==========================*/
    context.VertexShader.Set(vertexShader);
    context.PixelShader.Set(pixelShader);
    context.PixelShader.SetSampler(0, samplerState);

    context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
}

Here's the code for UpdateShader():

public void UpdateShader(D3D11.Device device, D3D11.DeviceContext context,
    Matrix worldViewProj, VertexPositionTexture[] vpts, int[] indices)
{
    DataStream mappedResource;

    //write to buffers
    context.MapSubresource(matrixBuffer, D3D11.MapMode.WriteDiscard, D3D11.MapFlags.None,
        out mappedResource);
    mappedResource.Write(worldViewProj);
    context.UnmapSubresource(matrixBuffer, 0);

    context.MapSubresource(vertexBuffer, D3D11.MapMode.WriteDiscard, D3D11.MapFlags.None,
        out mappedResource);
    mappedResource.WriteRange(vpts);
    context.UnmapSubresource(vertexBuffer, 0);

    context.MapSubresource(indexBuffer, D3D11.MapMode.WriteDiscard, D3D11.MapFlags.None,
        out mappedResource);
    mappedResource.WriteRange(indices);
    context.UnmapSubresource(indexBuffer, 0);

    context.DrawIndexed(indices.Length, 0, 0);
}

I think something that happens once in the SetActive() method should need to actually happen multiple times, and should be moved to the UpdateShader() method, but for the life of me I can't figure out what it is, or even if my reasoning is the correct.

Why is my render engine only rendering one frame?

sentences:
What is "game state?" The terminology "game state" is a bit vague to me. Could anybody clarify what is included in the game state, please?

Is it a state of all the variables and objects within the game at particular moment?

sentences: What are the advantages and disadvantages of different grids in a turn-based strategy-game? The two most common types are using hexagons and squares. My question is rather concerned with game design. Why are specifically those two found so often? What are disadvantages that speak against using other polygons such as triangles, pentagons or octagons?

sentences:
Splitting into files - how much splitting? If I say I have a hierarchal entity framework, rather than a component model. Something like:
(Yes, this is made up)

Weapon->Gun->AutomaticGun->MP44
Or, more of a classical example:
Entity->MovableEntity->Enemy->WalkingEnemy

How far would you split up the source/header files for readability and organization? Is it best to go something like Entity.cpp, MovableEntity.cpp, Enemy.cpp, etc. or would an approach like Entity.cpp [containing Entity and MovableEntity] and Enemy.cpp [containing Enemy and WalkingEnemy] be better?  (Or in a more language agnostic way, an Enemy file and an Entity file vs a file for each class?)
Also, would this affect anything other than readability and organization?

sentences:
Observer Pattern Implementation To teach myself basic game programming, I am going to program a clone of Pong. I will use the Observer design pattern, with an interface between the input and the game engine. However, I'm not sure what the interface should do. One idea I had was for the input interface to tell the game engine that (e.g.) the screen was clicked, then to let the game engine decide what to do with that information (shoot a bullet, for example). Another idea I had was for the input interface, having caught the mouse click, to tell the game engine to shoot a bullet.

Which method would be better for me to use?

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:
How to properly generate walls simulating perspective around stone in a cave-like level made of squares? Long story short. My levels tiles currently look like this:

And i want them to look like this:

My levels are designed as 400x400 squares of proceduraly generated 0's and 1's, 0 representing dirt(walkable by player), 1 represeting stone(impenetrable).
Game itself looks a lot like this.
At first, my method was to run another loop - after generating the world that replaced stone tiles, depending on directions of empty tiles were, with wall. The method doesn't work so bad up to the point where there are 1 wide walls sticking out, which are impossible for it to convert, check picture:

As you can see, in my method, the wall is an another texture, taking one tile itself.
I can't replace air with walls, as that could possibly obstruct a passage. It basically fails every time there are 3 or more dirt tiles directly next to it.
This is the place at which i wondered if i chose the right method or if i should change the whole design for the walls, if so - to what? Should i create some textures for the 1-wides alone? Or maybe i shouldn't generate 1-wides at all? How do games generally deal with this?
I've looked for the answer to my problem, and haven't found it. Probably because it's hard for me to word it(sorry for messy post).

sentences:
How can I ungrab the grabbed Object in Unity? I modified a grab Script to my purpose, I can grab the Object and make it a parent to the character with the Key "G" but I want to let it go and detach the parent of the picked Object with "H" with the Code: "hit.transform.parent = null;" but i cant get it to work, I dont know where to put it.

Code:

[SerializeField]
private Transform RayCastGrab;
[SerializeField]
private float raySize;
private Transform pickUpObj;
private Vector3 lastPos;

public LayerMask GrabLayer;

void Update ()
{
    PickRayLayer();
}

void PickRayLayer()
{
    Ray rayF = new Ray (RayCastGrab.position, transform.forward);
    Debug.DrawRay(rayF.origin, rayF.direction * raySize, Color.black);

    RaycastHit hit;

    if(Input.GetKey (KeyCode.G))
    {

        if (Physics.Raycast(rayF, out hit, 2f, GrabLayer))
        {
            //Picking up the Object and make it a parent of Player
            pickUpObj = hit.transform;
            hit.transform.parent = this.transform;
        }
    }

    if(Input.GetKey (KeyCode.H))
    {
        //Should let the grabbed Object go and detach it from parent of Player
        if(pickUpObj)
            pickUpObj = null;
        transform.parent = null;
    }

    if(pickUpObj)
    {
        pickUpObj.transform.position += transform.position - lastPos;
    }

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:
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:
Entity System handle graphics/textures I use in Java Artemis(entity system library) and Slick2D(graphics library) for a game.
Now I wonder me, how I should handle graphics(sprites, textures...).
In the demos of the page from Artemis it was made so:

SourceCode

I hope the diagram is good enough.
So someone asks now "Whats the problem ?":
The Problem is, that this method is not very efficient and it feels not very good, because:

The spatial forms are created and initialized at run time
The spatial forms are created individually for every entity(Load
textures or create a shape...)

I think there a better ways, so I hope someone have a better idea.
And if someone have the idea to make simply a sprite or a texture component, that's not a solution, because some entities have for example more textures than one.

And a supplementary question, how I should handle animated graphics ?

Thanks for reading :) and sorry for my bad English :(

sentences:
how to guarantee the order of response in a service-oriented mmo server cluster i'm working on a mmo server these days. it's a service-oriented architecture, every service is one process which processes a specific type of request, and i have inventory service, battle service, etc.
  when received a request from client, the request will be dispatched to some corresponding service, based on the request type.
  let's assume we received two requests from one client in the cluster-side request message queue, first request1 and then request2, then the two requests will be dispatched to service1 and service2. so request2 may be handled first and the client will receive response2 first and then response1, which will not be what the client expect.
  so i'm wondering how to guarantee that response will go back in the same order request come?

sentences:
clip space, normalized device coordinate space and window space in OpenGL I am learning OpenGL. Clip space, normalized device coordinate space and window space are confusing. I searched but still don't understand them clearly.
So, the question is- what are differences between them and how are they converted from one to another? And what coordinate do the built-in OpenGL functions (e.g.: glBufferData) take as input?

sentences: Unity3D : Where to put external files? I want my game to be user-translated friendly.I put .text file to Data folder from where strings will be read. What is Editor alternative for data folder ? Also i know compiler ignore some files, how i can tell compiler to include this one ? thanks.

sentences:
How do I create a big multiplayer world in UDK? I want to create a big multiplayer world in UDK and I'm having a few difficulties.

I created the biggest terrain possible but then any terrain related action I do takes forever. However, I've seen videos of people make same size terrain and working without a problem. My pc is strong enough, so maybe someone can tell me what I'm doing wrong.
I want to make it even bigger then the biggest terrain size, so I was thinking of doing level streaming but then I read that streaming is working server side which means if I have a player on every terrain all terrains will still be loaded and I want to save as much memory possible so it will work well online.

Thanks for any help you can give.

sentences:
Appropriate MMORPG battle system for Android-oriented MMORPG? I need a tip for a game I'm making. Because of many issues I want to make a 2D mmorpg:

A 2D game is easier to code (I'm using ActionScript3 / Starling).
I can more likely find preexistent graphics, and handling them is easier.
Fundamentally: I don't want to eat the device's memory!! Common devices here have at most 1GB RAM memory.

But when I think about battle systems, I imagine stuff like Argentum Online and Tibia. Those battle systems were OK on mouse-keyboard based systems. AO's battle system will be really hard to use (specially by any spellcaster class) in devices like Samsung S3 mini.

OTOH when I think in systems like Pokemon or Golden Sun, both of them being turn-based,  I ask myself about the interation: battles would be locked (they have a protocol, you cannot suddenly leave a fight, you can take as long as you want in each turn,...) which is not acceptable in a mmorpg for many reason (mmorpg users do not expect a protocol, they expect to leave a fight as they'd like, they would HATE users who suddenly go AFK on the middle of a battle without having opportunity to act).

What battle interaction would be a good balance between mobile-device-friendliness and not being a pain in the ass for game dynamics? Suggestions are accepted here (we cannot expect game design have absolute decisions at all).

sentences:
Shall we create our game engine in this case? Although my friend and I are not interested in game development, we like creating tools. We would really like to give life to our own game engine, however, we don't want to put effort into something useless. Develop something what can be used by smaller or "medium-sized" companies. It's not about the most modern graphics and technologies. Something like WoW's engine 10 years ago or GTA III's would be a dream.

So, is it possible that 2 (assuming) experienced programmers can create something like that?

sentences:
Pokemon Artificial Intelligence I'm working on a thesis about programming an AI combat system for Pokemon (To be implemented in Showdown!). However, I would like to include historical information about the existing implementations of Pokemon AI. This information would offer valuable context to my thesis.

I have been scouring the internet for some sort of algorithm that explains how the AI Trainers make their choices, but have found nothing promising. I realize the fan-games have implemented some more interesting AI systems for their trainers, these would be interesting to see as well.

What I am looking for is examples of the methods used for Pokemon Battle AI decision making used in Pokemon videogames, whether from main series by Nintendo or the many fan-games out there. I realize most of these pose no challenge to an experienced player, but I don't mind, I only wish to compile historical information on previous Pokemon AI attempts.

sentences:
Texture coordinate discontinuity with mipmaps creates seams I just started learning openGL and I am getting this artifact when texturing a sphere with mipmaps. Basically when the fragment samples the edge of my texture, it detects the discontinuity (say from 1 to 0) and picks the smallest mipmap, which creates this ugly seam:

ugly seam http://cdn.imghack.se/images/6bbe0ad0173cac003cd5dddc94bd43c7.png

So I tried to manually override the gradients using textureGrad:

//fragVert is the original vertex from the vertex shader
vec2 ll = vec2((atan(fragVert.y, fragVert.x) / 3.1415926 + 1.0) * 0.5, (asin(fragVert.z) / 3.1415926 + 0.5));
vec2 ll2 = ll;
if (ll.x < 0.01 || ll.x > 0.99)
    ll2.x = .5;
vec4 surfaceColor = textureGrad(material.tex, ll, dFdx(ll2), dFdy(ll2));

Now I get two seams instead of one. How can I get rid of them? And why does the code above generate 2 seams?

2 eams http://cdn.imghack.se/images/44a38ef13cc2cdd801967c9223fdd2d3.png

You can't tell from the two images but the 2 seams are on either side of the original seam.

sentences:
Are prefabs the only way to dynamically build a world in Unity? I'm trying to understand how to setup my Unity prefabs and scripts to dynamically spawn a series of "encounters", with each encounter containing several GameObjects.

For example, imagine spawning the next several portions of an infinite-runner level. One encounter is a ramp, the other encounter is a pit with some coins.

This is what I am currently doing:

A global SceneManager script has a handle to an EncounterFactory prefab. When needed, the SceneManager will begin constructing the game world.
The EncounterFactory prefab contains a script that has a method SpawnRandomEncounter. The EncounterFactory also contains handles to several other prefabs for the objects that can be found in an encounter.
The SpawnRandomEncounter method uses the prefabs linked to EncounterFactory and builds the expected GameObjects.

So when building out a new "encounter", the SceneManager clones the EncounterFactory (which serves as the parent object for the full encounter), and then calls SpawnRandomEncounter to build out the child objects.

This seems suboptimal. First, I need to have myriad prefabs for each thing that could be spawned. It also requires a meta-prefab to EncounterFactory. That is, a prefab who just allows me to spawn other prefabs.

Is there a better way to dynamically build out a game world or level in Unity? Or is it prefabs upon prefabs upon prefabs?

For example, I'm aware that I can find an existing object by name. (e.g. find EncounterTemplate5 and clone that.) However, that requires that EncounterTemplate5 exist in the game world. (So it can be cloned.)

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:
Having the player face themselves after the mid-game I am writing a game, in the vein of a jRPG, in which you begin playing as the main villain. You don't know it. You think you are playing the hero and the more successful you are and the stronger you make them the harder they will be to defeat at the very end of the game.

My main concern is anyone who puts in a significant effort early game could feel punished for it. It is also troublesome if the player finds the challenge of the final boss insurmountable because of actions from very early in the game. Is there a way I can signal early on in the second act that if they over-powered the villain it may haunt them? And there is also the possibility the twist will get out and people will just game it from the beginning. It is my intent to get some replay value out of it by having people do multiple runs based on different villain playthroughs. But is it a distraction if everyone learns the twist. Or conversely is it better if I reveal it myself in-game so everyone knows what they are working at from the start?

How do I make my potentially disengaging design hold up without turning people away?

sentences:
Is there an algorithm to construct lines (sets of grid points which are all connected) from an unsorted set of grid points? I have a 2d square grid used for pathfinding that I wish to convert into a navigation mesh.  My idea is to pluck out all of the nodes that are on the edge of walkable space, simplify the amount of data with a line reduction algorithm, then triangulate the set of points.  I am stuck at the simplifying step.

To find edge nodes I use a marching squares algorithm.  The downside to using marching squares is that the points are unsorted, and in order to pass the points into the Ramer-Douglas-Peucker algorithm they need to be sorted by connectivity (and separated into individual lines).  I'm looking for an algorithm that can either sort my collection by connectivity or discover edge nodes in a consecutive manner.

I'm trying out Djikstra search to find a path from one point to the next.  To determine if these points are connected, during path reconstruction if the parent point has a Euclidean distance greater than 1 to the current point then they are not directly connected.  I might be able to get this to work but it is proving to be extremely slow.

Here are screenshots of the graph I am working with:

2d pathfinding grid:

unsorted edge nodes discovered via marching squares:

sentences:
How do I set meshCollider.cookingOptions to MeshColliderCookingOptions.Everything in code? I'm procedurally generating some meshes for a project, and I need to add colliders to them. The meshes are generating fine, but after setting the shared mesh in the mesh collider, I need to be able to set the cookingOptions to Everything. In the inspector, I can do this fine and the colliders work correctly. Since I am generating these at runtime, I can't really do this after making a build. How do I go about doing this?

Works Correctly:

Does not Work Correctly:

sentences:
Whats an elegant implementation for 2D collision detection in a block based game? to make things clear, i do not want to know HOW to implement collision detection mathematically. What i am looking for is an elegant way to check for collisions without having to manage seperate lists of objects, maybe for example implementing a ICollidable interface.

currently i have a simple gameloop

while(runGame){ handleInput(); update(); render(); }

So there are two possibilities which come straight to my mind. First, ill add an extra call to a method or class handling collisions.

while(runGame){ handleInput(); update(); checkCollisions(); render(); }

Second, every gameobject gets a list of nearby other objects in its update method. so it can do the collision on its own

while(runGame){ handleInput(); update(otherNearShapes); render(); }

i dont like both of these for two reasons.

in the first, i have to manage a seperate list of objects which implement an ICollidable interface.

in the second, the update method handles more logic than it should in my opinion.

so, is there an elegant way of integrating collision detection in my game (loop)? searching the net always only results in how to calculate stuff, but thats not what i want to know.

sentences:
Is it more efficient to transform vertices on the CPU or the GPU? Working on optimizing the rendering core of my game engine and I have a couple of questions.

Is it more efficient to transform vertices to world space on the CPU before you send then stream to the GPU, or is it better to do this on the GPU?  If done on the GPU this means I have to send the world matrix to the GPU for every different mesh however the GPU is highly optimized to deal with these calculations.  It seems to me that doing it on the CPU would save some time, however, because I can transform the vertices and send over world positions all at one time.

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:
Listen for asset modification in editor I would like to listen for an event that some asset (prefab, precisely) has been modified. To my surprise, there's no such event in AssetModificationProcessor.

Is there any way to do this in Unity?

sentences:
Is there a common invitees/players ratio during closed beta? The question itself is fairly straight forward, but the answer takes a lot of industry insight.

To give an example scenario, I am playing a game that's in closed beta right now. They have about 5000 people invited and the game is only open from Fridays to Mondays. On average there are only about 200-400 players online at any given time, across EU and US. For a closed beta, this looks like a bit of a low turn-over if you ask me.

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:
How can i loop over all the childs of childs? In top of script i added:

public Transform parentToSearch;

Then:

private void OnGUI()
    {
        if (hasDescription == true && clickForDescription == true)
        {
            foreach (Transform child in parentToSearch)
            {
                if (child.GetComponent<ItemInformation>() != null)
                {
                    ItemInformation iteminformation = child.GetComponent<ItemInformation>();
                    if (child.name == objectHit)
                    {
                        var centeredStyle = GUI.skin.GetStyle("Label");
                        centeredStyle.alignment = TextAnchor.UpperCenter;
                        GUI.Label(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 25, 100, 50), iteminformation.description, centeredStyle);
                    }
                }
            }
        }
    }

But when i make the loop:

foreach (Transform child in parentToSearch)

It will find the first level childs of the first parent but this childs have also childs and so on. And i want to loop all the childs and childs of childs under the Transform.

For example in the Hierarchy i have:

Test

Test1
Test2
Test3

Test31
Test32

Test4
Test5

Test51

So now it will loop only over Test 1,2,3,4,5 but I want also to loop over Test31,Test32,Test51

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:
Design of a camera system Thinking about a common game, doesn't matter the type of the game, it's very likely that we need some camera type. For example:

Debug camera: controlled by keyboard and mouse, with that we are able to move around in any place of our scene.
Scripted camera: with that we can instruct the camera to move around, following a determinate path.
Player camera.
...

Each of these camera types has its own update function.
The easiest (and bad) system,is to have a camera manager class with a generic update function and specialized update functions for every camera type. Inside the generic update function we have a switch statement that, based on the camera type, calls the proper update function.

Instead of this I've thought to another approach: strategy pattern. We move each camera behavior (update method) in an appropriate class that implements a common interface. In the camera manager we have a member to that interface, and we can set dinamically any behavior we want.

What do you think about that? What other systems do you suggest me?
Thanks.

Additional info: there is the are real possibility that I need more than one camera active, for example for reflections. In short, I must take account also of that.

sentences:
Duplicate packets and termination of packets in multiplayer game I'm making a multiplayer game (lazertag) with real hardware.

After hours of research, I'm choosing the UDP instead of the TCP protocol to exchange data.

Because of how unreliable UDP is and because players want speed, I decided to have everything in the game that transmits data to transmit the same data more than once.

Due to my hardware limitations (AT89S52 microcontroller with HM-TRP radio modem set to 56kbps) and features I want in the game, I feel the maximum number of duplicate packets I should send out (along with the original) is 2 or 3 total.

Also, I have it setup where the receiver sets a flag if it receives an entire packet so it doesn't receive any more duplicate packets.

Currently, I have it where the server deliberately pauses between sending uninterrupted sets of duplicate packets. This pause indicates to the clients that a timeout occurred and that the next data that arrives is not part of the duplicate set.

Based on how I'm separating duplicate data, I find the method a bit slow because I have one global timer available to me. If I set the clock too small then the system basically freezes since there will be no time for other tasks to execute. Yes I'm literally time-slicing. If I set the clock too high, then the player could stall for a long time if he is disconnected from the network.

I thought of designating a special byte in the packet to indicate end of duplicate data but that probably won't work because chances are, that data won't be processed by the recipient (because he didn't receive it).

Is there any other way a player's hardware can efficiently know when duplicate packets are finished being sent instead of depending on a long timeout and letting the time run out?

Also, How many duplicate UDP packets would be necessary on a slowish connection (think high-speed dial-up internet) in order for the destination to receive at least one of the duplicates?

sentences:
there is a BLOB standard to store images in memory? I would like to abstract all the images in memory, to do so i would like to have just 1 format of reference without talking about the usual file formats for the filesystem like JPG, TGA, and so on.

I hear about BLOB in RGBA format but i don't get what is this format, RGBA for me is just a way to abstract color reproduction not a way to serialize image in memory. This also can be the case where one word "RGBA" is used for defining a more general concept and approach.

The possible explanation for me is that a BLOB in RGBA is just a matrix of pixels, but how is formed and what is the order that i'm supposed to use for reading them ? Technology like OpenGL can directly manage this BLOB ?

sentences:
Why doesn't glBindVertexArray work in this case? From my understanding of what glBindVertexArray does and how it works, the following code should work fine:

First init:

    glGenVertexArraysOES(1, &_vertexArray);
    glBindVertexArrayOES(_vertexArray);

    glGenBuffers(1, &_buffer);
    glBindBuffer(GL_ARRAY_BUFFER, _buffer);
    glBufferData(GL_ARRAY_BUFFER, kMaxDrawingVerticesCount*sizeof(GLKVector3), NULL, GL_DYNAMIC_DRAW);

    glGenBuffers(1, &_indexBuffer);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, kMaxDrawingVerticesCount*1.5*sizeof(GLuint), NULL, GL_DYNAMIC_DRAW);

    glEnableVertexAttribArray(GLKVertexAttribPosition);
    glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, sizeof(GLKVector3), BUFFER_OFFSET(0));

    glBindVertexArrayOES(0);

And later add new geometry:

glBindVertexArrayOES(_vertexArray);
glBufferSubData(GL_ARRAY_BUFFER, 0, (GLintptr)_data.vertices.length, _data.vertices.bytes);
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, (GLintptr)_data.indices.length, _data.indices.bytes);
glBindVertexArrayOES(0);

However, it doesn't work (there is screen output, but it looks like the buffers were changed between each other). Binding the vertex array is not enough for the vertex/indices buffer to get bound? Because, if I do this:

glBindVertexArrayOES(_vertexArray);
glBindBuffer(GL_ARRAY_BUFFER, _buffer); <-- note this line
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer); <-- note this line

glBufferSubData(GL_ARRAY_BUFFER, 0, (GLintptr)_data.vertices.length, _data.vertices.bytes);
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, (GLintptr)_data.indices.length, _data.indices.bytes);
glBindVertexArrayOES(0);

Everything works/looks as expected. I find it strange, since the vertex array should have taken care of the buffer binding. Otherwise, what's the purpose to have a vertex array if you still have to bind all the buffers?

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:
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: Tab between input fields I am new to working with Unity3d, I need to navigate between several inputField, for this I have looked at the solution that is in: tab-between-input-fields, but always the FindSelectableOnUp() or FindSelectableOnDown() returns null, so my next is always null and always ends in: next = Selectable.allSelectables[0];

sentences:
Touch pad controls not working in apk, working from Unity Remote I've come across something unusual with my HTC One M8, I'm not sure if it's phone specific, a bug in unity, or just poor setup on my part.

I've been using Unity Remote 4 to test in realtime, and it's really quite awesome. Don't think I've ever seen something quite so efficient for testing short of .NET and Windows Phone (and even then it's bloody close!)

Anywho, when in Unity Remote, obviously it's not an APK that's running but something that's running in some sort of virtual machine style environment, whereby the code is executed directly with massive links via USB. I tried, yesterday, to install my application as an apk, and for some reason the on screen controls didn't work. The boxes for them didn't appear (there is a dashed line around each control "area", and tapping and swiping simply did nothing.

I'm curious if this is because I've set the controls up as a "debug only" option, so I tried a debug build and still nothing. I tried a few other things like checking all the settings I could find to ensure nothing suggested that they were debug only, with no luck. Not sure where to turn.

If it helps at all, I'm using the "sample pack" (from the default assets) for mobile development, with a sprite as my "player", configured as a 2d sprite in a 2d side scroller game. I'm about to try it with the absolute default settings, literally just as a test, but I'm pretty confident that it won't make a blind difference.

sentences:
render/draw or input first? When creating the main game loop, what order should things generally happen? IE, should i be getting input, doing logic and then rendering, or something else? does this even matter? when i was coding with python and pygame the tutorial i was using pointed me towards the aforementioned method. however, A tutorial for LWJGL2 (http://thecodinguniverse.com/lwjgl-window/) does it like this:

while (!Display.isCloseRequested()) {
// While no attempt to close the display is made..
// Put render code here.
// Put input handling code here.
Display.update();
// Refresh the display and poll input.
Display.sync(60);
// Wait until 16.67 milliseconds have passed. (Maintain 60 frames-per-second)

and (so far) doesn't seem to have hinted at logic (though i assume it will later on, and looks like it might put it last)

so which should i be using? does it matter at all?
i'm using LWJGL2.

sentences: Unity: stop/play only background music I have a music sound clip simply drag-n-dropped to my hierarchy. I also have other sound effects in my game. I want to pause/play background music on button press but only music, not all sound effects. How can I reach this music GameObject in C# code?

sentences:
How to become a Ph.D. in video game design? The title says it all, I am wondering if it is possible and if so, how it would be possible, to become a Ph.D. in video game design. I'm quite sure you can become a Ph.D. in pretty much anything, but since video games are such an informal and relatively young sector, I thought I'd ask.

Thanks in advance!

sentences:
Smooth transitions between 2d animations I am writing a 2d game (in libGDX, but I think that doesn't matter too much). In that game I want to have smooth transitions between animations. For example, let's think of a guy walking around. Now that guy is hit by something (a bullet for example) and dies. So I want to play the death animation for this guy now.

The problem: I cannot simply exchange the walking animation by the death animation, because the guy's current walking animation frame is not necessarily the same as the first frame of the death animation. So for the player that would look as if the animation "jumps" from walking to death.

So my question is: what is the "typical" way to achieve a nice and smooth transition from animation to another, in general?

sentences: Changing render target within an effect I've got an effect which is a fairly simple two-pass deal- but it involves rendering to a texture in the first pass. Is it possible to change the render target from within an effect? I would definitely appreciate the reduction in code duplication from C++ by being able to do both passes within HLSL.

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:
Offsetting ground texture doesn't work in WebGL so I've created a 2D sidescroller game, the technique I used is to keep the player on the same place, and move the obstacles towards him. I also offset the ground and backdrop constantly to create the illusion of player moving.

The ground texture is on a quad, and the texture wrap mode is set to repeat.
In the editor everything is running fine as I wanted, however when I build it (WebGL), in the browser the ground doesn't seem as if it is set to Repeat but rather Clamp.
Here's how it looks:

You can see from the left part of the image the ground doesn't repeat, the strange thing is that, after the game runs for a few more seconds it fixes, and then in a few seconds becomes like that again.

heres the code attached to the ground to keep it offsetting constantly:

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

public class Offset : MonoBehaviour {

public float scrollSpeed;
public Material mat;

private float offset;

// Use this for initialization
void Start () {
    mat = GetComponent<Renderer>().material;
}

// Update is called once per frame
void Update () {
    offset = Mathf.Repeat(Time.time * scrollSpeed, 1);
    mat.mainTextureOffset = new Vector2(offset, mat.mainTextureOffset.y);
}
}

What may I be doing wrong, and how can I fix it?

Thanks in advance!

sentences:
glDeleteBuffers causing other objects not to draw I have few objects in scene and they exist until I turn off the application. Their calls for glDeleteBuffers are in destructor. Since I don't delete anything in the middle of the game everything is fine.
But now I created one helper function for drawing lines with following body:

void DrawLine(glm::vec3 p1, glm::vec3 p2, glm::vec4 color)
{
    GLuint vao, vbo;

    glm::vec3 data[2] = { p1, p2 };

    glGenBuffers(1, &vbo);
    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glBufferData(GL_ARRAY_BUFFER, 2 * sizeof(glm::vec3) * 2, data, GL_STATIC_DRAW);

    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);

    glEnableVertexAttribArray(0);

    glBindVertexArray(vao);

    SimpleShader.SetAttribute("World", glm::mat4x4());
    SimpleShader.SetAttribute("UseStaticColor", true);
    SimpleShader.SetAttribute("UseLighting", false);
    SimpleShader.SetAttribute("StaticColor", color);
    glDrawArrays(GL_LINES, 0, 2);
    SimpleShader.SetAttribute("UseStaticColor", false);
    SimpleShader.SetAttribute("UseLighting", true);

    glDeleteBuffers(1, &vbo);
    glDeleteBuffers(1, &vao);
}

But as soon as glDeleteBuffers is called nothing is drawing anymore. If I comment those two lines everything is fine (except a bunch of unreleased object names of course).

Anyone know why is this happening?

sentences:
Modify texture of sepcific area of Terrain in unity I am developing a farming simulator 3D game in unity. I have a crop field on terrain which is actually a texture paint in square to show a crop area, and i have to perform sowing (prepare field for seeding) in which process as tractor pass on that texture part its texture from plain soil which i had applied on it should change to more darker and rough texture. I have a idea to get that specific texture part from terrain data but i do not understand how to modify that specific area's texture at run time (through code). Any help would be helpful.
Thanks in advance.

sentences:
How do I properly use multithreading with Nvidia PhysX? I'm having a multithreading problem with Nvidia PhysX.
the SDK requires that you call Simulate() (starts computing new physics positions within a new thread) and FetchResults() (waits 'till the physics computations are done). Inbetween Simulate() and FetchResults() you may not "compute new physics".

It is proposed (in a sample) that we create a game loop as such:

Logic (you may calculate physics here and other stuff)
Render + Simulate() at start of Render call and FetchResults at end of Render() call

However, this has given me various little errors that stack up: since you actually render the scene that was computed in the previous iteration in the game loop.

Does anyone have a solution to this?

sentences: Unity: How many Raycasts per Sphere Collider? I understand that a simple sphere collider in Unity is a raycast in all directions with a certain length. How many Raycast events does a sphere collider trigger? At what degree increments are the rays cast?

sentences: OpenGL 2.0 Android Scrolling Horizontally and Vertically I am new to OpenGL2.0 in Android. How can I scroll the GLSurfaceView both horizontally and vertically?

sentences:
How to deal with inconsistent network delay caused by packets arriving at different times in the frame? I'm developing a multiplayer game that does not have prediction. It implements client-side interpolation. The problem with this is that input delay can be perceived. I've measured the various times involved in calculating the delay(packet arrival time, server respond time, time spent interpolating), and it seems about 50ms is spent on interpolating(correct), and 60ms is spent on ping and what I can only assume to be unfortunate message arrival time.

The ping is 18ms, which leaves 42ms. If the message arrives at the server immediately after the server has finished reading it's incoming messages this frame, we suffer at least a 16ms delay(at 60fps) that wouldn't be there if the message arrived right before the reading. If this happens with both the server and the client, the delay really adds up, especially at lower frame rates.

How can posts like this http://pastebin.com/ekk07PKn claim to have exactly 50ms  delay with 0 ping if this is an issue?

If it's relevant, this is being developed with Unity3d and the Lidgren networking library in C#. I've moved the server snapshot writing to a different thread with a lock around the game world update method. This helped a lot, but from what I understand moving the reading to a different thread won't help in the same way, because the client won't be able to use the new information until the next frame anyway.

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 to run code as an instance you just created in GML Alright, I'm looking how to create an instance, and then run a chunk of code on the instance I just created, and not have that code run on any other duplicate instances.

Noob question, I know. Please help though?

sentences:
How to get Unreal find headers needed for my code to work? I am trying to open a dialog to select files under UE4, using OpenFileDialog.
I added this to my build.cs
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "DesktopPlatform" });

In my header:
#include "IDesktopPlatform.h"
#include <Developer\DesktopPlatform\Private\Windows\DesktopPlatformWindows.h>

Second line suggested by IntelliSense...
I am adding dummy values to my code to start with:
void AFileDialogOpenerActor::OpenFileDialog() {
    FString defaultFile = "";
    FString fileTypes = "";
    TArray<FString> outFileNames;
    uint32 flags = 1;
    FDesktopPlatformWindows fpl;
    fpl.OpenFileDialog(0, dialogName,defaultPath, defaultFile, fileTypes,flags, outFileNames);
}

When I try to compile, I get these linker error messages:

If I replace the above includes in the header to these:
#include "IDesktopPlatform.h"
#include "DesktopPlatformWindows.h"

In message log:
cannot open include file: "DesktopPlatformWindows.h" no such file or directory

If I play around with these includes, I get a mixture of these messages.(Either a linking error, either no such file, or the bunch of linking error messages)
I took a look at containing folders of the headers and they are indeed there and public.

sentences:
Weird Animation Behavior in Unity I discovered a weird animation bug and have no idea how to solve it. Below you find the script I attached to my humanoid character.

using UnityEngine;
using UnityEngine.AI;

public class PlayerCharacter : MonoBehaviour {

    private Animator anim;
    private NavMeshAgent agent;

    private bool dead = false;

    void Awake()
    {
        this.anim = GetComponent<Animator>();
        this.agent = GetComponent<NavMeshAgent>();
    }

    public void Kill()
    {
        this.dead = true;
        this.anim.SetBool("Dead", true);
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.X))
        {
            Kill();
        }
    }

    public bool IsDead()
    {
        return this.dead;
    }
}

My character makes use of the NavMeshAgent and can walk around and idle - everything works fine. But if I want to kill the player the dead animation loops continuously. This also happens if I change the death animation.

This is my AnimationController:

As you can see, the transition has the condition "Death" with is set to true in the Kill() method. The code for walking and idling in combination with the NavMeshAgent is similar, but the script shown above doesn't work as expected and I have no clue why the animation starts to loop continuously (which looks a bit funny btw). Additionally the animation is not played to end, it restarts after a few frames.

Any ideas? I could also post a video of the behavior if it would help.
Thanks in advance! :)

sentences:
How should I setup my sprites for 2D combat? I was painting pixel sprites of a goblin (the enemies in the game). I first thought of making sprites of it for each different scenario:
facing camera, moving toward camera 1, moving toward camera 2,
facing camera with sword, moving toward camera with sword 1, moving toward camera with sword 2,
facing left, going left 1, going left 2
facing left with sword etc.
(for a total of 18 sprites)

Then I wondered, how will I make the sword hit the player ? What if I want the goblin to have a different type of sword ? Do I have to make different sprites of it holding different weapon ?
I realised doing sprites for every scenario wasn't ideal. So my question is, how do I make this ?
Should I keep the sprites I have but remove the sword from them and then add a sword sprite attached to the player sprite and animating it so it matches the players movement ? Is that the way to go ?

sentences:
Implementing a scrolling UI in Libgdx I am using the LibGDX framework. I'm not using Scene2D but I want to implement my own "scrolling UI". This is only what I could think of (see image below):

I will make the 2nd camera look at very far coordinates (and draw the UI stuff there) and have it (within the blue box) receive its own input. But I think this is not possible with LibGDX, since if you set the size of the camera you are like setting how big it views the world and not how big the viewport is. I mean you can't set the size of the camera of something like 50px width and height and have it place on the center. If you setPosition, you are setting it to where it looks at and not where it is placed in the 2D space. I'm trying to explain it clearly and I hope it is clear.

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:
Is GetFixtureA() of b2Contact guaranteed to return the body on which GetContactList() was called? For example, in the code below, will the assert ever fail?

for (const b2ContactEdge *contactEdge = playerPhysicsBody->GetContactList(); contactEdge; contactEdge = contactEdge->next) {
    assert(contactEdge->contact->GetFixtureA()->GetBody() == playerPhysicsBody);
}

I wasn't able to determine this from the source code. From some brief debugging, it seems to be the case, but I want to avoid any subtle bugs if this assumption is wrong.

The reason that I want to do this is to find the particular fixture that belongs to the player that was involved in the contact.

sentences:
Using a Higher Precision (than 8-bit unsigned integer) Buffered Image for Heightmaps in Java I am generating a heightmap for every quad in my quadtree in openCL. The way I was creating the image is as follows:

DataBufferInt dataBuffer =
            (DataBufferInt)img.getRaster().getDataBuffer();
      int data[] = dataBuffer.getData();
      //img is a bufferedimage
        inputImageMem = CL.clCreateImage2D(
        context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
        new cl_image_format[]{imageFormat}, size, size,
        size * Sizeof.cl_uint, Pointer.to(data), null);

This works ok but the major issue is that as the quads get smaller and smaller the 8-bit format of the buffered image starts to cause intolerable "stepping" issues as seen below:

I was wondering if there was an alternate way I could go about doing this?

Thanks for the time.

sentences:
How to reverse or create a group sprites pinned to other objects on a specific pattern. Hey guy i am creating a game, where i am facing some problem.

I am creating a sprite, SpriteT on runtime with a rope effect like snake with proper instances. Also am creating Text object pinned on the rope style sprites with instances and need to handle those sprites objects with text instances.

I gave the leadsprite 8 directions where other families are attached to leadsprite.

Now i want is when i rotate the leadsprite to 90 and then to 180 that is top left movement. I need is to compare the instances of equal positions of sprite Whenever i do this the system never compares each value of sprites. i don't know how to compare the elements of one single array that is definately instances to each other's position record and if they match i want to destroy the sprites objects.

this includes i think there must be some pattern now i need to reverse the remaining spriteT to the Leadsprite on the same pattern.. This is where i am lacking whenever i do this

  // On Destroyed
    OnObjectDestroyed() {
     // This contain let 10 number of sprite to attached with the center of one next sprite.
         SpriteTObjectFamily.setPositionTowardsObject(ImagePoint0);
    }

I have just started and a Noob. Please help this is actually doing in Construct2. Any help would be great. Thanks in Advance!

sentences:
Why are my animated objects (from Blender) always playing at the global origin in Unity? I created and animated a sledgehammer in Blender 2.67b using an armature. The sledgehammer has one animation (created using the Action Editor) called "Idle". I parented the imported sledgehammer to an empty GameObject and set the sledgehammer's position to (0, 0, 0). I then moved the parent GameObject to where I want it in the scene. When I launch the game, the animation plays but the sledgehammer child always re-positions itself to be at the global origin, no matter where I place the parent GameObject. See the image below:

Notice how the sledgehammer's position goes from (0, 0, 0) to (-1087, -3, -1149).

The armature has a single bone and has the sledgehammer object as a child. I've spent about 4 hours looking this up on the Internet, but it seems like parenting the animated mesh to an empty GameObject worked for everyone else except me. Anyone else experience this? I've tried both .fbx and .blend files.

sentences:
How can I identify loaded models so I can efficiently avoid loading them twice? I'm making a fairly basic OpenGL 3D engine, at the moment. In this engine, when you load an object, you would write

manager->LoadObjFile("cube.obj");
manager->AddParent("uvmap.bmp", "cube.obj", "cube", glm::vec3(10.0f, 1.0f, 0.0f));

"uvmap.bmp" being the texture, "cube.obj" is the .obj file path, "cube" being the ID for the object.

My question is, at the moment, when it loads an object, it stores the object in a struct with all of the buffer data and an ID, the ID being the path of the obj file, so when I load an .obj, it runs through all of the already loaded files and compared the ID of each using strcmp, which obviously when there's thousands of items, is going to start to get a bit slow.... it does the same for AddParent, and most of my other methods (different vector of data than where the obj data is stored).

What would be best in terms of identifying items, an integer? I really don't know, I want this to be as high level, user friendly as possible, but want to keep it as optimized and as efficient as possible.

sentences:
How does raytracing triangle meshes with RTX work internally? Raytracing a huge bunch of triangles the naive way (ie. testing each ray against every single triangle) would be humongously slow, which is why raytracers use optimizations to greatly reduce the number of ray-triangle tests that needs to be done. The most common optimization is to organize the triangles into a tree-like data structure, such as a kd-tree.

How does Nvidia's RTX technology do this internally? It's my understanding (please correct me if I'm wrong) that it, indeed, also uses a tree data structure for the triangles to be raytraced. My question is which part of the rendering pipeline performs this construction of the tree data structure. Is it done on the application side?

But, more importantly, and this is the crux of my question: How are mesh deformations handled? (In other words, triangles that change shape and/or their relative position to each other within the same mesh object.)

It is my understanding that a tree data structure works wonders when raytracing a triangle mesh... as long as the mesh is completely rigid and doesn't deform. If the mesh deforms (triangles change shape and/or their position in relation to each other) the entire tree needs to be rebuilt (because the changed triangles can well end up in completely different locations in the tree).

RTX demos, and especially BF5, show animated human characters (with eg. their clothes being deformed by wind) being shown in raytraced reflections just fine. How is this achieved? Are the tree data structures recalculated on every single frame, or is this done some other way?

sentences:
BoxCollider2D Not Working So I'm making a copy of noobtuts tutorial on Snake
I've done all their steps and am at the point of extending the game solo, however I have an issue with the basic set-up. My box colliders aren't working at all!
I have four borders each with a Box Collider 2D, nothing fancy about them, and a Snakehead with a Box Collider 2D, nothing fancy about that either. Only the food prefab I have uses the IsTrigger. The Snake head also has a Rigidbody 2D and I've experimented with putting a Rigidbody2D on the borders too but it's not solved my problem.
Basically when I have the Snakehead moves to the border, it just passes through the border! It doesn't stop, it doesn't do anything, just continues straight through the border.
I've a basic gif showing off what I mean:

The only different thing about the box colliders is that for the snake they're 0.7 in size, not 1. But even when put to 1, they don't work properly.
Why isn't it stopping the snake from moving? I've never had to tell an object that when it hits another object to not move through it from what I can remember.

sentences:
Unity - SetActive() on GameObject dont works on child's objects I have the following line of code:

GameObject.Find("_obstacles").SetActive(false);

It serves to leave an inactive object, but the children of this object are not getting with the same status.

My result is:

  The objects children do not inherit the parent object state (as stated in the > documentation of Unity)!

But the obsolete method "SetActiveRecursively()" works for me! O.o The Very strange, no?

sentences:
Call a function by name in Unity This might be a bit misplaced but is there a way to call a function by name in Unity?

I've tried Invoke(string, float) but that doesn't accept parameters.  I've tried StartCoroutine but that requires a yield return new statement.  I've also tried reflection, like this:

Type thisType = this.GetType();
MethodInfo theMethod = thisType.GetMethod(TheCommandString);
theMethod.Invoke(this, userParameters);

But this doesn't even compile giving an error of NullReferenceException: Object reference not set to an instance of an object
 and I don't really know why.  Thanks for the help guys.

sentences:
How to calculate vertex normals for a mesh in Java in OpenGL ES? Can some one point me to Java code ( in Java not C or C++) that calculates all the normals for all the vertices of a mesh for OpenGL ES application. I need this for lighting. Lets say I have a cube with following vertices and indices:

float vertices[] = { -width, -height, -depth, // 0
                      width, -height, -depth, // 1
                      width,  height, -depth, // 2
                     -width,  height, -depth, // 3
                     -width, -height,  depth, // 4
                      width, -height,  depth, // 5
                      width,  height,  depth, // 6
                     -width,  height,  depth  // 7
        };
short indices[] = { 0, 2, 1,
                    0, 3, 2,
                    1,2,6,
                    6,5,1,
                    4,5,6,
                    6,7,4,
                    2,3,6,
                    6,3,7,
                    0,7,3,
                    0,4,7,
                    0,1,5,
                    0,5,4
                  };

In above specific example how many normals we need?

sentences:
Cannot create EAttachmentRule variable in a Blueprint struct I'm trying to add a EAttachmentRule variable in a struct but the enum doesn't appear in the list of available types

I managed to create a variable in a BP by dragging the pin from an AttachActorToComponent node and promoting it to a variable. But I can't do the same thing to create a variable in a struct

sentences:
main camera not covering whole screen in unity3d I have been using unity and i got a problem where my main camera is covering only the first half of the floor i made.
camera position is left and the floor is rotated ,i m posting an image please help .
I have shown a player white coloured and an enemy pink coloured .player is not shown as you can see.

sentences: How does OnLive work, and is there anything special Game Developers need to do? The OnLive service works by "cloud rendering", which is very different from the traditional model of "on-premise rendering" that we are all familiar with.  How does this work at a technical level, and is there anything special game developers or artists need to do to optimize their game for the platform?  As a developer, I'm a bit skeptical that everything is as magically working as they seem to suggest.

sentences:
Efficient way to implement a lot of singletons I just came upon programming patterns and learned about singleton. I'm in the process of creating my first game and it contains several managers:

I wanted to implement singleton on each of the managers,but the only way I can think is copy pasting the singleton pattern on each awake method script attached to each manager.
Is there a more efficient way to do it rather than pasting the pattern on each awake method?

labels: unity c# cocos2d unity architecture physics minecraft-modding c++ unity android 2d javascript android mathematics 3d unity javascript ios software-rendering xna android unity animation unity physics mathematics unity voxels procedural-generation unity architecture mathematics legal c++ unity algorithm algorithm collision-detection android java c# legal logic opengl physics java unity c# hexagonal-grid c# multithreading android unity unity unity 3d legal game-design collision-detection unity tiles unity sprites java c++ android collision-detection c++ input android cocos2d-iphone libgdx xna performance java multiplayer c# unity unity glsl directx11 opengl architecture sky java graphics-programming xna mmo unity javascript c++ opengl opengl unity unity algorithm directx collision-detection unity c++ linux unity c# unity multiplayer transformation multiplayer xna godot game-design architecture unity c++ unity game-design unity java xna javascript software-engineering c# libgdx architecture xna unity architecture game-design 3d unity unity 2d unity unity performance 2d quaternion shaders unity mathematics unity unity game-design unity 2d unity udp unity c# c++ unity sprites shaders terrain sprites gui unity libgdx unity java textures android 3d rendering 3d opengl unity multiplayer interface opengl java unity shadows unity java opengl unity unity unity unity c++ c++ xna android xna-4.0 camera unity 3d unity unity php normal-mapping 3d 2d unity software-engineering unity java unity game-design performance savegame c++ android unity shaders unity unity animation flash xna 3d game-design unity c++ c++ xna java unity java unity opengl java unity game-design game-mechanics unity unity free-to-play networking xna models cocos2d-x c# networking opengl javascript opengl opengl xna gui android xna opengl unity python unity java algorithm unity unity art unity rts levels unity unity java c++ opengl 3d directx xna architecture collision-detection 2d unity unity unity unity camera sprites javascript godot collision-detection unity unity opengl unity architecture mathematics opengl unity c# 2d opengl mathematics android unity physics c++ unity unity unity xna unity cocos2d-iphone shaders game-mechanics c# cocos2d unity unity directx xna collision-detection libgdx game-design xna unity windows c++ unity networking c++ 2d networking directx unity ai javascript input unity libgdx unity 2d unity unity game-design tiles flash unity unity node.js unity android unity c++ vector directx11 unity procedural-generation game-maker unity legal directx unity ios java xna ios libgdx java unity opengl collision-detection java mathematics unity java unity unity c# iphone unity unity ai opengl javascript ai impactjs c# models skeletal-animation 2d android unreal-4 opengl shaders iphone methodology puzzle glsl software-engineering 2d unity unity unity python architecture unity networking opengl 3d normals c++ unity unity opengl unity steam textures physics java opengl 2d unity java c# game-loop c# architecture 2d mathematics opengl unity performance opengl godot android graphics unity libgdx flash unity unity xna unity xna game-design unity directx opengl unity sprites unity collision-detection unity rotation publishing unity mathematics c# c++ shadow-mapping architecture c# ai python architecture shaders unity java opengl vulkan licensing unity unity virtual-reality algorithm shaders game-design opengl libgdx unity unity c# opengl java sprites opengl unity unity 2d c# directx11 java unity physics java physics xna fluid-dynamics opengl unity unity unity box2d unity c++ unity graphic-effects unity opengl unity 3d directx unity game-design unity architecture browser-based-games unity 2d unity unity android unity unity libgdx c# unity 2d xna unity xna game-design java opengl opengl unity unity flash unity javascript mathematics 3d-meshes adventure-game-studio java c++ unity puzzle xna trigonometry cocos2d-iphone unity graphics opengl 3d unity gpu unity xna xna-4.0 3d-modeling rotation xna iphone unity collision-detection unity javascript opengl unity 2d unity c++ unity shaders version-control cocos2d-x opengl matrix unity xna unreal-4 c++ architecture unity html5 voxels c++ unity tilemap unity unity algorithm android 2d java animation c++ unity game-design 3d opengl xna c# game-design ios collision-detection unity unity tools algorithm algorithm python iphone xna unity unity rendering unity java entity-system rendering python unity art c++ unity unity textures physics unity opengl c# rendering opengl c++ unity windows-phone-7 opengl unity architecture sfml graphics sprites unity unity npc unity 2d procedural-generation java collision-detection unity unity unity physics opengl-es2 game-design unity tilemap slick unity javascript unity c++ unity html5 shaders xna libgdx xna c# c++ linear-algebra path-finding c++ 2d unity xna java unity java unity java procedural-generation ai unity mathematics unity collision-detection tilemap 2d unity opengl xna physics textures 2d opengl physics procedural-generation geometry graphics-design graphics unity c# rts opengl unity unity unity unity shaders sprites opengl collision-detection c++ objective-c shaders c# unity c++ unity physics java unity career opengl c++ unity assimp unity xna unity javascript animation unity 3d iphone android sfml bullet-physics opengl unity libgdx unity unity 3dsmax unity models unity normal-mapping unity libgdx unity unity unity unity opengl physics unity unity unity c++ unity physics opengl c# unity unity algorithm c++ unity 2d game-design unity unity unity unity entity-system nintendo unity c++ unity modding unity physics udk xna unity unity opengl rpg game-design procedural-generation raycasting software-engineering unity xna unity physics libgdx unity c# unity xna unity collision-detection unity ogre game-design c++ unreal-4 unity 3d mathematics rendering collision-detection physics textures opengl 2d unity unity unity c++ collision-detection textures unity opengl c# unity gpu opengl shaders unity tools architecture c# mathematics unity textures unity physics unity java unity opengl unity procedural-generation unity networking vector physics algorithm unity architecture tools 2d unity animation movement javascript xna unity c++ xna xna-4.0 libgdx opengl-es game-industry java unity unity algorithm matrix c# opengl java java unity geometry unity collision-detection unity blender interpolation unity opengl algorithm unity opengl xna unity 2d xna unity glsl java c# models unity input algorithm gpu game-design mathematics c++ mathematics unity gui game-maker c# architecture udk image legal xna directx c# unity 2d unity xna xna geometry unity graphics-programming unreal-4 game-design android xna xna java unity unity architecture c++ architecture mmo multiplayer c# software-engineering c++ unity opengl unity unity android 2d android xna unity quadtree sdl2 unity game-maker tiles unity mathematics directx11 textures unity game-mechanics networking c# c++ video mathematics unity unity c# game-loop glsl opengl 2d python mathematics c++ c++ unity unity geometry opengl 2d android procedural-generation 3d unity mathematics unity publishing unity xna unity geometry c++ unity unity collision-detection vector opengl opengl java platformer opengl java game-maker game-design java java monogame unity ios java unity opengl opengl xna unity 2d timing unity unity game-design unity libgdx path-finding animation unity opengl game-design unity hlsl marketing licensing unity opengl unity unity unity android c++ directx9 opengl simulations java c++ opengl animation unity c++ unity c++ c# 3d java physics java java c# python architecture game-design hacks lighting unity unity unity marketing algorithm unity game-design opengl architecture assets unity architecture shaders unity mathematics unity unity opengl unity mathematics c++ c# game-maker xna models xna 3d hlsl c++ java architecture c++ opengl c# unity java leaderboards unity unreal-4 beziers opengl xna first-person-shooter c++ java opengl unity c++ actionscript-3 java graphics xna glsl game-design algorithm unity c++ unity unity vulkan box2d multithreading game-loop unity unity opengl ai unity unity game-design unity libgdx unity game-design unity java strategy rotation unity unity unreal-4 xna unity shaders graphics 2d game-design ai unity unity c++ android unity architecture animation unity animation assets procedural-generation physics android game-maker input opengl business-model mathematics architecture ai collision-detection python algorithm tilemap architecture 2d game-mechanics java gui websocket opengl collision-detection opengl unity unity unity xna-4.0 love2d collision-detection directx procedural-generation 3d unity tilemap c++ c++ javascript c# unity sdl transformation architecture algorithm architecture html5 c++ 3d xna c++ unity source-engine opengl c++ algorithm ai directx unity directx unity unity xna textures 3d collision-detection mathematics xna unity unity unreal-4 c++ entity-system ruby xna unity unity multiplayer game-design unity 3d collision-detection mathematics 3d libgdx opengl web unity scripting unity java unity unity physics unity unity c++ unity shaders opengl unity monogame opengl animation camera ios unity unity mathematics unity blender unity unity unity android javascript unreal-4 c++ android unity shaders graphics-programming game-design c++ c# c++ c# rendering unity box2d c# xna camera unity game-design animation c++ 3d unreal-4 unity unity c# opengl java unity mathematics entity-system c++ marching-cubes web matrix unity libgdx opengl unity java education unity mathematics unity unity unity unity 2d unity directx c++ unity career fragment-shader 3d libgdx unity unity software-engineering javascript scripting architecture unity java game-design c++ android opengl unity c++ unity java libgdx opengl networking c++ collision-detection directx xna animation 2d unity collision-detection path-finding collision-detection c# path-finding xna unity unity opengl c++ game-design libgdx unity unity directx android xna unity android architecture java shadow-mapping c++ xna 2d xna opengl 3d c# c# directx11 unity design-patterns ai 3d c++ php unity game-mechanics physics ai collision-detection c# unity rendering c++ c++ unity unity xna c# unity c++ unity unity directx unity terrain game-design xna 2d javascript java online camera xna multiplayer unity unity xna unity unity directx unity opengl xna xna javascript java networking software-engineering lighting unity music 2d unity hexagonal-grid java unity unity 2d graphics 2d java input xna 2d tools phaser c# java ai javascript unity 2d libgdx c++ unity controllers game-industry opengl libgdx unity android architecture game-design xna unity gui spritekit algorithm game-design mmo unity c++ shaders unity javascript c++ java mathematics shaders c# unity cocos2d-iphone unity c++ flash unity android unity unity collision-detection normals c# entity-system camera opengl spritesheet java xna unity architecture sdl game-design c++ unity unity sdl2 python game-design unity unity ai input unity game-design unity sdl2 tiles mathematics unity graphics-programming memory-efficiency directx11 unity opengl c# unity unity xna heightmap unity education c++ unity hlsl c++ xna c++ unity monogame unity networking directx java mathematics ai xna sprites 3d 2d c# rotation unity performance input python sdl xna side-scroller c# unity c# unity xna camera web shaders raycasting godot unity unity unity ai physics opengl libgdx twine architecture terrain-rendering planning mathematics analytics minecraft-modding 3d unity unity mesh c# physics cocos2d-iphone java javascript textures xna 3d unity publishing c++ unity libgdx unity unity xna c++ unity unity voxels 2d mathematics unity opengl 2d unity unity 2d marketing procedural-generation unity opengl opengl monotouch networking 3d-meshes algorithm unity mobile encryption unity graphics-programming audio mathematics c# tiles unity terminology algorithm python c++ libgdx c++ game-design opengl unity unity java opengl game-design libgdx javascript webgl opengl opengl psm opengl frame-rate mmo unity libgdx javascript unity unity opengl game-mechanics java unity unity directx9 unreal-4 android mathematics multiplayer xna mathematics c# 3d 2d c++ interactive-fiction libgdx unity libgdx unity unity mmo 2d data-structure opengl unity physics c++ opengl unity project-management c# unity java cocos2d-x lua modding 2d touch algorithm physics opengl unity game-design unity xna 2d unity unity opengl unity iphone design-patterns directx android xna c# unity unity unity 3d 3d xna opengl-es c++ animation java 2d 3d unity 3d unity unity xna unity settings unity xna unity java xna jobs unity unreal-4 2d c# unity unity 2d unreal-4 python java architecture c# c++ collision-detection unity android java procedural-generation javascript java c# opengl c# unity unity opengl movement libgdx legal unity sound unity c++ opengl rpg isometric 2d mathematics unity ai c++ opengl networking unity architecture unity android opengl console java xna jogl android fragment-shader procedural-generation java directx java c++ legal opengl xna unity 2d linear-algebra java algorithm libgdx libgdx unity quaternion legal opengl unity flutter unity c# actionscript-3 unity graphics uv-mapping resource-management java c++ 2d collision-detection c++ mathematics unity java c++ unity c++ mathematics c++ c++ javascript sprites 2d opengl unity 3d unityscript unity iphone unity directx11 mathematics c# graphics cocos2d opengl path-finding architecture unity physics c++ unity xna unreal-4 2d c++ javascript legal ios c++ box2d lighting game-maker unity c++ c# shaders textures directx11 microsoft controllers unity game-design javascript architecture ios timer unity mathematics unity java performance c# c++ java c# multiplayer c# xna 3d game-industry java architecture javascript unity unity software-engineering c++ ai java authentication game-design c++ opengl java unity graphics unity 2d unreal-4 c++ entity-system directx xna c++ libgdx opengl opengl opengl iphone c# c# java unity assets procedural-generation animation godot opengl unity heightmap lwjgl tools unity xna opengl c++ graphics unity iphone c++ 2d lighting unity 3d unity xna java c# quadtree physics java virtual-reality game-design shaders game-loop c# unity adventure-games java unity networking unity unity c++ geometry java javascript unity car sound c++ android business unity space-partitioning unity collision-detection unity c++ android unity game-design 2d unity tiles c# 3d xna algorithm python java unity animation unity unity unity opengl-es c++ xna libgdx unity opengl compatibility unity unity 2d 2d unity java c++ 3dsmax libgdx xna fsm unity opengl android unity skyrim-modding unity mathematics architecture unreal-4 java c++ java unity libgdx java flash libgdx c++ xna game-design game-design unity procedural-generation animation architecture unity tilemap tiles xna java networking unity c++ xna directx xna xna c++ xna sfml c# c++ unity unreal-4 opengl networking monetization unity marketing c# antialiasing ai udk architecture unity 2d unity c# java java c++ opengl opengl optimization xna-4.0 unity c# unity ranking android xna algorithm architecture unity c++ directx mouse unity libgdx obj 2d sprites c++ 2d opengl libgdx 2d networking 3d c++ unity unity monetization path-finding unity unity libgdx c++ opengl directx java architecture game-design opengl libgdx 2d shaders xna c# mobile unity opengl shaders unreal collision-detection unity unity unity unity 2d unity 3d htc-vive client-server xna opengl unity xna shaders 2d java path-finding game-design sdl c++ terminology opengl java c# android unity javascript unity android game-design networking game-mechanics collision-detection xna unity c# c++ path-finding xna javascript algorithm game-maker xna 2d c++ depth-buffer ios unity unity directx collision-detection performance unity directx 3d unity collision-detection unity mathematics unity c# mathematics actionscript-3 unity glsl cross-platform computational-geometry unity architecture unity opengl pixel-art opengl unity unity phaser 3d-meshes web java unity directx11 unity node.js unity xna opengl unity 3dsmax models c# javascript opengl ios platformer unity android physics xna unity opengl unity data-structure xna java textures unity unity opengl udk input ui-design textures flash javascript c++ cocos2d-iphone glsl c# unity libgdx xna unity unity user-experience opengl c++ c# unity game-loop java c# c# unity networking unity java camera c++ unity trademark 2d mmo browser-based-games performance c++ c# unity c++ opengl rendering unity libgdx c# spritebatch unity unity c++ java opengl opengl java java opengl libgdx c# unity c++ physics architecture java game-design 2d 3d xna unity unity c++ xna networking c# android unity path-finding 2d physics unity animation directx xna unity client-server unity unity shaders unity algorithm glfw directx terrain unity java xna-4.0 unity textures unity libgdx xna xna 3dsmax procedural-generation libgdx flash unity networking xna unity pixel opengl opengl architecture unity unity rendering opengl xna-4.0 software-engineering physics sdl animation javascript levels c++ python opengl optimization c# unity glsl unity javascript libgdx unity unity unity camera libgdx javascript textures unreal-4 unity networking unity xna unity c# unity unity game-design game-design opengl unity libgdx legal libgdx unity unity octree xna mathematics mathematics monogame opengl hlsl c# unity libgdx 2d 2d terminology unity game-design textures android c++ collision-detection shaders unity unity libgdx bounding-spheres 2d xna xna xna xna c# android game-loop unity android unity 2d c# unity economy xna physics unity c++ game-maker textures javascript algorithm cross-platform unity architecture xna java opengl xna unity entity-system rendering architecture music 2d iphone physics physics ai antialiasing box2d game-design c# education xna java xna unity udk movement 2d c++ physics unity java design-patterns game-design java unity xna opengl unity c# teaching andengine unity java unity textures graphics unity unity java unity algorithm xna unity game-mechanics html-canvas opengl android xna java playstation4 html5 3d unity unreal-4 monetization unity animation unity c# android unity collision-detection game-maker xna xna skybox unity ios c++ java databases unity ai unity c++ unity architecture c# libgdx java c++ android sdl lua mathematics opengl directx movement game-design gpu unity c# software-engineering unity unity html5 cross-platform xna gui xna c# tiles unity unity unity shaders level-design server game-design unity textures java playtesting camera unity unreal-4 libgdx 3d-meshes sdl java windows textures algorithm architecture opengl android physics unity unity game-maker data-structure unity unity unity game-design opengl mathematics unity textures xna unity unity 3d unity udk java opengl unity unity unity xna unity rotation game-design 2d unity c++ starcraft-2 xna flash terminology unity unity unity collision-detection unity aabb lua c# copyright opengl opengl textures unity unity unity c# opengl xna c++ unity java 2d unity shaders c++ java xna c++ unity steam c++ phaser unity data-structure entity-system xna xna java cocos2d-iphone unity physics unity unity art opengl 3d unity unity opengl opengl ai unity unity c++ jmonkeyengine unity stencyl andengine unity unity java unity opengl unity architecture multiplayer mathematics javascript unity multiplayer xna javascript ogre opengl opengl physics unity unity unity unity libgdx probability unity mmo c++ movement 2d directx godot camera android unity c# xna opengl opengl xna-4.0 movement c# unity unity sprites mathematics java unity unity ai directx11 2d architecture java marketing android bounding-boxes unity unity physics unity javascript lwjgl xna open-source architecture unity sprites xna unity libgdx scripting opengl unity animation c++ unity opengl python c++ unity c++ c++ 2d ranking unity unity opengl xna ios unity cocos2d-iphone javascript music opengl xna legal unity unreal-4 sprites assets c# unity camera xna xna 2d xna shaders unity javascript opengl opengl path-finding unity unity game-mechanics unity xna unity xna 2d unity libgdx opengl physics opengl python unity mathematics game-maker game-maker harlowe unity unity collision-detection opengl xna unity c# opengl java java legal collision-detection physics xna component-based unity algorithm collision-detection 3d android unity unity opengl unity c# game-design game-mechanics unity collision-detection xna directx10 opengl opengl camera xna xna directx11 c# unity camera directx11 rts unity unity unity ios unity unreal-4 glsl path-finding java 2d unity physics android unity random 2d 3d game-design c++ xna unity unity opengl javascript libgdx textures rendering android c++ unity objective-c glsl algorithm architecture monogame unity game-maker xna opengl unity unity android browser-based-games collision-detection unity mathematics java c++ unity 3d c# c++ unreal-4 unity unity unity ai unity unity game-design matrix 3d tilemap mmo android shaders physics unity collision-detection architecture xna procedural-generation shaders 3d javascript xna android directx unity unity 3d-meshes physics-engine opengl scene-graph udk cocos2d-iphone algorithm rotation heuristics 3d-meshes c++ java mathematics 2d flash unity flash path-finding unity physics c++ xna xna mathematics javascript collision-detection 2d game-maker legal 2d unity unity collision-detection browser-based-games modding android unity software-engineering directx11 unity unity xna android unity mathematics unity c# java 2d c++ unity java collision-detection design-patterns opengl algorithm unity collision-detection path-finding 3d-meshes unity xna mmo mathematics unity java xna unity mathematics unity opengl rotation game-maker xna unity javascript collision-detection unity entity-system opengl c# java javascript algorithm opengl unreal unity c++ architecture c++ mathematics xna rpg-maker-xp software-engineering opengl opengl multiplayer game-design game-design unity unity unity monogame procedural-generation mathematics opengl graphics c# android 2d xna shaders unity unity performance xna minecraft-modding algorithm mathematics index-buffer unity graphic-effects opengl sdl game-design java c++ ai java scene-graph c++ libgdx iphone unity unity physics unity unity unity unity unity c++ c++ unity xna marketing java unity unity iphone collision-detection hlsl ios architecture glsl opengl unity 3d android unity textures unity xna c# textures c++ unity javascript unity c++ lua unity opengl unity unity opengl cocos2d unity input c++ terrain shaders c++ c++ unity c# procedural-generation unity c# culling 2d java 2d architecture mathematics c++ xna opengl libgdx unreal-4 architecture opengl ai unity opengl-es animation unity unity game-design c++ libgdx hlsl opengl directx assets unity unity c# collision-detection multiplayer mathematics tiles quadtree android algorithm physics shaders open-source android animation opengl game-design unity c# algorithm unity java c++ compression camera mobile unity minecraft-modding rendering 3d project-management opengl opengl physics opengl unity raytracing unity unity java unity 3d unity opengl animation xna unity c# unity game-design unity game-mechanics android xna terrain licensing level-design unreal-4 unity touch c# xna java 2d sprites opengl-es unity mmo multiplayer unity algorithm pyglet android unity c++ nintendo game-design .net rendering data-structure xna unity 2d unity licensing unity game-mechanics libgdx c# marketing platformer unity directx flash tools 2d c# flash xna mobile unity unity 3dsmax c++ multithreading unity 3d opengl unity java unity xna box2d rpg xna collision-detection libgdx directx c# physics networking c++ python game-design shaders directx unity legal java javascript unity architecture unity opengl unity unity xna unity networking javascript java opengl physics mmo scripting c# unity opengl unity unity multiplayer unity 2d unity game-design 3d windows unity phaser unity unity libgdx godot physics c++ input shaders c# opengl-es xna xna xna xna ai 2d java android unity unity unity events box2d networking unity unity shaders xna xna xna game-design 3d unity opengl java google-play 2d xna 2d 3d unity 3d unit-testing unity unity unity cocos2d-iphone unity monogame opengl opengl shaders c# animation career unreal-4 unity networking architecture java unity architecture unity physics art steam unity directx11 mathematics xna c++ opengl c++ unity java c++ movement collision-detection unity xna unity unity game-industry c# xna matrix performance unity opengl c# unity opengl java collision-detection xna unity networking tournament camera opengl unity unity unity unity unity 2d unity xna tools physics models unity c# opengl opengl unity unity javascript c++ opengl animation directx11 hud terminology source-engine c++ java c# rpg game-design unity libgdx libgdx java directx unity unity unity minecraft-modding 2d coordinates c++ rigidbody physics iphone collision-detection 2d unity c# xna opengl opengl javascript ios unity opengl opengl unity models unity c++ unity xna game-design textures unity directx physics mathematics java unity c++ c++ scripting unity c# unity c++ c# isometric opengl rendering sprites twine unity unity unity graphics unity c# unity unity xna javascript c++ c++ 3d xna 2d c++ mathematics rendering javascript libgdx unity xna unity opengl opengl 2d java matrix opengl c++ java unity opengl unity textures python unity unity unity unity bullet-physics legal opengl glsl fixed-timestep java xna unity javascript c# models unity java procedural-generation unity transformation isometric mathematics physics xna unity 3d collision-detection javascript unity performance angles iphone android licensing c++ unity transformation unity unity c# unity xna blender unity unity unity rendering unity c++ unity unity collision-detection javascript python java xna unity unity marketing java libgdx game-mechanics android unity rendering mathematics box2d unity path-finding software-engineering unity 3d unity entity-system unity 2d collision-detection unity terrain-rendering path-finding 2d unity opengl camera unity libgdx unity networking java unity javascript javascript software-rendering 2d flash matrix unity c# unity opengl xna unity multiplayer c++ libgdx unity opengl unity ai collision-detection shaders libgdx c# andengine unity opengl flash java opengl networking animation opengl 3d java opengl unity frame-rate 3d c++ c++ unity javascript unity c++ multiplayer state unity c++ networking algorithm unity javascript graphics 3d textures separating-axis-theorem opengl-es libgdx software-engineering c++ mathematics input multiplayer collision-detection unity opengl level-design opengl c# scene-graph vector component-based 2d ios unity game-design unity game-maker mathematics movement animation opengl unity unity xna opengl unity networking unity 3d-meshes c# physics unity 2d c# fonts android 3d javascript opengl physics java opengl textures c++ xna-4.0 android xna unity 3d camera xna java opengl unity window-management 2d monetization unity unity unity unity unity c++ opengl c# unity opengl-es2 unity unity unity card-game ios unity unity xna skeletal-animation mathematics unity javascript game-mechanics unity unity unity rendering minecraft-modding opengl physics collision-detection android java java unity javascript box2d unity c# mathematics unity networking 2d mobile quadtree java 3d c# unity unity multiplayer unreal-4 opengl c# unity unity opengl legal unity xna 3d unity c# input unity opengl matrix unity architecture movement unity collision-detection networking unity unity c# android opengl architecture 3d networking unity unity opengl-es2 unity unity unity mathematics unity java unity html5 algorithm networking unity scripting android c++ box2d tiles unity collision-detection mathematics procedural-generation c++ unity art unity game-design unity unity game-design game-loop c++ 2d rendering encryption unity libgdx java shaders unity java procedural-generation unity unity unity xna unity tiles java opengl input unity architecture opengl unity java architecture .net actionscript-3 allegro java c++ directx11 models networking 3d opengl unreal-4 physics 2d c# unity unity unity c++ android algorithm c++ c++ opengl opengl unity animation project-management unity c++ unreal-4 opengl opengl-es glfw javascript unity unity javascript c++ architecture xna c# component-based c++ iphone unity unity unity opengl trailer unity opengl unity algorithm xna game-maker unity unity multiplayer c++ unity android rendering java mathematics collision-detection c++ unity libgdx android spritesheet 3d architecture shaders ai xna unity mathematics opengl unity 2d opengl unity unity mathematics 2d unity algorithm unity phaser algorithm unity javascript game-design xna opengl xna java unity opengl unity architecture unity xna c# unity input c# unity opengl c++ shaders unity javascript 3d game-design xna unity opengl unity demo java android c++ unity game-design ios 2d ios unity javascript game-design unity unity unity c++ procedural-generation opengl entity-component-system java c++ algorithm unity unity component-based unity directx algorithm c++ multiplayer xna unity unity multiplayer directx sprites java architecture unity architecture unity xna libgdx unity opengl xna c# unity collision-detection opengl unity xna unity unity c++ unity rotation xna mathematics java c++ unity unity unity 2d c# multiplayer game-design physics rotation game-design game-design unreal-4 procedural-generation c++ unreal-4 level-design unity opengl-es2 game-mechanics 2d path-finding unity libgdx java unity unity xna mathematics unity unity architecture unity c++ c# xna animation unity unity unity xna ios shaders java java xna-4.0 architecture collision-detection javascript unity unity graphics unity unity unity unity c# unity mathematics marketing game-design unity assets opengl xna rotation sprites opengl unity c++ unity unity sdl c++ unity android rendering procedural-generation java c# java rpg-maker game-mechanics camera xna python physics physics unity networking unity c# android 3d game-design shaders libgdx collision-detection physics opengl java c# resource-management libgdx legal python legal fbx unity textures collision-detection unity c++ architecture box2d 2d state c# xna java android 2d shaders java game-design unity unity architecture 3d c++ geometry opengl sdl android unity unity game-design unity mathematics c# unity python xna c# opengl shaders unity client-server unity game-design vector architecture c++ iphone game-design textures assets opengl level-design architecture opengl godot udk graphics opengl c++ graphics-programming java opengl unity javascript game-design xna game-design collision-detection architecture physics unity 2d ios unity cocos2d procedural-generation javascript opengl javascript c# unity unity unity javascript unity opengl unity xna directx linux c++ c++ sprites unity xna video andengine unity unity rotation state unity xna collision-detection javascript lua ai unity browser-based-games c# c# opengl c# opengl architecture java xna lua unity opengl unity unity physics directx11 c++ xna c++ game-design efficiency unity opengl 2d c++ unity java opengl java xna procedural-generation opengl python rendering unity xna cocos2d unity graphics javascript mathematics c++ input android c# game-design scoring c++ iphone maps unity algorithm unity c# unity cocos2d-iphone unity unity dynamic-difficulty opengl algorithm unity unity java unity physics vector input 2d python networking opengl java java gui unity c# editors c# c++ 2d java c++ unity unity xna rpg-maker collision-detection software-engineering c# vector andengine testing random python java 3d unity unity java unity unity java gui c# unity unity java iphone collision-detection c++ unity ai unity monogame xna 2d javascript unity unity opengl lua networking xna 3d xna xna procedural-generation directx11 unity xna textures c++ minecraft-modding c++ 2d unity pipeline xna unity unity unity game-design assets unity directx11 3d xna unity cocos2d-iphone performance mmo unity unity unity unity flash xna 3d ios unity unity vector glsl xna architecture movement game-design java javascript unity c++ directx c++ physics unity xna xna opengl android java unity shaders java licensing unity glsl android unity cocos2d-x xna directx graphics javascript opengl javascript c++ unity unity unity keyboard collision-detection cocos2d-x unity unity unity collision-detection c++ unity camera unity java geometry c# unity unity release mathematics blender algorithm libgdx first-person-shooter opengl unity tiles c# opengl java unity xna architecture physics xna unity unity c++ java unity xna unity unity unity unity algorithm xna-4.0 3d c++ unity unity vb.net c# vertex unity game-design c# actionscript-3 python c++ 2d xna unity mathematics unity legal java unity steam unity graphics-programming xna animation c++ entity-system unity path-finding legal game-maker architecture c++ user-experience cross-platform unity game-industry unity opengl unity normals opengl unity c++ unity unity animation unity steam mathematics opengl c++ c++ libgdx graphics unreal-4 unity game-design opengl revenue unity unity transformation textures opengl unity xna graphics-programming architecture unity collision-detection xna physics javascript android opengl algorithm collision-detection java android java maps unity game-design opengl textures libgdx box2d design-patterns libgdx architecture interpolation unity entity-system java camera libgdx directx unity node.js xna physics unity c# unity game-design unity c++ collision-detection unity physics procedural-generation unity unity c++ c++ 3d collision-detection unity unity java unity android 3d first-person-shooter game-design camera unity shaders java unity unity unity collision-detection 2d c++ c++ java directx9 design-patterns c++ c++ box2d c++ c++ c++ libgdx opengl libgdx unity random 3d unity multiplayer xna c# unity education windows architecture unity unity java c++ game-design opengl collision-detection unity game-design c++ software-engineering python c# procedural-generation android opengl c# unity xna godot iphone game-design optimization xna unity java unity unity entity-system opengl unity xna ai mathematics 3d libgdx 2d c++ python c++ unity unity javascript c++ c# java opengl c++ 3d opengl ai unity unity c# unity shaders unity xna networking 3d unity directx legal shaders unity java opengl c# java marketing xna textures xna unity unity opengl c# unity physics unity unity java box2d android unity opengl ai algorithm directx shaders software-engineering unity textures unity c++ opengl multiplayer opengl 2d unity textures game-design movement hardware java unity unity 3d unity c# unity unity collision-detection opengl shaders stage3d xna libgdx c++ networking spritesheet unity libgdx unity unity c++ architecture color mathematics 3d camera game-design libgdx 2d steering-behaviors mathematics algorithm unity c++ python unity opengl textures animation rendering gpu unity vector java unity c++ unity xna unity collision-detection java c# java networking graphics networking turn-based unity java depth-buffer lighting xna user-interface c# collision-detection unity camera collision-detection ios opengl cryengine c++ software-engineering game-maker-dnd c# xna maps audio jobs directx java skyrim-modding unity camera game-design unity graphics opengl opengl unity unity algorithm game-design c# unity ide opengl c# unity fbx python graphics ai unreal-4 xna corona-sdk browser-based-games fonts unity opengl sdl game-design opengl opengl camera unity oop 2d unity unity platformer java unity unity marketing unity voxels xna mouse directx legal unity opengl component-based java ios random performance collision-detection c++ unity unity game-design shaders c# android xna-4.0 c# game-design game-design c++ input opengl 2d unity game-design mathematics java networking opengl unity mmo mmo business ai opengl unity shaders game-design path-finding unity collision-detection c++ shaders c# beta algorithm unity glsl camera algorithm c++ opengl directx9 java unity android game-loop unity game-design libgdx c++ procedural-generation unity opengl textures physics unity android unity unity game-maker c++ unity unity libgdx opengl c++ java construct-2 unity opengl raytracing c# c# unity opengl-es unreal-4 unity networking unity